Commit 0bf36e45 authored by Frank Bossen's avatar Frank Bossen

Merge branch 'JVET_L0054_MMVD is uploaded.' into 'master'

This is JVET L0054 MMVD code.
MACRO is JVET_L0054_MMVD.

See merge request jvet/VVCSoftware_VTM!26

Squashed commit of the following:

commit d9b44c2820495aee7c77604f511116711a18b880
Author: seungsoo <ss00.jeong@samsung.com>
Date:   Fri Oct 26 08:28:35 2018 +0900

    code update ( reflection )

commit 1fd1b4341134f355651d950ba0024c2b370cdfb5
Author: seungsoo <ss00.jeong@samsung.com>
Date:   Thu Oct 25 10:59:22 2018 +0900

    code update ( reflection of commented things )

commit 3befe26e3e9c23c51bad6e874d868403f665f452
Author: seungsoo <ss00.jeong@samsung.com>
Date:   Wed Oct 24 13:18:27 2018 +0900

    JVET_L0054_MMVD is uploaded.
parent 3ee4cb57
Pipeline #215 passed with stage
......@@ -294,6 +294,16 @@ static const int AFFINE_MAX_NUM_V2 = 2; ///< max
static const int AFFINE_MAX_NUM_COMB = 12; ///< max number of combined motion candidates
static const int AFFINE_MIN_BLOCK_SIZE = 4; ///< Minimum affine MC block size
#if JVET_L0054_MMVD
static const int MMVD_REFINE_STEP = 8; ///< max number of distance step
static const int MMVD_MAX_REFINE_NUM = (MMVD_REFINE_STEP * 4); ///< max number of candidate from a base candidate
static const int MMVD_BASE_MV_NUM = 2; ///< max number of base candidate
static const int MMVD_ADD_NUM = (MMVD_MAX_REFINE_NUM * MMVD_BASE_MV_NUM);///< total number of mmvd candidate
static const int MMVD_MRG_MAX_RD_NUM = MRG_MAX_NUM_CANDS;
static const int MMVD_MRG_MAX_RD_BUF_NUM = (MMVD_MRG_MAX_RD_NUM + 1);///< increase buffer size by 1
#endif
#if JVET_L0274
static const int MAX_NUM_REG_BINS_4x4SUBBLOCK = 32; ///< max number of context-coded bins (incl. gt2 bins) per 4x4 subblock
static const int MAX_NUM_GT2_BINS_4x4SUBBLOCK = 4; ///< max number of gt2 bins per 4x4 subblock
......
......@@ -365,6 +365,9 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
CHECK( candIdx >= numValidMergeCand, "Merge candidate does not exist" );
pu.mergeFlag = true;
#if JVET_L0054_MMVD
pu.mmvdMergeFlag = false;
#endif
pu.interDir = interDirNeighbours[candIdx];
pu.mergeIdx = candIdx;
pu.mergeType = mrgTypeNeighbours[candIdx];
......@@ -384,3 +387,209 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
#endif
}
#if JVET_L0054_MMVD
void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx)
{
const Slice &slice = *pu.cs->slice;
const int mvShift = VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE;
const int refMvdCands[8] = { 1 << mvShift , 2 << mvShift , 4 << mvShift , 8 << mvShift , 16 << mvShift , 32 << mvShift, 64 << mvShift , 128 << mvShift };
int fPosGroup = 0;
int fPosBaseIdx = 0;
int fPosStep = 0;
int tempIdx = 0;
int fPosPosition = 0;
Mv tempMv[2];
tempIdx = candIdx;
fPosGroup = tempIdx / (MMVD_BASE_MV_NUM * MMVD_MAX_REFINE_NUM);
tempIdx = tempIdx - fPosGroup * (MMVD_BASE_MV_NUM * MMVD_MAX_REFINE_NUM);
fPosBaseIdx = tempIdx / MMVD_MAX_REFINE_NUM;
tempIdx = tempIdx - fPosBaseIdx * (MMVD_MAX_REFINE_NUM);
fPosStep = tempIdx / 4;
fPosPosition = tempIdx - fPosStep * (4);
const int offset = refMvdCands[fPosStep];
#if !REMOVE_MV_ADAPT_PREC
const int highPrecList0 = mmvdBaseMv[fPosBaseIdx][0].mv.highPrec;
const int highPrecList1 = mmvdBaseMv[fPosBaseIdx][1].mv.highPrec;
#endif
const int refList0 = mmvdBaseMv[fPosBaseIdx][0].refIdx;
const int refList1 = mmvdBaseMv[fPosBaseIdx][1].refIdx;
if ((refList0 != -1) && (refList1 != -1))
{
const int poc0 = slice.getRefPOC(REF_PIC_LIST_0, refList0);
const int poc1 = slice.getRefPOC(REF_PIC_LIST_1, refList1);
const int currPoc = slice.getPOC();
int refSign = 1;
if ((poc0 - currPoc) * (currPoc - poc1) > 0)
{
refSign = -1;
}
#if REMOVE_MV_ADAPT_PREC
if (fPosPosition == 0)
{
tempMv[0] = Mv(offset, 0);
tempMv[1] = Mv(offset * refSign, 0);
}
else if (fPosPosition == 1)
{
tempMv[0] = Mv(-offset, 0);
tempMv[1] = Mv(-offset * refSign, 0);
}
else if (fPosPosition == 2)
{
tempMv[0] = Mv(0, offset);
tempMv[1] = Mv(0, offset * refSign);
}
else
{
tempMv[0] = Mv(0, -offset);
tempMv[1] = Mv(0, -offset * refSign);
}
#else
if (fPosPosition == 0)
{
tempMv[0] = Mv(offset, 0, highPrecList0);
tempMv[1] = Mv(offset * refSign, 0, highPrecList1);
}
else if (fPosPosition == 1)
{
tempMv[0] = Mv(-offset, 0, highPrecList0);
tempMv[1] = Mv(-offset * refSign, 0, highPrecList1);
}
else if (fPosPosition == 2)
{
tempMv[0] = Mv(0, offset, highPrecList0);
tempMv[1] = Mv(0, offset * refSign, highPrecList1);
}
else
{
tempMv[0] = Mv(0, -offset, highPrecList0);
tempMv[1] = Mv(0, -offset * refSign, highPrecList1);
}
#endif
if (abs(poc1 - currPoc) > abs(poc0 - currPoc))
{
const int scale = PU::getDistScaleFactor(currPoc, poc0, currPoc, poc1);
if (scale != 4096)
{
tempMv[0] = tempMv[0].scaleMv(scale);
}
}
else if (abs(poc1 - currPoc) < abs(poc0 - currPoc))
{
const int scale = PU::getDistScaleFactor(currPoc, poc1, currPoc, poc0);
if (scale != 4096)
{
tempMv[1] = tempMv[1].scaleMv(scale);
}
}
pu.interDir = 3;
pu.mv[REF_PIC_LIST_0] = mmvdBaseMv[fPosBaseIdx][0].mv + tempMv[0];
pu.refIdx[REF_PIC_LIST_0] = refList0;
pu.mv[REF_PIC_LIST_1] = mmvdBaseMv[fPosBaseIdx][1].mv + tempMv[1];
pu.refIdx[REF_PIC_LIST_1] = refList1;
}
else if (refList0 != -1)
{
#if REMOVE_MV_ADAPT_PREC
if (fPosPosition == 0)
{
tempMv[0] = Mv(offset, 0);
}
else if (fPosPosition == 1)
{
tempMv[0] = Mv(-offset, 0);
}
else if (fPosPosition == 2)
{
tempMv[0] = Mv(0, offset);
}
else
{
tempMv[0] = Mv(0, -offset);
}
#else
if (fPosPosition == 0)
{
tempMv[0] = Mv(offset, 0, highPrecList0);
}
else if (fPosPosition == 1)
{
tempMv[0] = Mv(-offset, 0, highPrecList0);
}
else if (fPosPosition == 2)
{
tempMv[0] = Mv(0, offset, highPrecList0);
}
else
{
tempMv[0] = Mv(0, -offset, highPrecList0);
}
#endif
pu.interDir = 1;
pu.mv[REF_PIC_LIST_0] = mmvdBaseMv[fPosBaseIdx][0].mv + tempMv[0];
pu.refIdx[REF_PIC_LIST_0] = refList0;
pu.mv[REF_PIC_LIST_1] = Mv(0, 0);
pu.refIdx[REF_PIC_LIST_1] = -1;
}
else if (refList1 != -1)
{
#if REMOVE_MV_ADAPT_PREC
if (fPosPosition == 0)
{
tempMv[1] = Mv(offset, 0);
}
else if (fPosPosition == 1)
{
tempMv[1] = Mv(-offset, 0);
}
else if (fPosPosition == 2)
{
tempMv[1] = Mv(0, offset);
}
else
{
tempMv[1] = Mv(0, -offset);
}
#else
if (fPosPosition == 0)
{
tempMv[1] = Mv(offset, 0, highPrecList1);
}
else if (fPosPosition == 1)
{
tempMv[1] = Mv(-offset, 0, highPrecList1);
}
else if (fPosPosition == 2)
{
tempMv[1] = Mv(0, offset, highPrecList1);
}
else
{
tempMv[1] = Mv(0, -offset, highPrecList1);
}
#endif
pu.interDir = 2;
pu.mv[REF_PIC_LIST_0] = Mv(0, 0);
pu.refIdx[REF_PIC_LIST_0] = -1;
pu.mv[REF_PIC_LIST_1] = mmvdBaseMv[fPosBaseIdx][1].mv + tempMv[1];
pu.refIdx[REF_PIC_LIST_1] = refList1;
}
pu.mmvdMergeFlag = true;
pu.mmvdMergeIdx = candIdx;
pu.mergeFlag = true;
pu.mergeIdx = candIdx;
pu.mergeType = MRG_TYPE_DEFAULT_N;
pu.mvd[REF_PIC_LIST_0] = Mv();
pu.mvd[REF_PIC_LIST_1] = Mv();
pu.mvpIdx[REF_PIC_LIST_0] = NOT_VALID;
pu.mvpIdx[REF_PIC_LIST_1] = NOT_VALID;
pu.mvpNum[REF_PIC_LIST_0] = NOT_VALID;
pu.mvpNum[REF_PIC_LIST_1] = NOT_VALID;
}
#endif
\ No newline at end of file
......@@ -309,6 +309,10 @@ public:
MotionBuf subPuMvpMiBuf;
MotionBuf subPuMvpExtMiBuf;
#if JVET_L0054_MMVD
MvField mmvdBaseMv[MMVD_BASE_MV_NUM][2];
void setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx);
#endif
void setMergeInfo( PredictionUnit& pu, int candIdx );
};
......
......@@ -313,7 +313,28 @@ const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet
{ CNU, CNU, CNU, CNU, CNU,},
#endif
});
#if JVET_L0054_MMVD
const CtxSet ContextSetCfg::MmvdFlag = ContextSetCfg::addCtxSet
({
{ 151, },
{ CNU, },
{ CNU, },
});
const CtxSet ContextSetCfg::MmvdMergeIdx = ContextSetCfg::addCtxSet
({
{ CNU, },
{ CNU, },
{ CNU, },
});
const CtxSet ContextSetCfg::MmvdStepMvpIdx = ContextSetCfg::addCtxSet
({
{ 184, },
{ CNU, },
{ CNU, },
});
#endif
const CtxSet ContextSetCfg::PartSize = ContextSetCfg::addCtxSet
({
{ 154, 139, 154, 154,},
......
......@@ -166,6 +166,11 @@ public:
static const CtxSet DeltaQP;
static const CtxSet InterDir;
static const CtxSet RefPic;
#if JVET_L0054_MMVD
static const CtxSet MmvdFlag;
static const CtxSet MmvdMergeIdx;
static const CtxSet MmvdStepMvpIdx;
#endif
static const CtxSet AffineFlag;
static const CtxSet AffineType;
static const CtxSet Mvd;
......
......@@ -61,6 +61,7 @@
#define JVET_L0191_LM_WO_LMS 1 // NO LMS regression. min/max are used instead
#define JVET_L0090_PAIR_AVG 1 // Add pairwise average candidates, replace HEVC combined candidates
#define JVET_L0054_MMVD 1
#define JVET_L0392_ALF_INIT_STATE 1
......
......@@ -253,6 +253,9 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other )
mtDepth = other.mtDepth;
splitSeries = other.splitSeries;
skip = other.skip;
#if JVET_L0054_MMVD
mmvdSkip = other.mmvdSkip;
#endif
affine = other.affine;
affineType = other.affineType;
transQuantBypass = other.transQuantBypass;
......@@ -284,6 +287,9 @@ void CodingUnit::initData()
mtDepth = 0;
splitSeries = 0;
skip = false;
#if JVET_L0054_MMVD
mmvdSkip = false;
#endif
affine = false;
affineType = 0;
transQuantBypass = false;
......@@ -321,6 +327,10 @@ void PredictionUnit::initData()
// inter data
mergeFlag = false;
mergeIdx = MAX_UCHAR;
#if JVET_L0054_MMVD
mmvdMergeFlag = false;
mmvdMergeIdx = MAX_UINT;
#endif
interDir = MAX_UCHAR;
mergeType = MRG_TYPE_DEFAULT_N;
for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++)
......@@ -351,6 +361,10 @@ PredictionUnit& PredictionUnit::operator=(const InterPredictionData& predData)
{
mergeFlag = predData.mergeFlag;
mergeIdx = predData.mergeIdx;
#if JVET_L0054_MMVD
mmvdMergeFlag = predData.mmvdMergeFlag;
mmvdMergeIdx = predData.mmvdMergeIdx;
#endif
interDir = predData.interDir;
mergeType = predData.mergeType;
for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++)
......@@ -378,6 +392,10 @@ PredictionUnit& PredictionUnit::operator=( const PredictionUnit& other )
mergeFlag = other.mergeFlag;
mergeIdx = other.mergeIdx;
#if JVET_L0054_MMVD
mmvdMergeFlag = other.mmvdMergeFlag;
mmvdMergeIdx = other.mmvdMergeIdx;
#endif
interDir = other.interDir;
mergeType = other.mergeType;
for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++)
......
......@@ -295,6 +295,9 @@ struct CodingUnit : public UnitArea
int8_t qp;
SplitSeries splitSeries;
bool skip;
#if JVET_L0054_MMVD
bool mmvdSkip;
#endif
bool affine;
int affineType;
bool transQuantBypass;
......@@ -349,6 +352,10 @@ struct InterPredictionData
{
bool mergeFlag;
uint8_t mergeIdx;
#if JVET_L0054_MMVD
bool mmvdMergeFlag;
uint32_t mmvdMergeIdx;
#endif
uint8_t interDir;
uint8_t mvpIdx [NUM_REF_PIC_LIST_01];
uint8_t mvpNum [NUM_REF_PIC_LIST_01];
......
......@@ -494,8 +494,11 @@ uint32_t PU::getFinalIntraMode( const PredictionUnit &pu, const ChannelType &chT
return uiIntraMode;
}
void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx )
void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
#if JVET_L0054_MMVD
int mmvdList,
#endif
const int& mrgCandIdx )
{
const CodingStructure &cs = *pu.cs;
const Slice &slice = *pu.cs->slice;
......@@ -723,7 +726,11 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, co
bool bMrgIdxMatchATMVPCan = ( mrgCandIdx == cnt );
bool tmpLICFlag = false;
isAvailableSubPu = cs.sps->getSpsNext().getUseATMVP() && getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, cnt
isAvailableSubPu = cs.sps->getSpsNext().getUseATMVP() &&
getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, cnt
#if JVET_L0054_MMVD
, mmvdList
#endif
);
if( isAvailableSubPu )
......@@ -1117,7 +1124,78 @@ static int xGetDistScaleFactor(const int &iCurrPOC, const int &iCurrRefPOC, cons
return iScale;
}
}
#if JVET_L0054_MMVD
int PU::getDistScaleFactor(const int &currPOC, const int &currRefPOC, const int &colPOC, const int &colRefPOC)
{
return xGetDistScaleFactor(currPOC, currRefPOC, colPOC, colRefPOC);
}
void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx)
{
int refIdxList0, refIdxList1;
int k;
int currBaseNum = 0;
const uint16_t maxNumMergeCand = mrgCtx.numValidMergeCand;
#if !REMOVE_MV_ADAPT_PREC
if (pu.cu->slice->getSPS()->getSpsNext().getUseHighPrecMv())
{
for (k = 0; k < maxNumMergeCand; k++)
{
if (mrgCtx.mrgTypeNeighbours[k] == MRG_TYPE_DEFAULT_N)
{
if ((mrgCtx.mvFieldNeighbours[(k << 1)].mv.highPrec == false) && (mrgCtx.mvFieldNeighbours[(k << 1)].refIdx >= 0))
{
mrgCtx.mvFieldNeighbours[(k << 1)].mv.setHighPrec();
}
if ((mrgCtx.mvFieldNeighbours[(k << 1) + 1].mv.highPrec == false) && (mrgCtx.mvFieldNeighbours[(k << 1) + 1].refIdx >= 0))
{
mrgCtx.mvFieldNeighbours[(k << 1) + 1].mv.setHighPrec();
}
}
}
}
#endif
for (k = 0; k < maxNumMergeCand; k++)
{
if (mrgCtx.mrgTypeNeighbours[k] == MRG_TYPE_DEFAULT_N)
{
refIdxList0 = mrgCtx.mvFieldNeighbours[(k << 1)].refIdx;
refIdxList1 = mrgCtx.mvFieldNeighbours[(k << 1) + 1].refIdx;
if ((refIdxList0 >= 0) && (refIdxList1 >= 0))
{
mrgCtx.mmvdBaseMv[currBaseNum][0] = mrgCtx.mvFieldNeighbours[(k << 1)];
mrgCtx.mmvdBaseMv[currBaseNum][1] = mrgCtx.mvFieldNeighbours[(k << 1) + 1];
}
else if (refIdxList0 >= 0)
{
mrgCtx.mmvdBaseMv[currBaseNum][0] = mrgCtx.mvFieldNeighbours[(k << 1)];
mrgCtx.mmvdBaseMv[currBaseNum][1] = MvField(Mv(0, 0), -1);
}
else if (refIdxList1 >= 0)
{
mrgCtx.mmvdBaseMv[currBaseNum][0] = MvField(Mv(0, 0), -1);
mrgCtx.mmvdBaseMv[currBaseNum][1] = mrgCtx.mvFieldNeighbours[(k << 1) + 1];
}
currBaseNum++;
if (currBaseNum == MMVD_BASE_MV_NUM)
break;
}
}
if (currBaseNum < MMVD_BASE_MV_NUM)
{
for (k = currBaseNum; k < MMVD_BASE_MV_NUM; k++)
{
mrgCtx.mmvdBaseMv[k][0] = MvField(Mv(0, 0), 0);
mrgCtx.mmvdBaseMv[k][0] = MvField(Mv(0, 0), 0);
}
}
}
#endif
bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList, const Position &_pos, Mv& rcMv, const int &refIdx )
{
// don't perform MV compression when generally disabled or subPuMvp is used
......@@ -2287,6 +2365,9 @@ void clipColBlkMv(int& mvX, int& mvY, const PredictionUnit& pu)
#endif
bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, bool& LICFlag, const int count
#if JVET_L0054_MMVD
, int mmvdList
#endif
)
{
const Slice &slice = *pu.cs->slice;
......@@ -2412,7 +2493,10 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b
{
return false;
}
#if JVET_L0054_MMVD
if (mmvdList != 1)
{
#endif
#if JVET_L0257_ATMVP_COLBLK_CLIP
int xOff = (puWidth >> 1) + tempX;
int yOff = (puHeight >> 1) + tempY;
......@@ -2487,7 +2571,9 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b
mb.subBuf(g_miScaling.scale(Position{ x, y } -pu.lumaPos()), g_miScaling.scale(Size(puWidth, puHeight))).fill(mi);
}
}
#if JVET_L0054_MMVD
}
#endif
return true;
}
......@@ -2617,7 +2703,11 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP
{
// this function is never called for merge
THROW("unexpected");
PU::getInterMergeCandidates ( pu, mrgCtx );
PU::getInterMergeCandidates ( pu, mrgCtx
#if JVET_L0054_MMVD
, 0
#endif
);
PU::restrictBiPredMergeCands( pu, mrgCtx );
mrgCtx.setMergeInfo( pu, pu.mergeIdx );
......@@ -2710,7 +2800,11 @@ void CU::resetMVDandMV2Int( CodingUnit& cu, InterPrediction *interPred )
}
else
{
PU::getInterMergeCandidates ( pu, mrgCtx );
PU::getInterMergeCandidates ( pu, mrgCtx
#if JVET_L0054_MMVD
, 0
#endif
);
PU::restrictBiPredMergeCands( pu, mrgCtx );
mrgCtx.setMergeInfo( pu, pu.mergeIdx );
......
......@@ -109,8 +109,15 @@ namespace PU
int getIntraMPMs(const PredictionUnit &pu, unsigned *mpm, const ChannelType &channelType = CHANNEL_TYPE_LUMA);
void getIntraChromaCandModes (const PredictionUnit &pu, unsigned modeList[NUM_CHROMA_MODE]);
uint32_t getFinalIntraMode (const PredictionUnit &pu, const ChannelType &chType);
void getInterMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx = -1 );
void getInterMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx,
#if JVET_L0054_MMVD
int mmvdList,
#endif
const int& mrgCandIdx = -1 );
#if JVET_L0054_MMVD
void getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx = -1);
int getDistScaleFactor(const int &currPOC, const int &currRefPOC, const int &colPOC, const int &colRefPOC);
#endif
bool isDiffMER (const PredictionUnit &pu, const PredictionUnit &pu2);
bool getColocatedMVP (const PredictionUnit &pu, const RefPicList &eRefPicList, const Position &pos, Mv& rcMv, const int &refIdx);
void fillMvpCand ( PredictionUnit &pu, const RefPicList &eRefPicList, const int &refIdx, AMVPInfo &amvpInfo );
......@@ -135,6 +142,9 @@ namespace PU
#endif
);
bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count
#if JVET_L0054_MMVD
, int mmvdList
#endif
);
bool getInterMergeSubPuRecurCand(const PredictionUnit &pu, MergeCtx &mrgCtx, const int count);
bool isBiPredFromDifferentDir (const PredictionUnit &pu);
......@@ -178,7 +188,11 @@ namespace TU
uint32_t getCtuAddr (const Position& pos, const PreCalcValues &pcv);
template<typename T, size_t N>
#if JVET_L0054_MMVD
uint32_t updateCandList(T uiMode, double uiCost, static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, size_t uiFastCandNum = N, int* iserttPos = nullptr)
#else
uint32_t updateCandList( T uiMode, double uiCost, static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, size_t uiFastCandNum = N )
#endif
{
CHECK( std::min( uiFastCandNum, candModeList.size() ) != std::min( uiFastCandNum, candCostList.size() ), "Sizes do not match!" );
CHECK( uiFastCandNum > candModeList.capacity(), "The vector is to small to hold all the candidates!" );
......@@ -201,15 +215,32 @@ uint32_t updateCandList( T uiMode, double uiCost, static_vector<T, N>& candModeL
}
candModeList[currSize - shift] = uiMode;
candCostList[currSize - shift] = uiCost;
#if JVET_L0054_MMVD
if (iserttPos != nullptr)
{
*iserttPos = int(currSize - shift);
}
#endif
return 1;
}
else if( currSize < uiFastCandNum )
{
candModeList.insert( candModeList.end() - shift, uiMode );
candCostList.insert( candCostList.end() - shift, uiCost );
#if JVET_L0054_MMVD
if (iserttPos != nullptr)
{
*iserttPos = int(candModeList.size() - shift - 1);
}
#endif
return 1;
}
#if JVET_L0054_MMVD
if (iserttPos != nullptr)
{
*iserttPos = -1;
}
#endif
return 0;
}
......
......@@ -757,6 +757,11 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
if( skip )
{
#if JVET_L0054_MMVD
unsigned mmvdSkip = m_BinDecoder.decodeBin(Ctx::MmvdFlag(0));
cu.mmvdSkip = mmvdSkip;
DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, mmvdSkip ? 1 : 0);