Commit 745dcf4b authored by Guichun's avatar Guichun
Browse files

JVET-N0448/N0380: MMVD fix when MaxNumMergeCand is 1

Implicitly infer the number of MMVD base merge candidate to be 1 as MaxNumMergeCand being equal to 1, and mmvd_merge_flag is not signalled in this case.
parent f555917e
......@@ -2187,6 +2187,7 @@ bool EncAppCfg::xCheckParameter()
msg( WARNING, "** advanced sup-pu temporal merging modes are enabled. **\n" );
msg( WARNING, "****************************************************************************\n" );
}
#if !JVET_N0448_N0380
else if( m_SubPuMvpMode != 0 && m_maxNumMergeCand < 6 )
{
msg( WARNING, "****************************************************************************\n" );
......@@ -2194,6 +2195,7 @@ bool EncAppCfg::xCheckParameter()
msg( WARNING, "** an advanced sup-pu temporal merging mode is enabled. **\n" );
msg( WARNING, "****************************************************************************\n" );
}
#endif
xConfirmPara( m_iQP < -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > MAX_QP, "QP exceeds supported range (-QpBDOffsety to 63)" );
#if W0038_DB_OPT
xConfirmPara( m_deblockingFilterMetric!=0 && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is non-zero then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
......
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_N0448_N0380 1 // When MaxNumMergeCand is 1, MMVD_BASE_MV_NUM is inferred to be 1.
#define JVET_N0462_FIX_CTX_MODELING 1 // Fix context modeling of inter_pred_idc
#define JVET_N0286_SIMPLIFIED_GBI_IDX 1 // Simplified coding of the GBi index
......
......@@ -2051,7 +2051,7 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx,
break;
}
}
#if !JVET_N0448_N0380
if (currBaseNum < MMVD_BASE_MV_NUM)
{
for (k = currBaseNum; k < MMVD_BASE_MV_NUM; k++)
......@@ -2063,6 +2063,7 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx,
mrgCtx.interDirNeighbours[k] = (mrgCtx.mmvdBaseMv[k][0].refIdx >= 0) + (mrgCtx.mmvdBaseMv[k][1].refIdx >= 0) * 2;
}
}
#endif
}
bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList, const Position &_pos, Mv& rcMv, const int &refIdx )
{
......
......@@ -1678,7 +1678,12 @@ void CABACReader::mmvd_merge_idx(PredictionUnit& pu)
mvpIdx = (var + dir0)*(MMVD_MAX_REFINE_NUM*MMVD_BASE_MV_NUM);
#if JVET_N0448_N0380
int numCand = int(pu.cs->slice->getMaxNumMergeCand());
int numCandminus1_base = (numCand > 1) ? MMVD_BASE_MV_NUM - 1 : 0;
#else
int numCandminus1_base = MMVD_BASE_MV_NUM - 1;
#endif
var0 = 0;
if (numCandminus1_base > 0)
{
......
......@@ -1634,7 +1634,12 @@ void CABACWriter::mmvd_merge_idx(const PredictionUnit& pu)
var1 = (mvpIdx - (var0 * MMVD_MAX_REFINE_NUM)) / 4;
var2 = mvpIdx - (var0 * MMVD_MAX_REFINE_NUM) - var1 * 4;
#if JVET_N0448_N0380
int numCand = int(pu.cs->slice->getMaxNumMergeCand());
int numCandminus1_base = (numCand > 1) ? MMVD_BASE_MV_NUM - 1 : 0;
#else
int numCandminus1_base = MMVD_BASE_MV_NUM - 1;
#endif
if (numCandminus1_base > 0)
{
if (var0 == 0)
......
......@@ -1977,7 +1977,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
#if !JVET_MMVD_OFF_MACRO
cu.mmvdSkip = true;
int tempNum = 0;
#if JVET_N0448_N0380
tempNum = (mergeCtx.numValidMergeCand > 1) ? MMVD_ADD_NUM : MMVD_ADD_NUM >> 1;
#else
tempNum = MMVD_ADD_NUM;
#endif
for (uint32_t mergeCand = mergeCtx.numValidMergeCand; mergeCand < mergeCtx.numValidMergeCand + tempNum; mergeCand++)
{
const int mmvdMergeCand = mergeCand - mergeCtx.numValidMergeCand;
......@@ -2076,7 +2080,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
{
if (bestIsMMVDSkip)
{
#if JVET_N0448_N0380
uiNumMrgSATDCand = mergeCtx.numValidMergeCand + ((mergeCtx.numValidMergeCand > 1) ? MMVD_ADD_NUM : MMVD_ADD_NUM >> 1);
#else
uiNumMrgSATDCand = mergeCtx.numValidMergeCand + MMVD_ADD_NUM;
#endif
}
else
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment