diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index 591d3186fd41bc589215dae5116da23de5807b0e..6a18b4a50453ebbdc299ff6d8b365fcebb7dcc5e 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -1045,7 +1045,14 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf const int64_t iAdd = int64_t(tu.cs->slice->isIRAP() ? 171 : 85) << int64_t(iQBits - 9); const int qBits8 = iQBits - 8; +#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS + const uint32_t lfnstIdx = tu.cu->lfnstIdx; + const int maxNumberOfCoeffs = lfnstIdx > 0 ? ((( uiWidth == 4 && uiHeight == 4 ) || ( uiWidth == 8 && uiHeight == 8) ) ? 8 : 16) : piQCoef.area(); + memset( piQCoef.buf, 0, sizeof(TCoeff) * piQCoef.area() ); + for (int uiBlockPos = 0; uiBlockPos < maxNumberOfCoeffs; uiBlockPos++ ) +#else for (int uiBlockPos = 0; uiBlockPos < piQCoef.area(); uiBlockPos++) +#endif { const TCoeff iLevel = piCoef.buf[uiBlockPos]; const TCoeff iSign = (iLevel < 0 ? -1: 1); diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index a31fcefa58208a1f1f04ee058e2d30aac67bdf74..df208ed21eb6565a1190c3c03d624356f3e3cd0a 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -671,7 +671,9 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, double *pdCostCoeffGroupSig = m_pdCostCoeffGroupSig; memset( pdCostCoeffGroupSig, 0, ( uiMaxNumCoeff >> cctx.log2CGSize() ) * sizeof( double ) ); +#if !JVET_O0094_LFNST_ZERO_PRIM_COEFFS const int iCGNum = std::min<int>(JVET_C0024_ZERO_OUT_TH, uiWidth) * std::min<int>(JVET_C0024_ZERO_OUT_TH, uiHeight) >> cctx.log2CGSize(); +#endif int iScanPos; coeffGroupRDStats rdStats; @@ -681,6 +683,9 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const uint32_t lfnstIdx = tu.cu->lfnstIdx; +#if JVET_O0094_LFNST_ZERO_PRIM_COEFFS + const int iCGNum = lfnstIdx > 0 ? 1 : std::min<int>(JVET_C0024_ZERO_OUT_TH, uiWidth) * std::min<int>(JVET_C0024_ZERO_OUT_TH, uiHeight) >> cctx.log2CGSize(); +#endif for (int subSetId = iCGNum - 1; subSetId >= 0; subSetId--) { diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 6a791b08a751b2bffa3571a7fc74e0a0dc59312e..03030a64c15f583fe41a8f7ec0a11e3496add319 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -209,7 +209,7 @@ #define JVET_O0364_PDPC_DC 1 // JVET-O0364 Part 4: align PDPC process for DC with the one for Planar #define JVET_O0364_PDPC_ANGULAR 1 // JVET-O0364 Part 5: simplify PDPC process for angular modes -#define JVET_O0094_LFNST_ZERO_PRIM_COEFFS 1 // JVET-O0049: CE6-2.1a, LFNST involves zeroing of primary only coefficient positions +#define JVET_O0094_LFNST_ZERO_PRIM_COEFFS 1 // JVET-O0094: CE6-2.1a, LFNST involves zeroing of primary only coefficient positions #define JVET_O0294_TRANSFORM_CLEANUP 1 // JVET-O0294: Context modelling for MTS index