Commit 7a43a1ed authored by Xiang Li's avatar Xiang Li

Merge branch 'yuhan/VVCSoftware_VTM-M0483-IBC'

parents 65950b7e 48a8d410
Pipeline #715 passed with stage
......@@ -831,7 +831,11 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C
if( cpyResi ) picture->getResiBuf( clippedArea ).copyFrom( subResiBuf );
if( cpyReco ) picture->getRecoBuf( clippedArea ).copyFrom( subRecoBuf );
#if JVET_M0483_IBC
if (!subStruct.m_isTuEnc && ((!slice->isIntra() || slice->getSPS()->getIBCFlag()) && subStruct.chType != CHANNEL_TYPE_CHROMA))
#else
if (!subStruct.m_isTuEnc && (!slice->isIntra() && subStruct.chType != CHANNEL_TYPE_CHROMA))
#endif
{
// copy motion buffer
MotionBuf ownMB = getMotionBuf ( clippedArea );
......@@ -1011,7 +1015,11 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel
pu = *ppu;
}
#if JVET_M0483_IBC
if (!other.slice->isIntra() || other.slice->getSPS()->getIBCFlag())
#else
if( !other.slice->isIntra() )
#endif
{
// copy motion buffer
MotionBuf ownMB = getMotionBuf();
......@@ -1074,7 +1082,11 @@ void CodingStructure::initStructData( const int &QP, const bool &_isLosses, cons
isLossless = _isLosses;
}
#if JVET_M0483_IBC
if (!skipMotBuf && (!parent || ((!slice->isIntra() || slice->getSPS()->getIBCFlag()) && !m_isTuEnc)))
#else
if( !skipMotBuf && ( !parent || ( ( slice->getSliceType() != I_SLICE ) && !m_isTuEnc ) ) )
#endif
{
getMotionBuf() .memset( 0 );
}
......
......@@ -482,6 +482,20 @@ unsigned DeriveCtx::CtxPredModeFlag( const CodingUnit& cu )
}
#endif
#if JVET_M0483_IBC
unsigned DeriveCtx::CtxIBCFlag(const CodingUnit& cu)
{
const CodingStructure *cs = cu.cs;
unsigned ctxId = 0;
const CodingUnit *cuLeft = cs->getCURestricted(cu.lumaPos().offset(-1, 0), cu, CH_L);
ctxId = (cuLeft && CU::isIBC(*cuLeft)) ? 1 : 0;
const CodingUnit *cuAbove = cs->getCURestricted(cu.lumaPos().offset(0, -1), cu, CH_L);
ctxId = (cuAbove && CU::isIBC(*cuAbove)) ? 1 : 0;
return ctxId;
}
#endif
void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
{
CHECK( candIdx >= numValidMergeCand, "Merge candidate does not exist" );
......@@ -501,12 +515,20 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
pu.mvpIdx [REF_PIC_LIST_1] = NOT_VALID;
pu.mvpNum [REF_PIC_LIST_0] = NOT_VALID;
pu.mvpNum [REF_PIC_LIST_1] = NOT_VALID;
#if JVET_M0483_IBC
if (CU::isIBC(*pu.cu))
{
pu.bv = pu.mv[REF_PIC_LIST_0];
pu.bv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); // used for only integer resolution
}
#else
if (interDirNeighbours[candIdx] == 1 && pu.cs->slice->getRefPic(REF_PIC_LIST_0, mvFieldNeighbours[candIdx << 1].refIdx)->getPOC() == pu.cs->slice->getPOC())
{
pu.cu->ibc = true;
pu.bv = pu.mv[REF_PIC_LIST_0];
pu.bv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); // used for only integer resolution
}
#endif
pu.cu->GBiIdx = ( interDirNeighbours[candIdx] == 3 ) ? GBiIdx[candIdx] : GBI_DEFAULT;
#if JVET_M0068_M0171_MMVD_CLEANUP
......
......@@ -321,6 +321,9 @@ unsigned CtxTriangleFlag( const CodingUnit& cu );
#if JVET_M0502_PRED_MODE_CTX
unsigned CtxPredModeFlag( const CodingUnit& cu );
#endif
#if JVET_M0483_IBC
unsigned CtxIBCFlag(const CodingUnit& cu);
#endif
}
#endif // __CONTEXTMODELLING__
......@@ -1370,6 +1370,22 @@ const CtxSet ContextSetCfg::TriangleIdx = ContextSetCfg::addCtxSet
});
// clang-format on
#if JVET_M0483_IBC
const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 149, 137, 137, },
{ 165, 151, 137, },
{ CNU, CNU, CNU, },
{ 9, 13, 10, },
#else
{ 165, 137, 153, },
{ 106, 122, 138, },
{ CNU, CNU, CNU, },
#endif
});
#endif
const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size();
......
......@@ -307,6 +307,9 @@ public:
#if JVET_M0444_SMVD
static const CtxSet SmvdFlag;
#endif
#if JVET_M0483_IBC
static const CtxSet IBCFlag;
#endif
#if JVET_M0102_INTRA_SUBPARTITIONS
static const CtxSet ISPMode;
#endif
......
......@@ -414,7 +414,11 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
int iRefIdx = pu.refIdx[eRefPicList];
Mv mv[3];
bool isIBC = false;
#if JVET_M0483_IBC
if (CU::isIBC(*pu.cu))
#else
if (pu.cs->slice->getRefPic(eRefPicList, iRefIdx)->getPOC() == pu.cs->slice->getPOC())
#endif
{
isIBC = true;
}
......@@ -454,11 +458,27 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
}
else
{
#if JVET_M0483_IBC
if (isIBC)
{
xPredInterBlk(compID, pu, pu.cu->slice->getPic(), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng(compID)
, bioApplied
, isIBC
);
}
else
{
xPredInterBlk(compID, pu, pu.cu->slice->getRefPic(eRefPicList, iRefIdx), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng(compID)
, bioApplied
, isIBC
);
}
#else
xPredInterBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx ), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng( compID )
, bioApplied
, isIBC
);
#endif
}
}
}
......@@ -519,7 +539,13 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
RefPicList eRefPicList = (refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
#if JVET_M0483_IBC
CHECK(CU::isIBC(*pu.cu) && eRefPicList != REF_PIC_LIST_0, "Invalid interdir for ibc mode");
CHECK(CU::isIBC(*pu.cu) && pu.refIdx[refList] != MAX_NUM_REF, "Invalid reference index for ibc mode");
CHECK((CU::isInter(*pu.cu) && pu.refIdx[refList] >= slice.getNumRefIdx(eRefPicList)), "Invalid reference index");
#else
CHECK( pu.refIdx[refList] >= slice.getNumRefIdx( eRefPicList ), "Invalid reference index" );
#endif
m_iRefListIdx = refList;
PelUnitBuf pcMbBuf = ( pu.chromaFormat == CHROMA_400 ?
......
......@@ -599,11 +599,17 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
if (sliceQ.isInterB() || sliceP.isInterB())
{
#if JVET_M0483_IBC
const Picture *piRefP0 = (CU::isIBC(cuP) ? sliceP.getPic() : ((0 > miP.refIdx[0]) ? NULL : sliceP.getRefPic(REF_PIC_LIST_0, miP.refIdx[0])));
const Picture *piRefP1 = (CU::isIBC(cuP) ? NULL : ((0 > miP.refIdx[1]) ? NULL : sliceP.getRefPic(REF_PIC_LIST_1, miP.refIdx[1])));
const Picture *piRefQ0 = (CU::isIBC(cuQ) ? sliceQ.getPic() : ((0 > miQ.refIdx[0]) ? NULL : sliceQ.getRefPic(REF_PIC_LIST_0, miQ.refIdx[0])));
const Picture *piRefQ1 = (CU::isIBC(cuQ) ? NULL : ((0 > miQ.refIdx[1]) ? NULL : sliceQ.getRefPic(REF_PIC_LIST_1, miQ.refIdx[1])));
#else
const Picture *piRefP0 = ( 0 > miP.refIdx[0] ) ? NULL : sliceP.getRefPic( REF_PIC_LIST_0, miP.refIdx[0] );
const Picture *piRefP1 = ( 0 > miP.refIdx[1] ) ? NULL : sliceP.getRefPic( REF_PIC_LIST_1, miP.refIdx[1] );
const Picture *piRefQ0 = ( 0 > miQ.refIdx[0] ) ? NULL : sliceQ.getRefPic( REF_PIC_LIST_0, miQ.refIdx[0] );
const Picture *piRefQ1 = ( 0 > miQ.refIdx[1] ) ? NULL : sliceQ.getRefPic( REF_PIC_LIST_1, miQ.refIdx[1] );
#endif
Mv mvP0, mvP1, mvQ0, mvQ1;
if( 0 <= miP.refIdx[0] ) { mvP0 = miP.mv[0]; }
......@@ -655,11 +661,17 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
// pcSlice->isInterP()
#if JVET_M0483_IBC
CHECK(CU::isInter(cuP) && 0 > miP.refIdx[0], "Invalid reference picture list index");
CHECK(CU::isInter(cuP) && 0 > miQ.refIdx[0], "Invalid reference picture list index");
const Picture *piRefP0 = (CU::isIBC(cuP) ? sliceP.getPic() : sliceP.getRefPic(REF_PIC_LIST_0, miP.refIdx[0]));
const Picture *piRefQ0 = (CU::isIBC(cuQ) ? sliceQ.getPic() : sliceQ.getRefPic(REF_PIC_LIST_0, miQ.refIdx[0]));
#else
CHECK(0 > miP.refIdx[0], "Invalid reference picture list index");
CHECK(0 > miQ.refIdx[0], "Invalid reference picture list index");
const Picture *piRefP0 = sliceP.getRefPic(REF_PIC_LIST_0, miP.refIdx[0]);
const Picture *piRefQ0 = sliceQ.getRefPic(REF_PIC_LIST_0, miQ.refIdx[0]);
#endif
if (piRefP0 != piRefQ0)
{
#if JVET_M0471_LONG_DEBLOCKING_FILTERS
......
......@@ -101,30 +101,49 @@ struct MvField
struct MotionInfo
{
bool isInter;
#if JVET_M0483_IBC
bool isIBCmot;
#endif
char interDir;
uint16_t sliceIdx;
Mv mv [ NUM_REF_PIC_LIST_01 ];
int16_t refIdx [ NUM_REF_PIC_LIST_01 ];
Mv bv;
#if JVET_M0264_HMVP_WITH_GBIIDX
uint8_t GBiIdx;
#endif
Mv bv;
#if JVET_M0483_IBC
#if JVET_M0264_HMVP_WITH_GBIIDX
MotionInfo() : isInter( false ), interDir( 0 ), sliceIdx( 0 ), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx( 0 ) { }
MotionInfo() : isInter(false), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx(0) { }
#else
MotionInfo() : isInter( false ), interDir( 0 ), sliceIdx( 0 ), refIdx{ NOT_VALID, NOT_VALID } { }
MotionInfo() : isInter(false), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID } { }
#endif
// ensure that MotionInfo(0) produces '\x000....' bit pattern - needed to work with AreaBuf - don't use this constructor for anything else
#if JVET_M0264_HMVP_WITH_GBIIDX
MotionInfo( int i ) : isInter( i != 0 ), interDir( 0 ), sliceIdx( 0 ), refIdx{ 0, 0 }, GBiIdx( 0 ) { CHECKD( i != 0, "The argument for this constructor has to be '0'" ); }
MotionInfo(int i) : isInter(i != 0), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ 0, 0 }, GBiIdx(0) { CHECKD(i != 0, "The argument for this constructor has to be '0'"); }
#else
MotionInfo(int i) : isInter(i != 0), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ 0, 0 } { CHECKD(i != 0, "The argument for this constructor has to be '0'"); }
#endif
#else
#if JVET_M0264_HMVP_WITH_GBIIDX
MotionInfo() : isInter(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, GBiIdx(0) { }
#else
MotionInfo() : isInter(false), interDir( 0 ), sliceIdx( 0 ), refIdx{ NOT_VALID, NOT_VALID } { }
#endif
// ensure that MotionInfo(0) produces '\x000....' bit pattern - needed to work with AreaBuf - don't use this constructor for anything else
#if JVET_M0264_HMVP_WITH_GBIIDX
MotionInfo(int i) : isInter(i != 0), interDir(0), sliceIdx(0), refIdx{ 0, 0 }, GBiIdx(0) { CHECKD(i != 0, "The argument for this constructor has to be '0'"); }
#else
MotionInfo( int i ) : isInter( i != 0 ), interDir( 0 ), sliceIdx( 0 ), refIdx{ 0, 0 } { CHECKD( i != 0, "The argument for this constructor has to be '0'" ); }
#endif
#endif
bool operator==( const MotionInfo& mi ) const
{
if( isInter != mi.isInter ) return false;
#if JVET_M0483_IBC
if (isIBCmot != mi.isIBCmot) return false;
#endif
if( isInter )
{
if( sliceIdx != mi.sliceIdx ) return false;
......@@ -242,5 +261,8 @@ struct LutMotionCand
{
MotionInfo* motionCand;
int currCnt;
#if JVET_M0483_IBC
int currCntIBC;
#endif
};
#endif // __MOTIONINFO__
......@@ -450,6 +450,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b
pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i));
}
}
#if JVET_M0483_IBC==0
if (getSPS()->getSpsNext().getIBCMode())
{
RefPicSetLtCurr[NumPicLtCurr] = getPic();
......@@ -457,6 +458,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b
getPic()->longTerm = true;
NumPicLtCurr++;
}
#endif
// ref_pic_list_init
Picture* rpsCurrList0[MAX_NUM_REF+1];
Picture* rpsCurrList1[MAX_NUM_REF+1];
......@@ -469,11 +471,13 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b
// - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
if (getRapPicFlag())
{
#if JVET_M0483_IBC==0
if (getSPS()->getSpsNext().getIBCMode())
{
CHECK(numPicTotalCurr != 1, "Invalid state");
}
else
#endif
CHECK(numPicTotalCurr != 0, "Invalid state");
}
......@@ -544,11 +548,13 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b
m_bIsUsedAsLongTerm[REF_PIC_LIST_1][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 );
}
}
#if JVET_M0483_IBC==0
if (getSPS()->getSpsNext().getIBCMode())
{
m_apcRefPicList[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = getPic();
m_bIsUsedAsLongTerm[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = true;
}
#endif
// For generalized B
// note: maybe not existed case (always L0 is copied to L1 if L1 is empty)
if( bCopyL0toL1ErrorCase && isInterB() && getNumRefIdx(REF_PIC_LIST_1) == 0)
......@@ -579,7 +585,11 @@ int Slice::getNumRpsCurrTempList() const
numRpsCurrTempList++;
}
}
#if JVET_M0483_IBC
if (getSPS()->getIBCFlag())
#else
if (getSPS()->getSpsNext().getIBCMode())
#endif
{
return numRpsCurrTempList + 1;
}
......@@ -1642,14 +1652,28 @@ void Slice::initMotionLUTs()
{
m_MotionCandLut = new LutMotionCand;
m_MotionCandLut->currCnt = 0;
#if JVET_M0483_IBC
m_MotionCandLut->currCntIBC = 0;
#endif
m_MotionCandLut->motionCand = nullptr;
#if JVET_M0483_IBC
m_MotionCandLut->motionCand = new MotionInfo[MAX_NUM_HMVP_CANDS * 2];
#else
m_MotionCandLut->motionCand = new MotionInfo[MAX_NUM_HMVP_CANDS];
#endif
#if JVET_M0170_MRG_SHARELIST
m_MotionCandLuTsBkup = new LutMotionCand;
m_MotionCandLuTsBkup->currCnt = 0;
#if JVET_M0483_IBC
m_MotionCandLuTsBkup->currCntIBC = 0;
#endif
m_MotionCandLuTsBkup->motionCand = nullptr;
#if JVET_M0483_IBC
m_MotionCandLuTsBkup->motionCand = new MotionInfo[MAX_NUM_HMVP_CANDS * 2];
#else
m_MotionCandLuTsBkup->motionCand = new MotionInfo[MAX_NUM_HMVP_CANDS];
#endif
#endif
}
void Slice::destroyMotionLUTs()
{
......@@ -1667,8 +1691,14 @@ void Slice::destroyMotionLUTs()
void Slice::resetMotionLUTs()
{
m_MotionCandLut->currCnt = 0;
#if JVET_M0483_IBC
m_MotionCandLut->currCntIBC = 0;
#endif
#if JVET_M0170_MRG_SHARELIST
m_MotionCandLuTsBkup->currCnt = 0;
#if JVET_M0483_IBC
m_MotionCandLuTsBkup->currCntIBC = 0;
#endif
#endif
}
......@@ -1683,8 +1713,46 @@ MotionInfo Slice::getMotionInfoFromLUTBkup(int MotCandIdx) const
}
#endif
#if JVET_M0483_IBC
void Slice::addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi, bool ibcflag)
#else
void Slice::addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi)
#endif
{
#if JVET_M0483_IBC
int currCntIBC = ibcflag ? lutMC->currCntIBC : lutMC->currCnt;
int offset = ibcflag ? MAX_NUM_HMVP_CANDS : 0;
bool pruned = false;
int sameCandIdx = 0;
for (int idx = 0; idx < currCntIBC; idx++)
{
if (lutMC->motionCand[idx + offset] == newMi)
{
sameCandIdx = idx;
pruned = true;
break;
}
}
if (pruned || currCntIBC == MAX_NUM_HMVP_CANDS)
{
memmove(&lutMC->motionCand[sameCandIdx + offset], &lutMC->motionCand[sameCandIdx + offset + 1],
sizeof(MotionInfo) * (currCntIBC - sameCandIdx - 1));
memcpy(&lutMC->motionCand[currCntIBC + offset - 1], &newMi, sizeof(MotionInfo));
}
else
{
if (ibcflag)
{
memcpy(&lutMC->motionCand[currCntIBC + offset], &newMi, sizeof(MotionInfo));
lutMC->currCntIBC++;
}
else
{
memcpy(&lutMC->motionCand[currCntIBC], &newMi, sizeof(MotionInfo));
lutMC->currCnt++;
}
}
#else
int currCnt = lutMC->currCnt ;
bool pruned = false;
......@@ -1708,6 +1776,7 @@ void Slice::addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi)
{
memcpy(&lutMC->motionCand[lutMC->currCnt++], &newMi, sizeof(MotionInfo));
}
#endif
}
void Slice::updateMotionLUTs(LutMotionCand* lutMC, CodingUnit & cu)
......@@ -1716,22 +1785,37 @@ void Slice::updateMotionLUTs(LutMotionCand* lutMC, CodingUnit & cu)
if (cu.affine) { return; }
if (cu.triangle) { return; }
MotionInfo newMi = selectedPU->getMotionInfo();
MotionInfo newMi = selectedPU->getMotionInfo();
#if JVET_M0264_HMVP_WITH_GBIIDX
newMi.GBiIdx = (newMi.interDir == 3) ? cu.GBiIdx : GBI_DEFAULT;
#endif
#if JVET_M0483_IBC
addMotionInfoToLUTs(lutMC, newMi, CU::isIBC(cu));
#else
addMotionInfoToLUTs(lutMC, newMi);
#endif
}
void Slice::copyMotionLUTs(LutMotionCand* Src, LutMotionCand* Dst)
{
memcpy(Dst->motionCand, Src->motionCand, sizeof(MotionInfo)*(std::min(Src->currCnt, MAX_NUM_HMVP_CANDS)));
Dst->currCnt = Src->currCnt;
#if JVET_M0483_IBC
memcpy(Dst->motionCand + MAX_NUM_HMVP_CANDS, Src->motionCand + MAX_NUM_HMVP_CANDS, sizeof(MotionInfo)*(std::min(Src->currCntIBC, MAX_NUM_HMVP_CANDS)));
Dst->currCntIBC = Src->currCntIBC;
#endif
}
unsigned Slice::getMinPictureDistance() const
{
int minPicDist = MAX_INT;
#if JVET_M0483_IBC
if (getSPS()->getIBCFlag())
{
minPicDist = 0;
}
else
#endif
if( ! isIntra() )
{
const int currPOC = getPOC();
......@@ -1916,6 +2000,9 @@ SPS::SPS()
, m_spsNextExtension (*this)
, m_wrapAroundEnabledFlag (false)
, m_wrapAroundOffset ( 0)
#if JVET_M0483_IBC
, m_IBCFlag ( 0)
#endif
#if JVET_M0427_INLOOP_RESHAPER
, m_lumaReshapeEnable (false)
#endif
......
......@@ -1080,9 +1080,14 @@ private:
bool m_wrapAroundEnabledFlag;
unsigned m_wrapAroundOffset;
#if JVET_M0483_IBC
unsigned m_IBCFlag;
#endif
#if JVET_M0427_INLOOP_RESHAPER
bool m_lumaReshapeEnable;
#endif
public:
SPS();
......@@ -1308,6 +1313,10 @@ public:
void setUseReshaper(bool b) { m_lumaReshapeEnable = b; }
bool getUseReshaper() const { return m_lumaReshapeEnable; }
#endif
#if JVET_M0483_IBC
void setIBCFlag(unsigned IBCFlag) { m_IBCFlag = IBCFlag; }
unsigned getIBCFlag() const { return m_IBCFlag; }
#endif
};
......@@ -2027,6 +2036,9 @@ public:
void initMotionLUTs ();
void destroyMotionLUTs ();
void resetMotionLUTs();
#if JVET_M0483_IBC
int getAvailableLUTIBCMrgNum() const { return m_MotionCandLut->currCntIBC; }
#endif
int getAvailableLUTMrgNum() const { return m_MotionCandLut->currCnt; }
#if JVET_M0170_MRG_SHARELIST
int getAvailableLUTBkupMrgNum() const { return m_MotionCandLuTsBkup->currCnt; }
......@@ -2035,8 +2047,11 @@ public:
MotionInfo getMotionInfoFromLUTs(int MotCandIdx) const;
LutMotionCand* getMotionLUTs() { return m_MotionCandLut; }
#if JVET_M0483_IBC
void addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi, bool ibcflag);
#else
void addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi);
#endif
void updateMotionLUTs(LutMotionCand* lutMC, CodingUnit & cu);
void copyMotionLUTs(LutMotionCand* Src, LutMotionCand* Dst);
......
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_M0483_IBC 1 // Block level flag signaling and independent IBC mode
#define JVET_M0102_INTRA_SUBPARTITIONS 1
#define JVET_M0303_IMPLICIT_MTS 1 // Implicit transform selection (can be enabled with MTSImplicit encoder config parameter)
......@@ -507,7 +509,12 @@ enum PredMode
{
MODE_INTER = 0, ///< inter-prediction mode
MODE_INTRA = 1, ///< intra-prediction mode
#if JVET_M0483_IBC
MODE_IBC = 2, ///< ibc-prediction mode
NUMBER_OF_PREDICTION_MODES = 3,
#else
NUMBER_OF_PREDICTION_MODES = 2,
#endif
};
/// reference list index
......
......@@ -287,7 +287,9 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other )
shareParentPos = other.shareParentPos;
shareParentSize = other.shareParentSize;
#endif
#if JVET_M0483_IBC==0
ibc = other.ibc;
#endif
#if JVET_M0444_SMVD
smvdMode = other.smvdMode;
#endif
......@@ -331,7 +333,9 @@ void CodingUnit::initData()
shareParentSize.width = -1;
shareParentSize.height = -1;
#endif
#if JVET_M0483_IBC==0
ibc = false;
#endif
#if JVET_M0444_SMVD
smvdMode = 0;
#endif
......
......@@ -322,7 +322,9 @@ struct CodingUnit : public UnitArea
Position shareParentPos;
Size shareParentSize;
#endif
#if JVET_M0483_IBC ==0
bool ibc;
#endif
#if JVET_M0444_SMVD
uint8_t smvdMode;
#endif
......
This diff is collapsed.
......@@ -60,6 +60,9 @@ namespace CU
{
bool isIntra (const CodingUnit &cu);
bool isInter (const CodingUnit &cu);
#if JVET_M0483_IBC
bool isIBC (const CodingUnit &cu);
#endif
bool isRDPCMEnabled (const CodingUnit &cu);
bool isLosslessCoded (const CodingUnit &cu);
uint32_t getIntraSizeIdx (const CodingUnit &cu);
......@@ -124,11 +127,18 @@ namespace PU
void getInterMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx,
int mmvdList,
const int& mrgCandIdx = -1 );
#if JVET_M0483_IBC
void getIBCMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx = -1);
#endif
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);
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 );
#if JVET_M0483_IBC
void fillIBCMvpCand (PredictionUnit &pu, AMVPInfo &amvpInfo);
bool addIBCMVPCand (const PredictionUnit &pu, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo);
#endif
void fillAffineMvpCand ( PredictionUnit &pu, const RefPicList &eRefPicList, const int &refIdx, AffineAMVPInfo &affiAMVPInfo);
bool addMVPCandUnscaled (const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo);
bool addMVPCandWithScaling (const PredictionUnit &pu, const RefPicList &eRefPicList, const int &iRefIdx, const Position &pos, const MvpDir &eDir, AMVPInfo &amvpInfo);
......@@ -136,14 +146,21 @@ 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_M0483_IBC==0
, int mmvdList
#endif
#if JVET_M0483_IBC
, bool ibcFlag
#endif
#if JVET_M0170_MRG_SHARELIST
, bool isShared
#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_M0483_IBC==0
, int mmvdList
#endif
);
#endif
void addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const RefPicList eRefPicList2nd, const int currRefPOC, AMVPInfo &info, uint8_t imv);
......@@ -160,7 +177,9 @@ namespace PU
bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count
, int mmvdList
#if !JVET_M0409_ATMVP_FIX
#if JVET_M0483_IBC==0
, const int countIBC
#endif
#endif
);
bool getInterMergeSubPuRecurCand(const PredictionUnit &pu, MergeCtx &mrgCtx, const int count);
......
......@@ -885,7 +885,11 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx&
}
// skip flag
#if JVET_M0483_IBC
if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) && cu.Y().valid())
#else
if (!cs.slice->isIntra() && cu.Y().valid())
#endif
{
cu_skip_flag( cu );
}
......@@ -951,12 +955,54 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )