diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index fa51ac28709c5bbf965a9024ae9c4fe63bd2dad1..15ced18b47d8f24d46cde24b4bd2287983684108 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -416,9 +416,7 @@ public: violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; lfnstLastScanPos = false; violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND mtsLastScanPos = false; -#endif } CUCtx(int _qp) : isDQPCoded(false), isChromaQpAdjCoded(false), qgStart(false), @@ -428,9 +426,7 @@ public: violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; lfnstLastScanPos = false; violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND mtsLastScanPos = false; -#endif } ~CUCtx() {} public: @@ -441,9 +437,7 @@ public: int8_t qp; // used as a previous(last) QP and for QP prediction bool violatesLfnstConstrained[MAX_NUM_CHANNEL_TYPE]; bool violatesMtsCoeffConstraint; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND bool mtsLastScanPos; -#endif }; class MergeCtx diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 88a167c0da4d5a76a9a638ed5cc5381d6f437acd..7102b6f4c46b9530bee097f5f41dafc206bc8c20 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -147,7 +147,6 @@ -#define JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND 1 // JVET-Q0516/Q0685: disable MTS when there is only DC coefficient #define JVET_Q0806 1 // Geo related adoptions (JVET-Q0059, JVET-Q0077, JVET-Q0123, JVET-Q0188, JVET-Q0242_GEO, JVET-Q0309, JVET-Q0365 and JVET-Q0370) diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index ba91f272c979a74e403313617d3b4dccffadbd65..58d80eeef4ecbf94303b51f8813d60070b7683f5 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -1531,9 +1531,7 @@ void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; cuCtx.lfnstLastScanPos = false; cuCtx.violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos = false; -#endif ChromaCbfs chromaCbfs; if( cu.ispMode && isLuma( partitioner.chType ) ) @@ -3004,12 +3002,10 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& cuCtx.violatesMtsCoeffConstraint = true; } #endif -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND if (isLuma(compID) && tu.mtsIdx[compID] != MTS_SKIP) { cuCtx.mtsLastScanPos |= cctx.scanPosLast() >= 1; } -#endif // parse subblocks const int stateTransTab = ( tu.cs->picHeader->getDepQuantEnabledFlag() ? 32040 : 0 ); @@ -3063,11 +3059,7 @@ void CABACReader::mts_idx( CodingUnit& cu, CUCtx& cuCtx ) int mtsIdx = tu.mtsIdx[COMPONENT_Y]; // Transform skip flag has already been decoded if( CU::isMTSAllowed( cu, COMPONENT_Y ) && !cuCtx.violatesMtsCoeffConstraint && -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos && cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP) -#else - cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) ) -#endif { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__MTS_FLAGS, tu.blocks[COMPONENT_Y], COMPONENT_Y ); int ctxIdx = 0; diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index e7c494463e61a2b2008fe5533542f0109de6e9de..c39b64fec12d565aa35ab31c48a60188bac1481c 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -1331,9 +1331,7 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; cuCtx.lfnstLastScanPos = false; cuCtx.violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos = false; -#endif if( cu.ispMode && isLuma( partitioner.chType ) ) { @@ -2756,12 +2754,10 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, cuCtx->violatesMtsCoeffConstraint = true; } #endif -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND if (cuCtx && isLuma(compID) && tu.mtsIdx[compID] != MTS_SKIP) { cuCtx->mtsLastScanPos |= cctx.scanPosLast() >= 1; } -#endif // code last coeff position @@ -2815,11 +2811,7 @@ void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx* cuCtx ) int mtsIdx = tu.mtsIdx[COMPONENT_Y]; if( CU::isMTSAllowed( cu, COMPONENT_Y ) && cuCtx && !cuCtx->violatesMtsCoeffConstraint && -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx->mtsLastScanPos && cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP) -#else - cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) ) -#endif { int symbol = mtsIdx != MTS_DCT2_DCT2 ? 1 : 0; int ctxIdx = 0; diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index a2cdd55428001574f38ab7d2a46ae1c8c85bcf56..2a861fc35b8ea8a4757a2f7425517c532a5bf89a 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -1874,12 +1874,10 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS } } -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND if (isLuma(partitioner.chType) && cu.firstTU->mtsIdx[COMPONENT_Y] > MTS_SKIP) { CHECK(!cuCtx.mtsLastScanPos, "MTS is disallowed to only contain DC coefficient"); } -#endif if( mtsFlag == 0 && lfnstIdx == 0 ) { diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 929169b8165fba5781c1cd25f8484af0f2cbab5b..627b040c6127e6e9945d642e7f6d5dad43916379 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -6779,7 +6779,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_CABACEstimator->cross_comp_pred( tu, compID ); } #endif -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND CUCtx cuCtx; cuCtx.isDQPCoded = true; cuCtx.isChromaQpAdjCoded = true; @@ -6792,9 +6791,6 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } else { -#else - m_CABACEstimator->residual_coding(tu, compID); -#endif currCompFracBits = m_CABACEstimator->getEstFracBits(); @@ -6820,9 +6816,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par #else currCompCost = m_pcRdCost->calcRdCost(currCompFracBits, currCompDist); #endif -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND } -#endif } #if !REMOVE_PPS_REXT else if( transformMode > 0 && !bUseCrossCPrediction ) diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 662028dea9c0b735fe6078de461fe7d2a8720538..9c289032558e90f7d6d4561db977604d6d6e6459 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -3977,9 +3977,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } } -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos = false; -#endif //----- determine rate and r-d cost ----- if( ( sps.getUseLFNST() ? ( modeId == lastCheckId && modeId != 0 && checkTransformSkip ) : ( trModes[ modeId ].first != 0 ) ) && !TU::getCbfAtDepth( tu, COMPONENT_Y, currDepth ) ) { @@ -4002,7 +4000,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par { singleTmpFracBits = xGetIntraFracBitsQT( *csFull, partitioner, true, false, subTuCounter, ispType, &cuCtx ); } -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND if (tu.mtsIdx[COMPONENT_Y] > MTS_SKIP) { if (!cuCtx.mtsLastScanPos) @@ -4015,7 +4012,6 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par } } else -#endif singleCostTmp = m_pcRdCost->calcRdCost( singleTmpFracBits, singleDistTmpLuma ); } @@ -4201,9 +4197,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] = false; cuCtx.lfnstLastScanPos = false; cuCtx.violatesMtsCoeffConstraint = false; -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND cuCtx.mtsLastScanPos = false; -#endif //----- determine rate and r-d cost ----- csSplit->fracBits = xGetIntraFracBitsQT( *csSplit, partitioner, true, false, cu.ispMode ? 0 : -1, ispType, &cuCtx ); @@ -4514,11 +4508,9 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } } -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND CUCtx cuCtx; cuCtx.isDQPCoded = true; cuCtx.isChromaQpAdjCoded = true; -#endif //----- determine rate and r-d cost ----- if ((sps.getUseLFNST() ? (modeId == lastCheckId && modeId != 0 && checkTransformSkip) : (trModes[modeId].first != 0)) && !TU::getCbfAtDepth(tu, COMPONENT_Y, currDepth)) { @@ -4533,7 +4525,6 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } else { -#if JVET_Q0516_MTS_SIGNALLING_DC_ONLY_COND singleTmpFracBits = xGetIntraFracBitsQT(*csFull, partitioner, true, false, -1, TU_NO_ISP, &cuCtx); if (tu.mtsIdx[COMPONENT_Y] > MTS_SKIP) @@ -4548,9 +4539,6 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti } } else -#else - singleTmpFracBits = xGetIntraFracBitsQT(*csFull, partitioner, true, false, -1, TU_NO_ISP); -#endif singleCostTmp = m_pcRdCost->calcRdCost(singleTmpFracBits, singleDistTmpLuma, false); }