diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index a07b8c68ec324b180946bdf5a6209cebd66f4427..9f612133f1d550e92dde1dc48c166878b765e8ad 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -254,7 +254,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseMHIntra ( m_MHIntra ); m_cEncLib.setUseTriangle ( m_Triangle ); -#if JVET_L0293_CPR m_cEncLib.setCPRMode ( m_CPRMode ); m_cEncLib.setCPRLocalSearchRangeX ( m_CPRLocalSearchRangeX ); m_cEncLib.setCPRLocalSearchRangeY ( m_CPRLocalSearchRangeY ); @@ -262,7 +261,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setCPRHashSearchMaxCand ( m_CPRHashSearchMaxCand ); m_cEncLib.setCPRHashSearchRange4SmallBlk ( m_CPRHashSearchRange4SmallBlk ); m_cEncLib.setCPRFastMethod ( m_CPRFastMethod ); -#endif m_cEncLib.setUseWrapAround ( m_wrapAround ); m_cEncLib.setWrapAroundOffset ( m_wrapAroundOffset ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index b2d7b306d99fb13035b30013de0599d5a3e5c4f5..e3e1ccf91f775b6830527dfba303f3dabdce5d75 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -855,7 +855,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("MHIntra", m_MHIntra, false, "Enable MHIntra mode") ("Triangle", m_Triangle, false, "Enable triangular shape motion vector prediction (0:off, 1:on)") -#if JVET_L0293_CPR ( "CPR", m_CPRMode, 0u, "CPRMode (0x1:enabled, 0x0:disabled) [default: disabled]") ( "CPRLocalSearchRangeX", m_CPRLocalSearchRangeX, 128u, "Search range of CPR local search in x direction") ( "CPRLocalSearchRangeY", m_CPRLocalSearchRangeY, 128u, "Search range of CPR local search in y direction") @@ -863,7 +862,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ( "CPRHashSearchMaxCand", m_CPRHashSearchMaxCand, 256u, "Max candidates for hash based CPR search") ( "CPRHashSearchRange4SmallBlk", m_CPRHashSearchRange4SmallBlk, 256u, "Small block search range in based CPR search") ( "CPRFastMethod", m_CPRFastMethod, 6u, "Fast methods for CPR") -#endif ("WrapAround", m_wrapAround, false, "Enable horizontal wrap-around motion compensation for inter prediction (0:off, 1:on) [default: off]") ("WrapAroundOffset", m_wrapAroundOffset, 0u, "Offset in luma samples used for computing the horizontal wrap-around position") @@ -1927,9 +1925,7 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_DisableMotionCompression, "Disable motion data compression only allowed with NEXT profile" ); xConfirmPara( m_MTT, "Multi type tree is only allowed with NEXT profile" ); xConfirmPara( m_ImvMode, "IMV is only allowed with NEXT profile" ); -#if JVET_L0293_CPR xConfirmPara(m_CPRMode, "CPR Mode only allowed with NEXT profile"); -#endif xConfirmPara( m_useFastLCTU, "Fast large CTU can only be applied when encoding with NEXT profile" ); xConfirmPara( m_EMT, "EMT only allowed with NEXT profile" ); xConfirmPara( m_FastEMT, "EMT only allowed with NEXT profile" ); @@ -3125,9 +3121,7 @@ void EncAppCfg::xPrintParameter() msg(VERBOSE, "MHIntra:%d ", m_MHIntra); msg( VERBOSE, "Triangle:%d ", m_Triangle ); } -#if JVET_L0293_CPR msg(VERBOSE, "CPR:%d ", m_CPRMode); -#endif msg( VERBOSE, "WrapAround:%d ", m_wrapAround); if( m_wrapAround ) { diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index dc808d73f2615259906307a3af2b85611e3beba6..fcb4f64d83791875b938b0496cd6566b1e0fa55d 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -236,7 +236,6 @@ protected: bool m_Triangle; -#if JVET_L0293_CPR unsigned m_CPRMode; unsigned m_CPRLocalSearchRangeX; unsigned m_CPRLocalSearchRangeY; @@ -244,7 +243,6 @@ protected: unsigned m_CPRHashSearchMaxCand; unsigned m_CPRHashSearchRange4SmallBlk; unsigned m_CPRFastMethod; -#endif bool m_wrapAround; unsigned m_wrapAroundOffset; diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 0b8ebbdfaba3ca5779064bbb809ba5ac668c3edc..a091499a74d01ad297294af32bb0680cb4564d01 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -746,11 +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 JVET_L0293_CPR if (!subStruct.m_isTuEnc && (!slice->isIntra() && subStruct.chType != CHANNEL_TYPE_CHROMA)) -#else - if( !subStruct.m_isTuEnc && !slice->isIntra() ) -#endif { // copy motion buffer MotionBuf ownMB = getMotionBuf ( clippedArea ); @@ -1303,7 +1299,6 @@ const TransformUnit* CodingStructure::getTURestricted( const Position &pos, cons } } -#if JVET_L0293_CPR CprLumaCoverage CodingStructure::getCprLumaCoverage(const CompArea& chromaArea) const { CHECK(chType != CHANNEL_TYPE_CHROMA, "Error"); @@ -1337,4 +1332,3 @@ CprLumaCoverage CodingStructure::getCprLumaCoverage(const CompArea& chromaArea) return coverage; } -#endif diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index ce4209de8f762ad1c5523478b0d7e38318ab94a7..70d85fc9e8ea32d9e04bd58ef1102f2f9ba2bb7f 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -58,7 +58,6 @@ enum PictureType PIC_ORG_RESI, NUM_PIC_TYPES }; -#if JVET_L0293_CPR enum CprLumaCoverage { CPR_LUMA_COVERAGE_FULL = 0, @@ -66,7 +65,6 @@ enum CprLumaCoverage CPR_LUMA_COVERAGE_NONE, NUM_CPR_LUMA_COVERAGE, }; -#endif extern XUCache g_globalUnitCache; // --------------------------------------------------------------------------- @@ -85,9 +83,7 @@ public: Slice *slice; UnitScale unitScale[MAX_NUM_COMPONENT]; -#if JVET_L0293_CPR ChannelType chType; -#endif int baseQP; int prevQP[MAX_NUM_CHANNEL_TYPE]; @@ -158,9 +154,7 @@ public: cCUTraverser traverseCUs(const UnitArea& _unit, const ChannelType _chType) const; cPUTraverser traversePUs(const UnitArea& _unit, const ChannelType _chType) const; cTUTraverser traverseTUs(const UnitArea& _unit, const ChannelType _chType) const; -#if JVET_L0293_CPR CprLumaCoverage getCprLumaCoverage(const CompArea& chromaArea) const; -#endif // --------------------------------------------------------------------------- // encoding search utilities // --------------------------------------------------------------------------- diff --git a/source/Lib/CommonLib/Common.h b/source/Lib/CommonLib/Common.h index a7eb0aa09c2b97d6b385fedfc34b8ef50ab3ad29..629e2f35b8e465733ff18f09f18e5b35cfdc1fb3 100644 --- a/source/Lib/CommonLib/Common.h +++ b/source/Lib/CommonLib/Common.h @@ -114,7 +114,6 @@ struct UnitScale Size scale( const Size &size ) const { return { size.width >> posx, size.height >> posy }; } Area scale( const Area &_area ) const { return Area( scale( _area.pos() ), scale( _area.size() ) ); } }; -#if JVET_L0293_CPR namespace std { template <> @@ -135,7 +134,6 @@ namespace std } }; } -#endif inline size_t rsAddr(const Position &pos, const uint32_t stride, const UnitScale &unitScale ) { return (size_t)(stride >> unitScale.posx) * (size_t)(pos.y >> unitScale.posy) + (size_t)(pos.x >> unitScale.posx); diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 4b98c93b750024f1ae6482b01bb635874d9eda2a..426c1292b00315ed78788906d161e983a5f1b5de 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -390,14 +390,12 @@ static const int TRIANGLE_MAX_NUM_CANDS = 40; static const int TRIANGLE_MAX_NUM_SATD_CANDS = 3; static const int TRIANGLE_MIN_SIZE = 8 * 8; -#if JVET_L0293_CPR static const int CPR_MAX_CAND_SIZE = 16; // max block size for cpr search static const int CPR_NUM_CANDIDATES = 64; ///< Maximum number of candidates to store/test static const int CHROMA_REFINEMENT_CANDIDATES = 8; /// 8 candidates BV to choose from static const int CPR_FAST_METHOD_NOINTRA_CPRCBF0 = 0x01; static const int CPR_FAST_METHOD_BUFFERBV = 0X02; static const int CPR_FAST_METHOD_ADAPTIVE_SEARCHRANGE = 0X04; -#endif // ==================================================================================================================== // Macro functions diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index 0ab1c94a2f3dc8d4d07ca7d76e2f477eab66150e..c22aec80641fe8de82e1df45c4648260a70657eb 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -340,14 +340,12 @@ 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_L0293_CPR if (interDirNeighbours[candIdx] == 1 && pu.cs->slice->getRefPic(REF_PIC_LIST_0, mvFieldNeighbours[candIdx << 1].refIdx)->getPOC() == pu.cs->slice->getPOC()) { pu.cu->cpr = 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; } diff --git a/source/Lib/CommonLib/CprHashMap.cpp b/source/Lib/CommonLib/CprHashMap.cpp index 4c06d2037ac33987b984f7b97ef047fe1b9d4197..c066b7e54c0c32b702dcf93dbe63b56bc1594d63 100644 --- a/source/Lib/CommonLib/CprHashMap.cpp +++ b/source/Lib/CommonLib/CprHashMap.cpp @@ -298,11 +298,7 @@ bool CprHashMap::cprHashMatch(const Area& lumaArea, std::vector<Position>& cand, bool wholeBlockMatch = true; if (lumaArea.width > MIN_PU_SIZE || lumaArea.height > MIN_PU_SIZE) { -#if JVET_L0293_CPR if (!cs.isDecomp(bottomRight, cs.chType) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight) -#else - if (!cs.isDecomp(bottomRight, CHANNEL_TYPE_LUMA) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight) -#endif { continue; } @@ -317,11 +313,7 @@ bool CprHashMap::cprHashMatch(const Area& lumaArea, std::vector<Position>& cand, } else { -#if JVET_L0293_CPR if (abs(refBlockPos->x - lumaArea.x) > searchRange4SmallBlk || abs(refBlockPos->y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, cs.chType)) -#else - if (abs(refBlockPos->x - lumaArea.x) > searchRange4SmallBlk || abs(refBlockPos->y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, CHANNEL_TYPE_LUMA)) -#endif { continue; } diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 89e96c43ff2bc43c2348378c57e6ee18290e1301..6f67c4c152cc09c053494e8d2860a6d2c2af9c5a 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -344,7 +344,6 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R pu.cu->affine = isAffine; } -#if JVET_L0293_CPR void InterPrediction::xChromaMC(PredictionUnit &pu, PelUnitBuf& pcYuvPred) { // separated tree, chroma @@ -372,27 +371,22 @@ void InterPrediction::xChromaMC(PredictionUnit &pu, PelUnitBuf& pcYuvPred) } } } -#endif void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi , const bool& bioApplied -#if JVET_L0293_CPR , const bool luma, const bool chroma -#endif ) { const SPS &sps = *pu.cs->sps; int iRefIdx = pu.refIdx[eRefPicList]; Mv mv[3]; -#if JVET_L0293_CPR bool isCPR = false; if (pu.cs->slice->getRefPic(eRefPicList, iRefIdx)->getPOC() == pu.cs->slice->getPOC()) { isCPR = true; } -#endif if( pu.cu->affine ) { CHECK( iRefIdx < 0, "iRefIdx incorrect." ); @@ -414,12 +408,10 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& for( uint32_t comp = COMPONENT_Y; comp < pcYuvPred.bufs.size() && comp <= m_maxCompIDToPred; comp++ ) { const ComponentID compID = ComponentID( comp ); -#if JVET_L0293_CPR if (compID == COMPONENT_Y && !luma) continue; if (compID != COMPONENT_Y && !chroma) continue; -#endif if ( pu.cu->affine ) { CHECK( bioApplied, "BIO is not allowed with affine" ); @@ -429,9 +421,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& { xPredInterBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx ), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng( compID ) , bioApplied -#if JVET_L0293_CPR , isCPR -#endif ); } @@ -490,9 +480,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) { xPredInterUni ( pu, eRefPicList, pcMbBuf, true , bioApplied -#if JVET_L0293_CPR , true, true -#endif ); } else @@ -501,18 +489,14 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) { xPredInterUni ( pu, eRefPicList, pcMbBuf, true , bioApplied -#if JVET_L0293_CPR , true, true -#endif ); } else { xPredInterUni( pu, eRefPicList, pcMbBuf, pu.cu->triangle , bioApplied -#if JVET_L0293_CPR , true, true -#endif ); } } @@ -541,9 +525,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) void InterPrediction::xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng , const bool& bioApplied -#if JVET_L0293_CPR , bool isCPR -#endif ) { JVET_J0090_SET_REF_PICTURE( refPic, compID ); @@ -555,13 +537,11 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio int xFrac = _mv.hor & ((1 << shiftHor) - 1); int yFrac = _mv.ver & ((1 << shiftVer) - 1); -#if JVET_L0293_CPR if (isCPR) { xFrac = yFrac = 0; JVET_J0090_SET_CACHE_ENABLE( false ); } -#endif PelBuf &dstBuf = dstPic.bufs[compID]; unsigned width = dstBuf.width; @@ -634,9 +614,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio *pu.cs->sps ); xPredInterBlk( compID, pu, refPic, mvTemp, dstPic, bi, clpRng , false -#if JVET_L0293_CPR , false -#endif ); return; } @@ -1223,12 +1201,9 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB } void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBuf, const RefPicList &eRefPicList -#if JVET_L0293_CPR , const bool luma, const bool chroma -#endif ) { -#if JVET_L0293_CPR // dual tree handling for CPR as the only ref if (!luma || !chroma) { @@ -1246,7 +1221,6 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu } } // else, go with regular MC below -#endif CodingStructure &cs = *pu.cs; const PPS &pps = *cs.pps; const SliceType sliceType = cs.slice->getSliceType(); @@ -1257,9 +1231,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu { xPredInterUni ( pu, eRefPicList, predBuf, true , false -#if JVET_L0293_CPR , true, true -#endif ); xWeightedPredictionUni( pu, predBuf, eRefPicList, predBuf, -1, m_maxCompIDToPred ); } @@ -1267,19 +1239,13 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu { xPredInterUni( pu, eRefPicList, predBuf, false , false -#if JVET_L0293_CPR , true, true -#endif ); } } else { -#if JVET_L0293_CPR if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_CPR) -#else - if( pu.mergeType != MRG_TYPE_DEFAULT_N ) -#endif { xSubPuMC( pu, predBuf, eRefPicList ); } @@ -1287,9 +1253,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu { xPredInterUni( pu, REF_PIC_LIST_0, predBuf, false , false -#if JVET_L0293_CPR , true, true -#endif ); } else @@ -1301,33 +1265,25 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu } void InterPrediction::motionCompensation( CodingUnit &cu, const RefPicList &eRefPicList -#if JVET_L0293_CPR , const bool luma, const bool chroma -#endif ) { for( auto &pu : CU::traversePUs( cu ) ) { PelUnitBuf predBuf = cu.cs->getPredBuf( pu ); motionCompensation( pu, predBuf, eRefPicList -#if JVET_L0293_CPR , luma, chroma -#endif ); } } void InterPrediction::motionCompensation( PredictionUnit &pu, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/ -#if JVET_L0293_CPR , const bool luma, const bool chroma -#endif ) { PelUnitBuf predBuf = pu.cs->getPredBuf( pu ); motionCompensation( pu, predBuf, eRefPicList -#if JVET_L0293_CPR , luma, chroma -#endif ); } diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index 8f9169059ac7202b17400a17b64beb38ac46e735..f281f5976a0c846edb9ef7bc333b2fdc7efa5404 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -105,16 +105,12 @@ protected: void xPredInterUni ( const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi , const bool& bioApplied -#if JVET_L0293_CPR , const bool luma, const bool chroma -#endif ); void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred ); void xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng , const bool& bioApplied -#if JVET_L0293_CPR , bool isCPR -#endif ); void xAddBIOAvg4 (const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel*gradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng); @@ -133,9 +129,7 @@ protected: MotionInfo m_SubPuMiBuf[(MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1)]; -#if JVET_L0293_CPR void xChromaMC(PredictionUnit &pu, PelUnitBuf& pcYuvPred); -#endif #if JVET_J0090_MEMORY_BANDWITH_MEASURE CacheModel *m_cacheModel; #endif @@ -147,19 +141,13 @@ public: // inter void motionCompensation (PredictionUnit &pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X -#if JVET_L0293_CPR , const bool luma = true, const bool chroma = true -#endif ); void motionCompensation (PredictionUnit &pu, const RefPicList &eRefPicList = REF_PIC_LIST_X -#if JVET_L0293_CPR , const bool luma = true, const bool chroma = true -#endif ); void motionCompensation (CodingUnit &cu, const RefPicList &eRefPicList = REF_PIC_LIST_X -#if JVET_L0293_CPR , const bool luma = true, const bool chroma = true -#endif ); void motionCompensation4Triangle( CodingUnit &cu, MergeCtx &triangleMrgCtx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1 ); diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index 6ccf89d7e27a1a7c76f90f6cc1fb1c4a1e097871..be0f9d8ba81aacae99a0abd610b7a5d6eaa657b0 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -430,13 +430,9 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De const Slice& sliceQ = *cu.slice; const Position& cuPosLuma = cu.lumaPos(); -#if JVET_L0293_CPR int shiftHor = cu.Y().valid() ? 0 : ::getComponentScaleX(COMPONENT_Cb, cu.firstPU->chromaFormat); int shiftVer = cu.Y().valid() ? 0 : ::getComponentScaleY(COMPONENT_Cb, cu.firstPU->chromaFormat); const Position& posQ = Position{ localPos.x >> shiftHor, localPos.y >> shiftVer }; -#else - const Position& posQ = localPos; -#endif const Position posP = ( edgeDir == EDGE_VER ) ? posQ.offset( -1, 0 ) : posQ.offset( 0, -1 ); const bool sameCU = posP.x >= cuPosLuma.x && posP.y >= cuPosLuma.y; diff --git a/source/Lib/CommonLib/MotionInfo.h b/source/Lib/CommonLib/MotionInfo.h index ff40e1c4b606cc32a7889ac6679e61fadefc8ff1..e440585e3f4c7ba29f8c94eebcb3abc54140c7e5 100644 --- a/source/Lib/CommonLib/MotionInfo.h +++ b/source/Lib/CommonLib/MotionInfo.h @@ -106,9 +106,7 @@ struct MotionInfo Mv mv [ NUM_REF_PIC_LIST_01 ]; int16_t refIdx [ NUM_REF_PIC_LIST_01 ]; -#if JVET_L0293_CPR Mv bv; -#endif MotionInfo() : isInter( 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 ), interDir( 0 ), sliceIdx( 0 ), refIdx{ 0, 0 } { CHECKD( i != 0, "The argument for this constructor has to be '0'" ); } diff --git a/source/Lib/CommonLib/Mv.h b/source/Lib/CommonLib/Mv.h index edad592841da8db5f5bf3bb55bfb49627611b514..b18b3e4637a98955679bfb20acac35894e503a94 100644 --- a/source/Lib/CommonLib/Mv.h +++ b/source/Lib/CommonLib/Mv.h @@ -203,7 +203,6 @@ public: } };// END CLASS DEFINITION MV -#if JVET_L0293_CPR namespace std { template <> @@ -215,7 +214,6 @@ namespace std } }; }; -#endif void clipMv ( Mv& rcMv, const struct Position& pos, const struct Size& size, const class SPS& sps ); diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index cb68c9a0ba18aac3332b52f26f4d2ec4b2f77718..bc6fa9d084eab4bf791596b7585bffe22c2a9027 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -916,11 +916,7 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift; // QBits will be OK for any internal bit depth as the reduction in transform shift is balanced by an increase in Qp_per due to QpBDOffset -#if JVET_L0293_CPR const int iAdd = int64_t(bUseHalfRoundingPoint ? 256 : (tu.cs->slice->isIRAP() ? 171 : 85)) << int64_t(iQBits - 9); -#else - const int iAdd = int64_t(bUseHalfRoundingPoint ? 256 : (tu.cs->slice->getSliceType() == I_SLICE ? 171 : 85)) << int64_t(iQBits - 9); -#endif TCoeff transformedCoefficient; // transform-skip diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index 93203d162121e67cb1fc24e7ab01ea5915f15a2f..48909797bb665c375a0cf64fa43f07fa2cb5c780 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -114,15 +114,11 @@ private: // for motion cost Mv m_mvPredictor; -#if JVET_L0293_CPR Mv m_bvPredictors[2]; -#endif double m_motionLambda; int m_iCostScale; -#if JVET_L0293_CPR double m_dCost; // for cpr -#endif public: RdCost(); virtual ~RdCost(); @@ -166,7 +162,6 @@ public: } void setCostScale ( int iCostScale ) { m_iCostScale = iCostScale; } Distortion getCost ( uint32_t b ) { return Distortion( m_motionLambda * b ); } -#if JVET_L0293_CPR // for cpr void getMotionCost(int add, bool isTransquantBypass) { m_dCost = m_dLambdaMotionSAD[(isTransquantBypass && m_costMode == COST_MIXED_LOSSLESS_LOSSY_CODING) ? 1 : 0] + add; } @@ -270,7 +265,6 @@ public: return length; } -#endif #if ENABLE_SPLIT_PARALLELISM void copyState( const RdCost& other ); diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 5cbfbf9544fa432296a1ebe0b1dce30ba4d40e3a..4194e64d3cab4143cf572cdd874d58e52e337d4b 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -433,7 +433,6 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); } } -#if JVET_L0293_CPR if (getSPS()->getSpsNext().getCPRMode()) { RefPicSetLtCurr[NumPicLtCurr] = getPic(); @@ -441,7 +440,6 @@ 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]; @@ -454,13 +452,11 @@ 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_L0293_CPR if (getSPS()->getSpsNext().getCPRMode()) { CHECK(numPicTotalCurr != 1, "Invalid state"); } else -#endif CHECK(numPicTotalCurr != 0, "Invalid state"); } @@ -531,13 +527,11 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b m_bIsUsedAsLongTerm[REF_PIC_LIST_1][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 ); } } -#if JVET_L0293_CPR if (getSPS()->getSpsNext().getCPRMode()) { 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) @@ -568,13 +562,11 @@ int Slice::getNumRpsCurrTempList() const numRpsCurrTempList++; } } -#if JVET_L0293_CPR if (getSPS()->getSpsNext().getCPRMode()) { return numRpsCurrTempList + 1; } else -#endif return numRpsCurrTempList; } @@ -1800,9 +1792,7 @@ SPSNext::SPSNext( SPS& sps ) , m_ImvMode ( IMV_OFF ) , m_MTTMode ( 0 ) , m_compositeRefEnabled ( false ) -#if JVET_L0293_CPR , m_CPRMode ( 0 ) -#endif // ADD_NEW_TOOL : (sps extension) add tool enabling flags here (with "false" as default values) { } diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 072b9a75796b6cd7f918b65276461ec2a01bcd62..5f0d40e22a93daafc23804a5b0bf7093b09cfef6 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -853,9 +853,7 @@ private: bool m_compositeRefEnabled; //composite longterm reference -#if JVET_L0293_CPR unsigned m_CPRMode; -#endif // ADD_NEW_TOOL : (sps extension) add tool enabling flags and associated parameters here @@ -964,10 +962,8 @@ public: bool getUseMHIntra () const { return m_MHIntra; } void setUseTriangle ( bool b ) { m_Triangle = b; } bool getUseTriangle () const { return m_Triangle; } -#if JVET_L0293_CPR void setCPRMode (unsigned CPRMode) { m_CPRMode = CPRMode; } unsigned getCPRMode () const { return m_CPRMode; } -#endif // ADD_NEW_TOOL : (sps extension) add access functions for tool enabling flags and associated parameters here }; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 48adec29287f08b1ae7c83a1ab9bf4a6e9d76ae5..028e4a87e0df24ad0e03a87930be879880cd3705 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -88,7 +88,6 @@ -#define JVET_L0293_CPR 1 // current picture referencing or intra block copy mode #define JVET_L0362_QG_FIX 1 // QG is the node of qtDepth + mttDepth <= maxDqpDepth #define JVET_L0362_QG_FIX_CU_REUSE 1 // fix bug on encoder cu coding info reusing fast algorithm (i.e., reuse cu info when having the same neighbor and the same qp) @@ -884,9 +883,7 @@ enum MergeType { MRG_TYPE_DEFAULT_N = 0, // 0 MRG_TYPE_SUBPU_ATMVP, -#if JVET_L0293_CPR MRG_TYPE_CPR, -#endif NUM_MRG_TYPE // 5 }; diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index f3276234609bbddbe75d65011025c610e97a3ea3..907518890ad358a2249e6abeae46130b2f2648a9 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -270,9 +270,7 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) GBiIdx = other.GBiIdx; for (int i = 0; i<2; i++) refIdxBi[i] = other.refIdxBi[i]; -#if JVET_L0293_CPR cpr = other.cpr; -#endif return *this; } @@ -303,9 +301,7 @@ void CodingUnit::initData() GBiIdx = GBI_DEFAULT; for (int i = 0; i < 2; i++) refIdxBi[i] = -1; -#if JVET_L0293_CPR cpr = false; -#endif } @@ -330,10 +326,8 @@ void PredictionUnit::initData() mmvdMergeIdx = MAX_UINT; interDir = MAX_UCHAR; mergeType = MRG_TYPE_DEFAULT_N; -#if JVET_L0293_CPR bv.setZero(); bvd.setZero(); -#endif for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++) { mvpIdx[i] = MAX_UCHAR; @@ -372,10 +366,8 @@ PredictionUnit& PredictionUnit::operator=(const InterPredictionData& predData) mmvdMergeIdx = predData.mmvdMergeIdx; interDir = predData.interDir; mergeType = predData.mergeType; -#if JVET_L0293_CPR bv = predData.bv; bvd = predData.bvd; -#endif for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++) { mvpIdx[i] = predData.mvpIdx[i]; @@ -411,10 +403,8 @@ PredictionUnit& PredictionUnit::operator=( const PredictionUnit& other ) mmvdMergeIdx = other.mmvdMergeIdx; interDir = other.interDir; mergeType = other.mergeType; -#if JVET_L0293_CPR bv = other.bv; bvd = other.bvd; -#endif for (uint32_t i = 0; i < NUM_REF_PIC_LIST_01; i++) { mvpIdx[i] = other.mvpIdx[i]; diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index dd5e089da1796f650da38f8410ab138f7f611e9d..e3ebe4dce19ba75ff900c624a2807ecef28f60cf 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -310,9 +310,7 @@ struct CodingUnit : public UnitArea int refIdxBi[2]; // needed for fast imv mode decisions int8_t imvNumCand; -#if JVET_L0293_CPR bool cpr; -#endif CodingUnit() : chType( CH_L ) { } CodingUnit(const UnitArea &unit); @@ -363,10 +361,8 @@ struct InterPredictionData Mv mvdAffi [NUM_REF_PIC_LIST_01][3]; Mv mvAffi[NUM_REF_PIC_LIST_01][3]; bool mhIntraFlag; -#if JVET_L0293_CPR Mv bv; // block vector for CPR Mv bvd; // block vector difference for CPR -#endif }; struct PredictionUnit : public UnitArea, public IntraPredictionData, public InterPredictionData diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index c3d030d76f3c451b0391016eb2b034ab7583c040..923412677d77bbd2b7a59e82b829a7ff1a4cf060 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -719,22 +719,16 @@ 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 , 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 , int mmvdList -#endif ) #endif { -#if JVET_L0293_CPR int mrgCandIdxCPR = mrgCandIdx; -#endif MotionInfo miNeighbor; bool hasPruned[MRG_MAX_NUM_CANDS]; memset(hasPruned, 0, MRG_MAX_NUM_CANDS * sizeof(bool)); @@ -757,7 +751,6 @@ bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter #if !JVET_L0090_PAIR_AVG isCandInter[cnt] = true; #endif -#if JVET_L0293_CPR if (miNeighbor.interDir == 1 && slice.getRefPic(REF_PIC_LIST_0, miNeighbor.refIdx[0])->getPOC() == slice.getPOC()) { mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; @@ -765,9 +758,6 @@ bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter mrgCandIdxCPR++; } if (mrgCandIdxCPR == cnt && canFastExit) -#else - if (mrgCandIdx == cnt && canFastExit) -#endif { return true; } @@ -813,9 +803,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, int cnt = 0; -#if JVET_L0293_CPR int mrgCandIdxCPR = mrgCandIdx; -#endif const Position posLT = pu.Y().topLeft(); const Position posRT = pu.Y().topRight(); @@ -840,27 +828,19 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miLeft.interDir; mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puLeft->cu->GBiIdx : GBI_DEFAULT; // get Mv from Left -#if JVET_L0293_CPR if (puLeft->cu->cpr) { mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; -#if JVET_L0293_CPR if (mmvdList != 0 && mrgCandIdx != -1) mrgCandIdxCPR++; -#endif } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miLeft.mv[0], miLeft.refIdx[0]); if (slice.isInterB()) { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miLeft.mv[1], miLeft.refIdx[1]); } -#if JVET_L0293_CPR if (mrgCandIdxCPR == cnt && canFastExit) -#else - if( mrgCandIdx == cnt && canFastExit ) -#endif { return; } @@ -894,27 +874,19 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miAbove.interDir; // get Mv from Above mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAbove->cu->GBiIdx : GBI_DEFAULT; -#if JVET_L0293_CPR if (puAbove->cu->cpr) { mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; -#if JVET_L0293_CPR if (mmvdList != 0 && mrgCandIdx != -1) mrgCandIdxCPR++; -#endif } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] ); if( slice.isInterB() ) { mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAbove.mv[1], miAbove.refIdx[1] ); } -#if JVET_L0293_CPR if (mrgCandIdxCPR == cnt && canFastExit) -#else - if( mrgCandIdx == cnt && canFastExit ) -#endif { return; } @@ -952,16 +924,12 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miAboveRight.interDir; // get Mv from Above-right mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAboveRight->cu->GBiIdx : GBI_DEFAULT; -#if JVET_L0293_CPR if (puAboveRight->cu->cpr) { mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; -#if JVET_L0293_CPR if (mmvdList != 0 && mrgCandIdx != -1) mrgCandIdxCPR++; -#endif } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] ); if( slice.isInterB() ) @@ -969,11 +937,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 if (mrgCandIdxCPR == cnt && canFastExit) -#else - if( mrgCandIdx == cnt && canFastExit ) -#endif { return; } @@ -1010,16 +974,12 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miBelowLeft.interDir; mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puLeftBottom->cu->GBiIdx : GBI_DEFAULT; // get Mv from Bottom-Left -#if JVET_L0293_CPR if (puLeftBottom->cu->cpr) { mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; -#if JVET_L0293_CPR if (mmvdList != 0 && mrgCandIdx != -1) mrgCandIdxCPR++; -#endif } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] ); if( slice.isInterB() ) @@ -1027,11 +987,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 if (mrgCandIdxCPR == cnt && canFastExit) -#else - if( mrgCandIdx == cnt && canFastExit ) -#endif { return; } @@ -1071,16 +1027,12 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.interDirNeighbours[cnt] = miAboveLeft.interDir; mrgCtx.GBiIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAboveLeft->cu->GBiIdx : GBI_DEFAULT; // get Mv from Above-Left -#if JVET_L0293_CPR if (puAboveLeft->cu->cpr) { mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; -#if JVET_L0293_CPR if (mmvdList != 0 && mrgCandIdx != -1) mrgCandIdxCPR++; -#endif } -#endif mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveLeft.mv[0], miAboveLeft.refIdx[0] ); if( slice.isInterB() ) @@ -1088,11 +1040,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 if (mrgCandIdxCPR == cnt && canFastExit) -#else - if( mrgCandIdx == cnt && canFastExit ) -#endif { return; } @@ -1194,11 +1142,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, isCandInter [uiArrayAddr] = true; #endif mrgCtx.GBiIdx[uiArrayAddr] = GBI_DEFAULT; -#if JVET_L0293_CPR if (mrgCandIdxCPR == cnt && canFastExit) -#else - if( mrgCandIdx == cnt && canFastExit ) -#endif { return; } @@ -1221,27 +1165,15 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, unsigned subPuMvpPos = 0; #if JVET_L0090_PAIR_AVG bool bFound = addMergeHMVPCand(slice, mrgCtx, canFastExit -#if JVET_L0293_CPR , (mmvdList != 0 && mrgCandIdx != -1) ? (const int) mrgCandIdxCPR : mrgCandIdx -#else - , mrgCandIdx -#endif , maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos -#if JVET_L0293_CPR , mmvdList -#endif ); #else bool bFound = addMergeHMVPCand(slice, mrgCtx, isCandInter, canFastExit -#if JVET_L0293_CPR , (mmvdList != 0 && mrgCandIdx != -1) ? (const int)mrgCandIdxCPR : mrgCandIdx -#else - , mrgCandIdx -#endif , maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos -#if JVET_L0293_CPR , mmvdList -#endif ); #endif if (bFound) @@ -1267,7 +1199,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[cnt * 2 + 1].setMvField( Mv( 0, 0 ), NOT_VALID ); // calculate average MV for L0 and L1 seperately unsigned char interDir = 0; -#if JVET_L0293_CPR // skip when one is BV and one is MV @@ -1275,7 +1206,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { continue; } -#endif for( int refListId = 0; refListId < (slice.isInterB() ? 2 : 1); refListId++ ) { const short refIdxI = mrgCtx.mvFieldNeighbours[i * 2 + refListId].refIdx; @@ -1299,7 +1229,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, avgMv += MvJ; avgMv.setHor( avgMv.getHor() / 2 ); avgMv.setVer( avgMv.getVer() / 2 ); -#if JVET_L0293_CPR @@ -1309,7 +1238,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, avgMv.setHor((avgMv.getHor() / 16) << 4); avgMv.setVer((avgMv.getVer() / 16) << 4); } -#endif mrgCtx.mvFieldNeighbours[cnt * 2 + refListId].setMvField( avgMv, refIdxI ); } @@ -1406,12 +1334,10 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours [(uiArrayAddr << 1) + 1].setMvField(Mv(0, 0), r); } -#if JVET_L0293_CPR if ( mrgCtx.interDirNeighbours[uiArrayAddr] == 1 && pu.cs->slice->getRefPic(REF_PIC_LIST_0, mrgCtx.mvFieldNeighbours[uiArrayAddr << 1].refIdx)->getPOC() == pu.cs->slice->getPOC()) { mrgCtx.mrgTypeNeighbours[uiArrayAddr] = MRG_TYPE_CPR; } -#endif uiArrayAddr++; @@ -1427,7 +1353,6 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, } mrgCtx.numValidMergeCand = uiArrayAddr; } -#if JVET_L0293_CPR // for cpr pu validation bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, int height, int picWidth, int picHeight, int xStartInCU, int yStartInCU, int xBv, int yBv, int ctuSize) { @@ -1491,7 +1416,6 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i return false; }// for cpr pu validation -#endif static int xGetDistScaleFactor(const int &iCurrPOC, const int &iCurrRefPOC, const int &iColPOC, const int &iColRefPOC) { @@ -1588,12 +1512,10 @@ bool PU::getColocatedMVP(const PredictionUnit &pu, const RefPicList &eRefPicList { return false; } -#if JVET_L0293_CPR if (eRefPicList == REF_PIC_LIST_0 && pu.cs->slice->getRefPic(eRefPicList, refIdx)->getPOC() == pu.cs->slice->getPOC()) { return false; } -#endif int iColRefIdx = mi.refIdx[eColRefPicList]; if (iColRefIdx < 0) @@ -1680,7 +1602,6 @@ bool PU::isDiffMER(const PredictionUnit &pu1, const PredictionUnit &pu2) return false; } -#if JVET_L0293_CPR void PU::getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) { @@ -1780,7 +1701,6 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) } return isCPR; } -#endif // CPR /** Constructs a list of candidates for AMVP (See specification, section "Derivation process for motion vector predictor candidates") * \param uiPartIdx * \param uiPartAddr @@ -2724,17 +2644,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx affMrgCtx.numValidMergeCand = 0; affMrgCtx.maxNumMergeCand = maxNumAffineMergeCand; -#if JVET_L0293_CPR bool enableSubPuMvp = slice.getSPS()->getSpsNext().getUseSubPuMvp() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP()); -#else - bool enableSubPuMvp = slice.getSPS()->getSpsNext().getUseSubPuMvp(); -#endif bool isAvailableSubPu = false; if ( enableSubPuMvp && slice.getEnableTMVPFlag() ) { -#if JVET_L0293_CPR int cntCPR = 0; -#endif MergeCtx mrgCtx = *affMrgCtx.mrgCtx; bool tmpLICFlag = false; @@ -2757,12 +2671,10 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx mrgCtx.interDirNeighbours[pos] = miLeft.interDir; // get Mv from Left -#if JVET_L0293_CPR if (puLeft->cu->cpr) { cntCPR++; } -#endif mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miLeft.mv[0], miLeft.refIdx[0] ); if ( slice.isInterB() ) @@ -2784,12 +2696,10 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx // get Inter Dir mrgCtx.interDirNeighbours[pos] = miAbove.interDir; // get Mv from Left -#if JVET_L0293_CPR if (puAbove->cu->cpr) { cntCPR++; } -#endif mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] ); if ( slice.isInterB() ) @@ -2817,12 +2727,10 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx // get Inter Dir mrgCtx.interDirNeighbours[pos] = miAboveRight.interDir; // get Mv from Left -#if JVET_L0293_CPR if (puAboveRight->cu->cpr) { cntCPR++; } -#endif mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] ); if ( slice.isInterB() ) @@ -2850,12 +2758,10 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx // get Inter Dir mrgCtx.interDirNeighbours[pos] = miBelowLeft.interDir; // get Mv from Bottom-Left -#if JVET_L0293_CPR if (puLeftBottom->cu->cpr) { cntCPR++; } -#endif mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] ); if ( slice.isInterB() ) @@ -2869,9 +2775,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx isAvailableSubPu = getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, pos , 0 -#if JVET_L0293_CPR , cntCPR -#endif ); if ( isAvailableSubPu ) { @@ -2959,9 +2863,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx const PredictionUnit* puNeigh = cs.getPURestricted( pos, pu, pu.chType ); if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_L0293_CPR && !puNeigh->cu->cpr -#endif ) { isAvailable[0] = true; @@ -2979,9 +2881,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_L0293_CPR && !puNeigh->cu->cpr -#endif ) { isAvailable[1] = true; @@ -2999,9 +2899,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh && CU::isInter( *puNeigh->cu ) -#if JVET_L0293_CPR && !puNeigh->cu->cpr -#endif ) { isAvailable[2] = true; @@ -3260,10 +3158,8 @@ static bool deriveScaledMotionTemporal( const Slice& slice, { iColPOC = pColSlice->getPOC(); iColRefPOC = pColSlice->getRefPOC(eColRefPicList, iColRefIdx); -#if JVET_L0293_CPR if (iColPOC == iColRefPOC) return false; -#endif /////////////////////////////////////////////////////////////// // Set the target reference index to 0, may be changed later // /////////////////////////////////////////////////////////////// @@ -3313,15 +3209,11 @@ void clipColPos(int& posX, int& posY, const PredictionUnit& pu) bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, bool& LICFlag, const int count , int mmvdList -#if JVET_L0293_CPR , const int countCPR -#endif ) { -#if JVET_L0293_CPR if (count == countCPR && pu.cs->slice->getSPS()->getSpsNext().getCPRMode()) return false; -#endif const Slice &slice = *pu.cs->slice; const unsigned scale = 4 * std::max<int>(1, 4 * AMVP_DECIMATION_FACTOR / 4); const unsigned mask = ~(scale - 1); @@ -3350,13 +3242,11 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b for (int uiN = 0; uiN < count && !terminate; uiN++) { RefPicList currRefPicList = RefPicList(slice.getCheckLDC() ? (slice.getColFromL0Flag() ? currRefListId : 1 - currRefListId) : currRefListId); -#if JVET_L0293_CPR //if (mrgCtx.mrgTypeNeighbours[uiN] == MRG_TYPE_CPR) if (((mrgCtx.interDirNeighbours[uiN] == 1) || (mrgCtx.interDirNeighbours[uiN] == 3)) && slice.getRefPic(REF_PIC_LIST_0, mrgCtx.mvFieldNeighbours[uiN << 1].refIdx)->getPOC() == slice.getPOC()) { continue; } -#endif if ((mrgCtx.interDirNeighbours[uiN] & (1 << currRefPicList)) && slice.getRefPic(currRefPicList, mrgCtx.mvFieldNeighbours[uiN * 2 + currRefPicList].refIdx) == pColPic) { cTMv = mrgCtx.mvFieldNeighbours[uiN * 2 + currRefPicList].mv; @@ -3464,11 +3354,7 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b mi.isInter = true; mi.sliceIdx = slice.getIndependentSliceIdx(); -#if JVET_L0293_CPR if (colMi.isInter && !((colMi.interDir == 1 || colMi.interDir == 3) && (pColPic->cs->slice->getRefPOC(REF_PIC_LIST_0, colMi.refIdx[0]) == pColPic->cs->slice->getPOC()) && pu.cs->sps->getSpsNext().getCPRMode())) -#else - if (colMi.isInter) -#endif { for (unsigned currRefListId = 0; currRefListId < (bBSlice ? 2 : 1); currRefListId++) { @@ -3510,9 +3396,7 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) MotionBuf mb = pu.getMotionBuf(); if( !pu.mergeFlag || pu.mergeType == MRG_TYPE_DEFAULT_N -#if JVET_L0293_CPR || pu.mergeType == MRG_TYPE_CPR -#endif ) { MotionInfo mi; @@ -3529,12 +3413,10 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) mi.mv[i] = pu.mv[i]; mi.refIdx[i] = pu.refIdx[i]; } -#if JVET_L0293_CPR if (pu.interDir == 1 && pu.cu->slice->getRefPOC(REF_PIC_LIST_0, pu.refIdx[0]) == pu.cu->slice->getPOC()) { mi.bv = pu.bv; } -#endif } if( pu.cu->affine ) @@ -3604,12 +3486,10 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP pu.mvpIdx[0] = mvp_idx; pu.mv [0] = amvpInfo.mvCand[mvp_idx] + pu.mvd[0]; pu.mv[0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); -#if JVET_L0293_CPR if (pu.interDir == 1 && pu.cs->slice->getRefPic(REF_PIC_LIST_0, pu.refIdx[REF_PIC_LIST_0])->getPOC() == pu.cs->slice->getPOC()) { pu.cu->cpr = true; } -#endif } if (pu.interDir != 1 /* PRED_L0 */) @@ -3703,9 +3583,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl //left const PredictionUnit* puLeft = cs.getPURestricted( posLB.offset( -1, 0 ), pu, pu.chType ); const bool isAvailableA1 = puLeft && isDiffMER( pu, *puLeft ) && pu.cu != puLeft->cu && CU::isInter( *puLeft->cu ) -#if JVET_L0293_CPR && !puLeft->cu->cpr -#endif ; if( isAvailableA1 ) { @@ -3722,9 +3600,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl // above const PredictionUnit *puAbove = cs.getPURestricted( posRT.offset( 0, -1 ), pu, pu.chType ); bool isAvailableB1 = puAbove && isDiffMER( pu, *puAbove ) && pu.cu != puAbove->cu && CU::isInter( *puAbove->cu ) -#if JVET_L0293_CPR && !puAbove->cu->cpr -#endif ; if( isAvailableB1 ) { @@ -3745,9 +3621,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl // above right const PredictionUnit *puAboveRight = cs.getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType ); bool isAvailableB0 = puAboveRight && isDiffMER( pu, *puAboveRight ) && CU::isInter( *puAboveRight->cu ) -#if JVET_L0293_CPR && !puAboveRight->cu->cpr -#endif ; if( isAvailableB0 ) @@ -3769,9 +3643,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl //left bottom const PredictionUnit *puLeftBottom = cs.getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType ); bool isAvailableA0 = puLeftBottom && isDiffMER( pu, *puLeftBottom ) && CU::isInter( *puLeftBottom->cu ) -#if JVET_L0293_CPR && !puLeftBottom->cu->cpr -#endif ; if( isAvailableA0 ) { @@ -3792,9 +3664,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl // above left const PredictionUnit *puAboveLeft = cs.getPURestricted( posLT.offset( -1, -1 ), pu, pu.chType ); bool isAvailableB2 = puAboveLeft && isDiffMER( pu, *puAboveLeft ) && CU::isInter( *puAboveLeft->cu ) -#if JVET_L0293_CPR && !puAboveLeft->cu->cpr -#endif ; if( isAvailableB2 ) diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index 299015b8080e8337c1d9b5d930c9b4ffdac8e5ea..6024678117f162e15d6bb08fd661344842835d62 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -123,15 +123,11 @@ 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 , 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 , int mmvdList -#endif ); #endif void addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const RefPicList eRefPicList2nd, const int currRefPOC, AMVPInfo &info, uint8_t imv); @@ -147,9 +143,7 @@ namespace PU ); bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count , int mmvdList -#if JVET_L0293_CPR , const int countCPR -#endif ); bool getInterMergeSubPuRecurCand(const PredictionUnit &pu, MergeCtx &mrgCtx, const int count); bool isBiPredFromDifferentDir (const PredictionUnit &pu); @@ -165,11 +159,9 @@ namespace PU bool getTriangleWeights (const PredictionUnit &pu, MergeCtx &triangleMrgCtx, const uint8_t candIdx0, const uint8_t candIdx1); void spanTriangleMotionInfo ( PredictionUnit &pu, MergeCtx &triangleMrgCtx, const uint8_t mergeIdx, const bool splitDir, const uint8_t candIdx0, const uint8_t candIdx1); int32_t mappingRefPic (const PredictionUnit &pu, int32_t refPicPoc, bool targetRefPicList); -#if JVET_L0293_CPR void getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred); bool getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv); bool isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, int height, int picWidth, int picHeight, int xStartInCU, int yStartInCU, int xBv, int yBv, int ctuSize); -#endif } // TU tools diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index 1a61e4ea847d4aae97a77bf1d0d43a2dff6dd90d..abb7ee07365151f5aff5f23acbb81bf02d3a21a4 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -668,9 +668,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IMVMode), cu.imv); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::RootCbf), cu.rootCbf); DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::GBIIndex), cu.GBiIdx); -#if JVET_L0293_CPR DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::CPRFlag), cu.cpr); -#endif } break; @@ -765,11 +763,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::TransQuantBypassFlag), cu.transQuantBypass); } // skip flag -#if JVET_L0293_CPR if (!cs.slice->isIntra() && cu.Y().valid()) -#else - if( !cs.slice->isIntra() ) -#endif { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::SkipFlag), cu.skip); if (cu.skip) diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index a6b423170041dac5ab56394e7d0e87942701eb9a..c3722dfc982265f92597a94bb7cdee2d2e898010 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -108,9 +108,7 @@ enum class BlockStatistic { TriangleMVL0, //<< currently only uni-prediction enabled TriangleMVL1, //<< currently only uni-prediction enabled GBIIndex, -#if JVET_L0293_CPR CPRFlag, -#endif // for dual tree // general Depth_Chroma, @@ -194,9 +192,7 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::TriangleMVL0, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL0", BlockStatisticType::VectorPolygon, "Scale: 4"}}, { BlockStatistic::TriangleMVL1, std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL1", BlockStatisticType::VectorPolygon, "Scale: 4"}}, { BlockStatistic::GBIIndex, std::tuple<std::string, BlockStatisticType, std::string>{"GBIIndex", BlockStatisticType::Integer, "[0, 4]"}}, -#if JVET_L0293_CPR { BlockStatistic::CPRFlag, std::tuple<std::string, BlockStatisticType, std::string>{"CPRFlag", BlockStatisticType::Flag, ""}}, -#endif // for dual tree { BlockStatistic::Depth_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"Depth_Chroma", BlockStatisticType::Integer, "[0, 10]"}}, // todo: actual limits? { BlockStatistic::QT_Depth_Chroma, std::tuple<std::string, BlockStatisticType, std::string>{"QT_Depth_Chroma", BlockStatisticType::Integer, "[0, 10]"}}, // todo: actual limits? diff --git a/source/Lib/CommonLib/x86/InitX86.cpp b/source/Lib/CommonLib/x86/InitX86.cpp index e01e83326d89f768fcbfb03ec839088043593093..915b381c6fe0c3a101990dd96cbee2852126f604 100644 --- a/source/Lib/CommonLib/x86/InitX86.cpp +++ b/source/Lib/CommonLib/x86/InitX86.cpp @@ -48,9 +48,7 @@ #include "CommonLib/AdaptiveLoopFilter.h" -#if JVET_L0293_CPR #include "CommonLib/CprHashMap.h" -#endif #ifdef TARGET_SIMD_X86 diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 22760912905ead2f57d96882abe641e5315b03fb..62cda7cdc54f033cd73a582eb985c1435f51bd17 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -682,9 +682,7 @@ bool CABACReader::split_cu_flag( CodingStructure& cs, Partitioner &partitioner ) bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& cuCtx ) { CodingStructure& cs = *cu.cs; -#if JVET_L0293_CPR cs.chType = partitioner.chType; -#endif // transquant bypass flag if( cs.pps->getTransquantBypassEnabledFlag() ) { @@ -692,11 +690,7 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& } // skip flag -#if JVET_L0293_CPR if (!cs.slice->isIntra() && cu.Y().valid()) -#else - if( !cs.slice->isIntra() ) -#endif { cu_skip_flag( cu ); } @@ -790,11 +784,9 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) unsigned value = 0; unsigned ctxId = DeriveCtx::CtxIMVFlag( cu ); -#if JVET_L0293_CPR 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 CPR block value = 1; else -#endif value = m_BinDecoder.decodeBin( Ctx::ImvFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, ctxId ); @@ -844,14 +836,12 @@ void CABACReader::cu_pred_data( CodingUnit &cu ) intra_chroma_pred_modes( cu ); return; } -#if JVET_L0293_CPR if (!cu.Y().valid()) // dual tree chroma CU { cu.predMode = MODE_INTER; cu.cpr = true; return; } -#endif MergeCtx mrgCtx; for( auto &pu : CU::traversePUs( cu ) ) diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 3d6486882a0676acd0304a158479ebebb2cb6bd4..4a91ce6a835be06e791d30d3b1b331927cdcf3a3 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -89,19 +89,14 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, chType ), chType ) ) { -#if JVET_L0293_CPR cs.chType = chType; if (currCU.predMode != MODE_INTRA && currCU.Y().valid()) { xDeriveCUMV(currCU); } -#endif switch( currCU.predMode ) { case MODE_INTER: -#if !JVET_L0293_CPR - xDeriveCUMV( currCU ); -#endif xReconInter( currCU ); break; case MODE_INTRA: @@ -341,7 +336,6 @@ void DecCu::xReconInter(CodingUnit &cu) m_pcIntraPred->geneIntrainterPred(cu); // inter prediction -#if JVET_L0293_CPR CHECK(cu.cpr && cu.firstPU->mhIntraFlag, "CPR and MHIntra cannot be used together"); CHECK(cu.cpr && cu.affine, "CPR and Affine cannot be used together"); CHECK(cu.cpr && cu.triangle, "CPR and triangle cannot be used together"); @@ -356,13 +350,8 @@ void DecCu::xReconInter(CodingUnit &cu) { m_pcInterPred->motionCompensation(cu, REF_PIC_LIST_0, luma, chroma); } -#else - m_pcInterPred->motionCompensation( cu ); -#endif } -#if JVET_L0293_CPR if (cu.Y().valid()) -#endif cu.slice->updateMotionLUTs(cu.slice->getMotionLUTs(), cu); if (cu.firstPU->mhIntraFlag) @@ -599,7 +588,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) AMVPInfo amvpInfo; PU::fillMvpCand(pu, eRefList, pu.refIdx[eRefList], amvpInfo); pu.mvpNum [eRefList] = amvpInfo.numCand; -#if JVET_L0293_CPR Mv mvd = pu.mvd[eRefList]; if (eRefList == REF_PIC_LIST_0 && pu.cs->slice->getRefPic(eRefList, pu.refIdx[eRefList])->getPOC() == pu.cs->slice->getPOC()) { @@ -610,9 +598,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) mvd.changePrecision(MV_PRECISION_INT, MV_PRECISION_QUARTER); } pu.mv [eRefList] = amvpInfo.mvCand[pu.mvpIdx[eRefList]] + mvd; -#else - pu.mv [eRefList] = amvpInfo.mvCand[pu.mvpIdx [eRefList]] + pu.mvd[eRefList]; -#endif pu.mv[eRefList].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); } } diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index c3f1ff4ec65bb3b2b473820af64b6f79044cba2a..65be7a97e1af59d251144d955100255fdf2af758 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1150,24 +1150,20 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } #endif -#if JVET_L0293_CPR if (pcSlice->getSPS()->getSpsNext().getCPRMode() && pcSlice->getEnableTMVPFlag()) { CHECK(pcSlice->getRefPic(RefPicList(pcSlice->isInterB() ? 1 - pcSlice->getColFromL0Flag() : 0), pcSlice->getColRefIdx())->getPOC() == pcSlice->getPOC(), "curr ref picture cannot be collocated picture"); } -#endif // Decode a picture m_cSliceDecoder.decompressSlice( pcSlice, &(nalu.getBitstream()) ); m_bFirstSliceInPicture = false; -#if JVET_L0293_CPR if (pcSlice->getSPS()->getSpsNext().getCPRMode()) { pcSlice->getPic()->longTerm = false; } -#endif m_uiSliceSegmentIdx++; return false; diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index c1cb1f8c91295d79bc7981e51013597b108763b7..2a237b2d1c5d0ab190c96c297b5be578d4e03ec6 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -802,9 +802,7 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) READ_FLAG( symbol, "affine_type_flag" ); spsNext.setUseAffineType ( symbol != 0 ); } READ_FLAG( symbol, "gbi_flag" ); spsNext.setUseGBi ( symbol != 0 ); -#if JVET_L0293_CPR READ_FLAG( symbol, "cpr_flag"); spsNext.setCPRMode ( symbol != 0 ); -#endif 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)" ); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index c12e239e29152e7bcf1407005e0bb4fdd5038308..d17e1f58e67e73ac772942ab822993aa79b10a1a 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -600,9 +600,7 @@ void CABACWriter::split_cu_mode_mt(const PartSplit split, const CodingStructure& void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, CUCtx& cuCtx ) { CodingStructure& cs = *cu.cs; -#if JVET_L0293_CPR cs.chType = partitioner.chType; -#endif // transquant bypass flag if( cs.pps->getTransquantBypassEnabledFlag() ) { @@ -610,11 +608,7 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C } // skip flag -#if JVET_L0293_CPR if (!cs.slice->isIntra() && cu.Y().valid()) -#else - if( !cs.slice->isIntra() ) -#endif { cu_skip_flag( cu ); } @@ -717,12 +711,10 @@ void CABACWriter::cu_pred_data( const CodingUnit& cu ) intra_chroma_pred_modes( cu ); return; } -#if JVET_L0293_CPR if (!cu.Y().valid()) // dual tree chroma CU { return; } -#endif for( auto &pu : CU::traversePUs( cu ) ) { prediction_unit( pu ); @@ -1329,9 +1321,7 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) } unsigned ctxId = DeriveCtx::CtxIMVFlag( cu ); -#if JVET_L0293_CPR 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 CPR block -#endif m_BinEncoder.encodeBin( ( cu.imv > 0 ), Ctx::ImvFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", (cu.imv > 0), ctxId ); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 77a2b1081472e50c3c4283c3ace2a60e1a4b3dbf..f7ff774ad8c349fce6127f27f9249928eb9d5bb9 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -237,7 +237,6 @@ protected: bool m_MHIntra; bool m_Triangle; -#if JVET_L0293_CPR unsigned m_CPRMode; unsigned m_CPRLocalSearchRangeX; unsigned m_CPRLocalSearchRangeY; @@ -245,7 +244,6 @@ protected: unsigned m_CPRHashSearchMaxCand; unsigned m_CPRHashSearchRange4SmallBlk; unsigned m_CPRFastMethod; -#endif bool m_wrapAround; unsigned m_wrapAroundOffset; @@ -749,7 +747,6 @@ public: bool getUseTriangle () const { return m_Triangle; } -#if JVET_L0293_CPR void setCPRMode (unsigned n) { m_CPRMode = n; } unsigned getCPRMode () const { return m_CPRMode; } void setCPRLocalSearchRangeX (unsigned n) { m_CPRLocalSearchRangeX = n; } @@ -764,7 +761,6 @@ public: unsigned getCPRHashSearchRange4SmallBlk () const { return m_CPRHashSearchRange4SmallBlk; } void setCPRFastMethod (unsigned n) { m_CPRFastMethod = n; } unsigned getCPRFastMethod () const { return m_CPRFastMethod; } -#endif void setUseWrapAround ( bool b ) { m_wrapAround = b; } bool getUseWrapAround () const { return m_wrapAround; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 0d2bd87b42bca616020b9929a2b7549a8ab0c1a8..497a22507ff0e022c5d99d953e3fef2e686e55cc 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -283,12 +283,10 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) m_clearSubMergeStatic = false; #endif -#if JVET_L0293_CPR if (m_pcEncCfg->getCPRHashSearch() && m_pcEncCfg->getCPRMode()) { m_cprHashMap.init(m_pcEncCfg->getSourceWidth(), m_pcEncCfg->getSourceHeight()); } -#endif } // ==================================================================================================================== @@ -297,12 +295,10 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsigned ctuRsAddr, const int prevQP[], const int currQP[] ) { -#if JVET_L0293_CPR if (m_pcEncCfg->getCPRHashSearch() && ctuRsAddr == 0 && cs.slice->getSPS()->getSpsNext().getCPRMode()) { m_cprHashMap.rebuildPicHashMap(cs.picture->getOrigBuf()); } -#endif m_modeCtrl->initCTUEncoding( *cs.slice ); #if ENABLE_SPLIT_PARALLELISM @@ -324,7 +320,6 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign // init the partitioning manager Partitioner *partitioner = PartitionerFactory::get( *cs.slice ); partitioner->initCtu( area, CH_L, *cs.slice ); -#if JVET_L0293_CPR if (m_pcEncCfg->getCPRMode()) { m_pcInterSearch->resetCtuRecord(); @@ -345,7 +340,6 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign m_ctuCprSearchRangeY >>= 1; } } -#endif //CPR // init current context pointer m_CurrCtx = m_CtxBuffer.data(); @@ -611,10 +605,8 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par tempCS->initSubStructure( *m_pImvTempCS[wIdx], partitioner.chType, partitioner.currArea(), false ); } -#if JVET_L0293_CPR tempCS->chType = partitioner.chType; bestCS->chType = partitioner.chType; -#endif m_modeCtrl->initCULevel( partitioner, *tempCS ); m_CurrCtx->start = m_CABACEstimator->getCtx(); @@ -634,9 +626,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par return; } if (!slice.isIntra() -#if JVET_L0293_CPR && tempCS->chType == CHANNEL_TYPE_LUMA -#endif ) { tempCS->slice->copyMotionLUTs(tempMotCandLUTs, tempCS->slice->getMotionLUTs()); @@ -707,9 +697,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par { xCheckRDCostMerge2Nx2N( tempCS, bestCS, partitioner, currTestMode ); CodingUnit* cu = bestCS->getCU(partitioner.chType); -#if JVET_L0293_CPR if (cu) -#endif cu->mmvdSkip = cu->skip == false ? false : cu->mmvdSkip; } else if( currTestMode.type == ETM_MERGE_TRIANGLE ) @@ -724,7 +712,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par { xCheckIntraPCM( tempCS, bestCS, partitioner, currTestMode ); } -#if JVET_L0293_CPR else if (currTestMode.type == ETM_CPR) { xCheckRDCostCPRMode(tempCS, bestCS, partitioner, currTestMode); @@ -733,7 +720,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par { xCheckRDCostCPRModeMerge2Nx2N(tempCS, bestCS, partitioner, currTestMode); } -#endif // CPR else if( isModeSplit( currTestMode ) ) { @@ -768,15 +754,9 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par // QP from last processed CU for further processing bestCS->prevQP[partitioner.chType] = bestCS->cus.back()->qp; if (!slice.isIntra() -#if JVET_L0293_CPR && bestCS->chType == CHANNEL_TYPE_LUMA -#endif && bestCS->cus.size() == 1 && bestCS->cus.back()->predMode == MODE_INTER -#if JVET_L0293_CPR && bestCS->area.Y() == (*bestCS->cus.back()).Y() -#else - && bestCS->area == *bestCS->cus.back() -#endif ) { bestCS->slice->updateMotionLUTs(bestMotCandLUTs, (*bestCS->cus.back())); @@ -1042,9 +1022,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, const unsigned wParIdx = gp_sizeIdxInfo->idxFrom(parArea.lwidth()); const unsigned hParIdx = gp_sizeIdxInfo->idxFrom(parArea.lheight()); -#if JVET_L0293_CPR if (tempCS->chType == CHANNEL_TYPE_LUMA) -#endif tempCS->slice->copyMotionLUTs(tempMotCandLUTs, m_pSplitTempMotLUTs[wParIdx][hParIdx]); const PartSplit split = getPartSplit( encTestMode ); @@ -1109,15 +1087,11 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, tempCS->initSubStructure( *bestSubCS, partitioner.chType, subCUArea, false ); LutMotionCand *tempSubMotCandLUTs = m_pTempMotLUTs[wIdx][hIdx]; LutMotionCand *bestSubMotCandLUTs = m_pBestMotLUTs[wIdx][hIdx]; -#if JVET_L0293_CPR if (tempCS->chType == CHANNEL_TYPE_LUMA) { -#endif tempCS->slice->copyMotionLUTs(tempMotCandLUTs, tempSubMotCandLUTs); tempCS->slice->copyMotionLUTs(tempMotCandLUTs, bestSubMotCandLUTs); -#if JVET_L0293_CPR } -#endif xCompressCU( tempSubCS, bestSubCS, partitioner , tempSubMotCandLUTs @@ -1133,9 +1107,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, bool bestCSUpdated = xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); -#if JVET_L0293_CPR if (tempCS->chType == CHANNEL_TYPE_LUMA) -#endif if (bestCSUpdated) { std::swap(tempMotCandLUTs, bestMotCandLUTs); @@ -1145,9 +1117,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, bool keepResi = KEEP_PRED_AND_RESI_SIGNALS; tempCS->useSubStructure( *bestSubCS, partitioner.chType, CS::getArea( *tempCS, subCUArea, partitioner.chType ), KEEP_PRED_AND_RESI_SIGNALS, true, keepResi, keepResi ); -#if JVET_L0293_CPR if (tempCS->chType == CHANNEL_TYPE_LUMA) -#endif tempCS->slice->copyMotionLUTs(bestSubMotCandLUTs, tempMotCandLUTs); if(currDepth < pps.getMaxCuDQPDepth()) @@ -1263,9 +1233,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_pcInterSearch->addAffMVInfo(tmpMVInfo); if (!slice.isIntra() -#if JVET_L0293_CPR && tempCS->chType == CHANNEL_TYPE_LUMA -#endif ) { if (bestCSUpdated) @@ -1372,9 +1340,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC } if( !cu.cs->slice->isIntra() -#if JVET_L0293_CPR && cu.Y().valid() -#endif ) { m_CABACEstimator->cu_skip_flag ( cu ); @@ -1459,9 +1425,7 @@ void EncCu::xCheckIntraPCM(CodingStructure *&tempCS, CodingStructure *&bestCS, P } if( !cu.cs->slice->isIntra() -#if JVET_L0293_CPR && cu.Y().valid() -#endif ) { m_CABACEstimator->cu_skip_flag ( cu ); @@ -1682,14 +1646,12 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& if( auto blkCache = dynamic_cast< CacheBlkInfoCtrl* >( m_modeCtrl ) ) { -#if JVET_L0293_CPR if (slice.getSPS()->getSpsNext().getCPRMode()) { ComprCUCtx cuECtx = m_modeCtrl->getComprCUCtx(); bestIsSkip = blkCache->isSkip(tempCS->area) && cuECtx.bestCU; } else -#endif bestIsSkip = blkCache->isSkip( tempCS->area ); bestIsMMVDSkip = blkCache->isMMVDSkip(tempCS->area); } @@ -1734,20 +1696,16 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& m_pcRdCost->setDistParam (distParam, tempCS->getOrgBuf().Y(), m_acMergeBuffer[0].Y(), sps.getBitDepth (CHANNEL_TYPE_LUMA), COMPONENT_Y, bUseHadamard); const UnitArea localUnitArea( tempCS->area.chromaFormat, Area( 0, 0, tempCS->area.Y().width, tempCS->area.Y().height) ); -#if JVET_L0293_CPR uint32_t cprCand = 0; uint32_t numValidMv = mergeCtx.numValidMergeCand; -#endif for( uint32_t uiMergeCand = 0; uiMergeCand < mergeCtx.numValidMergeCand; uiMergeCand++ ) { -#if JVET_L0293_CPR if ((mergeCtx.interDirNeighbours[uiMergeCand] == 1 || mergeCtx.interDirNeighbours[uiMergeCand] == 3) && tempCS->slice->getRefPic(REF_PIC_LIST_0, mergeCtx.mvFieldNeighbours[uiMergeCand << 1].refIdx)->getPOC() == tempCS->slice->getPOC()) { cprCand++; numValidMv--; continue; } -#endif mergeCtx.setMergeInfo( pu, uiMergeCand ); PU::spanMotionInfo( pu, mergeCtx ); @@ -1786,18 +1744,12 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& swap(singleMergeTempBuffer, acMergeTempBuffer[insertPos]); } } -#if JVET_L0293_CPR CHECK(std::min(uiMergeCand + 1 - cprCand, uiNumMrgSATDCand) != RdModeList.size(), ""); -#else - CHECK( std::min( uiMergeCand + 1, uiNumMrgSATDCand ) != RdModeList.size(), "" ); -#endif } -#if JVET_L0293_CPR if (numValidMv < uiNumMrgSATDCand) uiNumMrgSATDCand = numValidMv; if (numValidMv == 0) return; -#endif if (isIntrainterEnabled) @@ -1815,19 +1767,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& // save the to-be-tested merge candidates uint32_t MHIntraMergeCand[NUM_MRG_SATD_CAND]; -#if JVET_L0293_CPR for (uint32_t mergeCnt = 0; mergeCnt < std::min(NUM_MRG_SATD_CAND, (const int) uiNumMrgSATDCand); mergeCnt++) -#else - for (uint32_t mergeCnt = 0; mergeCnt < NUM_MRG_SATD_CAND; mergeCnt++) -#endif { MHIntraMergeCand[mergeCnt] = RdModeList[mergeCnt]; } -#if JVET_L0293_CPR for (uint32_t mergeCnt = 0; mergeCnt < std::min( std::min(NUM_MRG_SATD_CAND, (const int)uiNumMrgSATDCand), 4); mergeCnt++) -#else - for (uint32_t mergeCnt = 0; mergeCnt < std::min(NUM_MRG_SATD_CAND, 4); mergeCnt++) -#endif { uint32_t mergeCand = MHIntraMergeCand[mergeCnt]; acMergeBuffer[mergeCand] = m_acRealMergeBuffer[mergeCand].getBuf(localUnitArea); @@ -2020,13 +1964,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& uint32_t uiMergeCand = RdModeList[uiMrgHADIdx]; -#if JVET_L0293_CPR if(uiMergeCand < mergeCtx.numValidMergeCand) if ((mergeCtx.interDirNeighbours[uiMergeCand] == 1 || mergeCtx.interDirNeighbours[uiMergeCand] == 3) && tempCS->slice->getRefPic(REF_PIC_LIST_0, mergeCtx.mvFieldNeighbours[uiMergeCand << 1].refIdx)->getPOC() == tempCS->slice->getPOC()) { continue; } -#endif if (uiNoResidualPass != 0 && uiMergeCand >= (MRG_MAX_NUM_CANDS + MMVD_ADD_NUM)) // intrainter does not support skip mode { @@ -2183,16 +2125,12 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru trianglecandHasNoResidual[mergeCand] = false; } -#if JVET_L0293_CPR bool bestIsSkip; CodingUnit* cuTemp = bestCS->getCU(partitioner.chType); if (cuTemp) bestIsSkip = m_pcEncCfg->getUseFastDecisionForMerge() ? bestCS->getCU(partitioner.chType)->rootCbf == 0 : false; else bestIsSkip = false; -#else - bool bestIsSkip = m_pcEncCfg->getUseFastDecisionForMerge() ? bestCS->getCU( partitioner.chType )->rootCbf == 0 : false; -#endif uint8_t numTriangleCandidate = TRIANGLE_MAX_NUM_CANDS; uint8_t triangleNumMrgSATDCand = TRIANGLE_MAX_NUM_SATD_CANDS; PelUnitBuf triangleBuffer[TRIANGLE_MAX_NUM_UNI_CANDS]; @@ -2675,7 +2613,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct } } } -#if JVET_L0293_CPR ////////////////////////////////////////////////////////////////////////////////////////////// // cpr merge/skip mode check void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) @@ -3117,7 +3054,6 @@ void EncCu::xCheckRDCostCPRMode(CodingStructure *&tempCS, CodingStructure *&best } // check cpr mode in encoder RD ////////////////////////////////////////////////////////////////////////////////////////////// -#endif // CPR void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) { @@ -3353,16 +3289,12 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be if( !CU::hasSubCUNonZeroMVd( cu ) ) { -#if JVET_L0293_CPR if (m_modeCtrl->useModeResult(encTestModeBase, tempCS, partitioner)) { std::swap(tempCS, bestCS); // store temp best CI for next CU coding m_CurrCtx->best = m_CABACEstimator->getCtx(); } -#else - m_modeCtrl->useModeResult( encTestModeBase, tempCS, partitioner ); -#endif return false; } else @@ -3399,16 +3331,12 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be if( !CU::hasSubCUNonZeroMVd( cu ) ) { -#if JVET_L0293_CPR if (m_modeCtrl->useModeResult(encTestModeBase, tempCS, partitioner)) { std::swap(tempCS, bestCS); // store temp best CI for next CU coding m_CurrCtx->best = m_CABACEstimator->getCtx(); } -#else - m_modeCtrl->useModeResult( encTestModeBase, tempCS, partitioner ); -#endif return false; } diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index 24bc9051ef182ae307bcbbaeaf356c4415c77502..34b80f8f845aebdce88f215a5d42248cb1725a00 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -45,9 +45,7 @@ #include "CommonLib/TrQuant.h" #include "CommonLib/Unit.h" #include "CommonLib/UnitPartitioner.h" -#if JVET_L0293_CPR #include "CommonLib/CprHashMap.h" -#endif #if REUSE_CU_RESULTS #include "DecoderLib/DecCu.h" @@ -111,9 +109,7 @@ private: CABACWriter* m_CABACEstimator; RateCtrl* m_pcRateCtrl; -#if JVET_L0293_CPR CprHashMap m_cprHashMap; -#endif CodingStructure **m_pImvTempCS; EncModeCtrl *m_modeCtrl; PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; @@ -127,10 +123,8 @@ private: #if !JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK bool m_clearSubMergeStatic; #endif -#if JVET_L0293_CPR int m_ctuCprSearchRangeX; int m_ctuCprSearchRangeY; -#endif #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM EncLib* m_pcEncLib; #endif @@ -240,10 +234,8 @@ protected: && (abs(cu.slice->getPOC() - cu.slice->getRefPOC(REF_PIC_LIST_0, cu.refIdxBi[0])) == 1 || abs(cu.slice->getPOC() - cu.slice->getRefPOC(REF_PIC_LIST_1, cu.refIdxBi[1])) == 1)))); } -#if JVET_L0293_CPR void xCheckRDCostCPRMode ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); void xCheckRDCostCPRModeMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); -#endif }; //! \} diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index fc22bee21675ae92422fb55986424c62444d0771..463cdb0c1b642e786ec7ed25916b3745d0e7d1e1 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -1460,12 +1460,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setSliceType(I_SLICE); } -#if JVET_L0293_CPR if (pcSlice->getSliceType() == I_SLICE && pcSlice->getSPS()->getSpsNext().getCPRMode()) { pcSlice->setSliceType(P_SLICE); } -#endif // Set the nal unit type pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField)); if(pcSlice->getTemporalLayerNonReferenceFlag()) @@ -1636,7 +1634,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (pcPic->cs->sps->getSpsNext().getUseCompositeRef() && getPrepareLTRef()) { arrangeCompositeReference(pcSlice, rcListPic, pocCurr); } -#if JVET_L0293_CPR if (pcSlice->getSPS()->getSpsNext().getCPRMode()) { if (m_pcCfg->getIntraPeriod() > 0 && pcSlice->getPOC() % m_pcCfg->getIntraPeriod() == 0) @@ -1647,7 +1644,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0) + 1); } -#endif // Set reference list pcSlice->setRefPicList ( rcListPic ); @@ -1706,12 +1702,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setSliceType ( P_SLICE ); } -#if JVET_L0293_CPR if (pcSlice->getSPS()->getSpsNext().getCPRMode() && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == 1) { m_pcSliceEncoder->setEncCABACTableIdx(P_SLICE); } -#endif xUpdateRasInit( pcSlice ); // Do decoding refresh marking if any @@ -1797,13 +1791,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setEnableTMVPFlag(0); } -#if JVET_L0293_CPR // disable TMVP when current picture is the only ref picture if (pcSlice->isIRAP() && pcSlice->getSPS()->getSpsNext().getCPRMode()) { pcSlice->setEnableTMVPFlag(0); } -#endif // set adaptive search range for non-intra-slices if (m_pcCfg->getUseASR() && !pcSlice->isIRAP()) @@ -1814,7 +1806,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, bool bGPBcheck=false; if ( pcSlice->getSliceType() == B_SLICE) { -#if JVET_L0293_CPR if (pcSlice->getSPS()->getSpsNext().getCPRMode()) { if (pcSlice->getNumRefIdx(RefPicList(0)) - 1 == pcSlice->getNumRefIdx(RefPicList(1))) @@ -1831,7 +1822,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } else -#endif if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) ) { bGPBcheck=true; @@ -2439,9 +2429,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "final", 0 ) ) ); pcPic->reconstructed = true; -#if JVET_L0293_CPR pcPic->longTerm = false; -#endif m_bFirst = false; m_iNumPicCoded++; if (!(pcPic->cs->sps->getSpsNext().getUseCompositeRef() && isEncodeLtRef)) diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index f7c3e42085845cd2c4b26b4f75fbfa8161eaa8bc..61f8a93f404ff5725e6964a49b1e5462709ce250 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -898,9 +898,7 @@ void EncLib::xInitSPS(SPS &sps) sps.getSpsNext().setUseMHIntra ( m_MHIntra ); sps.getSpsNext().setUseTriangle ( m_Triangle ); -#if JVET_L0293_CPR sps.getSpsNext().setCPRMode ( m_CPRMode ); -#endif sps.setUseWrapAround ( m_wrapAround ); sps.setWrapAroundOffset ( m_wrapAroundOffset ); @@ -1409,13 +1407,11 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) } } CHECK(!(bestPos <= 15), "Unspecified error"); -#if JVET_L0293_CPR if (sps.getSpsNext().getCPRMode()) { pps.setNumRefIdxL0DefaultActive(bestPos + 1); } else -#endif pps.setNumRefIdxL0DefaultActive(bestPos); pps.setNumRefIdxL1DefaultActive(bestPos); pps.setTransquantBypassEnabledFlag(getTransquantBypassEnabledFlag()); diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index aa5cb06066dae1c4c6b9adbf51079be999397b81..164dc714c42f747b270fcb03b2f0c9dc9775c551 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -766,9 +766,7 @@ bool BestEncInfoCache::isValid( const CodingStructure& cs, const Partitioner& pa return false; #endif if( cs.picture->poc != encInfo.poc || CS::getArea( cs, cs.area, partitioner.chType ) != CS::getArea( cs, encInfo.cu, partitioner.chType ) || !isTheSameNbHood( encInfo.cu, cs, partitioner ) -#if JVET_L0293_CPR || encInfo.cu.cpr -#endif ) { return false; @@ -969,7 +967,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru #endif xGetMinMaxQP( minQP, maxQP, cs, partitioner, baseQP, *cs.sps, *cs.pps, true ); -#if JVET_L0293_CPR bool checkCpr = true; if (cs.chType == CHANNEL_TYPE_CHROMA) { @@ -991,7 +988,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru THROW("Unknown CPR luma coverage type"); } } -#endif // Add coding modes here // NOTE: Working back to front, as a stack, which is more efficient with the container // NOTE: First added modes will be processed at the end. @@ -1103,7 +1099,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add intra modes m_ComprCUCtxList.back().testModes.push_back( { ETM_IPCM, ETO_STANDARD, qp, lossless } ); m_ComprCUCtxList.back().testModes.push_back( { ETM_INTRA, ETO_STANDARD, qp, lossless } ); -#if JVET_L0293_CPR // add cpr mode to intra path if (cs.sps->getSpsNext().getCPRMode() && checkCpr ) { @@ -1113,7 +1108,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru m_ComprCUCtxList.back().testModes.push_back({ ETM_CPR_MERGE, ETO_STANDARD, qp, lossless }); } } -#endif } // add first pass modes @@ -1270,10 +1264,8 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } // INTRA MODES -#if JVET_L0293_CPR if (cs.sps->getSpsNext().getCPRMode() && !cuECtx.bestTU) return true; -#endif CHECK( !slice.isIntra() && !cuECtx.bestTU, "No possible non-intra encoding for a P- or B-slice found" ); if( !( slice.isIRAP() || bestMode.type == ETM_INTRA || @@ -1285,7 +1277,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } -#if JVET_L0293_CPR if ((m_pcEncCfg->getCPRFastMethod() & CPR_FAST_METHOD_NOINTRA_CPRCBF0) && (bestMode.type == ETM_CPR || bestMode.type == ETM_CPR_MERGE) && (!cuECtx.bestCU->Y().valid() || cuECtx.bestTU->cbf[0] == 0) @@ -1294,7 +1285,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } -#endif if( lastTestMode().type != ETM_INTRA && cuECtx.bestCS && cuECtx.bestCU && interHadActive( cuECtx ) ) { // Get SATD threshold from best Inter-CU @@ -1329,13 +1319,11 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt // PCM MODES return sps.getUsePCM() && width <= ( 1 << sps.getPCMLog2MaxSize() ) && width >= ( 1 << sps.getPCMLog2MinSize() ); } -#if JVET_L0293_CPR else if (encTestmode.type == ETM_CPR || encTestmode.type == ETM_CPR_MERGE) { // CPR MODES return sps.getSpsNext().getCPRMode() && width <= CPR_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= CPR_MAX_CAND_SIZE; } -#endif else if( isModeInter( encTestmode ) ) { // INTER MODES (ME + MERGE/SKIP) diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index 85a2c78d5cb4d4029fe2f50346a98e73e682e077..e5b4188dac7b9047891f27070fe247e0dbc8d1ee 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -70,10 +70,8 @@ enum EncTestModeType ETM_RECO_CACHED, #endif ETM_TRIGGER_IMV_LIST, -#if JVET_L0293_CPR ETM_CPR, // cpr mode ETM_CPR_MERGE, // cpr merge mode -#endif ETM_INVALID }; diff --git a/source/Lib/EncoderLib/EncSlice.h b/source/Lib/EncoderLib/EncSlice.h index 7b7888ea0afcecd1e2dca2bfd6d30be33d7fbfd7..6526ae94c7c40ca057cb77ffc1d8859db6194432 100644 --- a/source/Lib/EncoderLib/EncSlice.h +++ b/source/Lib/EncoderLib/EncSlice.h @@ -157,9 +157,7 @@ public: void setSliceSegmentIdx (uint32_t i) { m_uiSliceSegmentIdx = i; } SliceType getEncCABACTableIdx() const { return m_encCABACTableIdx; } - #if JVET_L0293_CPR void setEncCABACTableIdx (SliceType b) { m_encCABACTableIdx = b; } -#endif private: double xGetQPValueAccordingToLambda ( double lambda ); }; diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 362ba6f80fb80fd3f918d6d4ac51a67fa9017e3d..c0c56108af4f3bc2a24489a20b7c48234c5a1c2c 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -196,10 +196,8 @@ void InterSearch::init( EncCfg* pcEncCfg, ) { CHECK(m_isInitialized, "Already initialized"); -#if JVET_L0293_CPR m_numBVs = 0; m_numBV16s = 0; -#endif m_pcEncCfg = pcEncCfg; m_pcTrQuant = pcTrQuant; m_iSearchRange = iSearchRange; @@ -697,7 +695,6 @@ Distortion InterSearch::xGetInterPredictionError( PredictionUnit& pu, PelUnitBuf return (Distortion)cDistParam.distFunc( cDistParam ); } -#if JVET_L0293_CPR /// add cpr search functions here void InterSearch::xCPRSearchMVCandUpdate(Distortion sad, int x, int y, Distortion* sadBestCand, Mv* cMVCand) @@ -1487,7 +1484,6 @@ void InterSearch::xxCPRHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, } } -#endif // CPR @@ -1587,16 +1583,12 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) for ( int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) { RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); -#if JVET_L0293_CPR int refPicNumber = cs.slice->getNumRefIdx(eRefPicList); if (cs.slice->getSPS()->getSpsNext().getCPRMode() && eRefPicList == REF_PIC_LIST_0) { refPicNumber--; } for (int iRefIdxTemp = 0; iRefIdxTemp < refPicNumber; iRefIdxTemp++) -#else - for ( int iRefIdxTemp = 0; iRefIdxTemp < cs.slice->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) -#endif { uiBitsTemp = uiMbBits[iRefList]; if ( cs.slice->getNumRefIdx(eRefPicList) > 1 ) @@ -1798,12 +1790,10 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) iRefStart = 0; iRefEnd = cs.slice->getNumRefIdx(eRefPicList)-1; -#if JVET_L0293_CPR if (cs.slice->getSPS()->getSpsNext().getCPRMode() && eRefPicList == REF_PIC_LIST_0) { iRefEnd--; } -#endif for (int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++) { if( m_pcEncCfg->getUseGBiFast() && (gbiIdx != GBI_DEFAULT) @@ -2265,9 +2255,7 @@ Distortion InterSearch::xGetTemplateCost( const PredictionUnit& pu, xPredInterBlk( COMPONENT_Y, pu, picRef, cMvCand, predBuf, bi, pu.cu->slice->clpRng( COMPONENT_Y ) , false -#if JVET_L0293_CPR , false -#endif ); if ( bi ) @@ -3229,16 +3217,12 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, for ( int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) { RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); -#if JVET_L0293_CPR int refPicNumber = slice.getNumRefIdx(eRefPicList); if (slice.getSPS()->getSpsNext().getCPRMode() && eRefPicList == REF_PIC_LIST_0) { refPicNumber--; } for (int iRefIdxTemp = 0; iRefIdxTemp < refPicNumber; iRefIdxTemp++) -#else - for ( int iRefIdxTemp = 0; iRefIdxTemp < slice.getNumRefIdx(eRefPicList); iRefIdxTemp++ ) -#endif { // Get RefIdx bits uiBitsTemp = uiMbBits[iRefList]; @@ -3607,12 +3591,10 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, iRefStart = 0; iRefEnd = slice.getNumRefIdx(eRefPicList) - 1; -#if JVET_L0293_CPR if (slice.getSPS()->getSpsNext().getCPRMode() && eRefPicList == REF_PIC_LIST_0) { iRefEnd--; } -#endif for ( int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ ) { if ( pu.cu->affineType == AFFINEMODEL_6PARAM && refIdx4Para[iRefList] != iRefIdxTemp ) @@ -4734,9 +4716,7 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti } void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &partitioner, Distortion *puiZeroDist /*= NULL*/ -#if JVET_L0293_CPR , const bool luma, const bool chroma -#endif ) { const UnitArea& currArea = partitioner.currArea(); @@ -4744,9 +4724,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par const PPS &pps = *cs.pps; const uint32_t numValidComp = getNumberValidComponents( sps.getChromaFormatIdc() ); const uint32_t numTBlocks = getNumberValidTBlocks ( *cs.pcv ); -#if JVET_L0293_CPR const CodingUnit &cu = *cs.getCU(partitioner.chType); -#endif const unsigned currDepth = partitioner.currTrDepth; bool bCheckFull = !partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); @@ -4773,11 +4751,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par if (bCheckFull) { -#if JVET_L0293_CPR TransformUnit &tu = csFull->addTU(CS::isDualITree(cs) ? cu : currArea, partitioner.chType); -#else - TransformUnit &tu = csFull->addTU(currArea, partitioner.chType); -#endif tu.depth = currDepth; tu.emtIdx = 0; @@ -4798,21 +4772,15 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par saveCS.picture = cs.picture; saveCS.area.repositionTo(currArea); saveCS.clearTUs(); -#if JVET_L0293_CPR TransformUnit & bestTU = saveCS.addTU(CS::isDualITree(cs) ? cu : currArea, partitioner.chType); -#else - TransformUnit &bestTU = saveCS.addTU( currArea, partitioner.chType ); -#endif for( uint32_t c = 0; c < numTBlocks; c++ ) { const ComponentID compID = ComponentID(c); -#if JVET_L0293_CPR if (compID == COMPONENT_Y && !luma) continue; if (compID != COMPONENT_Y && !chroma) continue; -#endif const CompArea& compArea = tu.blocks[compID]; const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); @@ -5039,12 +5007,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par for( unsigned c = 0; c < numTBlocks; c++) { const ComponentID compID = cbf_getComp[c]; -#if JVET_L0293_CPR if (compID == COMPONENT_Y && !luma) continue; if (compID != COMPONENT_Y && !chroma) continue; -#endif if( tu.blocks[compID].valid() ) { const bool prevCbf = ( compID == COMPONENT_Cr ? TU::getCbfAtDepth( tu, COMPONENT_Cb, currDepth ) : false ); @@ -5055,12 +5021,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par for (uint32_t ch = 0; ch < numValidComp; ch++) { const ComponentID compID = ComponentID(ch); -#if JVET_L0293_CPR if (compID == COMPONENT_Y && !luma) continue; if (compID != COMPONENT_Y && !chroma) continue; -#endif if (tu.blocks[compID].valid()) { if( cs.pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isChroma(compID) && uiAbsSum[COMPONENT_Y] ) @@ -5105,9 +5069,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par do { xEstimateInterResidualQT(*csSplit, partitioner, bCheckFull ? nullptr : puiZeroDist -#if JVET_L0293_CPR , luma, chroma -#endif ); csSplit->cost = m_pcRdCost->calcRdCost( csSplit->fracBits, csSplit->dist ); @@ -5160,13 +5122,11 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par xEncodeInterResidualQT( *csSplit, partitioner, MAX_NUM_TBLOCKS ); for (uint32_t ch = 0; ch < numValidComp; ch++) { -#if JVET_L0293_CPR const ComponentID compID = ComponentID(ch); if (compID == COMPONENT_Y && !luma) continue; if (compID != COMPONENT_Y && !chroma) continue; -#endif xEncodeInterResidualQT( *csSplit, partitioner, ComponentID( ch ) ); } @@ -5198,9 +5158,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par } void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &partitioner, const bool &skipResidual -#if JVET_L0293_CPR , const bool luma, const bool chroma -#endif ) { CodingUnit &cu = *cs.getCU( partitioner.chType ); @@ -5221,22 +5179,16 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa // add an empty TU -#if JVET_L0293_CPR cs.addTU(CS::isDualITree(cs) ? cu : cs.area, partitioner.chType); -#else - cs.addTU(cs.area, partitioner.chType); -#endif Distortion distortion = 0; for (int comp = 0; comp < numValidComponents; comp++) { const ComponentID compID = ComponentID(comp); -#if JVET_L0293_CPR if (compID == COMPONENT_Y && !luma) continue; if (compID != COMPONENT_Y && !chroma) continue; -#endif CPelBuf reco = cs.getRecoBuf (compID); CPelBuf org = cs.getOrgBuf (compID); #if WCG_EXT @@ -5278,7 +5230,6 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa } // Residual coding. -#if JVET_L0293_CPR if (luma) { cs.getResiBuf().bufs[0].copyFrom(cs.getOrgBuf().bufs[0]); @@ -5291,15 +5242,10 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa cs.getResiBuf().bufs[1].subtract(cs.getPredBuf().bufs[1]); cs.getResiBuf().bufs[2].subtract(cs.getPredBuf().bufs[2]); } -#else - cs.getResiBuf().copyFrom (cs.getOrgBuf()); - cs.getResiBuf().subtract (cs.getPredBuf()); -#endif Distortion zeroDistortion = 0; const TempCtx ctxStart( m_CtxCache, m_CABACEstimator->getCtx() ); -#if JVET_L0293_CPR if (luma) { cs.getOrgResiBuf().bufs[0].copyFrom(cs.getResiBuf().bufs[0]); @@ -5310,11 +5256,6 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa cs.getOrgResiBuf().bufs[2].copyFrom(cs.getResiBuf().bufs[2]); } xEstimateInterResidualQT(cs, partitioner, &zeroDistortion, luma, chroma); -#else - cs.getOrgResiBuf().copyFrom(cs.getResiBuf()); - - xEstimateInterResidualQT(cs, partitioner, &zeroDistortion); -#endif TransformUnit &firstTU = *cs.getTU( partitioner.chType ); cu.rootCbf = false; @@ -5365,7 +5306,6 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa uint64_t finalFracBits = xGetSymbolFracBitsInter( cs, partitioner ); // we've now encoded the CU, and so have a valid bit cost -#if JVET_L0293_CPR if (!cu.rootCbf) { if (luma) @@ -5388,14 +5328,6 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa cs.getRecoBuf().bufs[1].reconstruct(cs.getPredBuf().bufs[1], cs.getResiBuf().bufs[1], cs.slice->clpRngs().comp[1]); cs.getRecoBuf().bufs[2].reconstruct(cs.getPredBuf().bufs[2], cs.getResiBuf().bufs[2], cs.slice->clpRngs().comp[2]); } -#else - if (!cu.rootCbf) - { - cs.getResiBuf().fill(0); // Clear the residual image, if we didn't code it. - } - - cs.getRecoBuf().reconstruct(cs.getPredBuf(), cs.getResiBuf(), cs.slice->clpRngs()); -#endif // update with clipped distortion and cost (previously unclipped reconstruction values were used) Distortion finalDistortion = 0; @@ -5403,12 +5335,10 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa for (int comp = 0; comp < numValidComponents; comp++) { const ComponentID compID = ComponentID(comp); -#if JVET_L0293_CPR if (compID == COMPONENT_Y && !luma) continue; if (compID != COMPONENT_Y && !chroma) continue; -#endif CPelBuf reco = cs.getRecoBuf (compID); CPelBuf org = cs.getOrgBuf (compID); @@ -5467,9 +5397,7 @@ uint64_t InterSearch::xGetSymbolFracBitsInter(CodingStructure &cs, Partitioner & { m_CABACEstimator->cu_transquant_bypass_flag( cu ); } -#if JVET_L0293_CPR if (cu.Y().valid()) -#endif m_CABACEstimator->cu_skip_flag( cu ); m_CABACEstimator->pred_mode ( cu ); m_CABACEstimator->cu_pred_data( cu ); diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index 3a1c2c24d2b430c0b631369a8603828c2082c097..6c8534ad4a1f9cbf58bc8790c6d2de3d3eb548ea 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -51,11 +51,9 @@ #include "CommonLib/RdCost.h" #include "CommonLib/AffineGradientSearch.h" -#if JVET_L0293_CPR #include "CommonLib/CprHashMap.h" #include <unordered_map> #include <vector> -#endif //! \ingroup EncoderLib //! \{ @@ -66,12 +64,10 @@ static const uint32_t MAX_NUM_REF_LIST_ADAPT_SR = 2; static const uint32_t MAX_IDX_ADAPT_SR = 33; static const uint32_t NUM_MV_PREDICTORS = 3; -#if JVET_L0293_CPR struct BlkRecord { std::unordered_map<Mv, Distortion> bvRecord; }; -#endif class EncModeCtrl; struct AffineMVInfo @@ -101,9 +97,7 @@ private: uint32_t m_estWeightIdxBits[GBI_NUM]; GBiMotionParam m_uniMotions; bool m_affineModeSelected; -#if JVET_L0293_CPR std::unordered_map< Position, std::unordered_map< Size, BlkRecord> > m_ctuRecord; -#endif AffineMVInfo *m_affMVList; int m_affMVListIdx; int m_affMVListSize; @@ -137,10 +131,8 @@ protected: Mv m_integerMv2Nx2N [NUM_REF_PIC_LIST_01][MAX_NUM_REF]; bool m_isInitialized; -#if JVET_L0293_CPR unsigned int m_numBVs, m_numBV16s; Mv m_acBVs[CPR_NUM_CANDIDATES]; -#endif public: InterSearch(); virtual ~InterSearch(); @@ -161,9 +153,7 @@ public: void destroy (); void setTempBuffers (CodingStructure ****pSlitCS, CodingStructure ****pFullCS, CodingStructure **pSaveCS ); -#if JVET_L0293_CPR void resetCtuRecord () { m_ctuRecord.clear(); } -#endif #if ENABLE_SPLIT_PARALLELISM void copyState ( const InterSearch& other ); #endif @@ -248,14 +238,12 @@ public: /// set ME search range void setAdaptiveSearchRange ( int iDir, int iRefIdx, int iSearchRange) { CHECK(iDir >= MAX_NUM_REF_LIST_ADAPT_SR || iRefIdx>=int(MAX_IDX_ADAPT_SR), "Invalid index"); m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; } -#if JVET_L0293_CPR bool predCPRSearch ( CodingUnit& cu, Partitioner& partitioner, const int localSearchRangeX, const int localSearchRangeY, CprHashMap& cprHashMap); void xIntraPatternSearch ( PredictionUnit& pu, IntTZSearchStruct& cStruct, Mv& rcMv, Distortion& ruiCost, Mv* cMvSrchRngLT, Mv* cMvSrchRngRB, Mv* pcMvPred); void xSetIntraSearchRange ( PredictionUnit& pu, int iRoiWidth, int iRoiHeight, const int localSearchRangeX, const int localSearchRangeY, Mv& rcMvSrchRngLT, Mv& rcMvSrchRngRB); void xCPREstimation ( PredictionUnit& pu, PelUnitBuf& origBuf, Mv *pcMvPred, Mv &rcMv, Distortion &ruiCost, const int localSearchRangeX, const int localSearchRangeY); void xCPRSearchMVCandUpdate ( Distortion uiSad, int x, int y, Distortion* uiSadBestCand, Mv* cMVCand); int xCPRSearchMVChromaRefine( PredictionUnit& pu, int iRoiWidth, int iRoiHeight, int cuPelX, int cuPelY, Distortion* uiSadBestCand, Mv* cMVCand); -#endif protected: // ------------------------------------------------------------------------------------------------------------------- @@ -428,22 +416,16 @@ protected: // ------------------------------------------------------------------------------------------------------------------- void setWpScalingDistParam ( int iRefIdx, RefPicList eRefPicListCur, Slice *slice ); -#if JVET_L0293_CPR private: void xxCPRHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, Mv &mv, int& idxMvPred, CprHashMap& cprHashMap); -#endif public: void encodeResAndCalcRdInterCU (CodingStructure &cs, Partitioner &partitioner, const bool &skipResidual -#if JVET_L0293_CPR , const bool luma = true, const bool chroma = true -#endif ); void xEncodeInterResidualQT (CodingStructure &cs, Partitioner &partitioner, const ComponentID &compID); void xEstimateInterResidualQT (CodingStructure &cs, Partitioner &partitioner, Distortion *puiZeroDist = NULL -#if JVET_L0293_CPR , const bool luma = true, const bool chroma = true -#endif ); uint64_t xGetSymbolFracBitsInter (CodingStructure &cs, Partitioner &partitioner); diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 36041374fb938f6e65f64372b096b7f82b799e48..8116b7a41d72ca5f6078ead74daa7ef0d0b27665 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -999,9 +999,7 @@ void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner, if( isFirst ) { if( !cs.slice->isIntra() -#if JVET_L0293_CPR && cu.Y().valid() -#endif ) { if( cs.pps->getTransquantBypassEnabledFlag() ) @@ -1027,10 +1025,8 @@ void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner, // luma prediction mode if (isFirst) { -#if JVET_L0293_CPR if ( !cu.Y().valid()) m_CABACEstimator->pred_mode( cu ); -#endif m_CABACEstimator->intra_luma_pred_mode( pu ); } } diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index d921d95a75e01b02520b8352252593b0afe5ef43..3f87520e58ec41c9a453bdb96c20e71edf687599 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -542,9 +542,7 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) WRITE_FLAG( spsNext.getUseAffineType() ? 1 : 0, "affine_type_flag" ); } WRITE_FLAG( spsNext.getUseGBi() ? 1 : 0, "gbi_flag" ); -#if JVET_L0293_CPR WRITE_FLAG(spsNext.getCPRMode() ? 1 : 0, "cpr_flag" ); -#endif for( int k = 0; k < SPSNext::NumReservedFlags; k++ ) { WRITE_FLAG( 0, "reserved_flag" );