Commit bacf32ad authored by Karsten Suehring's avatar Karsten Suehring

remove macro JVET_L0054_MMVD

parent 1405a98b
......@@ -298,14 +298,12 @@ static const int MAX_GR_ORDER_RESIDUAL = 10;
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
......
......@@ -350,9 +350,7 @@ 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];
......@@ -379,7 +377,6 @@ 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;
......@@ -523,4 +520,3 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx)
pu.cu->GBiIdx = (interDirNeighbours[fPosBaseIdx] == 3) ? GBiIdx[fPosBaseIdx] : GBI_DEFAULT;
#endif
}
#endif
......@@ -309,10 +309,8 @@ 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 );
};
......
......@@ -343,7 +343,6 @@ const CtxSet ContextSetCfg::MergeIdx = ContextSetCfg::addCtxSet
{ CNU, CNU, CNU, CNU, CNU,},
#endif
});
#if JVET_L0054_MMVD
const CtxSet ContextSetCfg::MmvdFlag = ContextSetCfg::addCtxSet
({
#if TRAINED_CABAC_INIT_TABLES
......@@ -382,7 +381,6 @@ const CtxSet ContextSetCfg::MmvdStepMvpIdx = ContextSetCfg::addCtxSet
{ CNU, },
#endif
});
#endif
const CtxSet ContextSetCfg::PartSize = ContextSetCfg::addCtxSet
({
{ 154, 139, 154, 154,},
......
......@@ -169,11 +169,9 @@ 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;
#if JVET_L0632_AFFINE_MERGE
......
......@@ -67,7 +67,6 @@
#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
......
......@@ -252,9 +252,7 @@ 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;
triangle = other.triangle;
......@@ -289,9 +287,7 @@ void CodingUnit::initData()
mtDepth = 0;
splitSeries = 0;
skip = false;
#if JVET_L0054_MMVD
mmvdSkip = false;
#endif
affine = false;
affineType = 0;
triangle = false;
......@@ -336,10 +332,8 @@ 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;
#if JVET_L0293_CPR
......@@ -384,10 +378,8 @@ 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;
#if JVET_L0293_CPR
......@@ -429,10 +421,8 @@ 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;
#if JVET_L0293_CPR
......
......@@ -294,9 +294,7 @@ struct CodingUnit : public UnitArea
int8_t qp;
SplitSeries splitSeries;
bool skip;
#if JVET_L0054_MMVD
bool mmvdSkip;
#endif
bool affine;
int affineType;
bool triangle;
......@@ -357,10 +355,8 @@ 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];
......
......@@ -725,20 +725,20 @@ bool PU::xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const
#if JVET_L0090_PAIR_AVG
bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
, int mmvdList
#endif
)
#else
bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter[MRG_MAX_NUM_CANDS], bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
, int mmvdList
#endif
)
#endif
{
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
int mrgCandIdxCPR = mrgCandIdx;
#endif
MotionInfo miNeighbor;
......@@ -767,16 +767,10 @@ bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter
if (miNeighbor.interDir == 1 && slice.getRefPic(REF_PIC_LIST_0, miNeighbor.refIdx[0])->getPOC() == slice.getPOC())
{
mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR;
#if JVET_L0054_MMVD
if(mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
#endif
}
#if JVET_L0054_MMVD
if (mrgCandIdxCPR == cnt && canFastExit)
#else
if (mrgCandIdx == cnt && canFastExit)
#endif
#else
if (mrgCandIdx == cnt && canFastExit)
#endif
......@@ -794,9 +788,7 @@ bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter
}
void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
#if JVET_L0054_MMVD
int mmvdList,
#endif
const int& mrgCandIdx )
{
const CodingStructure &cs = *pu.cs;
......@@ -829,7 +821,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
int cnt = 0;
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
int mrgCandIdxCPR = mrgCandIdx;
#endif
#if JVET_L0293_CPR && !JVET_L0369_SUBBLOCK_MERGE
......@@ -869,7 +861,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
cntCPR++;
#endif
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
#endif
......@@ -881,7 +873,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
{
mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miLeft.mv[1], miLeft.refIdx[1]);
}
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mrgCandIdxCPR == cnt && canFastExit)
#else
if( mrgCandIdx == cnt && canFastExit )
......@@ -929,7 +921,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
cntCPR++;
#endif
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
#endif
......@@ -941,7 +933,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
{
mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAbove.mv[1], miAbove.refIdx[1] );
}
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mrgCandIdxCPR == cnt && canFastExit)
#else
if( mrgCandIdx == cnt && canFastExit )
......@@ -993,7 +985,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
cntCPR++;
#endif
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
#endif
......@@ -1006,7 +998,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAboveRight.mv[1], miAboveRight.refIdx[1] );
}
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mrgCandIdxCPR == cnt && canFastExit)
#else
if( mrgCandIdx == cnt && canFastExit )
......@@ -1057,7 +1049,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
cntCPR++;
#endif
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
#endif
......@@ -1070,7 +1062,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miBelowLeft.mv[1], miBelowLeft.refIdx[1] );
}
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mrgCandIdxCPR == cnt && canFastExit)
#else
if( mrgCandIdx == cnt && canFastExit )
......@@ -1108,7 +1100,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
if( enableSubPuMvp && slice.getEnableTMVPFlag() )
{
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
bool bMrgIdxMatchATMVPCan = (mrgCandIdxCPR == cnt);
#else
bool bMrgIdxMatchATMVPCan = ( mrgCandIdx == cnt );
......@@ -1117,9 +1109,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
isAvailableSubPu = cs.sps->getSpsNext().getUseATMVP() &&
getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, cnt
#if JVET_L0054_MMVD
, mmvdList
#endif
#if JVET_L0293_CPR
, cntCPR
#endif
......@@ -1188,7 +1178,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
cntCPR++;
#endif
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mmvdList != 0 && mrgCandIdx != -1)
mrgCandIdxCPR++;
#endif
......@@ -1201,7 +1191,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAboveLeft.mv[1], miAboveLeft.refIdx[1] );
}
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mrgCandIdxCPR == cnt && canFastExit)
#else
if( mrgCandIdx == cnt && canFastExit )
......@@ -1338,7 +1328,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
#if JVET_L0646_GBI
mrgCtx.GBiIdx[uiArrayAddr] = GBI_DEFAULT;
#endif
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
if (mrgCandIdxCPR == cnt && canFastExit)
#else
if( mrgCandIdx == cnt && canFastExit )
......@@ -1367,13 +1357,13 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
#endif
#if JVET_L0090_PAIR_AVG
bool bFound = addMergeHMVPCand(slice, mrgCtx, canFastExit
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
, (mmvdList != 0 && mrgCandIdx != -1) ? (const int) mrgCandIdxCPR : mrgCandIdx
#else
, mrgCandIdx
#endif
, maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
, mmvdList
#endif
);
......@@ -1385,7 +1375,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
, mrgCandIdx
#endif
, maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
, mmvdList
#endif
);
......@@ -1661,7 +1651,6 @@ 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);
......@@ -1713,7 +1702,6 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx,
}
}
}
#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
......@@ -3220,9 +3208,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
mrgCtx.numValidMergeCand = pos;
isAvailableSubPu = getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, pos
#if JVET_L0054_MMVD
, 0
#endif
#if JVET_L0293_CPR
, cntCPR
#endif
......@@ -3810,9 +3796,7 @@ 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
#if JVET_L0293_CPR
, const int countCPR
#endif
......@@ -3964,10 +3948,8 @@ 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;
......@@ -4045,9 +4027,7 @@ 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;
}
......@@ -4178,9 +4158,7 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP
// this function is never called for merge
THROW("unexpected");
PU::getInterMergeCandidates ( pu, mrgCtx
#if JVET_L0054_MMVD
, 0
#endif
);
PU::restrictBiPredMergeCands( pu, mrgCtx );
......@@ -4785,9 +4763,7 @@ void CU::resetMVDandMV2Int( CodingUnit& cu, InterPrediction *interPred )
else
{
PU::getInterMergeCandidates ( pu, mrgCtx
#if JVET_L0054_MMVD
, 0
#endif
);
PU::restrictBiPredMergeCands( pu, mrgCtx );
......
......@@ -111,14 +111,10 @@ namespace PU
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,
#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 );
......@@ -129,13 +125,13 @@ namespace PU
bool xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const MergeCtx mergeCandList, bool hasPruned[MRG_MAX_NUM_CANDS]);
#if JVET_L0090_PAIR_AVG
bool addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
, int mmvdList
#endif
);
#else
bool addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter[MRG_MAX_NUM_CANDS], bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos
#if JVET_L0293_CPR && JVET_L0054_MMVD
#if JVET_L0293_CPR
, int mmvdList
#endif
);
......@@ -163,9 +159,7 @@ namespace PU
, bool setHighPrec = false
);
bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count
#if JVET_L0054_MMVD
, int mmvdList
#endif
#if JVET_L0293_CPR
, const int countCPR
#endif
......@@ -220,19 +214,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
#if JVET_L0283_MULTI_REF_LINE
, static_vector<int, N>& extendRefList, int extendRef
#endif
, 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
#if JVET_L0283_MULTI_REF_LINE
, static_vector<int, N>& extendRefList, int extendRef
#endif
, 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!" );
......@@ -267,12 +253,10 @@ uint32_t updateCandList( T uiMode, double uiCost, static_vector<T, N>& candModeL
extendRefList[currSize - shift] = extendRef;
}
#endif
#if JVET_L0054_MMVD
if (iserttPos != nullptr)
{
*iserttPos = int(currSize - shift);
}
#endif
return 1;
}
else if( currSize < uiFastCandNum )
......@@ -285,29 +269,21 @@ uint32_t updateCandList( T uiMode, double uiCost, static_vector<T, N>& candModeL
extendRefList.insert(extendRefList.end() - shift, extendRef);
}
#endif
#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;
}
template<typename T, size_t N>
#if JVET_L0054_MMVD
uint32_t updateDoubleCandList(T mode, double cost, static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, static_vector<T, N>& candModeList2, T mode2, size_t fastCandNum = N, int* iserttPos = nullptr)
#else
uint32_t updateDoubleCandList(T mode, double cost, static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, static_vector<T, N>& candModeList2, T mode2, size_t fastCandNum = N)
#endif
{
CHECK(std::min(fastCandNum, candModeList.size()) != std::min(fastCandNum, candCostList.size()), "Sizes do not match!");
CHECK(fastCandNum > candModeList.capacity(), "The vector is to small to hold all the candidates!");
......@@ -332,12 +308,10 @@ uint32_t updateDoubleCandList(T mode, double cost, static_vector<T, N>& candMode
candModeList[currSize - shift] = mode;
candModeList2[currSize - shift] = mode2;
candCostList[currSize - shift] = cost;
#if JVET_L0054_MMVD
if (iserttPos != nullptr)
{
*iserttPos = int(currSize - shift);
}
#endif
return 1;
}
else if (currSize < fastCandNum)
......@@ -345,21 +319,17 @@ uint32_t updateDoubleCandList(T mode, double cost, static_vector<T, N>& candMode
candModeList.insert(candModeList.end() - shift, mode);
candModeList2.insert(candModeList2.end() - shift, mode2);
candCostList.insert(candCostList.end() - shift, cost);
#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;
}
......
......@@ -441,9 +441,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::EMTFlag), cu.emtFlag);
}
#if JVET_L0054_MMVD
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::MMVDSkipFlag), cu.mmvdSkip);
#endif
}
else if( chType == CHANNEL_TYPE_CHROMA )
{
......@@ -481,13 +479,11 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MergeIdx), pu.mergeIdx);
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MergeType), pu.mergeType);
#if JVET_L0054_MMVD
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MMVDMergeFlag), pu.mmvdMergeFlag);
if (cu.mmvdSkip || pu.mmvdMergeFlag)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MMVDMergeIdx), pu.mmvdMergeIdx);
}
#endif
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, pu, GetBlockStatisticName(BlockStatistic::MHIntraFlag), pu.mhIntraFlag);
if (pu.mhIntraFlag)
{
......@@ -780,14 +776,10 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea)
#endif
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::SkipFlag), cu.skip);
#if JVET_L0054_MMVD
if (cu.skip)
{
#if JVET_L0054_MMVD
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::MMVDSkipFlag), cu.mmvdSkip);
#endif
}
#endif
}
// prediction mode and partitioning data
......@@ -857,27 +849,21 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MergeIdx), pu.mergeIdx);
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MergeType), pu.mergeType);
#if JVET_L0054_MMVD
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MMVDMergeFlag), pu.mmvdMergeFlag);
if (pu.mmvdMergeFlag)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MMVDMergeIdx), pu.mmvdMergeIdx);
}
#endif
#if JVET_L0369_SUBBLOCK_MERGE
if (!cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8
#if JVET_L0054_MMVD
&& !pu.mmvdMergeFlag && !cu.mmvdSkip
#endif
)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::AffineFlag), pu.cu->affine);
}
#endif
if (pu.cs->sps->getSpsNext().getUseMHIntra() && !pu.cu->skip && !pu.cu->affine && !(pu.cu->lwidth() * pu.cu->lheight() < 64 || pu.cu->lwidth() >= MAX_CU_SIZE || pu.cu->lheight() >= MAX_CU_SIZE)
#if JVET_L0054_MMVD
&& !pu.mmvdMergeFlag
#endif
)
{
DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MHIntraFlag), pu.mhIntraFlag);
......
......@@ -101,11 +101,9 @@ enum class BlockStatistic {
AffineMVL0,
AffineMVL1,
AffineType,
#if JVET_L0054_MMVD
MMVDSkipFlag,
MMVDMergeFlag,
MMVDMergeIdx,
#endif
MHIntraFlag,
TriangleFlag,
TrianglePartitioning,
......@@ -193,11 +191,9 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType
#if JVET_L0283_MULTI_REF_LINE
{ BlockStatistic::MultiRefIdx, std::tuple<std::string, BlockStatisticType, std::string>{"MultiRefIdx", BlockStatisticType::Integer, "[0, 1]"}},
#endif
#if JVET_L0054_MMVD
{ BlockStatistic::MMVDSkipFlag, std::tuple<std::string, BlockStatisticType, std::string>{"MMVDSkipFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::MMVDMergeFlag, std::tuple<std::string, BlockStatisticType, std::string>{"MMVDMergeFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::MMVDMergeIdx, std::tuple<std::string, BlockStatisticType, std::string>{"MMVDMergeIdx", BlockStatisticType::Integer, "[0, 1]"}},
#endif
{ BlockStatistic::MHIntraFlag, std::tuple<std::string, BlockStatisticType, std::string>{"MHIntraFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::TriangleFlag, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::TrianglePartitioning, std::tuple<std::string, BlockStatisticType, std::string>{"TrianglePartitioning", BlockStatisticType::Line, ""}},
......
......@@ -771,11 +771,9 @@ 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);
#endif
cu.skip = true;
cu.rootCbf = false;
cu.predMode = MODE_INTER;
......@@ -1238,13 +1236,11 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
pu.intraDir[1] = DM_CHROMA_IDX;
}
triangle_mode( *pu.cu );
#if JVET_L0054_MMVD
if (pu.mmvdMergeFlag)
{
mmvd_merge_idx(pu);
}
else
#endif
merge_data ( pu );
}
else
......@@ -1313,12 +1309,10 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
#if JVET_L0369_SUBBLOCK_MERGE
void CABACReader::subblock_merge_flag( CodingUnit& cu )
{
#if JVET_L0054_MMVD
if ( cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip) )
{
return;
}
#endif
if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getSpsNext().getUseAffine() || cu.cs->sps->getSpsNext().getUseSubPuMvp()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 )
{
......@@ -1372,12 +1366,10 @@ void CABACReader::affine_flag( CodingUnit& cu )
{
return;
}
#if JVET_L0054_MMVD
if (cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip))
{
return;
}
#endif
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG );
......@@ -1406,13 +1398,11 @@ void CABACReader::merge_flag( PredictionUnit& pu )
pu.mergeFlag = ( m_BinDecoder.decodeBin( Ctx::MergeFlag() ) );
DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height );
#if JVET_L0054_MMVD
if (pu.mergeFlag)
{
pu.mmvdMergeFlag = (m_BinDecoder.decodeBin(Ctx::MmvdFlag(0)));
DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_merge_flag() mmvd_merge=%d pos=(%d,%d) size=%dx%d\n", pu.mmvdMergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height);
}
#endif
}
......@@ -1425,13 +1415,11 @@ void CABACReader::merge_data( PredictionUnit& pu )
}
#endif