diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index 212f46d1b246444895d703ab0d6b52f9526ac4f4..e72c83a866e6d92351b9580d06fac4d1a3877894 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -1749,7 +1749,15 @@ inline uint32_t QuantRDOQ::xGetCodedLevelTSPred(double& rd64CodedCost double dErr = 0.0; dErr = double(levelDouble - (Intermediate_Int(absLevel) << qBits)); coeffLevelError[errorInd] = dErr * dErr * errorScale; +#if JVET_P0298_DISABLE_LEVELMAPPING_IN_BYPASS + int modAbsLevel = absLevel; + if (cctx.numCtxBins() >= 4) + { + modAbsLevel = cctx.deriveModCoeff(rightPixel, belowPixel, absLevel, m_bdpcm); + } +#else int modAbsLevel = cctx.deriveModCoeff(rightPixel, belowPixel, absLevel, m_bdpcm); +#endif #if JVET_P0072_SIMPLIFIED_TSRC int numCtxBins = 0; double dCurrCost = coeffLevelError[errorInd] + xGetICost(xGetICRateTS(modAbsLevel, fracBitsPar, cctx, fracBitsAccess, fracBitsSign, fracBitsGt1, numCtxBins, sign, ricePar, useLimitedPrefixLength, maxLog2TrDynamicRange)); diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 5ebb13d9ce6275ff0c37c5d5cb66f03ec16b2699..f319815e68ca2df29385a08400be8508c8e4998d 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,6 +50,8 @@ #include <assert.h> #include <cassert> +#define JVET_P0298_DISABLE_LEVELMAPPING_IN_BYPASS 1 // JVET-P0298: Disable level mapping in bypass mode + #define JVET_P0325_CHANGE_MERGE_CANDIDATE_ORDER 1 // JVET-P0325: reorder the spatial merge candidates #define JVET_P0578_MINIMUM_CU_SIZE_CONSTRAINT 1 // JVET-P0578: minimum CU size constraint diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index b5804f31d5d26d4495372608995ca6f576031d0f..260c5751ff7efb6e827f63545d370e7a20bbb8e7 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -3590,7 +3590,11 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* tcoeff += ( rem << 1 ); #endif } +#if JVET_P0298_DISABLE_LEVELMAPPING_IN_BYPASS + if (!cctx.bdpcm() && cutoffVal) +#else if (!cctx.bdpcm()) +#endif { if (tcoeff > 0) { diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index b4ec13d5107cf96f9af1a3404903b21d69475aae..6d9ab1d4a2f624f10b31b4f0cc32f8e4f9c40544 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -3290,10 +3290,16 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC { unsigned absLevel; cctx.neighTS(rightPixel, belowPixel, scanPos, coeff); +#if JVET_P0298_DISABLE_LEVELMAPPING_IN_BYPASS + cutoffVal = (scanPos <= lastScanPosPass2 ? 10 : (scanPos <= lastScanPosPass1 ? 2 : 0)); + absLevel = cctx.deriveModCoeff(rightPixel, belowPixel, abs(coeff[cctx.blockPos(scanPos)]), cctx.bdpcm()||!cutoffVal); +#else absLevel = cctx.deriveModCoeff(rightPixel, belowPixel, abs(coeff[cctx.blockPos(scanPos)]), cctx.bdpcm()); #if JVET_P0072_SIMPLIFIED_TSRC cutoffVal = (scanPos <= lastScanPosPass2 ? 10 : (scanPos <= lastScanPosPass1 ? 2 : 0)); #endif +#endif + if( absLevel >= cutoffVal ) { int rice = cctx.templateAbsSumTS( scanPos, coeff );