From 612c39cb3e5c5321f4493c517b6de73293a50847 Mon Sep 17 00:00:00 2001 From: Brian Heng <brian.heng@broadcom.com> Date: Fri, 8 Feb 2019 12:33:16 -0800 Subject: [PATCH] Fix for Ticket #152 - Sub-PU TMVP can generate an invalid inter candidate. --- source/Lib/CommonLib/UnitTools.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index aa9a7d9abb..bc348c7c39 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -4550,6 +4550,7 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b if (colMi.isInter && !((colMi.interDir == 1 || colMi.interDir == 3) && (pColPic->cs->slice->getRefPOC(REF_PIC_LIST_0, colMi.refIdx[0]) == pColPic->cs->slice->getPOC()) && pu.cs->sps->getIBCMode())) #endif { + bool foundMV = false; for (unsigned currRefListId = 0; currRefListId < (bBSlice ? 2 : 1); currRefListId++) { RefPicList currRefPicList = RefPicList(currRefListId); @@ -4557,9 +4558,18 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b { mi.refIdx[currRefListId] = 0; mi.mv[currRefListId] = cColMv; + foundMV = true; } } + if (foundMV == false) + { + // no motion vector is available so use default + mi.mv[0] = mrgCtx.mvFieldNeighbours[(count << 1) + 0].mv; + mi.mv[1] = mrgCtx.mvFieldNeighbours[(count << 1) + 1].mv; + mi.refIdx[0] = mrgCtx.mvFieldNeighbours[(count << 1) + 0].refIdx; + mi.refIdx[1] = mrgCtx.mvFieldNeighbours[(count << 1) + 1].refIdx; } + } else { // intra coded, in this case, no motion vector is available for list 0 or list 1, so use default -- GitLab