From b613940ee35ced3e0cd40e734e31787224fa6470 Mon Sep 17 00:00:00 2001 From: Han Huang <hanhuang@qti.qualcomm.com> Date: Fri, 10 Jun 2022 18:14:20 +0000 Subject: [PATCH] Fix: JVET_Z0054_BLK_REF_PIC_REORDER when DMVD is off --- source/Lib/DecoderLib/CABACReader.cpp | 8 ++++---- source/Lib/DecoderLib/DecCu.cpp | 4 ++++ source/Lib/EncoderLib/CABACWriter.cpp | 8 ++++---- source/Lib/EncoderLib/InterSearch.cpp | 4 ++++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 81317de46..32201bd16 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -4367,11 +4367,11 @@ void CABACReader::mvp_flag( PredictionUnit& pu, RefPicList eRefList ) #if JVET_Z0054_BLK_REF_PIC_REORDER else if (PU::useRefCombList(pu)) { - mvpIdx = pu.refIdxLC >= pu.cs->slice->getNumNonScaledRefPic() ? m_BinDecoder.decodeBin(Ctx::MVPIdx()) : 0; + mvpIdx = pu.refIdxLC >= pu.cs->slice->getNumNonScaledRefPic() || PU::checkTmEnableCondition(pu.cs->sps, pu.cs->pps, pu.cu->slice->getRefPic(eRefList, pu.refIdx[eRefList])) == false ? m_BinDecoder.decodeBin(Ctx::MVPIdx()) : 0; } else if (PU::useRefPairList(pu)) { - mvpIdx = pu.refPairIdx >= pu.cs->slice->getNumNonScaledRefPicPair() ? m_BinDecoder.decodeBin(Ctx::MVPIdx()) : 0; + mvpIdx = pu.refPairIdx >= pu.cs->slice->getNumNonScaledRefPicPair() || PU::checkTmEnableCondition(pu.cs->sps, pu.cs->pps, pu.cu->slice->getRefPic(eRefList, pu.refIdx[eRefList])) == false ? m_BinDecoder.decodeBin(Ctx::MVPIdx()) : 0; } #endif else if (PU::checkTmEnableCondition(pu.cs->sps, pu.cs->pps, pu.cu->slice->getRefPic(eRefList, pu.refIdx[eRefList])) == false) @@ -4796,7 +4796,7 @@ void CABACReader::mvsdIdxFunc(PredictionUnit &pu, RefPicList eRefList) return; } #if JVET_Z0054_BLK_REF_PIC_REORDER - if (pu.cs->sps->getUseARL()) + if (PU::useRefPairList(pu)) { if (pu.interDir == 3 && eRefList == REF_PIC_LIST_1 && (pu.mvd[0].getHor() || pu.mvd[0].getVer())) { @@ -4859,7 +4859,7 @@ void CABACReader::mvsdAffineIdxFunc(PredictionUnit &pu, RefPicList eRefList) } #if JVET_Z0054_BLK_REF_PIC_REORDER - if (pu.cs->sps->getUseARL()) + if (PU::useRefPairList(pu)) { if (pu.interDir == 3 && eRefList == REF_PIC_LIST_1 && (pu.mvdAffi[0][0].getHor() || pu.mvdAffi[0][0].getVer() || diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 4100e0e86..a512e1e9d 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -2346,7 +2346,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) ); pu.mvpNum [eRefList] = amvpInfo.numCand; #if JVET_Z0054_BLK_REF_PIC_REORDER +#if JVET_X0083_BM_AMVP_MERGE_MODE + if( (!PU::useRefCombList(pu) && !PU::useRefPairList(pu)) || (pu.amvpMergeModeFlag[REF_PIC_LIST_0] || pu.amvpMergeModeFlag[REF_PIC_LIST_1])) +#else if(!PU::useRefCombList(pu) && !PU::useRefPairList(pu)) +#endif { #else if (!cu.cs->pcv->isEncoder) diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 7a402ecff..0fa042b82 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -4270,11 +4270,11 @@ void CABACWriter::mvp_flag( const PredictionUnit& pu, RefPicList eRefList ) #if JVET_Z0054_BLK_REF_PIC_REORDER else if (PU::useRefCombList(pu)) { - needToCodeMvpIdx = pu.refIdxLC >= pu.cs->slice->getNumNonScaledRefPic(); + needToCodeMvpIdx = pu.refIdxLC >= pu.cs->slice->getNumNonScaledRefPic() || PU::checkTmEnableCondition(pu.cs->sps, pu.cs->pps, pu.cu->slice->getRefPic(eRefList, pu.refIdx[eRefList])) == false; } else if (PU::useRefPairList(pu)) { - needToCodeMvpIdx = pu.refPairIdx >= pu.cs->slice->getNumNonScaledRefPicPair(); + needToCodeMvpIdx = pu.refPairIdx >= pu.cs->slice->getNumNonScaledRefPicPair() || PU::checkTmEnableCondition(pu.cs->sps, pu.cs->pps, pu.cu->slice->getRefPic(eRefList, pu.refIdx[eRefList])) == false; } #endif else if (PU::checkTmEnableCondition(pu.cs->sps, pu.cs->pps, pu.cu->slice->getRefPic(eRefList, pu.refIdx[eRefList])) == false) @@ -4576,7 +4576,7 @@ void CABACWriter::mvsdIdxFunc(const PredictionUnit &pu, RefPicList eRefList) return; } #if JVET_Z0054_BLK_REF_PIC_REORDER - if (pu.cs->sps->getUseARL()) + if (PU::useRefPairList(pu)) { if (pu.interDir == 3 && eRefList == REF_PIC_LIST_1 && (pu.mvd[0].getHor() || pu.mvd[0].getVer())) { @@ -4638,7 +4638,7 @@ void CABACWriter::mvsdAffineIdxFunc(const PredictionUnit &pu, RefPicList eRefLis return; } #if JVET_Z0054_BLK_REF_PIC_REORDER - if (pu.cs->sps->getUseARL()) + if (PU::useRefPairList(pu)) { if (pu.interDir == 3 && eRefList == REF_PIC_LIST_1 && (pu.mvdAffi[0][0].getHor() || pu.mvdAffi[0][0].getVer() || diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index ad6b6ca2b..465cb2619 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -3865,7 +3865,11 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) setWpScalingDistParam(-1, REF_PIC_LIST_X, cu.cs->slice); return; } +#if JVET_X0083_BM_AMVP_MERGE_MODE + if ((!PU::useRefCombList(pu) && !PU::useRefPairList(pu)) || (pu.amvpMergeModeFlag[REF_PIC_LIST_0] || pu.amvpMergeModeFlag[REF_PIC_LIST_1])) +#else if(!PU::useRefPairList(pu) && !PU::useRefCombList(pu)) +#endif #endif if (pu.isMvsdApplicable()) { -- GitLab