diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index c394fb3f04b7b62d38ad423eefc837c453c2264f..330d73b106c825e8dc08dbec5c50053e96bc6920 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -8532,13 +8532,12 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& if( tu.mtsIdx[compID] != MTS_SKIP && tu.blocks[compID].height >= 4 && tu.blocks[compID].width >= 4 ) { #if JVET_AG0061_INTER_LFNST_NSPT - const int lfnstLastScanPosTh = CU::isIntra(*(tu.cu)) - ? (isLuma(compID) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA) - : (isLuma(compID) ? LFNST_LAST_SIG_LUMA_INTER : LFNST_LAST_SIG_CHROMA_INTER); + const int lfnstLastScanPosTh = isLuma( compID ) ? ( CU::isIntra( *( tu.cu ) ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_LUMA_INTER ) : LFNST_LAST_SIG_CHROMA; + cuCtx.lfnstLastScanPos |= ( CU::isIntra( *( tu.cu ) ) || isLuma( compID ) ) ? ( cctx.scanPosLast() >= lfnstLastScanPosTh ) : false; #else const int lfnstLastScanPosTh = isLuma( compID ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA; -#endif cuCtx.lfnstLastScanPos |= cctx.scanPosLast() >= lfnstLastScanPosTh; +#endif } if (isLuma(compID) && tu.mtsIdx[compID] != MTS_SKIP) { diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index f29cb4a1f65055e2c7f04d5114a5931ebf44240d..edace200777cae4060b9cee266492d0073cdbe79 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -8204,13 +8204,12 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, if (cuCtx && tu.mtsIdx[compID] != MTS_SKIP && tu.blocks[compID].height >= 4 && tu.blocks[compID].width >= 4) { #if JVET_AG0061_INTER_LFNST_NSPT - const int lfnstLastScanPosTh = CU::isIntra(*(tu.cu)) - ? (isLuma(compID) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA) - : (isLuma(compID) ? LFNST_LAST_SIG_LUMA_INTER : LFNST_LAST_SIG_CHROMA_INTER); + const int lfnstLastScanPosTh = isLuma( compID ) ? ( CU::isIntra( *( tu.cu ) ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_LUMA_INTER ) : LFNST_LAST_SIG_CHROMA; + cuCtx->lfnstLastScanPos |= ( CU::isIntra( *( tu.cu ) ) || isLuma( compID ) ) ? ( cctx.scanPosLast() >= lfnstLastScanPosTh ) : false; #else const int lfnstLastScanPosTh = isLuma(compID) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA; -#endif cuCtx->lfnstLastScanPos |= cctx.scanPosLast() >= lfnstLastScanPosTh; +#endif } if (cuCtx && isLuma(compID) && tu.mtsIdx[compID] != MTS_SKIP) {