From 552f201ac2e00012a0657eee4d1a38a17bbd2306 Mon Sep 17 00:00:00 2001 From: Shelly Chiang <chiangshelly@yahoo.com.tw> Date: Wed, 31 Oct 2018 00:52:58 +0800 Subject: [PATCH] fix the interaction --- source/Lib/EncoderLib/EncCu.cpp | 32 +++++++++++++++++++++++++++++--- source/Lib/EncoderLib/EncCu.h | 2 ++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 0069f0c053..1a05f9f8ef 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -1697,6 +1697,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& { isIntrainterEnabled = false; } + bool isTestSkipMerge[MRG_MAX_NUM_CANDS]; // record if the merge candidate has tried skip mode + for (uint32_t idx = 0; idx < MRG_MAX_NUM_CANDS; idx++) + { + isTestSkipMerge[idx] = false; + } #endif #if JVET_L0100_MULTI_HYPOTHESIS_INTRA if( m_pcEncCfg->getUseFastMerge() || isIntrainterEnabled) @@ -1926,7 +1931,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& m_CABACEstimator->getCtx() = SubCtx(Ctx::MHIntraPredMode, ctxStartIntraMode); uint64_t fracModeBits = m_pcIntraSearch->xFracModeBitsIntra(pu, pu.intraDir[0], CHANNEL_TYPE_LUMA); double cost = (double)sadValue + (double)(bitsCand + 1) * sqrtLambdaForFirstPass + (double)fracModeBits * sqrtLambdaForFirstPassIntra; - cost = MAX_DOUBLE; #if JVET_L0054_MMVD insertPos = -1; updateDoubleCandList(mergeCand + MRG_MAX_NUM_CANDS + MMVD_ADD_NUM, cost, RdModeList, candCostList, RdModeList2, pu.intraDir[0], uiNumMrgSATDCand, &insertPos); @@ -2048,6 +2052,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #endif } #endif + // Try to limit number of candidates using SATD-costs for( uint32_t i = 1; i < uiNumMrgSATDCand; i++ ) { @@ -2127,7 +2132,10 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #else uiMergeCand -= (MRG_MAX_NUM_CANDS + MRG_MAX_NUM_CANDS); // for skip, map back to normal merge candidate idx and try RDO #endif - continue; + if (isTestSkipMerge[uiMergeCand]) + { + continue; + } } #endif @@ -2225,7 +2233,14 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& else { #if JVET_L0054_MMVD - tempCS->getPredBuf().copyFrom(*acMergeTempBuffer[uiMrgHADIdx]); + if (uiNoResidualPass != 0 && uiMergeCand < mergeCtx.numValidMergeCand && RdModeList[uiMrgHADIdx] >= (MRG_MAX_NUM_CANDS + MMVD_ADD_NUM)) + { + tempCS->getPredBuf().copyFrom(acMergeBuffer[uiMergeCand]); + } + else + { + tempCS->getPredBuf().copyFrom(*acMergeTempBuffer[uiMrgHADIdx]); + } #else tempCS->getPredBuf().copyFrom(acMergeBuffer[uiMergeCand]); #endif @@ -2243,6 +2258,17 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& m_pcInterSearch->motionCompensation( pu ); } +#if JVET_L0100_MULTI_HYPOTHESIS_INTRA +#if JVET_L0054_MMVD + if (!cu.mmvdSkip && !pu.MHIntraFlag && uiNoResidualPass != 0) +#else + if (!pu.MHIntraFlag && uiNoResidualPass != 0) +#endif + { + CHECK(uiMergeCand >= mergeCtx.numValidMergeCand, "out of normal merge"); + isTestSkipMerge[uiMergeCand] = true; + } +#endif #if JVET_L0054_MMVD xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, uiNoResidualPass diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index fe95865551..3607a2f23e 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -242,6 +242,8 @@ protected: || abs(cu.slice->getPOC() - cu.slice->getRefPOC(REF_PIC_LIST_1, cu.refIdxBi[1])) == 1)))); } #endif + + }; //! \} -- GitLab