diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index e189aed16649653ae612dd0d0bdb8440dd30fb11..9589707dcb7c3e3142f3e28d38e90243deee805b 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,6 +50,8 @@ #include <assert.h> #include <cassert> +#define JVET_M0126_HMVP_MRG_PRUNING 1 // HMVP merge candidates pruning simplification + #define JVET_M0483_IBC 1 // Block level flag signaling and independent IBC mode #define JVET_M0102_INTRA_SUBPARTITIONS 1 diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index f7775517e42fac2db47baad9d002e4a4aae3f244..eabc515711bf8e1a02d021e89447ac1fdb562d1d 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -1100,7 +1100,11 @@ bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miNeighbor.mv[1], miNeighbor.refIdx[1]); } +#if JVET_M0126_HMVP_MRG_PRUNING + if (mrgIdx > 2 || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) +#else if (!xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) +#endif { #if !JVET_L0090_PAIR_AVG isCandInter[cnt] = true; @@ -1210,6 +1214,10 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const return; } +#if JVET_M0126_HMVP_MRG_PRUNING + int spatialCandPos = cnt; +#endif + // above right const PredictionUnit *puAboveRight = cs.getPURestricted(posRT.offset(1, -1), pu, pu.chType); bool isAvailableB0 = puAboveRight && isDiffMER(pu, *puAboveRight) && CU::isIBC(*puAboveRight->cu); @@ -1314,7 +1322,13 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const #if JVET_L0090_PAIR_AVG bool bFound = addMergeHMVPCand(slice, mrgCtx, canFastExit , mrgCandIdx - , maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos + , maxNumMergeCandMin1, cnt +#if JVET_M0126_HMVP_MRG_PRUNING + , spatialCandPos +#else + , cnt +#endif + , isAvailableSubPu, subPuMvpPos #if JVET_M0483_IBC , true #endif @@ -1536,6 +1550,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, return; } +#if JVET_M0126_HMVP_MRG_PRUNING + int spatialCandPos = cnt; +#endif + // above right const PredictionUnit *puAboveRight = cs.getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType ); @@ -1849,7 +1867,13 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #else , mrgCandIdx #endif - , maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos + , maxNumMergeCandMin1, cnt +#if JVET_M0126_HMVP_MRG_PRUNING + , spatialCandPos +#else + , cnt +#endif + , isAvailableSubPu, subPuMvpPos #if JVET_M0483_IBC==0 , mmvdList #endif