From 7341c1e78e006f5141886311740a1eef1cbc844b Mon Sep 17 00:00:00 2001 From: Yu Han <yuhan@qti.qualcomm.com> Date: Sun, 27 Jan 2019 20:16:15 +0100 Subject: [PATCH] M0483 change cpr to ibc tmp --- cfg/encoder_intra_vtm.cfg | 2 +- cfg/encoder_lowdelay_P_vtm.cfg | 2 +- cfg/encoder_lowdelay_vtm.cfg | 2 +- cfg/encoder_randomaccess_vtm.cfg | 2 +- source/App/EncoderApp/EncApp.cpp | 14 +- source/App/EncoderApp/EncAppCfg.cpp | 18 +-- source/App/EncoderApp/EncAppCfg.h | 14 +- source/Lib/CommonLib/CodingStructure.cpp | 16 +- source/Lib/CommonLib/CodingStructure.h | 12 +- source/Lib/CommonLib/CommonDef.h | 10 +- source/Lib/CommonLib/ContextModelling.cpp | 2 +- .../{CprHashMap.cpp => IbcHashMap.cpp} | 32 ++-- .../CommonLib/{CprHashMap.h => IbcHashMap.h} | 22 +-- source/Lib/CommonLib/InterPrediction.cpp | 14 +- source/Lib/CommonLib/InterPrediction.h | 2 +- source/Lib/CommonLib/RdCost.h | 4 +- source/Lib/CommonLib/Slice.cpp | 10 +- source/Lib/CommonLib/Slice.h | 6 +- source/Lib/CommonLib/TypeDef.h | 4 +- source/Lib/CommonLib/Unit.cpp | 4 +- source/Lib/CommonLib/Unit.h | 6 +- source/Lib/CommonLib/UnitTools.cpp | 140 +++++++++--------- source/Lib/CommonLib/UnitTools.h | 4 +- .../Lib/CommonLib/dtrace_blockstatistics.cpp | 2 +- source/Lib/CommonLib/dtrace_blockstatistics.h | 4 +- .../x86/{CprHashMapX86.h => IbcHashMapX86.h} | 8 +- source/Lib/CommonLib/x86/InitX86.cpp | 8 +- .../CommonLib/x86/sse42/CprHashmap_sse42.cpp | 1 - .../CommonLib/x86/sse42/IbcHashmap_sse42.cpp | 1 + source/Lib/DecoderLib/CABACReader.cpp | 4 +- source/Lib/DecoderLib/DecCu.cpp | 10 +- source/Lib/DecoderLib/DecLib.cpp | 4 +- source/Lib/DecoderLib/VLCReader.cpp | 2 +- source/Lib/EncoderLib/CABACWriter.cpp | 2 +- source/Lib/EncoderLib/EncCfg.h | 42 +++--- source/Lib/EncoderLib/EncCu.cpp | 82 +++++----- source/Lib/EncoderLib/EncCu.h | 12 +- source/Lib/EncoderLib/EncGOP.cpp | 10 +- source/Lib/EncoderLib/EncLib.cpp | 4 +- source/Lib/EncoderLib/EncModeCtrl.cpp | 46 +++--- source/Lib/EncoderLib/EncModeCtrl.h | 4 +- source/Lib/EncoderLib/InterSearch.cpp | 66 ++++----- source/Lib/EncoderLib/InterSearch.h | 14 +- source/Lib/EncoderLib/VLCWriter.cpp | 2 +- 44 files changed, 335 insertions(+), 335 deletions(-) rename source/Lib/CommonLib/{CprHashMap.cpp => IbcHashMap.cpp} (94%) rename source/Lib/CommonLib/{CprHashMap.h => IbcHashMap.h} (90%) rename source/Lib/CommonLib/x86/{CprHashMapX86.h => IbcHashMapX86.h} (92%) delete mode 100644 source/Lib/CommonLib/x86/sse42/CprHashmap_sse42.cpp create mode 100644 source/Lib/CommonLib/x86/sse42/IbcHashmap_sse42.cpp diff --git a/cfg/encoder_intra_vtm.cfg b/cfg/encoder_intra_vtm.cfg index 46a89c0a4..814bf20d9 100644 --- a/cfg/encoder_intra_vtm.cfg +++ b/cfg/encoder_intra_vtm.cfg @@ -111,7 +111,7 @@ LMChroma : 1 # use CCLM only DepQuant : 1 IMV : 2 ALF : 1 -CPR : 0 # turned off in CTC +IBC : 0 # turned off in CTC # Fast tools PBIntraFast : 1 diff --git a/cfg/encoder_lowdelay_P_vtm.cfg b/cfg/encoder_lowdelay_P_vtm.cfg index 9ffa21be9..132d9db5c 100644 --- a/cfg/encoder_lowdelay_P_vtm.cfg +++ b/cfg/encoder_lowdelay_P_vtm.cfg @@ -128,7 +128,7 @@ DepQuant : 1 IMV : 2 ALF : 1 MHIntra : 1 -CPR : 0 # turned off in CTC +IBC : 0 # turned off in CTC # Fast tools PBIntraFast : 1 diff --git a/cfg/encoder_lowdelay_vtm.cfg b/cfg/encoder_lowdelay_vtm.cfg index 4d5322596..7d8350f92 100644 --- a/cfg/encoder_lowdelay_vtm.cfg +++ b/cfg/encoder_lowdelay_vtm.cfg @@ -131,7 +131,7 @@ GBi : 1 GBiFast : 1 MHIntra : 1 Triangle : 1 -CPR : 0 # turned off in CTC +IBC : 0 # turned off in CTC # Fast tools PBIntraFast : 1 diff --git a/cfg/encoder_randomaccess_vtm.cfg b/cfg/encoder_randomaccess_vtm.cfg index 1280de857..f3404e3f2 100644 --- a/cfg/encoder_randomaccess_vtm.cfg +++ b/cfg/encoder_randomaccess_vtm.cfg @@ -146,7 +146,7 @@ GBiFast : 1 BIO : 1 MHIntra : 1 Triangle : 1 -CPR : 0 # turned off in CTC +IBC : 0 # turned off in CTC # Fast tools PBIntraFast : 1 diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index c054640b7..6afd8db73 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -258,13 +258,13 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseMHIntra ( m_MHIntra ); m_cEncLib.setUseTriangle ( m_Triangle ); - m_cEncLib.setCPRMode ( m_CPRMode ); - m_cEncLib.setCPRLocalSearchRangeX ( m_CPRLocalSearchRangeX ); - m_cEncLib.setCPRLocalSearchRangeY ( m_CPRLocalSearchRangeY ); - m_cEncLib.setCPRHashSearch ( m_CPRHashSearch ); - m_cEncLib.setCPRHashSearchMaxCand ( m_CPRHashSearchMaxCand ); - m_cEncLib.setCPRHashSearchRange4SmallBlk ( m_CPRHashSearchRange4SmallBlk ); - m_cEncLib.setCPRFastMethod ( m_CPRFastMethod ); + m_cEncLib.setIBCMode ( m_IBCMode ); + m_cEncLib.setIBCLocalSearchRangeX ( m_IBCLocalSearchRangeX ); + m_cEncLib.setIBCLocalSearchRangeY ( m_IBCLocalSearchRangeY ); + m_cEncLib.setIBCHashSearch ( m_IBCHashSearch ); + m_cEncLib.setIBCHashSearchMaxCand ( m_IBCHashSearchMaxCand ); + m_cEncLib.setIBCHashSearchRange4SmallBlk ( m_IBCHashSearchRange4SmallBlk ); + m_cEncLib.setIBCFastMethod ( m_IBCFastMethod ); 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 79fb683c9..d2a324e4a 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -865,13 +865,13 @@ 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)") - ( "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") - ( "CPRHashSearch", m_CPRHashSearch, 1u, "Hash based CPR search") - ( "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") + ( "IBC", m_IBCMode, 0u, "IBCMode (0x1:enabled, 0x0:disabled) [default: disabled]") + ( "IBCLocalSearchRangeX", m_IBCLocalSearchRangeX, 128u, "Search range of IBC local search in x direction") + ( "IBCLocalSearchRangeY", m_IBCLocalSearchRangeY, 128u, "Search range of IBC local search in y direction") + ( "IBCHashSearch", m_IBCHashSearch, 1u, "Hash based IBC search") + ( "IBCHashSearchMaxCand", m_IBCHashSearchMaxCand, 256u, "Max candidates for hash based IBC search") + ( "IBCHashSearchRange4SmallBlk", m_IBCHashSearchRange4SmallBlk, 256u, "Small block search range in based IBC search") + ( "IBCFastMethod", m_IBCFastMethod, 6u, "Fast methods for IBC") ("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") @@ -1934,7 +1934,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" ); - xConfirmPara(m_CPRMode, "CPR Mode only allowed with NEXT profile"); + xConfirmPara(m_IBCMode, "IBC Mode only allowed with NEXT profile"); xConfirmPara( m_useFastLCTU, "Fast large CTU can only be applied when encoding with NEXT profile" ); #if JVET_M0464_UNI_MTS xConfirmPara( m_MTS, "MTS only allowed with NEXT profile" ); @@ -3146,7 +3146,7 @@ void EncAppCfg::xPrintParameter() msg(VERBOSE, "MHIntra:%d ", m_MHIntra); msg( VERBOSE, "Triangle:%d ", m_Triangle ); } - msg(VERBOSE, "CPR:%d ", m_CPRMode); + msg(VERBOSE, "IBC:%d ", m_IBCMode); msg( VERBOSE, "WrapAround:%d ", m_wrapAround); if( m_wrapAround ) { diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index f45545f23..8b67d948d 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -239,13 +239,13 @@ protected: bool m_Triangle; - unsigned m_CPRMode; - unsigned m_CPRLocalSearchRangeX; - unsigned m_CPRLocalSearchRangeY; - unsigned m_CPRHashSearch; - unsigned m_CPRHashSearchMaxCand; - unsigned m_CPRHashSearchRange4SmallBlk; - unsigned m_CPRFastMethod; + unsigned m_IBCMode; + unsigned m_IBCLocalSearchRangeX; + unsigned m_IBCLocalSearchRangeY; + unsigned m_IBCHashSearch; + unsigned m_IBCHashSearchMaxCand; + unsigned m_IBCHashSearchRange4SmallBlk; + unsigned m_IBCFastMethod; bool m_wrapAround; unsigned m_wrapAroundOffset; diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 9f3226fc7..8d5013fcc 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -1299,7 +1299,7 @@ const TransformUnit* CodingStructure::getTURestricted( const Position &pos, cons } } -CprLumaCoverage CodingStructure::getCprLumaCoverage(const CompArea& chromaArea) const +IbcLumaCoverage CodingStructure::getIbcLumaCoverage(const CompArea& chromaArea) const { CHECK(chType != CHANNEL_TYPE_CHROMA, "Error"); @@ -1307,7 +1307,7 @@ CprLumaCoverage CodingStructure::getCprLumaCoverage(const CompArea& chromaArea) CompArea lumaArea = CompArea(COMPONENT_Y, chromaArea.chromaFormat, chromaArea.lumaPos(), recalcSize(chromaArea.chromaFormat, CHANNEL_TYPE_CHROMA, CHANNEL_TYPE_LUMA, chromaArea.size())); lumaArea = clipArea(lumaArea, picture->block(COMPONENT_Y)); const unsigned int fullArea = lumaArea.area(); - unsigned int cprArea = 0; + unsigned int ibcArea = 0; for (SizeType y = 0; y < lumaArea.height; y += MIN_PU_SIZE) { for (SizeType x = 0; x < lumaArea.width; x += MIN_PU_SIZE) @@ -1315,19 +1315,19 @@ CprLumaCoverage CodingStructure::getCprLumaCoverage(const CompArea& chromaArea) Position pos = lumaArea.offset(x, y); if (picture->cs->getMotionInfo(pos).isInter) // need to change if inter slice allows dualtree { - cprArea += unitAreaSubBlock; + ibcArea += unitAreaSubBlock; } } } - CprLumaCoverage coverage = CPR_LUMA_COVERAGE_FULL; - if (cprArea == 0) + IbcLumaCoverage coverage = IBC_LUMA_COVERAGE_FULL; + if (ibcArea == 0) { - coverage = CPR_LUMA_COVERAGE_NONE; + coverage = IBC_LUMA_COVERAGE_NONE; } - else if (cprArea < fullArea) + else if (ibcArea < fullArea) { - coverage = CPR_LUMA_COVERAGE_PARTIAL; + coverage = IBC_LUMA_COVERAGE_PARTIAL; } return coverage; diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index 451e1f13d..292090942 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -58,12 +58,12 @@ enum PictureType PIC_ORG_RESI, NUM_PIC_TYPES }; -enum CprLumaCoverage +enum IbcLumaCoverage { - CPR_LUMA_COVERAGE_FULL = 0, - CPR_LUMA_COVERAGE_PARTIAL, - CPR_LUMA_COVERAGE_NONE, - NUM_CPR_LUMA_COVERAGE, + IBC_LUMA_COVERAGE_FULL = 0, + IBC_LUMA_COVERAGE_PARTIAL, + IBC_LUMA_COVERAGE_NONE, + NUM_IBC_LUMA_COVERAGE, }; extern XUCache g_globalUnitCache; @@ -154,7 +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; - CprLumaCoverage getCprLumaCoverage(const CompArea& chromaArea) const; + IbcLumaCoverage getIbcLumaCoverage(const CompArea& chromaArea) const; // --------------------------------------------------------------------------- // encoding search utilities // --------------------------------------------------------------------------- diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 69f5c7b91..27d76437a 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -396,12 +396,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; -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 IBC_MAX_CAND_SIZE = 16; // max block size for ibc search +static const int IBC_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; +static const int IBC_FAST_METHOD_NOINTRA_IBCCBF0 = 0x01; +static const int IBC_FAST_METHOD_BUFFERBV = 0X02; +static const int IBC_FAST_METHOD_ADAPTIVE_SEARCHRANGE = 0X04; // ==================================================================================================================== // Macro functions diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index e13f466ba..d52ea51e0 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -472,7 +472,7 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) pu.mvpNum [REF_PIC_LIST_1] = NOT_VALID; 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.cu->ibc = true; pu.bv = pu.mv[REF_PIC_LIST_0]; pu.bv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_INT); // used for only integer resolution } diff --git a/source/Lib/CommonLib/CprHashMap.cpp b/source/Lib/CommonLib/IbcHashMap.cpp similarity index 94% rename from source/Lib/CommonLib/CprHashMap.cpp rename to source/Lib/CommonLib/IbcHashMap.cpp index 0ed0ac828..9d876292d 100644 --- a/source/Lib/CommonLib/CprHashMap.cpp +++ b/source/Lib/CommonLib/IbcHashMap.cpp @@ -31,46 +31,46 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/** \file CprHashMap.cpp - \brief CPR hash map encoder class +/** \file IbcHashMap.cpp + \brief IBC hash map encoder class */ #include "CommonLib/dtrace_codingstruct.h" #include "CommonLib/Picture.h" #include "CommonLib/UnitTools.h" -#include "CprHashMap.h" +#include "IbcHashMap.h" using namespace std; -//! \ingroup CprHashMap +//! \ingroup IbcHashMap //! \{ // ==================================================================================================================== // Constructor / destructor / create / destroy // ==================================================================================================================== -CprHashMap::CprHashMap() +IbcHashMap::IbcHashMap() { m_picWidth = 0; m_picHeight = 0; m_pos2Hash = NULL; m_computeCrc32c = xxComputeCrc32c16bit; -#if ENABLE_SIMD_OPT_CPR +#if ENABLE_SIMD_OPT_IBC #ifdef TARGET_SIMD_X86 - initCprHashMapX86(); + initIbcHashMapX86(); #endif #endif } -CprHashMap::~CprHashMap() +IbcHashMap::~IbcHashMap() { destroy(); } -void CprHashMap::init(const int picWidth, const int picHeight) +void IbcHashMap::init(const int picWidth, const int picHeight) { if (picWidth != m_picWidth || picHeight != m_picHeight) { @@ -87,7 +87,7 @@ void CprHashMap::init(const int picWidth, const int picHeight) } } -void CprHashMap::destroy() +void IbcHashMap::destroy() { if (m_pos2Hash != NULL) { @@ -168,7 +168,7 @@ static const uint32_t crc32Table[256] = { 0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L }; -uint32_t CprHashMap::xxComputeCrc32c16bit(uint32_t crc, const Pel pel) +uint32_t IbcHashMap::xxComputeCrc32c16bit(uint32_t crc, const Pel pel) { const void *buf = &pel; const uint8_t *p = (const uint8_t *)buf; @@ -184,7 +184,7 @@ uint32_t CprHashMap::xxComputeCrc32c16bit(uint32_t crc, const Pel pel) // CRC calculation in C code //////////////////////////////////////////////////////// -unsigned int CprHashMap::xxCalcBlockHash(const Pel* pel, const int stride, const int width, const int height, unsigned int crc) +unsigned int IbcHashMap::xxCalcBlockHash(const Pel* pel, const int stride, const int width, const int height, unsigned int crc) { for (int y = 0; y < height; y++) { @@ -198,7 +198,7 @@ unsigned int CprHashMap::xxCalcBlockHash(const Pel* pel, const int stride, const } template<ChromaFormat chromaFormat> -void CprHashMap::xxBuildPicHashMap(const PelUnitBuf& pic) +void IbcHashMap::xxBuildPicHashMap(const PelUnitBuf& pic) { const int chromaScalingX = getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, chromaFormat); const int chromaScalingY = getChannelTypeScaleY(CHANNEL_TYPE_CHROMA, chromaFormat); @@ -243,7 +243,7 @@ void CprHashMap::xxBuildPicHashMap(const PelUnitBuf& pic) } } -void CprHashMap::rebuildPicHashMap(const PelUnitBuf& pic) +void IbcHashMap::rebuildPicHashMap(const PelUnitBuf& pic) { m_hash2Pos.clear(); @@ -267,7 +267,7 @@ void CprHashMap::rebuildPicHashMap(const PelUnitBuf& pic) } } -bool CprHashMap::cprHashMatch(const Area& lumaArea, std::vector<Position>& cand, const CodingStructure& cs, const int maxCand, const int searchRange4SmallBlk) +bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector<Position>& cand, const CodingStructure& cs, const int maxCand, const int searchRange4SmallBlk) { cand.clear(); @@ -332,7 +332,7 @@ bool CprHashMap::cprHashMatch(const Area& lumaArea, std::vector<Position>& cand, return cand.size() > 0; } -int CprHashMap::getHashHitRatio(const Area& lumaArea) +int IbcHashMap::getHashHitRatio(const Area& lumaArea) { int maxX = std::min((int)(lumaArea.x + lumaArea.width), m_picWidth); int maxY = std::min((int)(lumaArea.y + lumaArea.height), m_picHeight); diff --git a/source/Lib/CommonLib/CprHashMap.h b/source/Lib/CommonLib/IbcHashMap.h similarity index 90% rename from source/Lib/CommonLib/CprHashMap.h rename to source/Lib/CommonLib/IbcHashMap.h index 6ac4069b5..e343aab6e 100644 --- a/source/Lib/CommonLib/CprHashMap.h +++ b/source/Lib/CommonLib/IbcHashMap.h @@ -31,12 +31,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/** \file CprHashMap.h - \brief CPR hash map encoder class (header) +/** \file IbcHashMap.h + \brief IBC hash map encoder class (header) */ -#ifndef __CPRHASHMAP__ -#define __CPRHASHMAP__ +#ifndef __IBCHASHMAP__ +#define __IBCHASHMAP__ // Include files #include "CommonLib/CommonDef.h" @@ -55,7 +55,7 @@ // Class definition // ==================================================================================================================== -class CprHashMap +class IbcHashMap { private: int m_picWidth; @@ -73,23 +73,23 @@ private: public: uint32_t (*m_computeCrc32c) (uint32_t crc, const Pel pel); - CprHashMap(); - virtual ~CprHashMap(); + IbcHashMap(); + virtual ~IbcHashMap(); void init(const int picWidth, const int picHeight); void destroy(); void rebuildPicHashMap(const PelUnitBuf& pic); - bool cprHashMatch(const Area& lumaArea, std::vector<Position>& cand, const CodingStructure& cs, const int maxCand, const int searchRange4SmallBlk); + bool ibcHashMatch(const Area& lumaArea, std::vector<Position>& cand, const CodingStructure& cs, const int maxCand, const int searchRange4SmallBlk); int getHashHitRatio(const Area& lumaArea); #ifdef TARGET_SIMD_X86 - void initCprHashMapX86(); + void initIbcHashMapX86(); template <X86_VEXT vext> - void _initCprHashMapX86(); + void _initIbcHashMapX86(); #endif }; //! \} -#endif // __CPRHASHMAP__ +#endif // __IBCHASHMAP__ diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 2c6402523..e19236e12 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -374,10 +374,10 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& int iRefIdx = pu.refIdx[eRefPicList]; Mv mv[3]; - bool isCPR = false; + bool isIBC = false; if (pu.cs->slice->getRefPic(eRefPicList, iRefIdx)->getPOC() == pu.cs->slice->getPOC()) { - isCPR = true; + isIBC = true; } if( pu.cu->affine ) { @@ -413,7 +413,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 - , isCPR + , isIBC ); } @@ -524,7 +524,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 - , bool isCPR + , bool isIBC ) { JVET_J0090_SET_REF_PICTURE( refPic, compID ); @@ -536,7 +536,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio int xFrac = _mv.hor & ((1 << shiftHor) - 1); int yFrac = _mv.ver & ((1 << shiftVer) - 1); - if (isCPR) + if (isIBC) { xFrac = yFrac = 0; JVET_J0090_SET_CACHE_ENABLE( false ); @@ -1077,7 +1077,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu , const bool luma, const bool chroma ) { - // dual tree handling for CPR as the only ref + // dual tree handling for IBC as the only ref if (!luma || !chroma) { if (!luma && chroma) @@ -1118,7 +1118,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu } else { - if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_CPR) + if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_IBC) { xSubPuMC( pu, predBuf, eRefPicList ); } diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index 2f0795569..0b3106f33 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -110,7 +110,7 @@ protected: 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 - , bool isCPR + , bool isIBC ); 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); diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index 52422e363..ead8fd5cb 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -118,7 +118,7 @@ private: double m_motionLambda; int m_iCostScale; - double m_dCost; // for cpr + double m_dCost; // for ibc public: RdCost(); virtual ~RdCost(); @@ -162,7 +162,7 @@ public: } void setCostScale ( int iCostScale ) { m_iCostScale = iCostScale; } Distortion getCost ( uint32_t b ) { return Distortion( m_motionLambda * b ); } - // for cpr + // for ibc void getMotionCost(int add, bool isTransquantBypass) { m_dCost = m_dLambdaMotionSAD[(isTransquantBypass && m_costMode == COST_MIXED_LOSSLESS_LOSSY_CODING) ? 1 : 0] + add; } void setPredictors(Mv* pcMv) diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index d235bc63a..65a93d955 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -432,7 +432,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i)); } } - if (getSPS()->getSpsNext().getCPRMode()) + if (getSPS()->getSpsNext().getIBCMode()) { RefPicSetLtCurr[NumPicLtCurr] = getPic(); //getPic()->setIsLongTerm(true); @@ -451,7 +451,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. if (getRapPicFlag()) { - if (getSPS()->getSpsNext().getCPRMode()) + if (getSPS()->getSpsNext().getIBCMode()) { CHECK(numPicTotalCurr != 1, "Invalid state"); } @@ -526,7 +526,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b m_bIsUsedAsLongTerm[REF_PIC_LIST_1][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 ); } } - if (getSPS()->getSpsNext().getCPRMode()) + if (getSPS()->getSpsNext().getIBCMode()) { m_apcRefPicList[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = getPic(); m_bIsUsedAsLongTerm[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = true; @@ -561,7 +561,7 @@ int Slice::getNumRpsCurrTempList() const numRpsCurrTempList++; } } - if (getSPS()->getSpsNext().getCPRMode()) + if (getSPS()->getSpsNext().getIBCMode()) { return numRpsCurrTempList + 1; } @@ -1781,7 +1781,7 @@ SPSNext::SPSNext( SPS& sps ) , m_ImvMode ( IMV_OFF ) , m_MTTMode ( 0 ) , m_compositeRefEnabled ( false ) - , m_CPRMode ( 0 ) + , m_IBCMode ( 0 ) // 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 11e589c85..6d74d3b72 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -842,7 +842,7 @@ private: unsigned m_MTTMode; bool m_compositeRefEnabled; //composite longterm reference - unsigned m_CPRMode; + unsigned m_IBCMode; public: SPSNext( SPS& sps ); @@ -914,8 +914,8 @@ public: bool getUseMHIntra () const { return m_MHIntra; } void setUseTriangle ( bool b ) { m_Triangle = b; } bool getUseTriangle () const { return m_Triangle; } - void setCPRMode (unsigned CPRMode) { m_CPRMode = CPRMode; } - unsigned getCPRMode () const { return m_CPRMode; } + void setIBCMode (unsigned IBCMode) { m_IBCMode = IBCMode; } + unsigned getIBCMode () const { return m_IBCMode; } }; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index b95c16428..038ec7a91 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -60,7 +60,7 @@ #define JVET_M0502_PRED_MODE_CTX 1 -#define JVET_M0407_CPR_RANGE 1 // extend CPR search range to some part of left CTU +#define JVET_M0407_IBC_RANGE 1 // extend IBC search range to some part of left CTU #define JVET_M0464_UNI_MTS 1 #define JVET_M0068_M0171_MMVD_CLEANUP 1 // MMVD cleanup with 1) flip removal, 2) L1 zero vector fix, 3) bi-pred restriction after merge/MMVD @@ -867,7 +867,7 @@ enum MergeType { MRG_TYPE_DEFAULT_N = 0, // 0 MRG_TYPE_SUBPU_ATMVP, - MRG_TYPE_CPR, + MRG_TYPE_IBC, NUM_MRG_TYPE // 5 }; diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index cf28c1bbe..10f4e8492 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -272,7 +272,7 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) GBiIdx = other.GBiIdx; for (int i = 0; i<2; i++) refIdxBi[i] = other.refIdxBi[i]; - cpr = other.cpr; + ibc = other.ibc; #if JVET_M0444_SMVD smvdMode = other.smvdMode; #endif @@ -309,7 +309,7 @@ void CodingUnit::initData() GBiIdx = GBI_DEFAULT; for (int i = 0; i < 2; i++) refIdxBi[i] = -1; - cpr = false; + ibc = false; #if JVET_M0444_SMVD smvdMode = 0; #endif diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 5b8e61946..546ca3461 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -312,7 +312,7 @@ struct CodingUnit : public UnitArea int refIdxBi[2]; // needed for fast imv mode decisions int8_t imvNumCand; - bool cpr; + bool ibc; #if JVET_M0444_SMVD uint8_t smvdMode; #endif @@ -366,8 +366,8 @@ struct InterPredictionData Mv mvdAffi [NUM_REF_PIC_LIST_01][3]; Mv mvAffi[NUM_REF_PIC_LIST_01][3]; bool mhIntraFlag; - Mv bv; // block vector for CPR - Mv bvd; // block vector difference for CPR + Mv bv; // block vector for IBC + Mv bvd; // block vector difference for IBC }; struct PredictionUnit : public UnitArea, public IntraPredictionData, public InterPredictionData diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index fc1646ebb..c798955ad 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -720,7 +720,7 @@ bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter ) #endif { - int mrgCandIdxCPR = mrgCandIdx; + int mrgCandIdxIBC = mrgCandIdx; MotionInfo miNeighbor; bool hasPruned[MRG_MAX_NUM_CANDS]; memset(hasPruned, 0, MRG_MAX_NUM_CANDS * sizeof(bool)); @@ -745,11 +745,11 @@ bool PU::addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter #endif if (miNeighbor.interDir == 1 && slice.getRefPic(REF_PIC_LIST_0, miNeighbor.refIdx[0])->getPOC() == slice.getPOC()) { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; + mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; if(mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxCPR++; + mrgCandIdxIBC++; } - if (mrgCandIdxCPR == cnt && canFastExit) + if (mrgCandIdxIBC == cnt && canFastExit) { return true; } @@ -795,7 +795,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, int cnt = 0; - int mrgCandIdxCPR = mrgCandIdx; + int mrgCandIdxIBC = mrgCandIdx; const Position posLT = pu.Y().topLeft(); const Position posRT = pu.Y().topRight(); @@ -820,11 +820,11 @@ 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 (puLeft->cu->cpr) + if (puLeft->cu->ibc) { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; + mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxCPR++; + mrgCandIdxIBC++; } mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miLeft.mv[0], miLeft.refIdx[0]); @@ -832,7 +832,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miLeft.mv[1], miLeft.refIdx[1]); } - if (mrgCandIdxCPR == cnt && canFastExit) + if (mrgCandIdxIBC == cnt && canFastExit) { return; } @@ -866,11 +866,11 @@ 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 (puAbove->cu->cpr) + if (puAbove->cu->ibc) { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; + mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxCPR++; + mrgCandIdxIBC++; } mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] ); @@ -878,7 +878,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAbove.mv[1], miAbove.refIdx[1] ); } - if (mrgCandIdxCPR == cnt && canFastExit) + if (mrgCandIdxIBC == cnt && canFastExit) { return; } @@ -916,11 +916,11 @@ 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 (puAboveRight->cu->cpr) + if (puAboveRight->cu->ibc) { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; + mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxCPR++; + mrgCandIdxIBC++; } mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] ); @@ -929,7 +929,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAboveRight.mv[1], miAboveRight.refIdx[1] ); } - if (mrgCandIdxCPR == cnt && canFastExit) + if (mrgCandIdxIBC == cnt && canFastExit) { return; } @@ -966,11 +966,11 @@ 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 (puLeftBottom->cu->cpr) + if (puLeftBottom->cu->ibc) { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; + mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxCPR++; + mrgCandIdxIBC++; } mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] ); @@ -979,7 +979,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miBelowLeft.mv[1], miBelowLeft.refIdx[1] ); } - if (mrgCandIdxCPR == cnt && canFastExit) + if (mrgCandIdxIBC == cnt && canFastExit) { return; } @@ -1019,11 +1019,11 @@ 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 (puAboveLeft->cu->cpr) + if (puAboveLeft->cu->ibc) { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; + mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; if (mmvdList != 0 && mrgCandIdx != -1) - mrgCandIdxCPR++; + mrgCandIdxIBC++; } mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveLeft.mv[0], miAboveLeft.refIdx[0] ); @@ -1032,7 +1032,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAboveLeft.mv[1], miAboveLeft.refIdx[1] ); } - if (mrgCandIdxCPR == cnt && canFastExit) + if (mrgCandIdxIBC == cnt && canFastExit) { return; } @@ -1134,7 +1134,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, isCandInter [uiArrayAddr] = true; #endif mrgCtx.GBiIdx[uiArrayAddr] = GBI_DEFAULT; - if (mrgCandIdxCPR == cnt && canFastExit) + if (mrgCandIdxIBC == cnt && canFastExit) { return; } @@ -1157,13 +1157,13 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, unsigned subPuMvpPos = 0; #if JVET_L0090_PAIR_AVG bool bFound = addMergeHMVPCand(slice, mrgCtx, canFastExit - , (mmvdList != 0 && mrgCandIdx != -1) ? (const int) mrgCandIdxCPR : mrgCandIdx + , (mmvdList != 0 && mrgCandIdx != -1) ? (const int) mrgCandIdxIBC : mrgCandIdx , maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos , mmvdList ); #else bool bFound = addMergeHMVPCand(slice, mrgCtx, isCandInter, canFastExit - , (mmvdList != 0 && mrgCandIdx != -1) ? (const int)mrgCandIdxCPR : mrgCandIdx + , (mmvdList != 0 && mrgCandIdx != -1) ? (const int)mrgCandIdxIBC : mrgCandIdx , maxNumMergeCandMin1, cnt, cnt, isAvailableSubPu, subPuMvpPos , mmvdList ); @@ -1194,7 +1194,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, // skip when one is BV and one is MV - if (mrgCtx.mrgTypeNeighbours[i] != mrgCtx.mrgTypeNeighbours[j] && pu.cs->sps->getSpsNext().getCPRMode()) + if (mrgCtx.mrgTypeNeighbours[i] != mrgCtx.mrgTypeNeighbours[j] && pu.cs->sps->getSpsNext().getIBCMode()) { continue; } @@ -1224,9 +1224,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, - if (mrgCtx.mrgTypeNeighbours[i] == MRG_TYPE_CPR && mrgCtx.mrgTypeNeighbours[j] == MRG_TYPE_CPR && pu.cs->sps->getSpsNext().getCPRMode()) + if (mrgCtx.mrgTypeNeighbours[i] == MRG_TYPE_IBC && mrgCtx.mrgTypeNeighbours[j] == MRG_TYPE_IBC && pu.cs->sps->getSpsNext().getIBCMode()) { - mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_CPR; + mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; avgMv.setHor((avgMv.getHor() / 16) << 4); avgMv.setVer((avgMv.getVer() / 16) << 4); } @@ -1328,7 +1328,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, 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; + mrgCtx.mrgTypeNeighbours[uiArrayAddr] = MRG_TYPE_IBC; } uiArrayAddr++; @@ -1345,7 +1345,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, } mrgCtx.numValidMergeCand = uiArrayAddr; } -// for cpr pu validation +// for ibc 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) { const int ctuSizeLog2 = g_aucLog2[ctuSize]; @@ -1389,14 +1389,14 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i } // in the same CTU line -#if JVET_M0407_CPR_RANGE +#if JVET_M0407_IBC_RANGE if ((refRightX >> ctuSizeLog2 <= xPos >> ctuSizeLog2) && (refLeftX >> ctuSizeLog2 >= (xPos >> ctuSizeLog2) - 1)) #else if ((refRightX >> ctuSizeLog2 <= xPos >> ctuSizeLog2) && (refLeftX >> ctuSizeLog2 >= (xPos >> ctuSizeLog2))) #endif { -#if JVET_M0407_CPR_RANGE +#if JVET_M0407_IBC_RANGE // in the same CTU, or left CTU // if part of ref block is in the left CTU, some area can be referred from the not-yet updated local CTU buffer if ((refLeftX >> ctuSizeLog2) == ((xPos >> ctuSizeLog2) - 1)) @@ -1410,7 +1410,7 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i return false; } #endif -#if !JVET_M0407_CPR_RANGE +#if !JVET_M0407_IBC_RANGE // in the same CTU, check if the reference block is already coded const Position refPosLT = pu.Y().topLeft().offset(xBv, yBv); const Position refPosBR = pu.Y().bottomRight().offset(xBv, yBv); @@ -1427,7 +1427,7 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i else return false; -#if JVET_M0407_CPR_RANGE +#if JVET_M0407_IBC_RANGE // in the same CTU, or valid area from left CTU. Check if the reference block is already coded const Position refPosLT = pu.Y().topLeft().offset(xBv, yBv); const Position refPosBR = pu.Y().bottomRight().offset(xBv, yBv); @@ -1439,7 +1439,7 @@ bool PU::isBlockVectorValid(PredictionUnit& pu, int xPos, int yPos, int width, i return true; #endif -}// for cpr pu validation +}// for ibc pu validation static int xGetDistScaleFactor(const int &iCurrPOC, const int &iCurrRefPOC, const int &iColPOC, const int &iColRefPOC) { @@ -1632,7 +1632,7 @@ bool PU::isDiffMER(const PredictionUnit &pu1, const PredictionUnit &pu2) return false; } -void PU::getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) +void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) { //-- Get Spatial MV @@ -1645,7 +1645,7 @@ void PU::getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) //left const PredictionUnit *neibLeftPU = NULL; neibLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 0), pu, pu.cs->chType); - left = (neibLeftPU) ? neibLeftPU->cu->cpr : 0; + left = (neibLeftPU) ? neibLeftPU->cu->ibc : 0; if (left) { @@ -1657,7 +1657,7 @@ void PU::getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) //above const PredictionUnit *neibAbovePU = NULL; neibAbovePU = pu.cs->getPURestricted(posRT.offset(0, -1), pu, pu.cs->chType); - above = (neibAbovePU) ? neibAbovePU->cu->cpr : 0; + above = (neibAbovePU) ? neibAbovePU->cu->ibc : 0; if (above) { @@ -1669,7 +1669,7 @@ void PU::getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Below Left predictor search const PredictionUnit *neibBelowLeftPU = NULL; neibBelowLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 1), pu, pu.cs->chType); - unsigned int belowLeft = (neibBelowLeftPU) ? neibBelowLeftPU->cu->cpr : 0; + unsigned int belowLeft = (neibBelowLeftPU) ? neibBelowLeftPU->cu->ibc : 0; if (belowLeft) { @@ -1682,7 +1682,7 @@ void PU::getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Above Right predictor search const PredictionUnit *neibAboveRightPU = NULL; neibAboveRightPU = pu.cs->getPURestricted(posRT.offset(1, -1), pu, pu.cs->chType); - unsigned int aboveRight = (neibAboveRightPU) ? neibAboveRightPU->cu->cpr : 0; + unsigned int aboveRight = (neibAboveRightPU) ? neibAboveRightPU->cu->ibc : 0; if (aboveRight) { @@ -1695,7 +1695,7 @@ void PU::getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Above Left predictor search const PredictionUnit *neibAboveLeftPU = NULL; neibAboveLeftPU = pu.cs->getPURestricted(posLT.offset(-1, -1), pu, pu.cs->chType); - unsigned int aboveLeft = (neibAboveLeftPU) ? neibAboveLeftPU->cu->cpr : 0; + unsigned int aboveLeft = (neibAboveLeftPU) ? neibAboveLeftPU->cu->ibc : 0; if (aboveLeft) { @@ -1723,13 +1723,13 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) const PredictionUnit *neibRefPU = NULL; neibRefPU = pu.cs->getPURestricted(pu.lumaPos().offset(offsetX, offsetY), pu, pu.cs->chType); - bool isCPR = (neibRefPU) ? neibRefPU->cu->cpr : 0; - if (isCPR) + bool isIBC = (neibRefPU) ? neibRefPU->cu->ibc : 0; + if (isIBC) { derivedMv = neibRefPU->bv; derivedMv += currentMv; } - return isCPR; + return isIBC; } /** Constructs a list of candidates for AMVP (See specification, section "Derivation process for motion vector predictor candidates") * \param uiPartIdx @@ -2674,7 +2674,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx bool isAvailableSubPu = false; if ( enableSubPuMvp && slice.getEnableTMVPFlag() ) { - int cntCPR = 0; + int cntIBC = 0; MergeCtx mrgCtx = *affMrgCtx.mrgCtx; bool tmpLICFlag = false; @@ -2697,9 +2697,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx mrgCtx.interDirNeighbours[pos] = miLeft.interDir; // get Mv from Left - if (puLeft->cu->cpr) + if (puLeft->cu->ibc) { - cntCPR++; + cntIBC++; } mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miLeft.mv[0], miLeft.refIdx[0] ); @@ -2722,9 +2722,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx // get Inter Dir mrgCtx.interDirNeighbours[pos] = miAbove.interDir; // get Mv from Left - if (puAbove->cu->cpr) + if (puAbove->cu->ibc) { - cntCPR++; + cntIBC++; } mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] ); @@ -2753,9 +2753,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx // get Inter Dir mrgCtx.interDirNeighbours[pos] = miAboveRight.interDir; // get Mv from Left - if (puAboveRight->cu->cpr) + if (puAboveRight->cu->ibc) { - cntCPR++; + cntIBC++; } mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] ); @@ -2784,9 +2784,9 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx // get Inter Dir mrgCtx.interDirNeighbours[pos] = miBelowLeft.interDir; // get Mv from Bottom-Left - if (puLeftBottom->cu->cpr) + if (puLeftBottom->cu->ibc) { - cntCPR++; + cntIBC++; } mrgCtx.mvFieldNeighbours[pos << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] ); @@ -2801,7 +2801,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx isAvailableSubPu = getInterMergeSubPuMvpCand( pu, mrgCtx, tmpLICFlag, pos , 0 - , cntCPR + , cntIBC ); if ( isAvailableSubPu ) { @@ -2889,7 +2889,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx const PredictionUnit* puNeigh = cs.getPURestricted( pos, pu, pu.chType ); if ( puNeigh && CU::isInter( *puNeigh->cu ) - && !puNeigh->cu->cpr + && !puNeigh->cu->ibc ) { isAvailable[0] = true; @@ -2907,7 +2907,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh && CU::isInter( *puNeigh->cu ) - && !puNeigh->cu->cpr + && !puNeigh->cu->ibc ) { isAvailable[1] = true; @@ -2925,7 +2925,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh && CU::isInter( *puNeigh->cu ) - && !puNeigh->cu->cpr + && !puNeigh->cu->ibc ) { isAvailable[2] = true; @@ -3224,10 +3224,10 @@ void clipColPos(int& posX, int& posY, const PredictionUnit& pu) bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, bool& LICFlag, const int count , int mmvdList - , const int countCPR + , const int countIBC ) { - if (count == countCPR && pu.cs->slice->getSPS()->getSpsNext().getCPRMode()) + if (count == countIBC && pu.cs->slice->getSPS()->getSpsNext().getIBCMode()) return false; const Slice &slice = *pu.cs->slice; const unsigned scale = 4 * std::max<int>(1, 4 * AMVP_DECIMATION_FACTOR / 4); @@ -3343,7 +3343,7 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b mi.isInter = true; mi.sliceIdx = slice.getIndependentSliceIdx(); - 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())) + 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().getIBCMode())) { for (unsigned currRefListId = 0; currRefListId < (bBSlice ? 2 : 1); currRefListId++) { @@ -3385,7 +3385,7 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) MotionBuf mb = pu.getMotionBuf(); if( !pu.mergeFlag || pu.mergeType == MRG_TYPE_DEFAULT_N - || pu.mergeType == MRG_TYPE_CPR + || pu.mergeType == MRG_TYPE_IBC ) { MotionInfo mi; @@ -3477,7 +3477,7 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP pu.mv[0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 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; + pu.cu->ibc = true; } } @@ -3590,7 +3590,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 ) - && !puLeft->cu->cpr + && !puLeft->cu->ibc ; if( isAvailableA1 ) { @@ -3607,7 +3607,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 ) - && !puAbove->cu->cpr + && !puAbove->cu->ibc ; if( isAvailableB1 ) { @@ -3628,7 +3628,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 ) - && !puAboveRight->cu->cpr + && !puAboveRight->cu->ibc ; if( isAvailableB0 ) @@ -3650,7 +3650,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 ) - && !puLeftBottom->cu->cpr + && !puLeftBottom->cu->ibc ; if( isAvailableA0 ) { @@ -3671,7 +3671,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 ) - && !puAboveLeft->cu->cpr + && !puAboveLeft->cu->ibc ; if( isAvailableB2 ) diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index 813991727..fe1fd0154 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -139,7 +139,7 @@ namespace PU ); bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count , int mmvdList - , const int countCPR + , const int countIBC ); bool getInterMergeSubPuRecurCand(const PredictionUnit &pu, MergeCtx &mrgCtx, const int count); bool isBiPredFromDifferentDir (const PredictionUnit &pu); @@ -158,7 +158,7 @@ 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); - void getCprMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred); + void getIbcMVPsEncOnly(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); } diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index 6e94dd904..5971ab404 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -668,7 +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); - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::CPRFlag), cu.cpr); + DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IBCFlag), cu.ibc); } break; diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index df69c1f2e..34d457098 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -108,7 +108,7 @@ enum class BlockStatistic { TriangleMVL0, //<< currently only uni-prediction enabled TriangleMVL1, //<< currently only uni-prediction enabled GBIIndex, - CPRFlag, + IBCFlag, // for dual tree // general Depth_Chroma, @@ -192,7 +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]"}}, - { BlockStatistic::CPRFlag, std::tuple<std::string, BlockStatisticType, std::string>{"CPRFlag", BlockStatisticType::Flag, ""}}, + { BlockStatistic::IBCFlag, std::tuple<std::string, BlockStatisticType, std::string>{"IBCFlag", BlockStatisticType::Flag, ""}}, // 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/CprHashMapX86.h b/source/Lib/CommonLib/x86/IbcHashMapX86.h similarity index 92% rename from source/Lib/CommonLib/x86/CprHashMapX86.h rename to source/Lib/CommonLib/x86/IbcHashMapX86.h index 133fad437..67e4c063d 100644 --- a/source/Lib/CommonLib/x86/CprHashMapX86.h +++ b/source/Lib/CommonLib/x86/IbcHashMapX86.h @@ -33,11 +33,11 @@ /** * \file - * \brief Implementation of CprHashMap class + * \brief Implementation of IbcHashMap class */ #include "CommonDefX86.h" -#include "../CprHashMap.h" +#include "../IbcHashMap.h" #ifdef TARGET_SIMD_X86 @@ -50,12 +50,12 @@ static uint32_t simdComputeCrc32c16bit(uint32_t crc, const Pel pel) } template <X86_VEXT vext> -void CprHashMap::_initCprHashMapX86() +void IbcHashMap::_initIbcHashMapX86() { m_computeCrc32c = simdComputeCrc32c16bit<vext>; } -template void CprHashMap::_initCprHashMapX86<SIMDX86>(); +template void IbcHashMap::_initIbcHashMapX86<SIMDX86>(); #endif //#ifdef TARGET_SIMD_X86 diff --git a/source/Lib/CommonLib/x86/InitX86.cpp b/source/Lib/CommonLib/x86/InitX86.cpp index 14642e161..00f18ae12 100644 --- a/source/Lib/CommonLib/x86/InitX86.cpp +++ b/source/Lib/CommonLib/x86/InitX86.cpp @@ -48,7 +48,7 @@ #include "CommonLib/AdaptiveLoopFilter.h" -#include "CommonLib/CprHashMap.h" +#include "CommonLib/IbcHashMap.h" #ifdef TARGET_SIMD_X86 @@ -167,8 +167,8 @@ void AdaptiveLoopFilter::initAdaptiveLoopFilterX86() } #endif -#if ENABLE_SIMD_OPT_CPR -void CprHashMap::initCprHashMapX86() +#if ENABLE_SIMD_OPT_IBC +void IbcHashMap::initIbcHashMapX86() { auto vext = read_x86_extension_flags(); switch (vext) @@ -177,7 +177,7 @@ void CprHashMap::initCprHashMapX86() case AVX2: case AVX: case SSE42: - _initCprHashMapX86<SSE42>(); + _initIbcHashMapX86<SSE42>(); break; case SSE41: default: diff --git a/source/Lib/CommonLib/x86/sse42/CprHashmap_sse42.cpp b/source/Lib/CommonLib/x86/sse42/CprHashmap_sse42.cpp deleted file mode 100644 index 2a26c1c63..000000000 --- a/source/Lib/CommonLib/x86/sse42/CprHashmap_sse42.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "../CprHashMapX86.h" diff --git a/source/Lib/CommonLib/x86/sse42/IbcHashmap_sse42.cpp b/source/Lib/CommonLib/x86/sse42/IbcHashmap_sse42.cpp new file mode 100644 index 000000000..5aca413b9 --- /dev/null +++ b/source/Lib/CommonLib/x86/sse42/IbcHashmap_sse42.cpp @@ -0,0 +1 @@ +#include "../IbcHashMapX86.h" diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 9b1137147..f5e036ca4 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -906,7 +906,7 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) unsigned value = 0; unsigned ctxId = DeriveCtx::CtxIMVFlag( cu ); - 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 + if (cu.firstPU->interDir == 1 && cu.cs->slice->getRefPic(REF_PIC_LIST_0, cu.firstPU->refIdx[REF_PIC_LIST_0])->getPOC() == cu.cs->slice->getPOC()) // the first bin of IMV flag does need to be signaled in IBC block value = 1; else value = m_BinDecoder.decodeBin( Ctx::ImvFlag( ctxId ) ); @@ -965,7 +965,7 @@ void CABACReader::cu_pred_data( CodingUnit &cu ) if (!cu.Y().valid()) // dual tree chroma CU { cu.predMode = MODE_INTER; - cu.cpr = true; + cu.ibc = true; return; } MergeCtx mrgCtx; diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 7b32dfe6a..fc9bbbaa4 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -336,10 +336,10 @@ void DecCu::xReconInter(CodingUnit &cu) m_pcIntraPred->geneIntrainterPred(cu); // inter prediction - 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"); - CHECK(cu.cpr && cu.firstPU->mmvdMergeFlag, "CPR and MMVD cannot be used together"); + CHECK(cu.ibc && cu.firstPU->mhIntraFlag, "IBC and MHIntra cannot be used together"); + CHECK(cu.ibc && cu.affine, "IBC and Affine cannot be used together"); + CHECK(cu.ibc && cu.triangle, "IBC and triangle cannot be used together"); + CHECK(cu.ibc && cu.firstPU->mmvdMergeFlag, "IBC and MMVD cannot be used together"); const bool luma = cu.Y().valid(); const bool chroma = cu.Cb().valid(); if (luma && chroma) @@ -595,7 +595,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) Mv mvd = pu.mvd[eRefList]; if (eRefList == REF_PIC_LIST_0 && pu.cs->slice->getRefPic(eRefList, pu.refIdx[eRefList])->getPOC() == pu.cs->slice->getPOC()) { - pu.cu->cpr = true; + pu.cu->ibc = true; #if REUSE_CU_RESULTS if (!cu.cs->pcv->isEncoder) #endif diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 3866b1196..09b493dd5 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1228,7 +1228,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } #endif - if (pcSlice->getSPS()->getSpsNext().getCPRMode() && pcSlice->getEnableTMVPFlag()) + if (pcSlice->getSPS()->getSpsNext().getIBCMode() && pcSlice->getEnableTMVPFlag()) { CHECK(pcSlice->getRefPic(RefPicList(pcSlice->isInterB() ? 1 - pcSlice->getColFromL0Flag() : 0), pcSlice->getColRefIdx())->getPOC() == pcSlice->getPOC(), "curr ref picture cannot be collocated picture"); } @@ -1238,7 +1238,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_cSliceDecoder.decompressSlice( pcSlice, &(nalu.getBitstream()) ); m_bFirstSliceInPicture = false; - if (pcSlice->getSPS()->getSpsNext().getCPRMode()) + if (pcSlice->getSPS()->getSpsNext().getIBCMode()) { pcSlice->getPic()->longTerm = false; } diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 9ad45078c..8e1725797 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -811,7 +811,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 ); - READ_FLAG( symbol, "cpr_flag"); spsNext.setCPRMode ( symbol != 0 ); + READ_FLAG( symbol, "ibc_flag"); spsNext.setIBCMode ( symbol != 0 ); 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 b05d0748e..50e02fd06 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -1459,7 +1459,7 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) } unsigned ctxId = DeriveCtx::CtxIMVFlag( cu ); - 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 + if (!(cu.firstPU->interDir == 1 && cu.cs->slice->getRefPic(REF_PIC_LIST_0, cu.firstPU->refIdx[REF_PIC_LIST_0])->getPOC() == cu.cs->slice->getPOC())) // the first bin of IMV flag does need to be signaled in IBC block 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 46bd3778d..0fdf46119 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -239,13 +239,13 @@ protected: bool m_MHIntra; bool m_Triangle; - unsigned m_CPRMode; - unsigned m_CPRLocalSearchRangeX; - unsigned m_CPRLocalSearchRangeY; - unsigned m_CPRHashSearch; - unsigned m_CPRHashSearchMaxCand; - unsigned m_CPRHashSearchRange4SmallBlk; - unsigned m_CPRFastMethod; + unsigned m_IBCMode; + unsigned m_IBCLocalSearchRangeX; + unsigned m_IBCLocalSearchRangeY; + unsigned m_IBCHashSearch; + unsigned m_IBCHashSearchMaxCand; + unsigned m_IBCHashSearchRange4SmallBlk; + unsigned m_IBCFastMethod; bool m_wrapAround; unsigned m_wrapAroundOffset; @@ -756,20 +756,20 @@ public: bool getUseTriangle () const { return m_Triangle; } - void setCPRMode (unsigned n) { m_CPRMode = n; } - unsigned getCPRMode () const { return m_CPRMode; } - void setCPRLocalSearchRangeX (unsigned n) { m_CPRLocalSearchRangeX = n; } - unsigned getCPRLocalSearchRangeX () const { return m_CPRLocalSearchRangeX; } - void setCPRLocalSearchRangeY (unsigned n) { m_CPRLocalSearchRangeY = n; } - unsigned getCPRLocalSearchRangeY () const { return m_CPRLocalSearchRangeY; } - void setCPRHashSearch (unsigned n) { m_CPRHashSearch = n; } - unsigned getCPRHashSearch () const { return m_CPRHashSearch; } - void setCPRHashSearchMaxCand (unsigned n) { m_CPRHashSearchMaxCand = n; } - unsigned getCPRHashSearchMaxCand () const { return m_CPRHashSearchMaxCand; } - void setCPRHashSearchRange4SmallBlk (unsigned n) { m_CPRHashSearchRange4SmallBlk = n; } - unsigned getCPRHashSearchRange4SmallBlk () const { return m_CPRHashSearchRange4SmallBlk; } - void setCPRFastMethod (unsigned n) { m_CPRFastMethod = n; } - unsigned getCPRFastMethod () const { return m_CPRFastMethod; } + void setIBCMode (unsigned n) { m_IBCMode = n; } + unsigned getIBCMode () const { return m_IBCMode; } + void setIBCLocalSearchRangeX (unsigned n) { m_IBCLocalSearchRangeX = n; } + unsigned getIBCLocalSearchRangeX () const { return m_IBCLocalSearchRangeX; } + void setIBCLocalSearchRangeY (unsigned n) { m_IBCLocalSearchRangeY = n; } + unsigned getIBCLocalSearchRangeY () const { return m_IBCLocalSearchRangeY; } + void setIBCHashSearch (unsigned n) { m_IBCHashSearch = n; } + unsigned getIBCHashSearch () const { return m_IBCHashSearch; } + void setIBCHashSearchMaxCand (unsigned n) { m_IBCHashSearchMaxCand = n; } + unsigned getIBCHashSearchMaxCand () const { return m_IBCHashSearchMaxCand; } + void setIBCHashSearchRange4SmallBlk (unsigned n) { m_IBCHashSearchRange4SmallBlk = n; } + unsigned getIBCHashSearchRange4SmallBlk () const { return m_IBCHashSearchRange4SmallBlk; } + void setIBCFastMethod (unsigned n) { m_IBCFastMethod = n; } + unsigned getIBCFastMethod () const { return m_IBCFastMethod; } 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 467ff5ca6..b2acc95e6 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -280,9 +280,9 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) ::memset(m_subMergeBlkNum, 0, sizeof(m_subMergeBlkNum)); m_prevPOC = MAX_UINT; - if (m_pcEncCfg->getCPRHashSearch() && m_pcEncCfg->getCPRMode()) + if (m_pcEncCfg->getIBCHashSearch() && m_pcEncCfg->getIBCMode()) { - m_cprHashMap.init(m_pcEncCfg->getSourceWidth(), m_pcEncCfg->getSourceHeight()); + m_ibcHashMap.init(m_pcEncCfg->getSourceWidth(), m_pcEncCfg->getSourceHeight()); } } @@ -292,9 +292,9 @@ 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 (m_pcEncCfg->getCPRHashSearch() && ctuRsAddr == 0 && cs.slice->getSPS()->getSpsNext().getCPRMode()) + if (m_pcEncCfg->getIBCHashSearch() && ctuRsAddr == 0 && cs.slice->getSPS()->getSpsNext().getIBCMode()) { - m_cprHashMap.rebuildPicHashMap(cs.picture->getOrigBuf()); + m_ibcHashMap.rebuildPicHashMap(cs.picture->getOrigBuf()); } m_modeCtrl->initCTUEncoding( *cs.slice ); @@ -317,24 +317,24 @@ 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 (m_pcEncCfg->getCPRMode()) + if (m_pcEncCfg->getIBCMode()) { m_pcInterSearch->resetCtuRecord(); - m_ctuCprSearchRangeX = m_pcEncCfg->getCPRLocalSearchRangeX(); - m_ctuCprSearchRangeY = m_pcEncCfg->getCPRLocalSearchRangeY(); + m_ctuIbcSearchRangeX = m_pcEncCfg->getIBCLocalSearchRangeX(); + m_ctuIbcSearchRangeY = m_pcEncCfg->getIBCLocalSearchRangeY(); } - if (m_pcEncCfg->getCPRMode() && m_pcEncCfg->getCPRHashSearch() && (m_pcEncCfg->getCPRFastMethod() & CPR_FAST_METHOD_ADAPTIVE_SEARCHRANGE)) + if (m_pcEncCfg->getIBCMode() && m_pcEncCfg->getIBCHashSearch() && (m_pcEncCfg->getIBCFastMethod() & IBC_FAST_METHOD_ADAPTIVE_SEARCHRANGE)) { - const int hashHitRatio = m_cprHashMap.getHashHitRatio(area.Y()); // in percent + const int hashHitRatio = m_ibcHashMap.getHashHitRatio(area.Y()); // in percent if (hashHitRatio < 5) // 5% { - m_ctuCprSearchRangeX >>= 1; - m_ctuCprSearchRangeY >>= 1; + m_ctuIbcSearchRangeX >>= 1; + m_ctuIbcSearchRangeY >>= 1; } if (cs.slice->getNumRefIdx(REF_PIC_LIST_0) > 1) { - m_ctuCprSearchRangeX >>= 1; - m_ctuCprSearchRangeY >>= 1; + m_ctuIbcSearchRangeX >>= 1; + m_ctuIbcSearchRangeY >>= 1; } } // init current context pointer @@ -707,13 +707,13 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par { xCheckIntraPCM( tempCS, bestCS, partitioner, currTestMode ); } - else if (currTestMode.type == ETM_CPR) + else if (currTestMode.type == ETM_IBC) { - xCheckRDCostCPRMode(tempCS, bestCS, partitioner, currTestMode); + xCheckRDCostIBCMode(tempCS, bestCS, partitioner, currTestMode); } - else if (currTestMode.type == ETM_CPR_MERGE) + else if (currTestMode.type == ETM_IBC_MERGE) { - xCheckRDCostCPRModeMerge2Nx2N(tempCS, bestCS, partitioner, currTestMode); + xCheckRDCostIBCModeMerge2Nx2N(tempCS, bestCS, partitioner, currTestMode); } else if( isModeSplit( currTestMode ) ) { @@ -1671,7 +1671,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& if( auto blkCache = dynamic_cast< CacheBlkInfoCtrl* >( m_modeCtrl ) ) { - if (slice.getSPS()->getSpsNext().getCPRMode()) + if (slice.getSPS()->getSpsNext().getIBCMode()) { ComprCUCtx cuECtx = m_modeCtrl->getComprCUCtx(); bestIsSkip = blkCache->isSkip(tempCS->area) && cuECtx.bestCU; @@ -1721,13 +1721,13 @@ 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) ); - uint32_t cprCand = 0; + uint32_t ibcCand = 0; uint32_t numValidMv = mergeCtx.numValidMergeCand; for( uint32_t uiMergeCand = 0; uiMergeCand < mergeCtx.numValidMergeCand; uiMergeCand++ ) { 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++; + ibcCand++; numValidMv--; continue; } @@ -1769,7 +1769,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& swap(singleMergeTempBuffer, acMergeTempBuffer[insertPos]); } } - CHECK(std::min(uiMergeCand + 1 - cprCand, uiNumMrgSATDCand) != RdModeList.size(), ""); + CHECK(std::min(uiMergeCand + 1 - ibcCand, uiNumMrgSATDCand) != RdModeList.size(), ""); } if (numValidMv < uiNumMrgSATDCand) uiNumMrgSATDCand = numValidMv; @@ -2651,12 +2651,12 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct } } ////////////////////////////////////////////////////////////////////////////////////////////// -// cpr merge/skip mode check -void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) +// ibc merge/skip mode check +void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { - assert(tempCS->chType != CHANNEL_TYPE_CHROMA); // chroma CPR is derived + assert(tempCS->chType != CHANNEL_TYPE_CHROMA); // chroma IBC is derived - if (tempCS->area.lwidth() > CPR_MAX_CAND_SIZE || tempCS->area.lheight() > CPR_MAX_CAND_SIZE) // currently only check 32x32 and below block for cpr merge/skip + if (tempCS->area.lwidth() > IBC_MAX_CAND_SIZE || tempCS->area.lheight() > IBC_MAX_CAND_SIZE) // currently only check 32x32 and below block for ibc merge/skip { return; } @@ -2677,7 +2677,7 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct CodingUnit cu(tempCS->area); cu.cs = tempCS; cu.predMode = MODE_INTER; - cu.cpr = true; + cu.ibc = true; cu.slice = tempCS->slice; #if HEVC_TILES_WPP cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap(tempCS->area.lumaPos()); @@ -2722,7 +2722,7 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct #endif cu.skip = false; cu.predMode = MODE_INTER; - cu.cpr = true; + cu.ibc = true; cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; @@ -2859,7 +2859,7 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct #endif cu.skip = false; cu.predMode = MODE_INTER; - cu.cpr = true; + cu.ibc = true; cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; @@ -2868,15 +2868,15 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct #endif PredictionUnit &pu = tempCS->addPU(cu, partitioner.chType);// tempCS->addPU(cu); - pu.intraDir[0] = DC_IDX; // set intra pred for cpr block - pu.intraDir[1] = PLANAR_IDX; // set intra pred for cpr block + pu.intraDir[0] = DC_IDX; // set intra pred for ibc block + pu.intraDir[1] = PLANAR_IDX; // set intra pred for ibc block cu.mmvdSkip = false; pu.mmvdMergeFlag = false; cu.triangle = false; mergeCtx.setMergeInfo(pu, mergeCand); PU::spanMotionInfo(pu, mergeCtx); - assert(mergeCtx.mrgTypeNeighbours[mergeCand] == MRG_TYPE_CPR); // should be CPR candidate at this round + assert(mergeCtx.mrgTypeNeighbours[mergeCand] == MRG_TYPE_IBC); // should be IBC candidate at this round const bool chroma = !(CS::isDualITree(*tempCS)); // MC @@ -2924,7 +2924,7 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct } -void EncCu::xCheckRDCostCPRMode(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) +void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { tempCS->initStructData(encTestMode.qp, encTestMode.lossless); @@ -2940,7 +2940,7 @@ void EncCu::xCheckRDCostCPRMode(CodingStructure *&tempCS, CodingStructure *&best cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; cu.qp = encTestMode.qp; - cu.cpr = true; + cu.ibc = true; cu.imv = 0; CU::addPUs(cu); @@ -2949,16 +2949,16 @@ void EncCu::xCheckRDCostCPRMode(CodingStructure *&tempCS, CodingStructure *&best cu.mmvdSkip = false; pu.mmvdMergeFlag = false; - pu.intraDir[0] = DC_IDX; // set intra pred for cpr block - pu.intraDir[1] = PLANAR_IDX; // set intra pred for cpr block + pu.intraDir[0] = DC_IDX; // set intra pred for ibc block + pu.intraDir[1] = PLANAR_IDX; // set intra pred for ibc block - pu.interDir = 1; // use list 0 for CPR mode + pu.interDir = 1; // use list 0 for IBC mode pu.refIdx[REF_PIC_LIST_0] = pu.cs->slice->getNumRefIdx(REF_PIC_LIST_0) - 1; // last idx in the list if (partitioner.chType == CHANNEL_TYPE_LUMA) { - bool bValid = m_pcInterSearch->predCPRSearch(cu, partitioner, m_ctuCprSearchRangeX, m_ctuCprSearchRangeY, m_cprHashMap); + bool bValid = m_pcInterSearch->predIBCSearch(cu, partitioner, m_ctuIbcSearchRangeX, m_ctuIbcSearchRangeY, m_ibcHashMap); if (bValid) { @@ -3045,13 +3045,13 @@ void EncCu::xCheckRDCostCPRMode(CodingStructure *&tempCS, CodingStructure *&best tempCS->cost = MAX_DOUBLE; } } - // chroma CU cpr comp + // chroma CU ibc comp else { bool success = true; // chroma tree, reuse luma bv at minimal block level // enabled search only when each chroma sub-block has a BV from its luma sub-block - assert(tempCS->getCprLumaCoverage(pu.Cb()) == CPR_LUMA_COVERAGE_FULL); + assert(tempCS->getIbcLumaCoverage(pu.Cb()) == IBC_LUMA_COVERAGE_FULL); // check if each BV for the chroma sub-block is valid //static const UInt unitArea = MIN_PU_SIZE * MIN_PU_SIZE; const CompArea lumaArea = CompArea(COMPONENT_Y, pu.chromaFormat, pu.Cb().lumaPos(), recalcSize(pu.chromaFormat, CHANNEL_TYPE_CHROMA, CHANNEL_TYPE_LUMA, pu.Cb().size())); @@ -3086,7 +3086,7 @@ void EncCu::xCheckRDCostCPRMode(CodingStructure *&tempCS, CodingStructure *&best if (success) { - //pu.mergeType = MRG_TYPE_CPR; + //pu.mergeType = MRG_TYPE_IBC; m_pcInterSearch->motionCompensation(pu, REF_PIC_LIST_0, false, true); // luma=0, chroma=1 m_pcInterSearch->encodeResAndCalcRdInterCU(*tempCS, partitioner, false, false, true); @@ -3106,7 +3106,7 @@ void EncCu::xCheckRDCostCPRMode(CodingStructure *&tempCS, CodingStructure *&best } } } - // check cpr mode in encoder RD + // check ibc mode in encoder RD ////////////////////////////////////////////////////////////////////////////////////////////// void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index eadb9e445..1e4fe78ab 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -45,7 +45,7 @@ #include "CommonLib/TrQuant.h" #include "CommonLib/Unit.h" #include "CommonLib/UnitPartitioner.h" -#include "CommonLib/CprHashMap.h" +#include "CommonLib/IbcHashMap.h" #if REUSE_CU_RESULTS #include "DecoderLib/DecCu.h" @@ -109,7 +109,7 @@ private: CABACWriter* m_CABACEstimator; RateCtrl* m_pcRateCtrl; - CprHashMap m_cprHashMap; + IbcHashMap m_ibcHashMap; CodingStructure **m_pImvTempCS; EncModeCtrl *m_modeCtrl; PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; @@ -120,8 +120,8 @@ private: unsigned int m_subMergeBlkSize[10]; unsigned int m_subMergeBlkNum[10]; unsigned int m_prevPOC; - int m_ctuCprSearchRangeX; - int m_ctuCprSearchRangeY; + int m_ctuIbcSearchRangeX; + int m_ctuIbcSearchRangeY; #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM EncLib* m_pcEncLib; #endif @@ -222,8 +222,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)))); } - void xCheckRDCostCPRMode ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); - void xCheckRDCostCPRModeMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); + void xCheckRDCostIBCMode ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); + void xCheckRDCostIBCModeMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); }; //! \} diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 08c396ed0..bc863bb6c 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -1456,7 +1456,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setSliceType(I_SLICE); } - if (pcSlice->getSliceType() == I_SLICE && pcSlice->getSPS()->getSpsNext().getCPRMode()) + if (pcSlice->getSliceType() == I_SLICE && pcSlice->getSPS()->getSpsNext().getIBCMode()) { pcSlice->setSliceType(P_SLICE); } @@ -1630,7 +1630,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (pcPic->cs->sps->getSpsNext().getUseCompositeRef() && getPrepareLTRef()) { arrangeCompositeReference(pcSlice, rcListPic, pocCurr); } - if (pcSlice->getSPS()->getSpsNext().getCPRMode()) + if (pcSlice->getSPS()->getSpsNext().getIBCMode()) { if (m_pcCfg->getIntraPeriod() > 0 && pcSlice->getPOC() % m_pcCfg->getIntraPeriod() == 0) { @@ -1696,7 +1696,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { pcSlice->setSliceType ( P_SLICE ); } - if (pcSlice->getSPS()->getSpsNext().getCPRMode() && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == 1) + if (pcSlice->getSPS()->getSpsNext().getIBCMode() && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == 1) { m_pcSliceEncoder->setEncCABACTableIdx(P_SLICE); } @@ -1786,7 +1786,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } // disable TMVP when current picture is the only ref picture - if (pcSlice->isIRAP() && pcSlice->getSPS()->getSpsNext().getCPRMode()) + if (pcSlice->isIRAP() && pcSlice->getSPS()->getSpsNext().getIBCMode()) { pcSlice->setEnableTMVPFlag(0); } @@ -1800,7 +1800,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, bool bGPBcheck=false; if ( pcSlice->getSliceType() == B_SLICE) { - if (pcSlice->getSPS()->getSpsNext().getCPRMode()) + if (pcSlice->getSPS()->getSpsNext().getIBCMode()) { if (pcSlice->getNumRefIdx(RefPicList(0)) - 1 == pcSlice->getNumRefIdx(RefPicList(1))) { diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index a59d52d29..56f49fc86 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -892,7 +892,7 @@ void EncLib::xInitSPS(SPS &sps) sps.getSpsNext().setUseMHIntra ( m_MHIntra ); sps.getSpsNext().setUseTriangle ( m_Triangle ); - sps.getSpsNext().setCPRMode ( m_CPRMode ); + sps.getSpsNext().setIBCMode ( m_IBCMode ); sps.setWrapAroundEnabledFlag ( m_wrapAround ); sps.setWrapAroundOffset ( m_wrapAroundOffset ); @@ -1395,7 +1395,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) } } CHECK(!(bestPos <= 15), "Unspecified error"); - if (sps.getSpsNext().getCPRMode()) + if (sps.getSpsNext().getIBCMode()) { pps.setNumRefIdxL0DefaultActive(bestPos + 1); } diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 483060d46..df7ca478e 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -760,7 +760,7 @@ bool BestEncInfoCache::isValid( const CodingStructure& cs, const Partitioner& pa if( encInfo.cu.qp != qp ) return false; 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 ) - || encInfo.cu.cpr + || encInfo.cu.ibc ) { return false; @@ -951,25 +951,25 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru #endif xGetMinMaxQP( minQP, maxQP, cs, partitioner, baseQP, *cs.sps, *cs.pps, true ); - bool checkCpr = true; + bool checkIbc = true; if (cs.chType == CHANNEL_TYPE_CHROMA) { - CprLumaCoverage cprLumaCoverage = cs.getCprLumaCoverage(cs.area.Cb()); - switch (cprLumaCoverage) + IbcLumaCoverage ibcLumaCoverage = cs.getIbcLumaCoverage(cs.area.Cb()); + switch (ibcLumaCoverage) { - case CPR_LUMA_COVERAGE_FULL: - // check CPR + case IBC_LUMA_COVERAGE_FULL: + // check IBC break; - case CPR_LUMA_COVERAGE_PARTIAL: - // do not check CPR - checkCpr = false; + case IBC_LUMA_COVERAGE_PARTIAL: + // do not check IBC + checkIbc = false; break; - case CPR_LUMA_COVERAGE_NONE: - // do not check CPR - checkCpr = false; + case IBC_LUMA_COVERAGE_NONE: + // do not check IBC + checkIbc = false; break; default: - THROW("Unknown CPR luma coverage type"); + THROW("Unknown IBC luma coverage type"); } } // Add coding modes here @@ -1076,13 +1076,13 @@ 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 } ); - // add cpr mode to intra path - if (cs.sps->getSpsNext().getCPRMode() && checkCpr ) + // add ibc mode to intra path + if (cs.sps->getSpsNext().getIBCMode() && checkIbc ) { - m_ComprCUCtxList.back().testModes.push_back({ ETM_CPR, ETO_STANDARD, qp, lossless }); + m_ComprCUCtxList.back().testModes.push_back({ ETM_IBC, ETO_STANDARD, qp, lossless }); if (cs.chType == CHANNEL_TYPE_LUMA) { - m_ComprCUCtxList.back().testModes.push_back({ ETM_CPR_MERGE, ETO_STANDARD, qp, lossless }); + m_ComprCUCtxList.back().testModes.push_back({ ETM_IBC_MERGE, ETO_STANDARD, qp, lossless }); } } } @@ -1241,7 +1241,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } // INTRA MODES - if (cs.sps->getSpsNext().getCPRMode() && !cuECtx.bestTU) + if (cs.sps->getSpsNext().getIBCMode() && !cuECtx.bestTU) return true; CHECK( !slice.isIntra() && !cuECtx.bestTU, "No possible non-intra encoding for a P- or B-slice found" ); @@ -1254,8 +1254,8 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } - if ((m_pcEncCfg->getCPRFastMethod() & CPR_FAST_METHOD_NOINTRA_CPRCBF0) - && (bestMode.type == ETM_CPR || bestMode.type == ETM_CPR_MERGE) + if ((m_pcEncCfg->getIBCFastMethod() & IBC_FAST_METHOD_NOINTRA_IBCCBF0) + && (bestMode.type == ETM_IBC || bestMode.type == ETM_IBC_MERGE) && (!cuECtx.bestCU->Y().valid() || cuECtx.bestTU->cbf[0] == 0) && (!cuECtx.bestCU->Cb().valid() || cuECtx.bestTU->cbf[1] == 0) && (!cuECtx.bestCU->Cr().valid() || cuECtx.bestTU->cbf[2] == 0)) @@ -1296,10 +1296,10 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt // PCM MODES return sps.getPCMEnabledFlag() && width <= ( 1 << sps.getPCMLog2MaxSize() ) && width >= ( 1 << sps.getPCMLog2MinSize() ); } - else if (encTestmode.type == ETM_CPR || encTestmode.type == ETM_CPR_MERGE) + else if (encTestmode.type == ETM_IBC || encTestmode.type == ETM_IBC_MERGE) { - // CPR MODES - return sps.getSpsNext().getCPRMode() && width <= CPR_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= CPR_MAX_CAND_SIZE; + // IBC MODES + return sps.getSpsNext().getIBCMode() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE; } else if( isModeInter( encTestmode ) ) { diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index e4e1410c1..422e4c808 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -70,8 +70,8 @@ enum EncTestModeType ETM_RECO_CACHED, #endif ETM_TRIGGER_IMV_LIST, - ETM_CPR, // cpr mode - ETM_CPR_MERGE, // cpr merge mode + ETM_IBC, // ibc mode + ETM_IBC_MERGE, // ibc merge mode ETM_INVALID }; diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index f08043287..cad55ecf9 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -695,9 +695,9 @@ Distortion InterSearch::xGetInterPredictionError( PredictionUnit& pu, PelUnitBuf return (Distortion)cDistParam.distFunc( cDistParam ); } -/// add cpr search functions here +/// add ibc search functions here -void InterSearch::xCPRSearchMVCandUpdate(Distortion sad, int x, int y, Distortion* sadBestCand, Mv* cMVCand) +void InterSearch::xIBCSearchMVCandUpdate(Distortion sad, int x, int y, Distortion* sadBestCand, Mv* cMVCand) { int j = CHROMA_REFINEMENT_CANDIDATES - 1; @@ -720,7 +720,7 @@ void InterSearch::xCPRSearchMVCandUpdate(Distortion sad, int x, int y, Distorti } } -int InterSearch::xCPRSearchMVChromaRefine(PredictionUnit& pu, +int InterSearch::xIBCSearchMVChromaRefine(PredictionUnit& pu, int roiWidth, int roiHeight, int cuPelX, @@ -814,7 +814,7 @@ int InterSearch::xCPRSearchMVChromaRefine(PredictionUnit& pu, static unsigned int xMergeCandLists(Mv *dst, unsigned int dn, Mv *src, unsigned int sn) { - for (unsigned int cand = 0; cand < sn && dn<CPR_NUM_CANDIDATES; cand++) + for (unsigned int cand = 0; cand < sn && dn<IBC_NUM_CANDIDATES; cand++) { bool found = false; for (int j = 0; j<dn; j++) @@ -897,7 +897,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS Mv cMvPredEncOnly[16]; int nbPreds = 0; - PU::getCprMVPsEncOnly(pu, cMvPredEncOnly, nbPreds); + PU::getIbcMVPsEncOnly(pu, cMvPredEncOnly, nbPreds); m_numBVs = xMergeCandLists(m_acBVs, m_numBVs, cMvPredEncOnly, nbPreds); for (unsigned int cand = 0; cand < m_numBVs; cand++) @@ -917,7 +917,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * yPred + xPred; sad += m_cDistParam.distFunc(m_cDistParam); - xCPRSearchMVCandUpdate(sad, xPred, yPred, sadBestCand, cMVCand); + xIBCSearchMVCandUpdate(sad, xPred, yPred, sadBestCand, cMVCand); } } } @@ -939,7 +939,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y; sad += m_cDistParam.distFunc(m_cDistParam); - xCPRSearchMVCandUpdate(sad, 0, y, sadBestCand, cMVCand); + xIBCSearchMVCandUpdate(sad, 0, y, sadBestCand, cMVCand); tempSadBest = sadBestCand[0]; if (sadBestCand[0] <= 3) { @@ -965,7 +965,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS sad += m_cDistParam.distFunc(m_cDistParam); - xCPRSearchMVCandUpdate(sad, x, 0, sadBestCand, cMVCand); + xIBCSearchMVCandUpdate(sad, x, 0, sadBestCand, cMVCand); tempSadBest = sadBestCand[0]; if (sadBestCand[0] <= 3) { @@ -984,7 +984,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS if ((!bestX && !bestY) || (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL) <= 32)) { //chroma refine - bestCandIdx = xCPRSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); + bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); bestX = cMVCand[bestCandIdx].getHor(); bestY = cMVCand[bestCandIdx].getVer(); sadBest = sadBestCand[bestCandIdx]; @@ -1015,7 +1015,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y + x; sad += m_cDistParam.distFunc(m_cDistParam); - xCPRSearchMVCandUpdate(sad, x, y, sadBestCand, cMVCand); + xIBCSearchMVCandUpdate(sad, x, y, sadBestCand, cMVCand); } } @@ -1025,7 +1025,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS if (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL) <= 16) { //chroma refine - bestCandIdx = xCPRSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); + bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); bestX = cMVCand[bestCandIdx].getHor(); bestY = cMVCand[bestCandIdx].getVer(); @@ -1056,11 +1056,11 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS sad += m_cDistParam.distFunc(m_cDistParam); - xCPRSearchMVCandUpdate(sad, x, y, sadBestCand, cMVCand); + xIBCSearchMVCandUpdate(sad, x, y, sadBestCand, cMVCand); if (sadBestCand[0] <= 5) { //chroma refine & return - bestCandIdx = xCPRSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); + bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); bestX = cMVCand[bestCandIdx].getHor(); bestY = cMVCand[bestCandIdx].getVer(); sadBest = sadBestCand[bestCandIdx]; @@ -1078,7 +1078,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS if ((sadBest >= tempSadBest) || ((sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL)) <= 32)) { //chroma refine - bestCandIdx = xCPRSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); + bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); bestX = cMVCand[bestCandIdx].getHor(); bestY = cMVCand[bestCandIdx].getVer(); sadBest = sadBestCand[bestCandIdx]; @@ -1113,11 +1113,11 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS sad += m_cDistParam.distFunc(m_cDistParam); - xCPRSearchMVCandUpdate(sad, x, y, sadBestCand, cMVCand); + xIBCSearchMVCandUpdate(sad, x, y, sadBestCand, cMVCand); if (sadBestCand[0] <= 5) { //chroma refine & return - bestCandIdx = xCPRSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); + bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); bestX = cMVCand[bestCandIdx].getHor(); bestY = cMVCand[bestCandIdx].getVer(); sadBest = sadBestCand[bestCandIdx]; @@ -1130,7 +1130,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS } } - bestCandIdx = xCPRSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); + bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); bestX = cMVCand[bestCandIdx].getHor(); bestY = cMVCand[bestCandIdx].getVer(); @@ -1155,14 +1155,14 @@ end: // based on xMotionEstimation -void InterSearch::xCPREstimation(PredictionUnit& pu, PelUnitBuf& origBuf, +void InterSearch::xIBCEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Mv *pcMvPred, Mv &rcMv, Distortion &ruiCost, const int localSearchRangeX, const int localSearchRangeY ) { bool buffered = false; - if (m_pcEncCfg->getCPRFastMethod() & CPR_FAST_METHOD_BUFFERBV) + if (m_pcEncCfg->getIBCFastMethod() & IBC_FAST_METHOD_BUFFERBV) { ruiCost = MAX_UINT; const int iPicWidth = pu.cs->slice->getSPS()->getPicWidthInLumaSamples(); @@ -1280,10 +1280,10 @@ void InterSearch::xSetIntraSearchRange(PredictionUnit& pu, int iRoiWidth, int iR rcMvSrchRngRB >>= 2; } -bool InterSearch::predCPRSearch(CodingUnit& cu, Partitioner& partitioner, const int localSearchRangeX, const int localSearchRangeY, CprHashMap& cprHashMap) +bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const int localSearchRangeX, const int localSearchRangeY, IbcHashMap& ibcHashMap) { - // check only no greater than CPR_MAX_CAND_SIZE - if (cu.Y().width > CPR_MAX_CAND_SIZE || cu.Y().height > CPR_MAX_CAND_SIZE) + // check only no greater than IBC_MAX_CAND_SIZE + if (cu.Y().width > IBC_MAX_CAND_SIZE || cu.Y().height > IBC_MAX_CAND_SIZE) return false; Mv cMvSrchRngLT; Mv cMvSrchRngRB; @@ -1297,7 +1297,7 @@ bool InterSearch::predCPRSearch(CodingUnit& cu, Partitioner& partitioner, const CHECK(pu.cu != &cu, "PU is contained in another CU"); ////////////////////////////////////////////////////////// - /// cpr search + /// ibc search pu.cu->imv = 2; AMVPInfo amvpInfo4Pel; PU::fillMvpCand(pu, REF_PIC_LIST_0, pu.refIdx[REF_PIC_LIST_0], amvpInfo4Pel); @@ -1315,23 +1315,23 @@ bool InterSearch::predCPRSearch(CodingUnit& cu, Partitioner& partitioner, const cMv.setZero(); Distortion cost = 0; - if (m_pcEncCfg->getCPRHashSearch()) + if (m_pcEncCfg->getIBCHashSearch()) { - xxCPRHashSearch(pu, cMvPred, iBvpNum, cMv, bvpIdxBest, cprHashMap); + xxIBCHashSearch(pu, cMvPred, iBvpNum, cMv, bvpIdxBest, ibcHashMap); } if (cMv.getHor() == 0 && cMv.getVer() == 0) { // if hash search does not work or is not enabled PelUnitBuf origBuf = pu.cs->getOrgBuf(pu); - xCPREstimation(pu, origBuf, cMvPred, cMv, cost, localSearchRangeX, localSearchRangeY); + xIBCEstimation(pu, origBuf, cMvPred, cMv, cost, localSearchRangeX, localSearchRangeY); } if (cMv.getHor() == 0 && cMv.getVer() == 0) { return false; } - /// cpr search + /// ibc search ///////////////////////////////////////////////////////// unsigned int bitsBVPBest, bitsBVPTemp; bitsBVPBest = MAX_INT; @@ -1412,13 +1412,13 @@ bool InterSearch::predCPRSearch(CodingUnit& cu, Partitioner& partitioner, const return true; } -void InterSearch::xxCPRHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, Mv &mv, int& idxMvPred, CprHashMap& cprHashMap) +void InterSearch::xxIBCHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, Mv &mv, int& idxMvPred, IbcHashMap& ibcHashMap) { mv.setZero(); m_pcRdCost->setCostScale(0); std::vector<Position> candPos; - if (cprHashMap.cprHashMatch(pu.Y(), candPos, *pu.cs, m_pcEncCfg->getCPRHashSearchMaxCand(), m_pcEncCfg->getCPRHashSearchRange4SmallBlk())) + if (ibcHashMap.ibcHashMatch(pu.Y(), candPos, *pu.cs, m_pcEncCfg->getIBCHashSearchMaxCand(), m_pcEncCfg->getIBCHashSearchRange4SmallBlk())) { unsigned int minCost = MAX_UINT; @@ -1588,7 +1588,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) { RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); int refPicNumber = cs.slice->getNumRefIdx(eRefPicList); - if (cs.slice->getSPS()->getSpsNext().getCPRMode() && eRefPicList == REF_PIC_LIST_0) + if (cs.slice->getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) { refPicNumber--; } @@ -1794,7 +1794,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) iRefStart = 0; iRefEnd = cs.slice->getNumRefIdx(eRefPicList)-1; - if (cs.slice->getSPS()->getSpsNext().getCPRMode() && eRefPicList == REF_PIC_LIST_0) + if (cs.slice->getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) { iRefEnd--; } @@ -3494,7 +3494,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); int refPicNumber = slice.getNumRefIdx(eRefPicList); - if (slice.getSPS()->getSpsNext().getCPRMode() && eRefPicList == REF_PIC_LIST_0) + if (slice.getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) { refPicNumber--; } @@ -3867,7 +3867,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, iRefStart = 0; iRefEnd = slice.getNumRefIdx(eRefPicList) - 1; - if (slice.getSPS()->getSpsNext().getCPRMode() && eRefPicList == REF_PIC_LIST_0) + if (slice.getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) { iRefEnd--; } diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index 33f64fb5b..f9edc9438 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -51,7 +51,7 @@ #include "CommonLib/RdCost.h" #include "CommonLib/AffineGradientSearch.h" -#include "CommonLib/CprHashMap.h" +#include "CommonLib/IbcHashMap.h" #include <unordered_map> #include <vector> //! \ingroup EncoderLib @@ -132,7 +132,7 @@ protected: bool m_isInitialized; unsigned int m_numBVs, m_numBV16s; - Mv m_acBVs[CPR_NUM_CANDIDATES]; + Mv m_acBVs[IBC_NUM_CANDIDATES]; public: InterSearch(); virtual ~InterSearch(); @@ -238,12 +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; } - bool predCPRSearch ( CodingUnit& cu, Partitioner& partitioner, const int localSearchRangeX, const int localSearchRangeY, CprHashMap& cprHashMap); + bool predIBCSearch ( CodingUnit& cu, Partitioner& partitioner, const int localSearchRangeX, const int localSearchRangeY, IbcHashMap& ibcHashMap); 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); + void xIBCEstimation ( PredictionUnit& pu, PelUnitBuf& origBuf, Mv *pcMvPred, Mv &rcMv, Distortion &ruiCost, const int localSearchRangeX, const int localSearchRangeY); + void xIBCSearchMVCandUpdate ( Distortion uiSad, int x, int y, Distortion* uiSadBestCand, Mv* cMVCand); + int xIBCSearchMVChromaRefine( PredictionUnit& pu, int iRoiWidth, int iRoiHeight, int cuPelX, int cuPelY, Distortion* uiSadBestCand, Mv* cMVCand); protected: // ------------------------------------------------------------------------------------------------------------------- @@ -440,7 +440,7 @@ protected: void setWpScalingDistParam ( int iRefIdx, RefPicList eRefPicListCur, Slice *slice ); private: - void xxCPRHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, Mv &mv, int& idxMvPred, CprHashMap& cprHashMap); + void xxIBCHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, Mv &mv, int& idxMvPred, IbcHashMap& ibcHashMap); public: void encodeResAndCalcRdInterCU (CodingStructure &cs, Partitioner &partitioner, const bool &skipResidual diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 9932e7dba..34a8b308d 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -551,7 +551,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" ); - WRITE_FLAG(spsNext.getCPRMode() ? 1 : 0, "cpr_flag" ); + WRITE_FLAG(spsNext.getIBCMode() ? 1 : 0, "ibc_flag" ); for( int k = 0; k < SPSNext::NumReservedFlags; k++ ) { WRITE_FLAG( 0, "reserved_flag" ); -- GitLab