diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index d74a2581c2ff41327e2a06fdfbeb760c2e9727f6..0186cb5012dc45c8ff2b1018b2ea56b5beca74b8 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -949,6 +949,9 @@ void EncApp::xInitLibCfg() m_cEncLib.setIBCHashSearchMaxCand ( m_IBCHashSearchMaxCand ); m_cEncLib.setIBCHashSearchRange4SmallBlk ( m_IBCHashSearchRange4SmallBlk ); m_cEncLib.setIBCFastMethod ( m_IBCFastMethod ); +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + m_cEncLib.setTMnoninterToolsEnableFlag ( m_tmNoninterToolsEnableFlag ); +#endif #if JVET_AA0061_IBC_MBVD m_cEncLib.setIbcMbvd ( m_ibcMbvd ); #endif diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index af30719425fede1dc9d00a208e493b22bf2af740..3ffce6b0d3db11311e75ed2bd47525a7edcc66a7 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1109,6 +1109,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #if JVET_AA0133_INTER_MTS_OPT ("InterMTSMaxSize", m_interMTSMaxSize, 32, "InterMTSMaxSize") #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + ("EnableTMnoninterTools", m_tmNoninterToolsEnableFlag, (bool) JVET_AE0174_NONINTER_TM_TOOLS_CONTROL, "Enable non-inter based template matching (0:off, 1:on) \n") +#endif #if ENABLE_DIMD ( "DIMD", m_dimd, true, "Enable decoder side intra mode derivation\n" ) #endif @@ -3901,6 +3904,81 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_maxNumAffineMergeCand < (m_sbTmvpEnableFlag ? 1 : 0), "MaxNumAffineMergeCand must be greater than 0 when SbTMVP is enabled"); xConfirmPara( m_maxNumAffineMergeCand > AFFINE_MRG_MAX_NUM_CANDS, "MaxNumAffineMergeCand must be no more than AFFINE_MRG_MAX_NUM_CANDS." ); +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (!m_tmNoninterToolsEnableFlag) + { +#if JVET_AC0104_IBC_BVD_PREDICTION + if (m_bvdPred) + { + msg(WARNING, "BVD Prediction is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_bvdPred = false; + } +#endif +#if JVET_AC0071_DBV + if (m_intraDBV) + { + msg(WARNING, "DBV is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_intraDBV = false; + } +#endif +#if JVET_AC0060_IBC_BVP_CLUSTER_RRIBC_BVD_SIGN_DERIV + if (m_bvpCluster) + { + msg(WARNING, "BvpCluster is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_bvpCluster = false; + } +#endif +#if JVET_V0130_INTRA_TMP + if (m_intraTMP) + { + msg(WARNING, "IntraTMP is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_intraTMP = false; + } +#endif +#if JVET_W0123_TIMD_FUSION + if (m_timd) + { + msg(WARNING, "TIMD is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_timd = false; + } +#endif +#if JVET_AB0155_SGPM + if (m_sgpm) + { + msg(WARNING, "SGPM is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_sgpm = false; + } +#endif +#if JVET_AD0082_TMRL_CONFIG + if (m_tmrl) + { + msg(WARNING, "TMRL is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_tmrl = false; + } +#endif +#if JVET_AD0085_MPM_SORTING + if (m_mpmSorting) + { + msg(WARNING, "MPMsorting is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_mpmSorting = false; + } +#endif +#if JVET_AD0208_IBC_ADAPT_FOR_CAM_CAPTURED_CONTENTS + if (m_tmibc) + { + msg(WARNING, "TM-IBC is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_tmibc = false; + } +#endif +#if JVET_AD0188_CCP_MERGE + if (m_ccpMerge) + { + msg(WARNING, "CCPmerge is forcefully disabled since the enable flag of non-inter-TM tools is set off. \n"); + m_ccpMerge = false; + } +#endif + } +#endif if ( m_Affine == 0 ) { #if AFFINE_MMVD @@ -3977,7 +4055,11 @@ bool EncAppCfg::xCheckParameter() } #endif #if JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (m_AML && !m_tmNoninterToolsEnableFlag) +#else if (m_AML) +#endif { msg(WARNING, "ARMC is forcefully disabled since the enable flag of TM tools is set off. \n"); m_AML = false; @@ -5342,13 +5424,15 @@ void EncAppCfg::xPrintParameter() #if JVET_AD0208_IBC_ADAPT_FOR_CAM_CAPTURED_CONTENTS msg(VERBOSE, "IBCFrac:%d ", m_IBCFracMode); msg(VERBOSE, "RRIBC:%d ", m_rribc); +#if !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg(VERBOSE, "TMIBC:%d ", m_tmibc); +#endif msg(VERBOSE, "IBCMerge:%d ", m_ibcMerge ); #endif -#if JVET_AC0104_IBC_BVD_PREDICTION +#if JVET_AC0104_IBC_BVD_PREDICTION && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg(VERBOSE, "IBCBvdPred:%d ", m_bvdPred); #endif -#if JVET_AC0060_IBC_BVP_CLUSTER_RRIBC_BVD_SIGN_DERIV +#if JVET_AC0060_IBC_BVP_CLUSTER_RRIBC_BVD_SIGN_DERIV && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg(VERBOSE, "IBCBvpCluster:%d ", m_bvpCluster); #endif #if JVET_AC0112_IBC_CIIP @@ -5447,35 +5531,79 @@ void EncAppCfg::xPrintParameter() #if ENABLE_DIMD msg( VERBOSE, "DIMD:%d ", m_dimd ); #endif -#if JVET_W0123_TIMD_FUSION +#if JVET_W0123_TIMD_FUSION && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg( VERBOSE, "TIMD:%d ", m_timd ); #endif -#if JVET_AB0155_SGPM +#if JVET_AB0155_SGPM && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg(VERBOSE, "SGPM:%d ", m_sgpm); #if JVET_AC0189_SGPM_NO_BLENDING msg(VERBOSE, "SGPMnoBlend:%d ", m_sgpmNoBlend); #endif #endif -#if JVET_AD0082_TMRL_CONFIG +#if JVET_AD0082_TMRL_CONFIG && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg(VERBOSE, "TMRL:%d ", m_tmrl); #endif -#if JVET_AD0085_MPM_SORTING +#if JVET_AD0085_MPM_SORTING && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg(VERBOSE, "MPMSorting:%d ", m_mpmSorting); #endif #if JVET_AC0147_CCCM_NO_SUBSAMPLING msg(VERBOSE, "CCCM:%d ", m_cccm); #endif -#if JVET_V0130_INTRA_TMP +#if JVET_V0130_INTRA_TMP && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg( VERBOSE, "IntraTMP:%d ", m_intraTMP ); msg( VERBOSE, "IntraTmpMaxSize:%d ", m_intraTmpMaxSize ); #if JVET_AB0130_ITMP_SAMPLING msg(VERBOSE, "FastIntraTMP:%d ", m_fastIntraTMP); #endif #endif -#if JVET_AC0071_DBV +#if JVET_AC0071_DBV && !JVET_AE0174_NONINTER_TM_TOOLS_CONTROL msg(VERBOSE, "IntraDBV:%d ", m_intraDBV); #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + msg(VERBOSE, "EnableTMnoninterTools:%d ( ", m_tmNoninterToolsEnableFlag); +#if JVET_AC0104_IBC_BVD_PREDICTION + msg(VERBOSE, "BvdPred:%d ", m_bvdPred); +#endif +#if JVET_AC0071_DBV + msg(VERBOSE, "DBV:%d ", m_intraDBV); +#endif +#if JVET_AC0060_IBC_BVP_CLUSTER_RRIBC_BVD_SIGN_DERIV + msg(VERBOSE, "BvpCluster:%d ", m_bvpCluster); +#endif +#if JVET_V0130_INTRA_TMP + msg(VERBOSE, "IntraTMP:%d ", m_intraTMP); + msg( VERBOSE, "IntraTmpMaxSize:%d ", m_intraTmpMaxSize ); +#if JVET_AB0130_ITMP_SAMPLING + msg(VERBOSE, "FastIntraTMP:%d ", m_fastIntraTMP); +#endif +#endif +#if JVET_W0123_TIMD_FUSION + msg(VERBOSE, "TIMD:%d ", m_timd); +#endif +#if JVET_AB0155_SGPM + msg(VERBOSE, "SGPM:%d ", m_sgpm); +#if JVET_AC0189_SGPM_NO_BLENDING + msg(VERBOSE, "SGPMnoBlend:%d ", m_sgpmNoBlend); +#endif +#endif +#if JVET_AD0082_TMRL_CONFIG + msg(VERBOSE, "TMRL:%d ", m_tmrl); +#endif +#if JVET_AD0085_MPM_SORTING + msg(VERBOSE, "MPMsorting:%d ", m_mpmSorting); +#endif +#if JVET_AD0208_IBC_ADAPT_FOR_CAM_CAPTURED_CONTENTS + msg(VERBOSE, "TM-IBC:%d ", m_tmibc); +#endif +#if JVET_AD0188_CCP_MERGE + msg(VERBOSE, "CCPmerge:%d ", m_ccpMerge); +#endif + msg(VERBOSE, ") "); +#else + msg(VERBOSE, "EnableTMnoninterTools:%d ", m_tmNoninterToolsEnableFlag); +#endif + //inter #if AFFINE_MMVD if( m_Affine ) diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 5cc218fd8e75ec7fc8033275a1861493761b22e9..1e66a3eb8ad5334b32e932f5da2cdb1a3aed1407 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -472,6 +472,9 @@ protected: #if JVET_AD0082_TMRL_CONFIG bool m_tmrl; #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + bool m_tmNoninterToolsEnableFlag; +#endif #if JVET_AD0085_MPM_SORTING bool m_mpmSorting; #endif diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index 537cad4a28df66465155b34ee9708c0600529e99..17047f0e214992e43c2ccf4a82248d07edb77599 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -3404,10 +3404,14 @@ void IntraPrediction::geneChromaFusionPred(const ComponentID compId, PelBuf &piP #if JVET_AD0120_LBCCP static int cclmSAD = MAX_INT; static int cccmSAD = MAX_INT; - bool isMultiCccmFullEnabled = false; #if JVET_AA0057_CCCM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->slice->isIntra() && PU::cccmMultiModeAvail(pu, MMLM_CHROMA_IDX) && pu.cs->sps->getTMnoninterToolsEnableFlag()) +#else + bool isMultiCccmFullEnabled = false; isMultiCccmFullEnabled = PU::cccmMultiModeAvail(pu, MMLM_CHROMA_IDX); if (pu.cs->slice->isIntra() && isMultiCccmFullEnabled) +#endif { const int bitDepth = pu.cu->slice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); const CompArea &areaCb = pu2.blocks[COMPONENT_Cb]; @@ -3512,7 +3516,11 @@ void IntraPrediction::geneChromaFusionPred(const ComponentID compId, PelBuf &piP int shift = 2; #if JVET_AD0120_LBCCP +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->slice->isIntra() && PU::cccmMultiModeAvail(pu, MMLM_CHROMA_IDX) && pu.cs->sps->getTMnoninterToolsEnableFlag()) +#else if (pu.cs->slice->isIntra() && isMultiCccmFullEnabled) +#endif { const bool aboveAvailable = pu.cu->cs->getCU(pu.blocks[compId].pos().offset(0, -1), toChannelType(compId)) ? true : false; const bool leftAvailable = pu.cu->cs->getCU(pu.blocks[compId].pos().offset(-1, 0), toChannelType(compId)) ? true : false; @@ -14893,6 +14901,9 @@ void IntraPrediction::predIntraCCCM( const PredictionUnit &pu, PelBuf &predCb, P #endif #if JVET_AC0147_CCCM_NO_SUBSAMPLING && !pu.cccmNoSubFlag +#endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMnoninterToolsEnableFlag() #endif ) { diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index d8dbb100c4fe1dfd250aa7a4199ce91ec7d10f80..67ef3d0e086b502a6db5e01bf7455123503b4a2d 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -3664,6 +3664,20 @@ SPS::SPS() #if JVET_Z0056_GPM_SPLIT_MODE_REORDERING , m_altGPMSplitModeCode ( false ) #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL +#if JVET_Y0067_ENHANCED_MMVD_MVD_SIGN_PRED || JVET_AD0140_MVD_PREDICTION + , m_mvdPred(false) +#endif +#if JVET_AC0104_IBC_BVD_PREDICTION + , m_bvdPred(false) +#endif +#if JVET_AC0060_IBC_BVP_CLUSTER_RRIBC_BVD_SIGN_DERIV + , m_bvpCluster(false) +#endif +#if JVET_Z0054_BLK_REF_PIC_REORDER + , m_useARL(false) +#endif +#endif , m_SBT ( false ) , m_ISP ( false ) , m_chromaFormatIdc (CHROMA_420) @@ -3762,6 +3776,24 @@ SPS::SPS() #if JVET_W0123_TIMD_FUSION , m_timd ( false ) #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL +#if JVET_AB0155_SGPM + , m_sgpm(false) +#endif +#if JVET_AD0082_TMRL_CONFIG + , m_tmrl(false) +#endif +, m_tmNoninterToolsEnableFlag ( false ) +#if JVET_AD0085_MPM_SORTING +, m_mpmSorting ( false ) +#endif +#if JVET_AC0147_CCCM_NO_SUBSAMPLING +, m_cccm ( false ) +#endif +#if JVET_AD0188_CCP_MERGE +, m_ccpMerge ( false ) +#endif +#endif #if JVET_V0130_INTRA_TMP , m_intraTMP ( false ) , m_intraTmpMaxSize ( 64 ) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index e9c571af6969349dd6b70eee30f1d63cc708ddf4..cc9af8437bb5170f2a65cc8bfcd790b99fc69a3b 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -1764,6 +1764,9 @@ private: #if JVET_AD0082_TMRL_CONFIG bool m_tmrl; #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + bool m_tmNoninterToolsEnableFlag; +#endif #if JVET_AD0085_MPM_SORTING bool m_mpmSorting; #endif @@ -2382,6 +2385,10 @@ void setCCALFEnabledFlag( bool b ) void setUseTmrl (bool b) { m_tmrl = b; } bool getUseTmrl () const { return m_tmrl; } #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + void setTMnoninterToolsEnableFlag (bool b) { m_tmNoninterToolsEnableFlag = b; } + bool getTMnoninterToolsEnableFlag () const { return m_tmNoninterToolsEnableFlag; } +#endif #if JVET_AD0085_MPM_SORTING void setUseMpmSorting (bool b) { m_mpmSorting = b; } bool getUseMpmSorting () const { return m_mpmSorting; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index a07798719627559d0d7611f920f6e381ac601f31..0d710a58796b6ea873deb161792092b72359b903 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -52,7 +52,6 @@ - #define BASE_ENCODER 1 #define BASE_NORMATIVE 1 #define TOOLS 1 @@ -170,7 +169,9 @@ #define JVET_AC0053_GAUSSIAN_SOLVER 1 // JVET-AC0053: Filter parameters using Gaussian elimination steps #endif #define JVET_AB0155_SGPM 1 // JVET-AB0155: Spatial geometric partitioning mode +#if JVET_AB0155_SGPM #define JVET_AC0189_SGPM_NO_BLENDING 1 // JVET-AC0189: Allow no blending for SGPM +#endif #define JVET_AB0157_TMRL 1 // JVET-AB0157: Template-based multiple reference line intra prediction #if JVET_AB0157_TMRL #define JVET_AD0082_TMRL_CONFIG 1 // JVET-AD0082: a configuration option for TMRL @@ -206,6 +207,7 @@ #define JVET_AC0071_DBV 1 // JVET-AC0071: Direct block vector mode for chroma prediction #define JVET_AD0208_IBC_ADAPT_FOR_CAM_CAPTURED_CONTENTS 1 // JVET-AD0208: IBC adaptation for camera-captured contents and IBC extension to fractional-pel BV +#define JVET_AE0174_NONINTER_TM_TOOLS_CONTROL 1 // JVET-AE0174: Add non-inter TM sps flag to control whether template matching is used for non-inter (Intra and IBC) tools // Inter #define CIIP_PDPC 1 // Apply pdpc to megre prediction as a new CIIP mode (CIIP_PDPC) additional to CIIP mode diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 719ee5c4eba39e2a826a1d650d01cc187b268915..0f53e4648b8ed195e65f0b9bd86a19bd9881fa79 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -4625,10 +4625,12 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const } // above left -#if JVET_Z0084_IBC_TM && JVET_Z0075_IBC_HMVP_ENLARGE && JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL && JVET_Z0084_IBC_TM && JVET_Z0075_IBC_HMVP_ENLARGE && JVET_W0090_ARMC_TM + if ((cnt < 4 && pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag() && mrgCandIdx >= 0) || !(pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag())) //Only for AMVP case +#elif JVET_Z0084_IBC_TM && JVET_Z0075_IBC_HMVP_ENLARGE && JVET_W0090_ARMC_TM if ((cnt < 4 && pu.cs->sps->getUseAML() && mrgCandIdx >= 0) #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_W0090_ARMC_TM - || !pu.cs->sps->getUseAML() + || !pu.cs->sps->getUseAML() #endif ) //Only for AMVP case #elif !JVET_Z0075_IBC_HMVP_ENLARGE @@ -5901,7 +5903,11 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, ) { #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (!(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag())|| !pu.cs->sps->getUseTmvpNmvpReordering()) +#else if (!pu.cs->sps->getUseAML() || !pu.cs->sps->getUseTmvpNmvpReordering()) +#endif { tmvpMrgCtx = nullptr; namvpMrgCtx = nullptr; @@ -5924,14 +5930,21 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, } const uint32_t maxNumMergeCand = #if JVET_AA0132_CONFIGURABLE_TM_TOOLS +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + !(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag())|| !pu.cs->sps->getUseTmvpNmvpReordering() ? +#else !pu.cs->sps->getUseAML() || !pu.cs->sps->getUseTmvpNmvpReordering() ? +#endif (pu.tmMergeFlag ? pu.cs->sps->getMaxNumTMMergeCand() : pu.cs->sps->getMaxNumMergeCand()) : #endif (pu.tmMergeFlag ? std::min((int)(TM_MRG_MAX_NUM_INIT_CANDS + additionalMRGCand), ((int)NUM_MERGE_CANDS - (3))) : std::min((int)(pu.cs->sps->getMaxNumMergeCand() + additionalMRGCand), ((int)NUM_MERGE_CANDS - (3)))); #else #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM - const uint32_t maxNumMergeCand = pu.tmMergeFlag ? ((pu.cs->sps->getUseAML() + const uint32_t maxNumMergeCand = pu.tmMergeFlag ? (( pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && pu.cs->sps->getUseTmvpNmvpReordering() #endif @@ -6785,7 +6798,11 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #endif { #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (!(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag()) && cnt >= maxNumMergeCand - 1) +#else if (!pu.cs->sps->getUseAML() && cnt >= maxNumMergeCand - 1) +#endif { continue; } @@ -6800,7 +6817,11 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #endif { #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (!(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag()) && cnt >= maxNumMergeCand - 1) +#else if (!pu.cs->sps->getUseAML() && cnt >= maxNumMergeCand - 1) +#endif { continue; } @@ -6946,8 +6967,12 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC int maxNumMergeCandMin1 = maxNumMergeCand; #if JVET_AA0132_CONFIGURABLE_TM_TOOLS +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + maxNumMergeCandMin1 -= !(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag()) ? 1 : 0; +#else maxNumMergeCandMin1 -= !pu.cs->sps->getUseAML() ? 1 : 0; #endif +#endif #else int maxNumMergeCandMin1 = maxNumMergeCand - 1; #endif @@ -6987,7 +7012,11 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { if (cnt > 1 && cnt < maxNumMergeCand #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && !(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag()) +#else && !pu.cs->sps->getUseAML() +#endif #endif ) { @@ -8461,7 +8490,11 @@ void PU::getInterBMCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, ) { #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (!(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag()) || !pu.cs->sps->getUseTmvpNmvpReordering()) +#else if (!pu.cs->sps->getUseAML() || !pu.cs->sps->getUseTmvpNmvpReordering()) +#endif { mvpMrgCtx1 = nullptr; mvpMrgCtx2 = nullptr; @@ -8476,6 +8509,9 @@ void PU::getInterBMCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, + (mvpMrgCtx2 != NULL ? mvpMrgCtx2->numValidMergeCand : 0); #endif const uint32_t maxNumMergeCand = pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && pu.cs->sps->getUseTmvpNmvpReordering() #endif @@ -8973,8 +9009,12 @@ void PU::getInterBMCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC int maxNumMergeCandMin1 = maxNumMergeCand; #if JVET_AA0132_CONFIGURABLE_TM_TOOLS +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + maxNumMergeCandMin1 -= !(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag()) ? 1 : 0; +#else maxNumMergeCandMin1 -= !pu.cs->sps->getUseAML() ? 1 : 0; #endif +#endif #else int maxNumMergeCandMin1 = maxNumMergeCand - 1; #endif @@ -9113,7 +9153,11 @@ void PU::getInterBMCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, #if !JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC || (JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC) #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (!(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag())) +#else if (!pu.cs->sps->getUseAML()) +#endif #endif { if (cnt > 1 && cnt < maxNumMergeCand) @@ -11761,7 +11805,11 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in namvpMergeCandCtx[1].numValidMergeCand = 0; bool isSaved = true; - if (pu.cs->sps->getUseAML() && interPred != NULL) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + && interPred != NULL) { int nWidth = pu.lumaSize().width; int nHeight = pu.lumaSize().height; @@ -13185,7 +13233,11 @@ bool PU::addSpatialAffineMergeHMVPCand(const PredictionUnit& pu, AffineMergeCtx& const Slice& slice = *pu.cs->slice; #if JVET_AA0107_RMVF_AFFINE_MERGE_DERIVATION #if JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand() + ((pu.cs->sps->getUseAML()&& pu.cs->sps->getTMToolsEnableFlag()) ? ADDITIONAL_AFFINE_CAND_NUM : 0); +#else const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand() + (pu.cs->sps->getUseAML() ? ADDITIONAL_AFFINE_CAND_NUM : 0); +#endif #else const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand(); #endif @@ -14786,7 +14838,11 @@ void PU::getNonAdjCstMergeCand(const PredictionUnit &pu, AffineMergeCtx &affMrgC const Slice & slice = *pu.cs->slice; #if JVET_AA0107_RMVF_AFFINE_MERGE_DERIVATION #if JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand() + ((pu.cs->sps->getUseAML()&& pu.cs->sps->getTMToolsEnableFlag()) ? ADDITIONAL_AFFINE_CAND_NUM : 0); +#else const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand() + (pu.cs->sps->getUseAML() ? ADDITIONAL_AFFINE_CAND_NUM : 0); +#endif #else const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand(); #endif @@ -15013,7 +15069,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx const Slice &slice = *pu.cs->slice; #if JVET_AA0107_RMVF_AFFINE_MERGE_DERIVATION #if JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand() + ((pu.cs->sps->getUseAML()&& pu.cs->sps->getTMToolsEnableFlag()) ? ADDITIONAL_AFFINE_CAND_NUM : 0); +#else const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand() + (pu.cs->sps->getUseAML() ? ADDITIONAL_AFFINE_CAND_NUM : 0); +#endif #else const uint32_t maxNumAffineMergeCand = slice.getPicHeader()->getMaxNumAffineMergeCand(); #endif @@ -15340,7 +15400,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx } affMrgCtxTemp.numValidMergeCand = 0; affMrgCtxTemp.maxNumMergeCand = RMVF_AFFINE_MRG_MAX_CAND_LIST_SIZE; - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { int counter = 0; affMrgCtxTemp = affineRMVFCtx; @@ -15495,7 +15559,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx collectNeiMotionInfo(mvpInfoVec, pu); #if JVET_W0090_ARMC_TM - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { for (int i = 0; i < numAffNeighExtend2; i++) { @@ -15897,7 +15965,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx } } #if JVET_AA0107_RMVF_AFFINE_MERGE_DERIVATION && JVET_W0090_ARMC_TM - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { affMrgCtx.numAffCandToTestEnc = affMrgCtx.numValidMergeCand; } @@ -17041,7 +17113,11 @@ void PU::getRMVFAffineCand(const PredictionUnit &pu, AffineMergeCtx& affineMerge std::vector<RMVFInfo> mvpInfoVec[NUM_REF_PIC_LIST_01][MAX_NUM_REF]; collectNeiMotionInfo(mvpInfoVec, pu); #if JVET_W0090_ARMC_TM - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { for (int i = 0; i < numAffNeighExtend2; i++) { @@ -21090,7 +21166,11 @@ bool PU::checkIsValidMergeMvCand(const CodingStructure &cs, const PredictionUnit #if JVET_AA0093_REFINED_MOTION_FOR_ARMC bool PU::isArmcRefinedMotionEnabled(const PredictionUnit &pu, unsigned mode) { +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (!(pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag()) || !pu.cs->sps->getUseArmcRefinedMotion()) +#else if (!pu.cs->sps->getUseAML() || !pu.cs->sps->getUseArmcRefinedMotion()) +#endif { return false; } diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index f41722f723f376c3c614cde72e5690a96cfc661b..479180e998cde3d7cb2d8ac0226fce114350f829 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -2227,7 +2227,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) } if (pu.cs->picHeader->getEnableTMVPFlag()) { - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { MergeCtx namvpMergeCandCtx[2]; int nWidth = pu.lumaSize().width; @@ -2405,7 +2409,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) #if JVET_W0090_ARMC_TM else { - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) #if JVET_Z0139_NA_AFF if (affineMergeCtx.numValidMergeCand > 1) #endif @@ -2423,7 +2431,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) #endif #else #if JVET_W0090_ARMC_TM - int affMrgIdx = pu.cs->sps->getUseAML() && (((pu.mergeIdx / ADAPTIVE_AFFINE_SUB_GROUP_SIZE + 1)*ADAPTIVE_AFFINE_SUB_GROUP_SIZE < pu.cs->sps->getMaxNumAffineMergeCand()) || (pu.mergeIdx / ADAPTIVE_AFFINE_SUB_GROUP_SIZE) == 0) ? pu.mergeIdx / ADAPTIVE_AFFINE_SUB_GROUP_SIZE * ADAPTIVE_AFFINE_SUB_GROUP_SIZE + ADAPTIVE_AFFINE_SUB_GROUP_SIZE - 1 : pu.mergeIdx; + int affMrgIdx = pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + && (((pu.mergeIdx / ADAPTIVE_AFFINE_SUB_GROUP_SIZE + 1)*ADAPTIVE_AFFINE_SUB_GROUP_SIZE < pu.cs->sps->getMaxNumAffineMergeCand()) || (pu.mergeIdx / ADAPTIVE_AFFINE_SUB_GROUP_SIZE) == 0) ? pu.mergeIdx / ADAPTIVE_AFFINE_SUB_GROUP_SIZE * ADAPTIVE_AFFINE_SUB_GROUP_SIZE + ADAPTIVE_AFFINE_SUB_GROUP_SIZE - 1 : pu.mergeIdx; #if !JVET_Z0139_NA_AFF PU::getAffineMergeCand(pu, affineMergeCtx, affMrgIdx); #else @@ -2434,7 +2446,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) affMrgIdx, pu.mergeIdx == 0); if (affineMergeCtx.numValidMergeCand > 1) #endif - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { m_pcInterPred->adjustAffineMergeCandidates(pu, affineMergeCtx, pu.mergeIdx); } @@ -2553,7 +2569,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) } } #if JVET_W0090_ARMC_TM - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { m_pcInterPred->adjustInterMergeCandidates(pu, mrgCtx, CIIP_TM_MRG_MAX_NUM_CANDS - 1); } @@ -2584,7 +2604,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) { int fPosIBCBaseIdx = pu.ibcMbvdMergeIdx / IBC_MBVD_MAX_REFINE_NUM; #if JVET_Y0058_IBC_LIST_MODIFY && JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag()) +#else if (pu.cs->sps->getUseAML()) +#endif { #if JVET_Z0075_IBC_HMVP_ENLARGE PU::getIBCMergeCandidates(pu, mrgCtx); @@ -2610,18 +2634,29 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) PU::getIbcMbvdMergeCandidates(pu, mrgCtx, fPosIBCBaseIdx + 1); - uint32_t ibcMbvdLUT[IBC_MBVD_NUM]; - uint32_t ibcMbvdValidNum[IBC_MBVD_BASE_NUM] = { 0 }; - int ibcMbvdIdx= pu.ibcMbvdMergeIdx; - m_pcInterPred->sortIbcMergeMbvdCandidates(pu, mrgCtx, ibcMbvdLUT, ibcMbvdValidNum, ibcMbvdIdx); - bool mbvdCandMisAlign = mrgCtx.setIbcMbvdMergeCandiInfo(pu, ibcMbvdIdx, ibcMbvdLUT[ibcMbvdIdx]); - CHECK(mbvdCandMisAlign, "MBVD candidate is invalid"); +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag()) + { +#endif + uint32_t ibcMbvdLUT[IBC_MBVD_NUM]; + uint32_t ibcMbvdValidNum[IBC_MBVD_BASE_NUM] = { 0 }; + int ibcMbvdIdx = pu.ibcMbvdMergeIdx; + m_pcInterPred->sortIbcMergeMbvdCandidates(pu, mrgCtx, ibcMbvdLUT, ibcMbvdValidNum, ibcMbvdIdx); + bool mbvdCandMisAlign = mrgCtx.setIbcMbvdMergeCandiInfo(pu, ibcMbvdIdx, ibcMbvdLUT[ibcMbvdIdx]); + CHECK(mbvdCandMisAlign, "MBVD candidate is invalid"); +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + } +#endif } else { #endif #if JVET_Y0058_IBC_LIST_MODIFY && JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag()) +#else if (pu.cs->sps->getUseAML()) +#endif { #if JVET_Z0075_IBC_HMVP_ENLARGE auto mrgCandIdx = pu.mergeIdx; @@ -2672,7 +2707,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) { auto mergeIdx = pu.bmDir == 2 ? pu.mergeIdx - BM_MRG_MAX_NUM_CANDS : pu.mergeIdx; #if JVET_W0090_ARMC_TM - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { uint8_t bmDir = pu.bmDir; #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING @@ -2752,9 +2791,14 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) #endif #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC PU::getInterBMCandidates(pu, mrgCtx, -1); +#else +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + PU::getInterBMCandidates(pu, mrgCtx, pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag() && (((mergeIdx / ADAPTIVE_SUB_GROUP_SIZE + 1)*ADAPTIVE_SUB_GROUP_SIZE < pu.cs->sps->getMaxNumBMMergeCand()) || (mergeIdx / ADAPTIVE_SUB_GROUP_SIZE) == 0) ? mergeIdx / ADAPTIVE_SUB_GROUP_SIZE * ADAPTIVE_SUB_GROUP_SIZE + ADAPTIVE_SUB_GROUP_SIZE - 1 : mergeIdx); + #else PU::getInterBMCandidates(pu, mrgCtx, pu.cs->sps->getUseAML() && (((mergeIdx / ADAPTIVE_SUB_GROUP_SIZE + 1)*ADAPTIVE_SUB_GROUP_SIZE < pu.cs->sps->getMaxNumBMMergeCand()) || (mergeIdx / ADAPTIVE_SUB_GROUP_SIZE) == 0) ? mergeIdx / ADAPTIVE_SUB_GROUP_SIZE * ADAPTIVE_SUB_GROUP_SIZE + ADAPTIVE_SUB_GROUP_SIZE - 1 : mergeIdx); #endif +#endif #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_Y0134_TMVP_NAMVP_CAND_REORDERING } #endif @@ -2931,7 +2975,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) else #endif #if JVET_W0090_ARMC_TM +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag()) +#else if (pu.cs->sps->getUseAML()) +#endif { #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING #if JVET_AA0132_CONFIGURABLE_TM_TOOLS @@ -3121,7 +3169,11 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) else { #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + PU::getInterMergeCandidates(pu, mrgCtx, 0, pu.cs->sps->getUseAML() && pu.cs->sps->getTMToolsEnableFlag() && (((pu.mergeIdx / ADAPTIVE_SUB_GROUP_SIZE + 1)*ADAPTIVE_SUB_GROUP_SIZE < pu.cs->sps->getMaxNumMergeCand()) || (pu.mergeIdx / ADAPTIVE_SUB_GROUP_SIZE) == 0) ? pu.mergeIdx / ADAPTIVE_SUB_GROUP_SIZE * ADAPTIVE_SUB_GROUP_SIZE + ADAPTIVE_SUB_GROUP_SIZE - 1 : pu.mergeIdx); +#else PU::getInterMergeCandidates(pu, mrgCtx, 0, pu.cs->sps->getUseAML() && (((pu.mergeIdx / ADAPTIVE_SUB_GROUP_SIZE + 1)*ADAPTIVE_SUB_GROUP_SIZE < pu.cs->sps->getMaxNumMergeCand()) || (pu.mergeIdx / ADAPTIVE_SUB_GROUP_SIZE) == 0) ? pu.mergeIdx / ADAPTIVE_SUB_GROUP_SIZE * ADAPTIVE_SUB_GROUP_SIZE + ADAPTIVE_SUB_GROUP_SIZE - 1 : pu.mergeIdx); +#endif #if TM_MRG && JVET_AA0093_REFINED_MOTION_FOR_ARMC tmMergeRefinedMotion = PU::isArmcRefinedMotionEnabled(pu, 2); int nWidth = pu.lumaSize().width; diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 3fe17a334bc66adbd3dd175af5aa12ef7567acf2..07716404f0863866ee577b86b648fcb284ebd91a 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -2218,6 +2218,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #if JVET_AA0132_CONFIGURABLE_TM_TOOLS READ_FLAG( uiCode, "sps_tm_tools_enabled_flag" ); pcSPS->setTMToolsEnableFlag( uiCode ); #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + READ_FLAG( uiCode, "sps_tmNoninterToolsEnableFlag_enabled_flag" ); pcSPS->setTMnoninterToolsEnableFlag( uiCode ); +#endif #if INTER_LIC READ_FLAG( uiCode, "sps_lic_enabled_flag" ); pcSPS->setLicEnabledFlag( uiCode ); #endif @@ -2248,8 +2251,12 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #if JVET_W0090_ARMC_TM #if JVET_AA0132_CONFIGURABLE_TM_TOOLS +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if(pcSPS->getTMToolsEnableFlag() || pcSPS->getTMnoninterToolsEnableFlag()) +#else pcSPS->setUseAML(false); if(pcSPS->getTMToolsEnableFlag()) +#endif { #endif READ_FLAG( uiCode, "sps_aml_enabled_flag"); pcSPS->setUseAML ( uiCode != 0 ); @@ -2262,7 +2269,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #endif #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM pcSPS->setUseTmvpNmvpReordering(false); - if (pcSPS->getUseAML()) + if (pcSPS->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pcSPS->getTMToolsEnableFlag() +#endif + ) { READ_FLAG( uiCode, "sps_aml_tmvp_nmvp_enabled_flag"); pcSPS->setUseTmvpNmvpReordering ( uiCode != 0 ); } @@ -2271,7 +2282,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #if JVET_AA0132_CONFIGURABLE_TM_TOOLS pcSPS->setUseArmcRefinedMotion (false); #endif - if (pcSPS->getUseAML()) + if (pcSPS->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pcSPS->getTMToolsEnableFlag() +#endif + ) { READ_FLAG( uiCode, "sps_ArmcRefinedMotion_enabled_flag"); pcSPS->setUseArmcRefinedMotion ( uiCode != 0 ); } @@ -2280,7 +2295,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #if JVET_AA0132_CONFIGURABLE_TM_TOOLS pcSPS->setNumLambda(0); #endif - if (pcSPS->getUseAML()) + if (pcSPS->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pcSPS->getTMToolsEnableFlag() +#endif + ) { READ_UVLC(uiCode, "num_Lambda"); pcSPS->setNumLambda(uiCode); @@ -2518,6 +2537,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #if ENABLE_DIMD READ_FLAG(uiCode, "sps_dimd_enabled_flag"); pcSPS->setUseDimd(uiCode != 0); #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pcSPS->getTMnoninterToolsEnableFlag()) + { +#endif #if JVET_V0130_INTRA_TMP READ_FLAG(uiCode, "sps_intraTMP_enabled_flag"); pcSPS->setUseIntraTMP( uiCode != 0 ); if(pcSPS->getUseIntraTMP()) @@ -2555,6 +2578,15 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) #endif #if JVET_AD0188_CCP_MERGE READ_UVLC(uiCode, "sps_ccp_merge"); pcSPS->setUseCcpMerge(uiCode); +#endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + } + else + { +#if JVET_AC0147_CCCM_NO_SUBSAMPLING + READ_UVLC(uiCode, "sps_cccm_cand"); pcSPS->setUseCccm(uiCode); +#endif + } #endif if( pcSPS->getChromaFormatIdc() != CHROMA_400) { @@ -2638,15 +2670,29 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setUseIbcMbvd( 0 ); } READ_FLAG(uiCode, "sps_rribc_enabled_flag"); pcSPS->setUseRRIbc(uiCode != 0); +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pcSPS->getTMnoninterToolsEnableFlag()) + { + READ_FLAG(uiCode, "sps_tmibc_enabled_flag"); pcSPS->setUseTMIbc(uiCode != 0); + } +#else READ_FLAG(uiCode, "sps_tmibc_enabled_flag"); pcSPS->setUseTMIbc(uiCode != 0); #endif - +#endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pcSPS->getTMnoninterToolsEnableFlag()) + { +#endif #if JVET_AC0104_IBC_BVD_PREDICTION READ_FLAG( uiCode, "sps_ibc_bvd_pred_enabled_flag" ); pcSPS->setUseBvdPred ( uiCode != 0 ); #endif #if JVET_AC0060_IBC_BVP_CLUSTER_RRIBC_BVD_SIGN_DERIV READ_FLAG( uiCode, "sps_ibc_bvp_cluster_enabled_flag" ); pcSPS->setUseBvpCluster ( uiCode != 0 ); #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + } +#endif + #if JVET_AC0112_IBC_CIIP READ_FLAG(uiCode, "sps_ibc_ciip_enabled_flag"); pcSPS->setUseIbcCiip(uiCode != 0); #endif @@ -5231,7 +5277,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par } #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if (!pcSlice->isIntra() && sps->getUseAML()) + if (!pcSlice->isIntra() && sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps->getTMToolsEnableFlag() +#endif + ) { int index = sps->getQPOffsetsIdx(pcSlice->getSliceQp() - (pps->getPicInitQPMinus26() + 26)); bool lambdaCanBePredicted = false; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index ef93b7744c17afafad3fa6c8681e351a2a73d913..93f47b16e1002e23b6e5c6ab7dbc7dd25c5c0466 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -479,6 +479,9 @@ protected: #if JVET_AD0082_TMRL_CONFIG bool m_tmrl; #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + bool m_tmNoninterToolsEnableFlag; +#endif #if JVET_AD0085_MPM_SORTING bool m_mpmSorting; #endif @@ -1590,6 +1593,10 @@ public: void setUseTmrl (bool b) { m_tmrl = b; } bool getUseTmrl () const { return m_tmrl; } #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + void setTMnoninterToolsEnableFlag (bool b) { m_tmNoninterToolsEnableFlag = b; } + bool getTMnoninterToolsEnableFlag () const { return m_tmNoninterToolsEnableFlag; } +#endif #if JVET_AD0085_MPM_SORTING void setUseMpmSorting (bool b) { m_mpmSorting = b; } bool getUseMpmSorting () const { return m_mpmSorting; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 3158a5de0f1dbb33372a54f58d8e10687597b4d3..e11e165011380913b0a9720785d0040ffbeabdf4 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -3707,12 +3707,20 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& MergeCtx tmvpMergeCandCtx; #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if (sps.getUseAML() && tplAvail) + if (sps.getUseAML() && tplAvail +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getTmvpMergeCand(pu, tmvpMergeCandCtx); } #else - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getTmvpMergeCand(pu, tmvpMergeCandCtx); if (tplAvail) @@ -3727,12 +3735,20 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #endif MergeCtx namvpMergeCandCtx; #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if (sps.getUseAML() && tplAvail) + if (sps.getUseAML() && tplAvail +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getNonAdjacentMergeCand(pu, namvpMergeCandCtx); } #else - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getNonAdjacentMergeCand(pu, namvpMergeCandCtx); if (tplAvail) @@ -3759,12 +3775,24 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& , 0 #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM , -1 - , (sps.getUseAML()) ? &tmvpMergeCandCtx : NULL - , (sps.getUseAML()) ? &namvpMergeCandCtx : NULL + , (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) ? &tmvpMergeCandCtx : NULL + , (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) ? &namvpMergeCandCtx : NULL #endif ); #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { #if JVET_AA0132_CONFIGURABLE_TM_TOOLS if (!sps.getUseTmvpNmvpReordering()) @@ -3837,7 +3865,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } if (pu.cs->picHeader->getEnableTMVPFlag()) { - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { MergeCtx namvpMergeCandCtxSubTMVP[2]; int nWidth = pu.lumaSize().width; @@ -3919,7 +3951,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } } #if JVET_W0090_ARMC_TM - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { m_pcInterSearch->adjustInterMergeCandidates(pu, ciipTmMrgCtx); } @@ -3942,7 +3978,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& PU::getInterMMVDMergeCandidates(pu, mergeCtx); #if JVET_W0090_ARMC_TM mergeCtxtmp = mergeCtx; - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { m_pcInterSearch->adjustInterMergeCandidates(pu, mergeCtx); } @@ -3971,12 +4011,20 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #endif MergeCtx tmvpTmMergeCandCtx; #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if (sps.getUseAML() && tplAvail) + if (sps.getUseAML() && tplAvail +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getTmvpMergeCand(pu, tmvpTmMergeCandCtx); } #else - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getTmvpMergeCand(pu, tmvpTmMergeCandCtx); if (tplAvail) @@ -3991,12 +4039,20 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #endif MergeCtx namvpTmMergeCandCtx; #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if (sps.getUseAML() && tplAvail) + if (sps.getUseAML() && tplAvail +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getNonAdjacentMergeCand(pu, namvpTmMergeCandCtx); } #else - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getNonAdjacentMergeCand(pu, namvpTmMergeCandCtx); if (tplAvail) @@ -4022,8 +4078,16 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& PU::getInterMergeCandidates(pu, tmMrgCtx, 0 #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM , -1 - , (sps.getUseAML()) ? &tmvpTmMergeCandCtx : NULL - , (sps.getUseAML()) ? &namvpTmMergeCandCtx : NULL + , (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) ? &tmvpTmMergeCandCtx : NULL + , (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) ? &namvpTmMergeCandCtx : NULL #endif ); #if JVET_W0090_ARMC_TM @@ -4031,7 +4095,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& bool tmMergeRefinedMotion = PU::isArmcRefinedMotionEnabled(pu, 2); tmMergeRefinedMotion &= tplAvail; #endif - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING #if JVET_AA0132_CONFIGURABLE_TM_TOOLS @@ -4351,7 +4419,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& m_pcInterSearch->sortAffineMergeCandidates(pu, affineMergeCtxTmp, affMmvdLUT); #endif #endif - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { m_pcInterSearch->adjustAffineMergeCandidates(pu, affineMergeCtx); #if JVET_AA0107_RMVF_AFFINE_MERGE_DERIVATION @@ -4645,12 +4717,20 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM MergeCtx tmvpMergeCandCtx2; #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if (sps.getUseAML() && tplAvail) + if (sps.getUseAML() && tplAvail +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getTmvpBMCand(pu, tmvpMergeCandCtx2); } #else - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getTmvpBMCand(pu, tmvpMergeCandCtx2); pu.bmDir = 0; @@ -4666,12 +4746,20 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #endif MergeCtx namvpMergeCandCtx2; #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if (sps.getUseAML() && tplAvail) + if (sps.getUseAML() && tplAvail +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getNonAdjacentBMCand(pu, namvpMergeCandCtx2); } #else - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { PU::getNonAdjacentBMCand(pu, namvpMergeCandCtx2); pu.bmDir = 0; @@ -4703,12 +4791,24 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& PU::getInterBMCandidates(pu, bmMrgCtx #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM , -1 - , (sps.getUseAML()) ? &tmvpMergeCandCtx2 : NULL - , (sps.getUseAML()) ? &namvpMergeCandCtx2 : NULL + , (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) ? &tmvpMergeCandCtx2 : NULL + , (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) ? &namvpMergeCandCtx2 : NULL #endif ); #if JVET_W0090_ARMC_TM - if (pu.cs->sps->getUseAML()) + if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { pu.bmDir = 0; #if JVET_Y0134_TMVP_NAMVP_CAND_REORDERING @@ -10899,7 +10999,11 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct #endif ); #if JVET_W0090_ARMC_TM - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { m_pcInterSearch->adjustAffineMergeCandidates(pu, affineMergeCtx); } @@ -11574,7 +11678,11 @@ void EncCu::xCheckRDCostTMMerge2Nx2N(CodingStructure *&tempCS, CodingStructure * pu.tmMergeFlag = true; PU::getInterMergeCandidates(pu, mergeCtx, 0); #if JVET_W0090_ARMC_TM - if (sps.getUseAML()) + if (sps.getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && sps.getTMToolsEnableFlag() +#endif + ) { m_pcInterSearch->adjustInterMergeCandidates(pu, mergeCtx); } @@ -11991,8 +12099,12 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct #else PU::getIBCMergeCandidates(pu, mergeCtx); #endif -#if JVET_Y0058_IBC_LIST_MODIFY && JVET_W0090_ARMC_TM - if(pu.cs->sps->getUseAML()) +#if JVET_Y0058_IBC_LIST_MODIFY +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag()) +#else + if (pu.cs->sps->getUseAML()) +#endif { #if JVET_Z0075_IBC_HMVP_ENLARGE m_pcInterSearch->adjustIBCMergeCandidates(pu, mergeCtx, 0, IBC_MRG_MAX_NUM_CANDS_MEM); @@ -12018,8 +12130,12 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct #else PU::getIBCMergeCandidates(pu, mergeCtxTm); #endif -#if JVET_Y0058_IBC_LIST_MODIFY && JVET_W0090_ARMC_TM - if (pu.cs->sps->getUseAML()) +#if JVET_Y0058_IBC_LIST_MODIFY +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag()) +#else + if (pu.cs->sps->getUseAML()) +#endif { #if JVET_Z0075_IBC_HMVP_ENLARGE m_pcInterSearch->adjustIBCMergeCandidates(pu, mergeCtxTm, 0, IBC_MRG_MAX_NUM_CANDS_MEM); @@ -12044,8 +12160,12 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct PU::getIBCMergeCandidates(pu, mergeCtxTmp); pu.mergeFlag = false; -#if JVET_Y0058_IBC_LIST_MODIFY && JVET_W0090_ARMC_TM - if (pu.cs->sps->getUseAML()) +#if JVET_Y0058_IBC_LIST_MODIFY +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag()) +#else + if (pu.cs->sps->getUseAML()) +#endif { #if JVET_Z0075_IBC_HMVP_ENLARGE m_pcInterSearch->adjustIBCMergeCandidates(pu, mergeCtxTmp, 0, IBC_MRG_MAX_NUM_CANDS_MEM); @@ -12930,10 +13050,17 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct PU::getIbcMbvdMergeCandidates(pu, mergeCtxTmp, baseNum); - bool flag = pu.ibcMbvdMergeFlag; - pu.ibcMbvdMergeFlag = true; - m_pcInterSearch->sortIbcMergeMbvdCandidates(pu, mergeCtxTmp, ibcMbvdLUT, ibcMbvdValidNum); - pu.ibcMbvdMergeFlag = flag; +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pu.cs->sps->getUseAML() && pu.cs->sps->getTMnoninterToolsEnableFlag()) + { +#endif + bool flag = pu.ibcMbvdMergeFlag; + pu.ibcMbvdMergeFlag = true; + m_pcInterSearch->sortIbcMergeMbvdCandidates(pu, mergeCtxTmp, ibcMbvdLUT, ibcMbvdValidNum); + pu.ibcMbvdMergeFlag = flag; +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + } +#endif const int tempNum = baseNum * IBC_MBVD_MAX_REFINE_NUM; int baseIdx = 0; @@ -16644,6 +16771,9 @@ void EncCu::xCheckSATDCostBMMerge(CodingStructure*& tempCS, uint32_t maxNumCand = mrgCtx.numCandToTestEnc; #if (JVET_Y0134_TMVP_NAMVP_CAND_REORDERING || JVET_AA0093_REFINED_MOTION_FOR_ARMC) && JVET_W0090_ARMC_TM if (pu.cs->sps->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && pu.cs->sps->getUseTmvpNmvpReordering() #endif @@ -16751,7 +16881,11 @@ void EncCu::xCheckSATDCostBMMerge(CodingStructure*& tempCS, maxNumCand = ::min(mrgCtx.numValidMergeCand, (int)pu.cs->sps->getMaxNumBMMergeCand()); } #if JVET_AB0079_TM_BCW_MRG - if(pu.cs->sps->getUseAML() && !armcRefinedMotion) + if(pu.cs->sps->getUseAML() && !armcRefinedMotion +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pu.cs->sps->getTMToolsEnableFlag() +#endif + ) { pu.bmDir = 0; m_pcInterSearch->adjustMergeCandidatesBcwIdx(pu, mrgCtx); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 8e7aadcd32d37c3c7ff5a25e8dd50cc58e61075f..718f2d15c7eb883ac48ae8f09d2e6df3e7aeea83 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -1848,6 +1848,9 @@ void EncLib::xInitSPS( SPS& sps ) #if JVET_AD0082_TMRL_CONFIG sps.setUseTmrl ( m_tmrl ); #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + sps.setTMnoninterToolsEnableFlag ( m_tmNoninterToolsEnableFlag ); +#endif #if JVET_AD0085_MPM_SORTING sps.setUseMpmSorting ( m_mpmSorting ); #endif diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 03e140355c7c14319a88ef364942f39544fa4161..83d61efd4c4db81ef0d3557071f6b01278989e9e 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -1363,6 +1363,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) #if JVET_AA0132_CONFIGURABLE_TM_TOOLS WRITE_FLAG(pcSPS->getTMToolsEnableFlag() ? 1 : 0, "sps_tm_tools_enabled_flag"); #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + WRITE_FLAG(pcSPS->getTMnoninterToolsEnableFlag() ? 1 : 0, "sps_tmNoninterToolsEnableFlag_enabled_flag"); +#endif #if INTER_LIC WRITE_FLAG(pcSPS->getLicEnabledFlag() ? 1 : 0, "sps_lic_enabled_flag"); #endif @@ -1380,7 +1383,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) #if JVET_W0090_ARMC_TM #if JVET_AA0132_CONFIGURABLE_TM_TOOLS +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if(pcSPS->getTMToolsEnableFlag() || pcSPS->getTMnoninterToolsEnableFlag()) +#else if(pcSPS->getTMToolsEnableFlag()) +#endif #endif WRITE_FLAG( pcSPS->getUseAML() ? 1 : 0, "sps_aml_enabled_flag" ); #endif @@ -1388,7 +1395,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getUseFastSubTmvp() ? 1 : 0, "sps_fast_sub_tmvp_enabled_flag"); #endif #if JVET_AA0132_CONFIGURABLE_TM_TOOLS && JVET_Y0134_TMVP_NAMVP_CAND_REORDERING && JVET_W0090_ARMC_TM - if (pcSPS->getUseAML()) + if (pcSPS->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pcSPS->getTMToolsEnableFlag() +#endif + ) { WRITE_FLAG( pcSPS->getUseTmvpNmvpReordering() ? 1 : 0, "sps_aml_tmvp_nmvp_enabled_flag" ); } @@ -1398,14 +1409,22 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } #endif #if JVET_AA0093_REFINED_MOTION_FOR_ARMC - if (pcSPS->getUseAML()) + if (pcSPS->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pcSPS->getTMToolsEnableFlag() +#endif + ) { WRITE_FLAG( pcSPS->getUseArmcRefinedMotion() ? 1 : 0, "sps_ArmcRefinedMotion_enabled_flag" ); } #endif #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if (pcSPS->getUseAML()) + if (pcSPS->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pcSPS->getTMToolsEnableFlag() +#endif + ) { WRITE_UVLC(pcSPS->getNumLambda(), "num_Lambda"); WRITE_CODE(pcSPS->getMaxbitsLambdaVal(), 4, "MaxBitsLambda"); @@ -1582,6 +1601,10 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) #if ENABLE_DIMD WRITE_FLAG( pcSPS->getUseDimd() ? 1 : 0, "sps_dimd_enabled_flag"); #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pcSPS->getTMnoninterToolsEnableFlag()) + { +#endif #if JVET_V0130_INTRA_TMP WRITE_FLAG( pcSPS->getUseIntraTMP() ? 1 : 0, "sps_intraTMP_enabled_flag"); if(pcSPS->getUseIntraTMP()) @@ -1617,7 +1640,15 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) #if JVET_AD0188_CCP_MERGE WRITE_UVLC(pcSPS->getUseCcpMerge(), "sps_ccp_merge"); #endif - +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + } + else + { +#if JVET_AC0147_CCCM_NO_SUBSAMPLING + WRITE_UVLC(pcSPS->getUseCccm(), "sps_cccm_cand"); +#endif + } +#endif if( pcSPS->getChromaFormatIdc() != CHROMA_400) { WRITE_FLAG( pcSPS->getUseLMChroma() ? 1 : 0, "sps_cclm_enabled_flag"); @@ -1679,15 +1710,30 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) #if JVET_AD0208_IBC_ADAPT_FOR_CAM_CAPTURED_CONTENTS } WRITE_FLAG(pcSPS->getUseRRIbc() ? 1 : 0, "sps_rribc_enabled_flag"); +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pcSPS->getTMnoninterToolsEnableFlag()) + { WRITE_FLAG(pcSPS->getUseTMIbc() ? 1 : 0, "sps_tmibc_enabled_flag"); + } +#else + WRITE_FLAG(pcSPS->getUseTMIbc() ? 1 : 0, "sps_tmibc_enabled_flag"); +#endif #endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + if (pcSPS->getTMnoninterToolsEnableFlag()) + { +#endif #if JVET_AC0104_IBC_BVD_PREDICTION - WRITE_FLAG(pcSPS->getUseBvdPred() ? 1 : 0, "sps_ibc_bvd_pred_enabled_flag"); + WRITE_FLAG(pcSPS->getUseBvdPred() ? 1 : 0, "sps_ibc_bvd_pred_enabled_flag"); #endif #if JVET_AC0060_IBC_BVP_CLUSTER_RRIBC_BVD_SIGN_DERIV - WRITE_FLAG(pcSPS->getUseBvpCluster() ? 1 : 0, "sps_ibc_bvp_cluster_enabled_flag"); + WRITE_FLAG(pcSPS->getUseBvpCluster() ? 1 : 0, "sps_ibc_bvp_cluster_enabled_flag"); +#endif +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + } #endif + #if JVET_AC0112_IBC_CIIP WRITE_FLAG(pcSPS->getUseIbcCiip() ? 1 : 0, "sps_ibc_ciip_enabled_flag"); #endif @@ -3247,7 +3293,11 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_FLAG(pcSlice->getTSResidualCodingDisabledFlag() ? 1 : 0, "slice_ts_residual_coding_disabled_flag"); } #if JVET_AA0093_DIVERSITY_CRITERION_FOR_ARMC - if ( !pcSlice->isIntra() && pcSlice->getSPS()->getUseAML()) + if ( !pcSlice->isIntra() && pcSlice->getSPS()->getUseAML() +#if JVET_AE0174_NONINTER_TM_TOOLS_CONTROL + && pcSlice->getSPS()->getTMToolsEnableFlag() +#endif + ) { // Prediction of the Lambda value int index = pcSlice->getSPS()->getQPOffsetsIdx(pcSlice->getSliceQp() - (pcSlice->getPPS()->getPicInitQPMinus26() + 26));