diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 84b337869a20042f0a13a74827224f0e17b32804..dfd76225ee686f3de0e3c633db72fe508186896d 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -13928,6 +13928,8 @@ void InterPrediction::clearAmvpTmvpBuffer() { m_pcMergeCtxList0 = MergeCtx(); m_pcMergeCtxList1 = MergeCtx(); + m_pcMergeCtxList0.numValidMergeCand = 0; + m_pcMergeCtxList1.numValidMergeCand = 0; } #endif diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 4690207508b95a7d14dae454e4ffa157e7b346d9..bf6656700e30c9b068db9b84bc7c7421a7da936f 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -10270,8 +10270,17 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in #endif { MergeCtx mrgCtxAll[2]; - MergeCtx MrgTmvp[2]; + mrgCtxAll[0].numValidMergeCand = 0; + mrgCtxAll[1].numValidMergeCand = 0; + + MergeCtx mrgTmvp[2]; + mrgTmvp[0].numValidMergeCand = 0; + mrgTmvp[1].numValidMergeCand = 0; + MergeCtx namvpMergeCandCtx[2]; + namvpMergeCandCtx[0].numValidMergeCand = 0; + namvpMergeCandCtx[1].numValidMergeCand = 0; + bool isSaved = true; if (pu.cs->sps->getUseAML() && interPred != NULL) { @@ -10298,11 +10307,11 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in isSaved = false; } - PU::getTMVPCandOpt(pu, eRefPicList, refIdx, MrgTmvp[col], mrgCtxAll[col], col); - interPred->adjustMergeCandidatesInOneCandidateGroup(pu, MrgTmvp[col], AMVP_TMVP_INDEX); - if (MrgTmvp[col].numValidMergeCand > 0) + PU::getTMVPCandOpt(pu, eRefPicList, refIdx, mrgTmvp[col], mrgCtxAll[col], col); + interPred->adjustMergeCandidatesInOneCandidateGroup(pu, mrgTmvp[col], AMVP_TMVP_INDEX); + if (mrgTmvp[col].numValidMergeCand > 0) { - Mv mvTmp = MrgTmvp[col].mvFieldNeighbours[eRefPicList].mv; + Mv mvTmp = mrgTmvp[col].mvFieldNeighbours[eRefPicList].mv; mvTmp.roundTransPrecInternal2Amvr(pu.cu->imv); #if TM_AMVP pInfo->mvCand[pInfo->numCand] = mvTmp;