Commit 48a8d410 authored by Yu Han's avatar Yu Han

Code clean and remove spsNext

parent c16d1f29
...@@ -750,7 +750,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C ...@@ -750,7 +750,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C
if( cpyReco ) picture->getRecoBuf( clippedArea ).copyFrom( subRecoBuf ); if( cpyReco ) picture->getRecoBuf( clippedArea ).copyFrom( subRecoBuf );
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (!subStruct.m_isTuEnc && ((!slice->isIntra() || slice->getSPS()->getSpsNext().getIBCMode()) && subStruct.chType != CHANNEL_TYPE_CHROMA)) if (!subStruct.m_isTuEnc && ((!slice->isIntra() || slice->getSPS()->getIBCFlag()) && subStruct.chType != CHANNEL_TYPE_CHROMA))
#else #else
if (!subStruct.m_isTuEnc && (!slice->isIntra() && subStruct.chType != CHANNEL_TYPE_CHROMA)) if (!subStruct.m_isTuEnc && (!slice->isIntra() && subStruct.chType != CHANNEL_TYPE_CHROMA))
#endif #endif
...@@ -934,7 +934,7 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel ...@@ -934,7 +934,7 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel
} }
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (!other.slice->isIntra() || other.slice->getSPS()->getSpsNext().getIBCMode()) if (!other.slice->isIntra() || other.slice->getSPS()->getIBCFlag())
#else #else
if( !other.slice->isIntra() ) if( !other.slice->isIntra() )
#endif #endif
...@@ -993,7 +993,7 @@ void CodingStructure::initStructData( const int &QP, const bool &_isLosses, cons ...@@ -993,7 +993,7 @@ void CodingStructure::initStructData( const int &QP, const bool &_isLosses, cons
} }
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (!skipMotBuf && (!parent || ((!slice->isIntra() || slice->getSPS()->getSpsNext().getIBCMode()) && !m_isTuEnc))) if (!skipMotBuf && (!parent || ((!slice->isIntra() || slice->getSPS()->getIBCFlag()) && !m_isTuEnc)))
#else #else
if( !skipMotBuf && ( !parent || ( ( slice->getSliceType() != I_SLICE ) && !m_isTuEnc ) ) ) if( !skipMotBuf && ( !parent || ( ( slice->getSliceType() != I_SLICE ) && !m_isTuEnc ) ) )
#endif #endif
......
...@@ -498,7 +498,7 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) ...@@ -498,7 +498,7 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx )
if (CU::isIBC(*pu.cu)) if (CU::isIBC(*pu.cu))
{ {
pu.bv = pu.mv[REF_PIC_LIST_0]; pu.bv = pu.mv[REF_PIC_LIST_0];
pu.bv >>= (2 + MV_FRACTIONAL_BITS_DIFF); // used for only integer resolution pu.bv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); // used for only integer resolution
} }
#else #else
if (interDirNeighbours[candIdx] == 1 && pu.cs->slice->getRefPic(REF_PIC_LIST_0, mvFieldNeighbours[candIdx << 1].refIdx)->getPOC() == pu.cs->slice->getPOC()) if (interDirNeighbours[candIdx] == 1 && pu.cs->slice->getRefPic(REF_PIC_LIST_0, mvFieldNeighbours[candIdx << 1].refIdx)->getPOC() == pu.cs->slice->getPOC())
......
...@@ -576,7 +576,11 @@ int Slice::getNumRpsCurrTempList() const ...@@ -576,7 +576,11 @@ int Slice::getNumRpsCurrTempList() const
numRpsCurrTempList++; numRpsCurrTempList++;
} }
} }
#if JVET_M0483_IBC
if (getSPS()->getIBCFlag())
#else
if (getSPS()->getSpsNext().getIBCMode()) if (getSPS()->getSpsNext().getIBCMode())
#endif
{ {
return numRpsCurrTempList + 1; return numRpsCurrTempList + 1;
} }
...@@ -1785,7 +1789,7 @@ unsigned Slice::getMinPictureDistance() const ...@@ -1785,7 +1789,7 @@ unsigned Slice::getMinPictureDistance() const
{ {
int minPicDist = MAX_INT; int minPicDist = MAX_INT;
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (getSPS()->getSpsNext().getIBCMode()) if (getSPS()->getIBCFlag())
{ {
minPicDist = 0; minPicDist = 0;
} }
...@@ -1972,6 +1976,9 @@ SPS::SPS() ...@@ -1972,6 +1976,9 @@ SPS::SPS()
, m_spsNextExtension (*this) , m_spsNextExtension (*this)
, m_wrapAroundEnabledFlag (false) , m_wrapAroundEnabledFlag (false)
, m_wrapAroundOffset ( 0) , m_wrapAroundOffset ( 0)
#if JVET_M0483_IBC
, m_IBCFlag ( 0)
#endif
{ {
for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
{ {
......
...@@ -1033,6 +1033,9 @@ private: ...@@ -1033,6 +1033,9 @@ private:
bool m_wrapAroundEnabledFlag; bool m_wrapAroundEnabledFlag;
unsigned m_wrapAroundOffset; unsigned m_wrapAroundOffset;
#if JVET_M0483_IBC
unsigned m_IBCFlag;
#endif
public: public:
...@@ -1252,6 +1255,10 @@ public: ...@@ -1252,6 +1255,10 @@ public:
bool getWrapAroundEnabledFlag() const { return m_wrapAroundEnabledFlag; } bool getWrapAroundEnabledFlag() const { return m_wrapAroundEnabledFlag; }
void setWrapAroundOffset(unsigned offset) { m_wrapAroundOffset = offset; } void setWrapAroundOffset(unsigned offset) { m_wrapAroundOffset = offset; }
unsigned getWrapAroundOffset() const { return m_wrapAroundOffset; } unsigned getWrapAroundOffset() const { return m_wrapAroundOffset; }
#if JVET_M0483_IBC
void setIBCFlag(unsigned IBCFlag) { m_IBCFlag = IBCFlag; }
unsigned getIBCFlag() const { return m_IBCFlag; }
#endif
}; };
......
...@@ -3185,7 +3185,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, ...@@ -3185,7 +3185,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
const int neibRefIdx = neibMi.refIdx[eRefPicListIndex]; const int neibRefIdx = neibMi.refIdx[eRefPicListIndex];
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (neibRefIdx >= 0 && (CU::isIBC(*pu.cu) || (CU::isIBC(*pu.cu) == false && currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx)))) if (neibRefIdx >= 0 && (CU::isIBC(*pu.cu) || (currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx))))
#else #else
if (neibRefIdx >= 0 && currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx)) if (neibRefIdx >= 0 && currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx))
#endif #endif
......
...@@ -886,7 +886,7 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& ...@@ -886,7 +886,7 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx&
// skip flag // skip flag
#if JVET_M0483_IBC #if JVET_M0483_IBC
if ((!cs.slice->isIntra() || cs.slice->getSPS()->getSpsNext().getIBCMode()) && cu.Y().valid()) if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) && cu.Y().valid())
#else #else
if (!cs.slice->isIntra() && cu.Y().valid()) if (!cs.slice->isIntra() && cu.Y().valid())
#endif #endif
...@@ -953,7 +953,7 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) ...@@ -953,7 +953,7 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SKIP_FLAG ); RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SKIP_FLAG );
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getIBCFlag())
{ {
cu.skip = false; cu.skip = false;
cu.rootCbf = false; cu.rootCbf = false;
...@@ -979,7 +979,7 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) ...@@ -979,7 +979,7 @@ 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 ); DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, skip ? 1 : 0 );
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (skip && cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if (skip && cu.cs->slice->getSPS()->getIBCFlag())
{ {
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx))) if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
...@@ -995,8 +995,8 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) ...@@ -995,8 +995,8 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
} }
DTRACE(g_trace_ctx, D_SYNTAX, "ibc() ctx=%d cu.predMode=%d\n", ctxidx, cu.predMode); DTRACE(g_trace_ctx, D_SYNTAX, "ibc() ctx=%d cu.predMode=%d\n", ctxidx, cu.predMode);
} }
if ((skip && CU::isInter(cu) && cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) || if ((skip && CU::isInter(cu) && cu.cs->slice->getSPS()->getIBCFlag()) ||
(skip && !cu.cs->slice->getSPS()->getSpsNext().getIBCMode())) (skip && !cu.cs->slice->getSPS()->getIBCFlag()))
#else #else
if( skip ) if( skip )
#endif #endif
...@@ -1095,7 +1095,7 @@ void CABACReader::pred_mode( CodingUnit& cu ) ...@@ -1095,7 +1095,7 @@ void CABACReader::pred_mode( CodingUnit& cu )
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__PRED_MODE ); RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__PRED_MODE );
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if (cu.cs->slice->getSPS()->getIBCFlag())
{ {
if (cu.cs->slice->isIntra()) if (cu.cs->slice->isIntra())
{ {
......
...@@ -705,15 +705,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) ...@@ -705,15 +705,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
pu.mvpNum [eRefList] = amvpInfo.numCand; pu.mvpNum [eRefList] = amvpInfo.numCand;
#if JVET_M0483_IBC==0 #if JVET_M0483_IBC==0
Mv mvd = pu.mvd[eRefList]; Mv mvd = pu.mvd[eRefList];
#if JVET_M0483_IBC
if (CU::isIBC(cu))
{
#if REUSE_CU_RESULTS
if (!cu.cs->pcv->isEncoder)
#endif
mvd <<= 2;
}
#else
if (eRefList == REF_PIC_LIST_0 && pu.cs->slice->getRefPic(eRefList, pu.refIdx[eRefList])->getPOC() == pu.cs->slice->getPOC()) if (eRefList == REF_PIC_LIST_0 && pu.cs->slice->getRefPic(eRefList, pu.refIdx[eRefList])->getPOC() == pu.cs->slice->getPOC())
{ {
pu.cu->ibc = true; pu.cu->ibc = true;
...@@ -722,7 +713,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) ...@@ -722,7 +713,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
#endif #endif
mvd.changePrecision(MV_PRECISION_INT, MV_PRECISION_QUARTER); mvd.changePrecision(MV_PRECISION_INT, MV_PRECISION_QUARTER);
} }
#endif
pu.mv [eRefList] = amvpInfo.mvCand[pu.mvpIdx[eRefList]] + mvd; pu.mv [eRefList] = amvpInfo.mvCand[pu.mvpIdx[eRefList]] + mvd;
#else #else
pu.mv[eRefList] = amvpInfo.mvCand[pu.mvpIdx[eRefList]] + pu.mvd[eRefList]; pu.mv[eRefList] = amvpInfo.mvCand[pu.mvpIdx[eRefList]] + pu.mvd[eRefList];
......
...@@ -1228,7 +1228,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl ...@@ -1228,7 +1228,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
} }
#endif #endif
#if JVET_M0483_IBC
if (pcSlice->getSPS()->getIBCFlag() && pcSlice->getEnableTMVPFlag())
#else
if (pcSlice->getSPS()->getSpsNext().getIBCMode() && pcSlice->getEnableTMVPFlag()) if (pcSlice->getSPS()->getSpsNext().getIBCMode() && pcSlice->getEnableTMVPFlag())
#endif
{ {
CHECK(pcSlice->getRefPic(RefPicList(pcSlice->isInterB() ? 1 - pcSlice->getColFromL0Flag() : 0), pcSlice->getColRefIdx())->getPOC() == pcSlice->getPOC(), "curr ref picture cannot be collocated picture"); CHECK(pcSlice->getRefPic(RefPicList(pcSlice->isInterB() ? 1 - pcSlice->getColFromL0Flag() : 0), pcSlice->getColRefIdx())->getPOC() == pcSlice->getPOC(), "curr ref picture cannot be collocated picture");
} }
......
...@@ -811,7 +811,9 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) ...@@ -811,7 +811,9 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM )
READ_FLAG( symbol, "affine_type_flag" ); spsNext.setUseAffineType ( symbol != 0 ); READ_FLAG( symbol, "affine_type_flag" ); spsNext.setUseAffineType ( symbol != 0 );
} }
READ_FLAG( symbol, "gbi_flag" ); spsNext.setUseGBi ( symbol != 0 ); READ_FLAG( symbol, "gbi_flag" ); spsNext.setUseGBi ( symbol != 0 );
#if JVET_M0483_IBC==0
READ_FLAG( symbol, "ibc_flag"); spsNext.setIBCMode ( symbol != 0 ); READ_FLAG( symbol, "ibc_flag"); spsNext.setIBCMode ( symbol != 0 );
#endif
for( int k = 0; k < SPSNext::NumReservedFlags; k++ ) for( int k = 0; k < SPSNext::NumReservedFlags; k++ )
{ {
READ_FLAG( symbol, "reserved_flag" ); if( symbol != 0 ) EXIT("Incompatible version: SPSNext reserved flag not equal to zero (bitstream was probably created with newer software version)" ); READ_FLAG( symbol, "reserved_flag" ); if( symbol != 0 ) EXIT("Incompatible version: SPSNext reserved flag not equal to zero (bitstream was probably created with newer software version)" );
...@@ -877,6 +879,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) ...@@ -877,6 +879,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
READ_FLAG(uiCode, "no_ladf_constraint_flag"); pcSPS->setNoLadfConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_ladf_constraint_flag"); pcSPS->setNoLadfConstraintFlag(uiCode > 0 ? true : false);
READ_FLAG(uiCode, "no_dep_quant_constraint_flag"); pcSPS->setNoDepQuantConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_dep_quant_constraint_flag"); pcSPS->setNoDepQuantConstraintFlag(uiCode > 0 ? true : false);
READ_FLAG(uiCode, "no_sign_data_hiding_constraint_flag"); pcSPS->setNoSignDataHidingConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_sign_data_hiding_constraint_flag"); pcSPS->setNoSignDataHidingConstraintFlag(uiCode > 0 ? true : false);
#if JVET_M0483_IBC
READ_FLAG(uiCode, "ibc_flag"); pcSPS->setIBCFlag(uiCode);
#endif
#if HEVC_VPS #if HEVC_VPS
READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode );
#endif #endif
...@@ -1755,7 +1760,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para ...@@ -1755,7 +1760,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
} }
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (!pcSlice->isIntra() || sps->getSpsNext().getIBCMode()) if (!pcSlice->isIntra() || sps->getIBCFlag())
{ {
READ_UVLC(uiCode, "six_minus_max_num_merge_cand"); READ_UVLC(uiCode, "six_minus_max_num_merge_cand");
pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);
......
...@@ -714,7 +714,7 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C ...@@ -714,7 +714,7 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C
// skip flag // skip flag
#if JVET_M0483_IBC #if JVET_M0483_IBC
if ((!cs.slice->isIntra() || cs.slice->getSPS()->getSpsNext().getIBCMode()) && cu.Y().valid()) if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) && cu.Y().valid())
#else #else
if (!cs.slice->isIntra() && cu.Y().valid()) if (!cs.slice->isIntra() && cu.Y().valid())
#endif #endif
...@@ -772,7 +772,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) ...@@ -772,7 +772,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu )
unsigned ctxId = DeriveCtx::CtxSkipFlag( cu ); unsigned ctxId = DeriveCtx::CtxSkipFlag( cu );
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if (cu.slice->isIntra() && cu.cs->slice->getSPS()->getIBCFlag())
{ {
m_BinEncoder.encodeBin((cu.skip), Ctx::SkipFlag(ctxId)); m_BinEncoder.encodeBin((cu.skip), Ctx::SkipFlag(ctxId));
DTRACE(g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0); DTRACE(g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0);
...@@ -784,7 +784,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) ...@@ -784,7 +784,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu )
DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0 ); DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0 );
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (cu.skip && cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if (cu.skip && cu.cs->slice->getSPS()->getIBCFlag())
{ {
unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu); unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
m_BinEncoder.encodeBin(CU::isIBC(cu) ? 1 : 0, Ctx::IBCFlag(ctxidx)); m_BinEncoder.encodeBin(CU::isIBC(cu) ? 1 : 0, Ctx::IBCFlag(ctxidx));
...@@ -796,7 +796,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) ...@@ -796,7 +796,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu )
DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, cu.mmvdSkip ? 1 : 0); DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, cu.mmvdSkip ? 1 : 0);
} }
} }
if (cu.skip && !cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if (cu.skip && !cu.cs->slice->getSPS()->getIBCFlag())
{ {
m_BinEncoder.encodeBin(cu.mmvdSkip, Ctx::MmvdFlag(0)); m_BinEncoder.encodeBin(cu.mmvdSkip, Ctx::MmvdFlag(0));
DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, cu.mmvdSkip ? 1 : 0); DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_cu_skip_flag() ctx=%d mmvd_skip=%d\n", 0, cu.mmvdSkip ? 1 : 0);
...@@ -814,7 +814,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu ) ...@@ -814,7 +814,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu )
void CABACWriter::pred_mode( const CodingUnit& cu ) void CABACWriter::pred_mode( const CodingUnit& cu )
{ {
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if (cu.cs->slice->getSPS()->getIBCFlag())
{ {
#endif #endif
#if JVET_M0483_IBC #if JVET_M0483_IBC
...@@ -1846,7 +1846,7 @@ void CABACWriter::ref_idx( const PredictionUnit& pu, RefPicList eRefList ) ...@@ -1846,7 +1846,7 @@ void CABACWriter::ref_idx( const PredictionUnit& pu, RefPicList eRefList )
int numRef = pu.cs->slice->getNumRefIdx(eRefList); int numRef = pu.cs->slice->getNumRefIdx(eRefList);
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (eRefList == REF_PIC_LIST_0 && pu.cs->sps->getSpsNext().getIBCMode()) if (eRefList == REF_PIC_LIST_0 && pu.cs->sps->getIBCFlag())
{ {
if (CU::isIBC(*pu.cu)) if (CU::isIBC(*pu.cu))
return; return;
......
...@@ -675,7 +675,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par ...@@ -675,7 +675,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
const UnitArea currCsArea = clipArea( CS::getArea( *bestCS, bestCS->area, partitioner.chType ), *tempCS->picture ); const UnitArea currCsArea = clipArea( CS::getArea( *bestCS, bestCS->area, partitioner.chType ), *tempCS->picture );
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (m_pImvTempCS && (!slice.isIntra() || slice.getSPS()->getSpsNext().getIBCMode())) if (m_pImvTempCS && (!slice.isIntra() || slice.getSPS()->getIBCFlag()))
#else #else
if( m_pImvTempCS && !slice.isIntra() ) if( m_pImvTempCS && !slice.isIntra() )
#endif #endif
...@@ -704,7 +704,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par ...@@ -704,7 +704,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
return; return;
} }
#if JVET_M0483_IBC #if JVET_M0483_IBC
if ((!slice.isIntra() || slice.getSPS()->getSpsNext().getIBCMode()) if ((!slice.isIntra() || slice.getSPS()->getIBCFlag())
#else #else
if (!slice.isIntra() if (!slice.isIntra()
#endif #endif
...@@ -863,7 +863,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par ...@@ -863,7 +863,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
// QP from last processed CU for further processing // QP from last processed CU for further processing
bestCS->prevQP[partitioner.chType] = bestCS->cus.back()->qp; bestCS->prevQP[partitioner.chType] = bestCS->cus.back()->qp;
#if JVET_M0483_IBC #if JVET_M0483_IBC
if ((!slice.isIntra() || slice.getSPS()->getSpsNext().getIBCMode()) if ((!slice.isIntra() || slice.getSPS()->getIBCFlag())
#else #else
if (!slice.isIntra() if (!slice.isIntra()
#endif #endif
...@@ -1433,7 +1433,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, ...@@ -1433,7 +1433,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
m_pcInterSearch->addAffMVInfo(tmpMVInfo); m_pcInterSearch->addAffMVInfo(tmpMVInfo);
#if JVET_M0483_IBC #if JVET_M0483_IBC
if ((!slice.isIntra() || slice.getSPS()->getSpsNext().getIBCMode()) if ((!slice.isIntra() || slice.getSPS()->getIBCFlag())
#else #else
if (!slice.isIntra() if (!slice.isIntra()
#endif #endif
...@@ -1557,7 +1557,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1557,7 +1557,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
} }
#if JVET_M0483_IBC #if JVET_M0483_IBC
if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getIBCFlag())
#else #else
if( !cu.cs->slice->isIntra() if( !cu.cs->slice->isIntra()
#endif #endif
...@@ -1647,7 +1647,7 @@ void EncCu::xCheckIntraPCM(CodingStructure *&tempCS, CodingStructure *&bestCS, P ...@@ -1647,7 +1647,7 @@ void EncCu::xCheckIntraPCM(CodingStructure *&tempCS, CodingStructure *&bestCS, P
} }
#if JVET_M0483_IBC #if JVET_M0483_IBC
if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getSpsNext().getIBCMode()) if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getIBCFlag())
#else #else
if( !cu.cs->slice->isIntra() if( !cu.cs->slice->isIntra()
#endif #endif
...@@ -1876,7 +1876,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& ...@@ -1876,7 +1876,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
if( auto blkCache = dynamic_cast< CacheBlkInfoCtrl* >( m_modeCtrl ) ) if( auto blkCache = dynamic_cast< CacheBlkInfoCtrl* >( m_modeCtrl ) )
{ {
#if JVET_M0483_IBC
if (slice.getSPS()->getIBCFlag())
#else
if (slice.getSPS()->getSpsNext().getIBCMode()) if (slice.getSPS()->getSpsNext().getIBCMode())
#endif
{ {
ComprCUCtx cuECtx = m_modeCtrl->getComprCUCtx(); ComprCUCtx cuECtx = m_modeCtrl->getComprCUCtx();
bestIsSkip = blkCache->isSkip(tempCS->area) && cuECtx.bestCU; bestIsSkip = blkCache->isSkip(tempCS->area) && cuECtx.bestCU;
......
...@@ -1792,7 +1792,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, ...@@ -1792,7 +1792,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
} }
// disable TMVP when current picture is the only ref picture // disable TMVP when current picture is the only ref picture
#if JVET_M0483_IBC
if (pcSlice->isIRAP() && pcSlice->getSPS()->getIBCFlag())
#else
if (pcSlice->isIRAP() && pcSlice->getSPS()->getSpsNext().getIBCMode()) if (pcSlice->isIRAP() && pcSlice->getSPS()->getSpsNext().getIBCMode())
#endif
{ {
pcSlice->setEnableTMVPFlag(0); pcSlice->setEnableTMVPFlag(0);
} }
......
...@@ -897,8 +897,11 @@ void EncLib::xInitSPS(SPS &sps) ...@@ -897,8 +897,11 @@ void EncLib::xInitSPS(SPS &sps)
#if JVET_M0246_AFFINE_AMVR #if JVET_M0246_AFFINE_AMVR
sps.setAffineAmvrEnabledFlag ( m_AffineAmvr ); sps.setAffineAmvrEnabledFlag ( m_AffineAmvr );
#endif #endif
sps.getSpsNext().setIBCMode ( m_IBCMode ); #if JVET_M0483_IBC
sps.setIBCFlag ( m_IBCMode);
#else
sps.getSpsNext().setIBCMode (m_IBCMode);
#endif
sps.setWrapAroundEnabledFlag ( m_wrapAround ); sps.setWrapAroundEnabledFlag ( m_wrapAround );
sps.setWrapAroundOffset ( m_wrapAroundOffset ); sps.setWrapAroundOffset ( m_wrapAroundOffset );
// ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here // ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here
......
...@@ -1126,7 +1126,11 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru ...@@ -1126,7 +1126,11 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
m_ComprCUCtxList.back().testModes.push_back( { ETM_IPCM, ETO_STANDARD, qp, lossless } ); m_ComprCUCtxList.back().testModes.push_back( { ETM_IPCM, ETO_STANDARD, qp, lossless } );
m_ComprCUCtxList.back().testModes.push_back( { ETM_INTRA, ETO_STANDARD, qp, lossless } ); m_ComprCUCtxList.back().testModes.push_back( { ETM_INTRA, ETO_STANDARD, qp, lossless } );
// add ibc mode to intra path // add ibc mode to intra path
#if JVET_M0483_IBC
if (cs.sps->getIBCFlag() && checkIbc)
#else
if (cs.sps->getSpsNext().getIBCMode() && checkIbc ) if (cs.sps->getSpsNext().getIBCMode() && checkIbc )
#endif
{ {
m_ComprCUCtxList.back().testModes.push_back({ ETM_IBC, ETO_STANDARD, qp, lossless }); m_ComprCUCtxList.back().testModes.push_back({ ETM_IBC, ETO_STANDARD, qp, lossless });
if (cs.chType == CHANNEL_TYPE_LUMA) if (cs.chType == CHANNEL_TYPE_LUMA)
...@@ -1292,7 +1296,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ...@@ -1292,7 +1296,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
} }
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (m_pcEncCfg->getUsePbIntraFast() && (!cs.slice->isIntra() || cs.slice->getSPS()->getSpsNext().getIBCMode()) && !interHadActive(cuECtx) && cuECtx.bestCU && !CU::isIntra(*cuECtx.bestCU)) if (m_pcEncCfg->getUsePbIntraFast() && (!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag()) && !interHadActive(cuECtx) && cuECtx.bestCU && !CU::isIntra(*cuECtx.bestCU))
#else #else
if( m_pcEncCfg->getUsePbIntraFast() && !cs.slice->isIntra() && !interHadActive( cuECtx ) && cuECtx.bestCU && CU::isInter( *cuECtx.bestCU ) ) if( m_pcEncCfg->getUsePbIntraFast() && !cs.slice->isIntra() && !interHadActive( cuECtx ) && cuECtx.bestCU && CU::isInter( *cuECtx.bestCU ) )
#endif #endif
...@@ -1301,7 +1305,11 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ...@@ -1301,7 +1305,11 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
} }
// INTRA MODES // INTRA MODES
#if JVET_M0483_IBC
if (cs.sps->getIBCFlag() && !cuECtx.bestTU)
#else
if (cs.sps->getSpsNext().getIBCMode() && !cuECtx.bestTU) if (cs.sps->getSpsNext().getIBCMode() && !cuECtx.bestTU)
#endif
return true; return true;
CHECK( !slice.isIntra() && !cuECtx.bestTU, "No possible non-intra encoding for a P- or B-slice found" ); CHECK( !slice.isIntra() && !cuECtx.bestTU, "No possible non-intra encoding for a P- or B-slice found" );
...@@ -1367,7 +1375,11 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ...@@ -1367,7 +1375,11 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
else if (encTestmode.type == ETM_IBC || encTestmode.type == ETM_IBC_MERGE) else if (encTestmode.type == ETM_IBC || encTestmode.type == ETM_IBC_MERGE)
{ {
// IBC MODES // IBC MODES
#if JVET_M0483_IBC
return sps.getIBCFlag() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE;
#else
return sps.getSpsNext().getIBCMode() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE; return sps.getSpsNext().getIBCMode() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE;
#endif
} }
else if( isModeInter( encTestmode ) ) else if( isModeInter( encTestmode ) )
{ {
...@@ -1434,7 +1446,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ...@@ -1434,7 +1446,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
int skipScore = 0; int skipScore = 0;
#if JVET_M0483_IBC #if JVET_M0483_IBC
if ((!slice.isIntra() || slice.getSPS()->getSpsNext().getIBCMode()) && cuECtx.get<bool>(IS_BEST_NOSPLIT_SKIP)) if ((!slice.isIntra() || slice.getSPS()->getIBCFlag()) && cuECtx.get<bool>(IS_BEST_NOSPLIT_SKIP))
#else #else
if( !slice.isIntra() && cuECtx.get<bool>( IS_BEST_NOSPLIT_SKIP ) ) if( !slice.isIntra() && cuECtx.get<bool>( IS_BEST_NOSPLIT_SKIP ) )
#endif #endif
...@@ -1533,8 +1545,8 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ...@@ -1533,8 +1545,8 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
unsigned height = partitioner.currArea().lumaSize().height; unsigned height = partitioner.currArea().lumaSize().height;
#if JVET_M0483_IBC #if JVET_M0483_IBC
if (bestCU && ((bestCU->btDepth == 0 && maxBTD >= ((slice.isIntra() && !slice.getSPS()->getSpsNext().getIBCMode()) ? 3 : 2)) if (bestCU && ((bestCU->btDepth == 0 && maxBTD >= ((slice.isIntra() && !slice.getSPS()->getIBCFlag()) ? 3 : 2))
|| (bestCU->btDepth == 1 && cuBR && cuBR->btDepth == 1 && maxBTD >= ((slice.isIntra() && !slice.getSPS()->getSpsNext().getIBCMode()) ? 4 : 3))) || (bestCU->btDepth == 1 && cuBR && cuBR->btDepth == 1 && maxBTD >= ((slice.isIntra() && !slice.getSPS()->getIBCFlag()) ? 4 : 3)))
&& (width <= MAX_TU_SIZE_FOR_PROFILE && height <= MAX_TU_SIZE_FOR_PROFILE) && (width <= MAX_TU_SIZE_FOR_PROFILE && height <= MAX_TU_SIZE_FOR_PROFILE)
&& cuECtx.get<bool>(DID_HORZ_SPLIT) && cuECtx.get<bool>(DID_VERT_SPLIT)) && cuECtx.get<bool>(DID_HORZ_SPLIT) && cuECtx.get<bool>(DID_VERT_SPLIT))
{ {
......
...@@ -537,7 +537,7 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr ...@@ -537,7 +537,7 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr
if(rpcSlice->getPPS()->getSliceChromaQpFlag()) if(rpcSlice->getPPS()->getSliceChromaQpFlag())
{ {
#if JVET_M0483_IBC #if JVET_M0483_IBC
const bool bUseIntraOrPeriodicOffset = (rpcSlice->isIntra() && !rpcSlice->getSPS()->getSpsNext().getIBCMode()) || (m_pcCfg->getSliceChromaOffsetQpPeriodicity() > 0 && (rpcSlice->getPOC() % m_pcCfg->getSliceChromaOffsetQpPeriodicity()) == 0); const bool bUseIntraOrPeriodicOffset = (rpcSlice->isIntra() && !rpcSlice->getSPS()->getIBCFlag()) || (m_pcCfg->getSliceChromaOffsetQpPeriodicity() > 0 && (rpcSlice->getPOC() % m_pcCfg->getSliceChromaOffsetQpPeriodicity()) == 0);
#else #else
const bool bUseIntraOrPeriodicOffset = rpcSlice->isIntra() || (m_pcCfg->getSliceChromaOffsetQpPeriodicity() > 0 && (rpcSlice->getPOC() % m_pcCfg->getSliceChromaOffsetQpPeriodicity()) == 0); const bool bUseIntraOrPeriodicOffset = rpcSlice->isIntra() || (m_pcCfg->getSliceChromaOffsetQpPeriodicity() > 0 && (rpcSlice->getPOC() % m_pcCfg->getSliceChromaOffsetQpPeriodicity()) == 0);
#endif #endif
...@@ -1485,7 +1485,11 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons ...@@ -1485,7 +1485,11 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
#endif #endif
#if JVET_M0255_FRACMMVD_SWITCH #if JVET_M0255_FRACMMVD_SWITCH