diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 2bae6edf9ce58dd843d08b76969c4e1e1637b075..dddc6721b70379182f352fafffed7293750a225a 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -66,6 +66,8 @@ #endif //JVET_N0671 +#define JVET_N0843_BVP_SIMPLIFICATION 1 + #define JVET_N0448_N0380 1 // When MaxNumMergeCand is 1, MMVD_BASE_MV_NUM is inferred to be 1. #define JVET_N0054_JOINT_CHROMA 1 // Joint chroma residual coding mode diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index fe67d456507f9ce57abdf1a48a56e1216d722f8c..f05e534f316c200214790e5c66ee8c76b453c5ce 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -1073,7 +1073,11 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, bool isCa { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miNeighbor.mv[1], miNeighbor.refIdx[1]); } +#if JVET_N0843_BVP_SIMPLIFICATION + if (mrgIdx > 2 || (mrgIdx > 1 && ibcFlag) || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) +#else if (mrgIdx > 2 || !xCheckSimilarMotion(cnt, prevCnt, mrgCtx, hasPruned)) +#endif { #if !JVET_L0090_PAIR_AVG isCandInter[cnt] = true; @@ -1114,7 +1118,9 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int cnt = 0; +#if JVET_N0843_BVP_SIMPLIFICATION==0 const Position posLT = pu.shareParentPos; +#endif const Position posRT = pu.shareParentPos.offset(pu.shareParentSize.width - 1, 0); const Position posLB = pu.shareParentPos.offset(0, pu.shareParentSize.height - 1); @@ -1175,6 +1181,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int spatialCandPos = cnt; +#if JVET_N0843_BVP_SIMPLIFICATION==0 // above right const PredictionUnit *puAboveRight = cs.getPURestricted(posRT.offset(1, -1), pu, pu.chType); bool isAvailableB0 = puAboveRight && isDiffMER(pu, *puAboveRight) && CU::isIBC(*puAboveRight->cu); @@ -1269,8 +1276,13 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const { return; } +#endif +#if JVET_N0843_BVP_SIMPLIFICATION + int maxNumMergeCandMin1 = maxNumMergeCand; +#else int maxNumMergeCandMin1 = maxNumMergeCand - 1; +#endif if (cnt != maxNumMergeCandMin1) { bool isAvailableSubPu = false; @@ -1299,7 +1311,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const } } -#if JVET_L0090_PAIR_AVG +#if JVET_L0090_PAIR_AVG && JVET_N0843_BVP_SIMPLIFICATION==0 // pairwise-average candidates if (cnt>1 && cnt <maxNumMergeCand) { @@ -2435,12 +2447,15 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) */ void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo) { +#if JVET_N0843_BVP_SIMPLIFICATION==0 CodingStructure &cs = *pu.cs; +#endif AMVPInfo *pInfo = &amvpInfo; pInfo->numCand = 0; +#if JVET_N0843_BVP_SIMPLIFICATION==0 //-- Get Spatial MV Position posLT = pu.Y().topLeft(); Position posRT = pu.Y().topRight(); @@ -2508,10 +2523,26 @@ void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo) pInfo->mvCand[pInfo->numCand] = Mv(0, 0); pInfo->numCand++; } +#endif + +#if JVET_N0843_BVP_SIMPLIFICATION + MergeCtx mergeCtx; + PU::getIBCMergeCandidates(pu, mergeCtx, AMVP_MAX_NUM_CANDS - 1); + int candIdx = 0; + while (pInfo->numCand < AMVP_MAX_NUM_CANDS) + { + pInfo->mvCand[pInfo->numCand] = mergeCtx.mvFieldNeighbours[(candIdx << 1) + 0].mv;; + pInfo->numCand++; + candIdx++; + } +#endif for (Mv &mv : pInfo->mvCand) { mv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); +#if JVET_N0843_BVP_SIMPLIFICATION + mv.roundToAmvrSignalPrecision(MV_PRECISION_QUARTER, pu.cu->imv); +#endif } } diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index e0cc81fb611b21ad9c00be02eea85d9821cf6eef..75ba9c904fe5ecb1bdc2bcd5303a2d4cf7404654 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -713,6 +713,10 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) } else { +#if JVET_N0843_BVP_SIMPLIFICATION + pu.shareParentPos = cu.shareParentPos; + pu.shareParentSize = cu.shareParentSize; +#endif #if REUSE_CU_RESULTS if ( cu.imv && !pu.cu->affine && !cu.cs->pcv->isEncoder ) #else diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 79ece425cb9b25405f49a10a1607fc48f7a70711..4e0439dede0892e37c8bafc095a4fb4a81a9a8ce 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -3121,6 +3121,11 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best cu.mmvdSkip = false; pu.mmvdMergeFlag = false; +#if JVET_N0843_BVP_SIMPLIFICATION + pu.shareParentPos = tempCS->sharedBndPos; + pu.shareParentSize = tempCS->sharedBndSize; +#endif + pu.intraDir[0] = DC_IDX; // set intra pred for ibc block pu.intraDir[1] = PLANAR_IDX; // set intra pred for ibc block