Commit 02338646 authored by Yu Han's avatar Yu Han

Clean and bug fix

parent 87a44fe9
......@@ -746,7 +746,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C
if( cpyResi ) picture->getResiBuf( clippedArea ).copyFrom( subResiBuf );
if( cpyReco ) picture->getRecoBuf( clippedArea ).copyFrom( subRecoBuf );
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (!subStruct.m_isTuEnc && ((!slice->isIntra() || slice->getSPS()->getSpsNext().getIBCMode()) && subStruct.chType != CHANNEL_TYPE_CHROMA))
#else
if (!subStruct.m_isTuEnc && (!slice->isIntra() && subStruct.chType != CHANNEL_TYPE_CHROMA))
......@@ -930,7 +930,7 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel
pu = *ppu;
}
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (!other.slice->isIntra() || other.slice->getSPS()->getSpsNext().getIBCMode())
#else
if( !other.slice->isIntra() )
......@@ -989,7 +989,7 @@ void CodingStructure::initStructData( const int &QP, const bool &_isLosses, cons
isLossless = _isLosses;
}
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (!skipMotBuf && (!parent || ((!slice->isIntra() || slice->getSPS()->getSpsNext().getIBCMode()) && !m_isTuEnc)))
#else
if( !skipMotBuf && ( !parent || ( ( slice->getSliceType() != I_SLICE ) && !m_isTuEnc ) ) )
......
......@@ -451,7 +451,7 @@ unsigned DeriveCtx::CtxPredModeFlag( const CodingUnit& cu )
}
#endif
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
unsigned DeriveCtx::CtxIBCFlag(const CodingUnit& cu)
{
const CodingStructure *cs = cu.cs;
......@@ -484,7 +484,7 @@ 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 IBC_SEPERATE_MODE // remove macro VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE
#if JVET_M0483_IBC // remove macro VCEG_AZ07_MV_ADD_PRECISION_BIT_FOR_STORE
if (CU::isIBC(*pu.cu))
{
pu.bv = pu.mv[REF_PIC_LIST_0];
......
......@@ -317,7 +317,7 @@ unsigned CtxTriangleFlag( const CodingUnit& cu );
#if JVET_M0502_PRED_MODE_CTX
unsigned CtxPredModeFlag( const CodingUnit& cu );
#endif
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
unsigned CtxIBCFlag(const CodingUnit& cu);
#endif
}
......
......@@ -1326,7 +1326,7 @@ const CtxSet ContextSetCfg::TriangleIdx = ContextSetCfg::addCtxSet
});
// clang-format on
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
......
......@@ -307,7 +307,7 @@ public:
#if JVET_M0444_SMVD
static const CtxSet SmvdFlag;
#endif
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
static const CtxSet IBCFlag;
#endif
static const unsigned NumberOfContexts;
......
......@@ -375,7 +375,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
int iRefIdx = pu.refIdx[eRefPicList];
Mv mv[3];
bool isIBC = false;
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (CU::isIBC(*pu.cu))
#else
if (pu.cs->slice->getRefPic(eRefPicList, iRefIdx)->getPOC() == pu.cs->slice->getPOC())
......@@ -415,7 +415,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
}
else
{
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (isIBC)
{
xPredInterBlk(compID, pu, pu.cu->slice->getPic(), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng(compID)
......@@ -488,8 +488,9 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
RefPicList eRefPicList = (refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
#if IBC_SEPERATE_MODE
CHECK(pu.refIdx[refList] > slice.getNumRefIdx(eRefPicList), "Invalid reference index");
#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" );
......
......@@ -101,7 +101,7 @@ struct MvField
struct MotionInfo
{
bool isInter;
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
bool isIBCmot;
#endif
char interDir;
......@@ -110,7 +110,7 @@ struct MotionInfo
Mv mv [ NUM_REF_PIC_LIST_01 ];
int16_t refIdx [ NUM_REF_PIC_LIST_01 ];
Mv bv;
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
MotionInfo() : isInter(false), isIBCmot(false), interDir(0), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID } { }
// ensure that MotionInfo(0) produces '\x000....' bit pattern - needed to work with AreaBuf - don't use this constructor for anything 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'"); }
......@@ -123,7 +123,7 @@ struct MotionInfo
bool operator==( const MotionInfo& mi ) const
{
if( isInter != mi.isInter ) return false;
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (isIBCmot != mi.isIBCmot) return false;
#endif
if( isInter )
......@@ -223,7 +223,7 @@ struct LutMotionCand
{
MotionInfo* motionCand;
int currCnt;
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
int currCntIBC;
#endif
};
......
......@@ -435,7 +435,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b
pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i));
}
}
#if IBC_SEPERATE_MODE==0
#if JVET_M0483_IBC==0
if (getSPS()->getSpsNext().getIBCMode())
{
RefPicSetLtCurr[NumPicLtCurr] = getPic();
......@@ -456,7 +456,7 @@ 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 IBC_SEPERATE_MODE==0
#if JVET_M0483_IBC==0
if (getSPS()->getSpsNext().getIBCMode())
{
CHECK(numPicTotalCurr != 1, "Invalid state");
......@@ -533,7 +533,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b
m_bIsUsedAsLongTerm[REF_PIC_LIST_1][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 );
}
}
#if IBC_SEPERATE_MODE==0
#if JVET_M0483_IBC==0
if (getSPS()->getSpsNext().getIBCMode())
{
m_apcRefPicList[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = getPic();
......@@ -1618,11 +1618,11 @@ void Slice::initMotionLUTs()
{
m_MotionCandLut = new LutMotionCand;
m_MotionCandLut->currCnt = 0;
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
m_MotionCandLut->currCntIBC = 0;
#endif
m_MotionCandLut->motionCand = nullptr;
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
m_MotionCandLut->motionCand = new MotionInfo[MAX_NUM_HMVP_CANDS * 2];
#else
m_MotionCandLut->motionCand = new MotionInfo[MAX_NUM_HMVP_CANDS];
......@@ -1630,11 +1630,11 @@ void Slice::initMotionLUTs()
#if JVET_M0170_MRG_SHARELIST
m_MotionCandLuTsBkup = new LutMotionCand;
m_MotionCandLuTsBkup->currCnt = 0;
#if IBC_SEPERATE_MODE_AND_MER && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
m_MotionCandLuTsBkup->currCntIBC = 0;
#endif
m_MotionCandLuTsBkup->motionCand = nullptr;
#if IBC_SEPERATE_MODE_AND_MER
#if JVET_M0483_IBC
m_MotionCandLuTsBkup->motionCand = new MotionInfo[MAX_NUM_HMVP_CANDS * 2];
#else
m_MotionCandLuTsBkup->motionCand = new MotionInfo[MAX_NUM_HMVP_CANDS];
......@@ -1657,12 +1657,12 @@ void Slice::destroyMotionLUTs()
void Slice::resetMotionLUTs()
{
m_MotionCandLut->currCnt = 0;
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
m_MotionCandLut->currCntIBC = 0;
#endif
#if JVET_M0170_MRG_SHARELIST
m_MotionCandLuTsBkup->currCnt = 0;
#if IBC_SEPERATE_MODE_AND_MER && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
m_MotionCandLuTsBkup->currCntIBC = 0;
#endif
#endif
......@@ -1679,13 +1679,13 @@ MotionInfo Slice::getMotionInfoFromLUTBkup(int MotCandIdx) const
}
#endif
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
void Slice::addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi, bool ibcflag)
#else
void Slice::addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi)
#endif
{
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
int currCntIBC = ibcflag ? lutMC->currCntIBC : lutMC->currCnt;
int offset = ibcflag ? MAX_NUM_HMVP_CANDS : 0;
bool pruned = false;
......@@ -1752,7 +1752,7 @@ void Slice::updateMotionLUTs(LutMotionCand* lutMC, CodingUnit & cu)
if (cu.triangle) { return; }
MotionInfo newMi = selectedPU->getMotionInfo();
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
addMotionInfoToLUTs(lutMC, newMi, CU::isIBC(cu));
#else
addMotionInfoToLUTs(lutMC, newMi);
......@@ -1763,7 +1763,7 @@ 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 IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#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
......@@ -1772,7 +1772,7 @@ void Slice::copyMotionLUTs(LutMotionCand* Src, LutMotionCand* Dst)
unsigned Slice::getMinPictureDistance() const
{
int minPicDist = MAX_INT;
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (getSPS()->getSpsNext().getIBCMode())
{
minPicDist = 0;
......
......@@ -1949,7 +1949,7 @@ public:
void initMotionLUTs ();
void destroyMotionLUTs ();
void resetMotionLUTs();
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
int getAvailableLUTIBCMrgNum() const { return m_MotionCandLut->currCntIBC; }
#endif
int getAvailableLUTMrgNum() const { return m_MotionCandLut->currCnt; }
......@@ -1960,7 +1960,7 @@ public:
MotionInfo getMotionInfoFromLUTs(int MotCandIdx) const;
LutMotionCand* getMotionLUTs() { return m_MotionCandLut; }
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
void addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi, bool ibcflag);
#else
void addMotionInfoToLUTs(LutMotionCand* lutMC, MotionInfo newMi);
......
......@@ -50,21 +50,7 @@
#include <assert.h>
#include <cassert>
#define JVET_M0483_IBC 1 //
#if JVET_M0483_IBC
#define IBC_SEPERATE_MODE 1 //JVET-M0483_method3
#define IBC_SEPERATE_MODE_FIX 1 //JVET-M0483_method3 bug fix ticket 129 and 140
#define IBC_SEPERATE_MODE_REDUCTION 0
#define IBC_SIZE_CONSTRAINT 0
#define IBC_SEPERATE_FUNCTION 1
#define CLEAN_getInterMergeCandidates 1
#define CLEAN_fillMvpCand 1
#define MODIFY_for_vtm4 1
#define IBC_SEPERATE_MODE_AND_MER 1
#define IBC_MER_FIX 1
#define DEBUG_M0483 1
#endif
#define JVET_M0483_IBC 1 // Block level flag signaling and independent IBC mode
#define JVET_M0145_AFFINE_MV_CLIP 1 // Missing clipping for MV storage in affine
......@@ -459,7 +445,7 @@ enum PredMode
{
MODE_INTER = 0, ///< inter-prediction mode
MODE_INTRA = 1, ///< intra-prediction mode
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
MODE_IBC = 2, ///< ibc-prediction mode
NUMBER_OF_PREDICTION_MODES = 3,
#else
......
......@@ -277,7 +277,7 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other )
shareParentPos = other.shareParentPos;
shareParentSize = other.shareParentSize;
#endif
#if IBC_SEPERATE_MODE==0
#if JVET_M0483_IBC==0
ibc = other.ibc;
#endif
#if JVET_M0444_SMVD
......@@ -321,7 +321,7 @@ void CodingUnit::initData()
shareParentSize.width = -1;
shareParentSize.height = -1;
#endif
#if IBC_SEPERATE_MODE==0
#if JVET_M0483_IBC==0
ibc = false;
#endif
#if JVET_M0444_SMVD
......
......@@ -316,7 +316,7 @@ struct CodingUnit : public UnitArea
Position shareParentPos;
Size shareParentSize;
#endif
#if IBC_SEPERATE_MODE ==0
#if JVET_M0483_IBC ==0
bool ibc;
#endif
#if JVET_M0444_SMVD
......
This diff is collapsed.
......@@ -57,7 +57,7 @@ namespace CU
{
bool isIntra (const CodingUnit &cu);
bool isInter (const CodingUnit &cu);
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
bool isIBC (const CodingUnit &cu);
#endif
bool isRDPCMEnabled (const CodingUnit &cu);
......@@ -110,7 +110,7 @@ namespace PU
void getInterMergeCandidates (const PredictionUnit &pu, MergeCtx& mrgCtx,
int mmvdList,
const int& mrgCandIdx = -1 );
#if IBC_SEPERATE_FUNCTION
#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);
......@@ -118,8 +118,9 @@ namespace PU
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 IBC_SEPERATE_FUNCTION
void fillIBCMvpCand (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);
......@@ -128,10 +129,10 @@ 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 IBC_SEPERATE_MODE==0
#if JVET_M0483_IBC==0
, int mmvdList
#endif
#if IBC_SEPERATE_MODE && IBC_SEPERATE_MODE_REDUCTION==0
#if JVET_M0483_IBC
, bool ibc_flag
#endif
#if JVET_M0170_MRG_SHARELIST
......@@ -140,7 +141,7 @@ namespace PU
);
#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 IBC_SEPERATE_MODE==0
#if JVET_M0483_IBC==0
, int mmvdList
#endif
);
......@@ -159,7 +160,7 @@ namespace PU
bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count
, int mmvdList
#if !JVET_M0409_ATMVP_FIX
#if IBC_SEPERATE_MODE==0
#if JVET_M0483_IBC==0
, const int countIBC
#endif
#endif
......
......@@ -885,7 +885,7 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx&
}
// skip flag
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if ((!cs.slice->isIntra() || cs.slice->getSPS()->getSpsNext().getIBCMode()) && cu.Y().valid())
#else
if (!cs.slice->isIntra() && cu.Y().valid())
......@@ -952,36 +952,23 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
{
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SKIP_FLAG );
#if IBC_SEPERATE_MODE
#if IBC_SEPERATE_MODE_FIX
#if JVET_M0483_IBC
if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getSpsNext().getIBCMode())
#else
if (cu.slice->isIntra())
#endif
{
cu.skip = false;
cu.rootCbf = false;
cu.predMode = MODE_INTRA;
//cu.partSize = SIZE_2Nx2N; //Todo
cu.mmvdSkip = false;
if (cu.lwidth() > IBC_MAX_CAND_SIZE || cu.lheight() > IBC_MAX_CAND_SIZE) // currently only check 32x32 and below block for ibc merge/skip
unsigned ctxId = DeriveCtx::CtxSkipFlag(cu);
unsigned skip = m_BinDecoder.decodeBin(Ctx::SkipFlag(ctxId));
if (skip)
{
}
else
{
unsigned ctxId = DeriveCtx::CtxSkipFlag(cu);
unsigned skip = m_BinDecoder.decodeBin(Ctx::SkipFlag(ctxId));
if (skip)
{
cu.skip = true;
cu.rootCbf = false;
cu.predMode = MODE_IBC;
//cu.partSize = SIZE_2Nx2N;//Todo
cu.mmvdSkip = false;
}
cu.skip = true;
cu.rootCbf = false;
cu.predMode = MODE_IBC;
cu.mmvdSkip = false;
}
return;
}
#endif
......@@ -991,41 +978,25 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, skip ? 1 : 0 );
#if IBC_SEPERATE_MODE
#if IBC_SEPERATE_MODE_FIX
#if JVET_M0483_IBC
if (skip && cu.cs->slice->getSPS()->getSpsNext().getIBCMode())
#else
if (skip)
#endif
{
if (cu.lwidth() > IBC_MAX_CAND_SIZE || cu.lheight() > IBC_MAX_CAND_SIZE) // currently only check 32x32 and below block for ibc merge/skip
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
cu.predMode = MODE_INTER;
cu.skip = true;
cu.rootCbf = false;
cu.predMode = MODE_IBC;
cu.mmvdSkip = false;
}
else
{
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
cu.skip = true;
cu.rootCbf = false;
cu.predMode = MODE_IBC;
//cu.partSize = SIZE_2Nx2N;//Todo
cu.mmvdSkip = false;
}
else
{
cu.predMode = MODE_INTER;
}
DTRACE(g_trace_ctx, D_SYNTAX, "ibc() ctx=%d cu.predMode=%d\n", ctxidx, cu.predMode);
cu.predMode = MODE_INTER;
}
DTRACE(g_trace_ctx, D_SYNTAX, "ibc() ctx=%d cu.predMode=%d\n", ctxidx, cu.predMode);
}
#if IBC_SEPERATE_MODE_FIX
if ((skip && CU::isInter(cu) && cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) ||
(skip && !cu.cs->slice->getSPS()->getSpsNext().getIBCMode()))
#else
if (skip && CU::isInter(cu))
#endif
#else
if( skip )
#endif
......@@ -1058,7 +1029,7 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx )
unsigned value = 0;
unsigned ctxId = DeriveCtx::CtxIMVFlag( cu );
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (CU::isIBC(cu))
#else
if (cu.firstPU->interDir == 1 && cu.cs->slice->getRefPic(REF_PIC_LIST_0, cu.firstPU->refIdx[REF_PIC_LIST_0])->getPOC() == cu.cs->slice->getPOC()) // the first bin of IMV flag does need to be signaled in IBC block
......@@ -1083,25 +1054,16 @@ void CABACReader::pred_mode( CodingUnit& cu )
{
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__PRED_MODE );
#if IBC_SEPERATE_MODE//Todo : predmode ctx
#if IBC_SEPERATE_MODE_FIX
#if JVET_M0483_IBC
if (cu.cs->slice->getSPS()->getSpsNext().getIBCMode())
{
#endif
if (cu.cs->slice->isIntra())
{
cu.predMode = MODE_INTRA;
if (cu.lwidth() > IBC_MAX_CAND_SIZE || cu.lheight() > IBC_MAX_CAND_SIZE) // currently only check 32x32 and below block for ibc merge/skip
{
}
else
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
cu.predMode = MODE_IBC;
}
cu.predMode = MODE_IBC;
}
}
else
......@@ -1117,20 +1079,13 @@ void CABACReader::pred_mode( CodingUnit& cu )
else
{
cu.predMode = MODE_INTER;
if (cu.lwidth() > IBC_MAX_CAND_SIZE || cu.lheight() > IBC_MAX_CAND_SIZE) // currently only check 32x32 and below block for ibc merge/skip
{
}
else
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
{
cu.predMode = MODE_IBC;
}
cu.predMode = MODE_IBC;
}
}
}
#if IBC_SEPERATE_MODE_FIX
}
else
{
......@@ -1147,7 +1102,6 @@ void CABACReader::pred_mode( CodingUnit& cu )
cu.predMode = MODE_INTER;
}
}
#endif
#else
#if JVET_M0502_PRED_MODE_CTX
if( cu.cs->slice->isIntra() || m_BinDecoder.decodeBin( Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)) ) )
......@@ -1187,7 +1141,7 @@ void CABACReader::cu_pred_data( CodingUnit &cu )
}
if (!cu.Y().valid()) // dual tree chroma CU
{
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
cu.predMode = MODE_IBC;
#else
cu.predMode = MODE_INTER;
......@@ -1470,7 +1424,7 @@ void CABACReader::intra_chroma_pred_mode( PredictionUnit& pu )
void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& cuCtx )
{
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (!CU::isIntra(cu))
#else
if( CU::isInter( cu ) )
......@@ -1558,7 +1512,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
}
if( pu.mergeFlag )
{
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (CU::isIBC(*pu.cu))
{
merge_idx(pu);
......@@ -1579,17 +1533,17 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
mmvd_merge_idx(pu);
}
else
merge_data ( pu );
#if IBC_SEPERATE_MODE
merge_data ( pu );
#if JVET_M0483_IBC
}
#endif
}
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
else if (CU::isIBC(*pu.cu))
{
pu.interDir = 1;
pu.cu->affine = false;
ref_idx(pu, REF_PIC_LIST_0);
pu.refIdx[REF_PIC_LIST_0] = MAX_NUM_REF;
mvd_coding(pu.mvd[REF_PIC_LIST_0]);
mvp_flag(pu, REF_PIC_LIST_0);
}
......@@ -1744,7 +1698,7 @@ void CABACReader::merge_flag( PredictionUnit& pu )
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 IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (pu.mergeFlag && CU::isIBC(*pu.cu))
{
pu.mmvdMergeFlag = false;
......@@ -1966,17 +1920,6 @@ void CABACReader::ref_idx( PredictionUnit &pu, RefPicList eRefList )
int numRef = pu.cs->slice->getNumRefIdx(eRefList);
#if IBC_SEPERATE_MODE //Todo : check
if (eRefList == REF_PIC_LIST_0 && pu.cs->sps->getSpsNext().getIBCMode())
{
if (CU::isIBC(*pu.cu))
{
pu.refIdx[eRefList] = numRef;
return;
}
}
#endif
if( numRef <= 1 || !m_BinDecoder.decodeBin( Ctx::RefPic() ) )
{
if( numRef > 1 )
......@@ -2622,9 +2565,6 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID )
const bool tsAllowed = TU::isTSAllowed ( tu, compID );
const bool mtsAllowed = TU::isMTSAllowed( tu, compID );
#if IBC_SEPERATE_MODE//Todo
#endif
if( !mtsAllowed && !tsAllowed ) return;
int symbol = 0;
......@@ -2713,7 +2653,7 @@ void CABACReader::emt_cu_flag( CodingUnit& cu )
{
const CodingStructure &cs = *cu.cs;
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
if (!((cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getSpsNext().getUseInterEMT() && !CU::isIntra(cu))) || isChroma(cu.chType))
#else
if( !( ( cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra( cu ) ) || ( cs.sps->getSpsNext().getUseInterEMT() && CU::isInter( cu ) ) ) || isChroma( cu.chType ) )
......
......@@ -102,8 +102,6 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea )
for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, chType ), chType ) )
{
#if JVET_M0170_MRG_SHARELIST
#if IBC_SEPERATE_MODE//Todo : check
#endif
if(sharePrepareCondition)
{
if ((currCU.shareParentPos.x >= 0) && (!(currCU.shareParentPos.x == prevTmpPos.x && currCU.shareParentPos.y == prevTmpPos.y)))
......@@ -127,7 +125,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea )
switch( currCU.predMode )
{
case MODE_INTER:
#if IBC_SEPERATE_MODE
#if JVET_M0483_IBC
case MODE_IBC: