diff --git a/doc/software-manual.tex b/doc/software-manual.tex index b5363bbc8dea5496ac8df77fab81dde4b8f8b035..4e9c60e2caf3639a1d26ba58272f8266232e2a06 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -3129,6 +3129,26 @@ Enables or disables the use of Bi-prediction with CU-level Weights (BCW). \Default{false} & Enables or disables the fast encoding of Bi-prediction with CU-level Weights (BCW). \\ + +\Option{MTS} & +%\ShortOption{\None} & +\Default{0} & +Enables explicit mutiple transform set (MTS). +0: disable, +1: enable explicit intra MTS, +2: enable implicit intra and explicit inter MTS, +3: enable explicit intra and explicit inter MTS, +4: enable implicit intra MTS. +\\ + +\Option{MTSImplicit} & +%\ShortOption{\None} & +\Default{0} & +Enables implicit multiple transform set (MTS). +0: disable, +1: enable implicit intra MTS. +Must be 0 when MTS is nonzero. Setting MTS to 0 and MTSImplicit to 1 is equivalent to setting MTS to 4 and MTSImplicit to 0. +\\ \Option{BDOF} & %\ShortOption{\None} & diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index dc1693493d333f8c581e453bec172f8a7b13d726..af6001159ffe7fba15f126189d7f047300bc99bb 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -371,7 +371,8 @@ void EncApp::xInitLibCfg() CHECK(m_noCclmConstraintFlag && m_LMChroma, "CCLM shall be deactivated when m_bNoCclmConstraintFlag is equal to 1"); m_cEncLib.setNoMtsConstraintFlag(m_noMtsConstraintFlag); - CHECK(m_noMtsConstraintFlag && (m_MTS || m_MTSImplicit), "MTS shall be deactivated when m_bNoMtsConstraintFlag is equal to 1"); + CHECK(m_noMtsConstraintFlag && (m_mtsMode || m_mtsImplicitIntra), + "MTS shall be deactivated when m_bNoMtsConstraintFlag is equal to 1"); m_cEncLib.setNoSbtConstraintFlag(m_noSbtConstraintFlag); CHECK(m_noSbtConstraintFlag && m_SBT, "SBT shall be deactivated when mm_noSbtConstraintFlag_nonPackedConstraintFlag is equal to 1"); @@ -732,11 +733,11 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseLMChroma ( m_LMChroma ); m_cEncLib.setHorCollocatedChromaFlag ( m_horCollocatedChromaFlag ); m_cEncLib.setVerCollocatedChromaFlag ( m_verCollocatedChromaFlag ); - m_cEncLib.setIntraMTS ( m_MTS & 1 ); - m_cEncLib.setInterMTS ( ( m_MTS >> 1 ) & 1 ); + m_cEncLib.setExplicitMtsIntraEnabled((m_mtsMode & 1) != 0); + m_cEncLib.setExplicitMtsInterEnabled((m_mtsMode & 2) != 0); m_cEncLib.setMTSIntraMaxCand ( m_MTSIntraMaxCand ); m_cEncLib.setMTSInterMaxCand ( m_MTSInterMaxCand ); - m_cEncLib.setImplicitMTS ( m_MTSImplicit ); + m_cEncLib.setImplicitMtsIntraEnabled(m_mtsImplicitIntra || (m_mtsMode & 4) != 0); m_cEncLib.setUseSBT ( m_SBT ); m_cEncLib.setSBTFast64WidthTh ( m_SBTFast64WidthTh ); m_cEncLib.setUseCompositeRef ( m_compositeRefEnabled ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index ac0d1ead93d1b286b24dcb0420128a96a3cfcd02..fe7ea3b8d3453a5abf1ed579b34d37426098d791 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1011,14 +1011,15 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("VerCollocatedChroma", m_verCollocatedChromaFlag, false, "Specifies location of a chroma sample relatively to the luma sample in vertical direction in the cross-component linear model intra prediction and the reference picture resampling\n" "\t0: horizontally co-sited, vertically shifted by 0.5 units of luma samples\n" "\t1: collocated\n") - ("MTS", m_MTS, 0, "Multiple Transform Set (MTS)\n" + ("MTS", m_mtsMode, 0, "Multiple Transform Set (MTS)\n" "\t0: Disable MTS\n" - "\t1: Enable only Intra MTS\n" - "\t2: Enable only Inter MTS\n" - "\t3: Enable both Intra & Inter MTS\n") + "\t1: Enable explicit Intra MTS\n" + "\t2: Enable implicit Intra and explicit Inter MTS\n" + "\t3: Enable explicit Intra and explicit Inter MTS\n" + "\t4: Enable implicit Intra MTS\n") ("MTSIntraMaxCand", m_MTSIntraMaxCand, 3, "Number of additional candidates to test in encoder search for MTS in intra slices\n") ("MTSInterMaxCand", m_MTSInterMaxCand, 4, "Number of additional candidates to test in encoder search for MTS in inter slices\n") - ("MTSImplicit", m_MTSImplicit, 0, "Enable implicit MTS (when explicit MTS is off)\n") + ("MTSImplicit", m_mtsImplicitIntra, 0, "Enable implicit Intra MTS (when MTS is 0)\n") ( "SBT", m_SBT, false, "Enable Sub-Block Transform for inter blocks\n" ) ( "SBTFast64WidthTh", m_SBTFast64WidthTh, 1920, "Picture width threshold for testing size-64 SBT in RDO (now for HD and above sequences)\n") ( "ISP", m_ISP, false, "Enable Intra Sub-Partitions\n" ) @@ -3504,10 +3505,10 @@ bool EncAppCfg::xCheckParameter() m_PROF = false; } - xConfirmPara( m_MTS < 0 || m_MTS > 3, "MTS must be greater than 0 smaller than 4" ); + xConfirmPara(m_mtsMode < 0 || m_mtsMode > 4, "MTS must in the range 0..4"); xConfirmPara( m_MTSIntraMaxCand < 0 || m_MTSIntraMaxCand > 5, "m_MTSIntraMaxCand must be greater than 0 and smaller than 6" ); xConfirmPara( m_MTSInterMaxCand < 0 || m_MTSInterMaxCand > 5, "m_MTSInterMaxCand must be greater than 0 and smaller than 6" ); - xConfirmPara( m_MTS != 0 && m_MTSImplicit != 0, "Both explicit and implicit MTS cannot be enabled at the same time" ); + xConfirmPara(m_mtsMode != 0 && m_mtsImplicitIntra != 0, "MTSImplicit may be enabled only when MTS is 0"); if (m_useBDPCM) { @@ -4688,7 +4689,22 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "LMChroma:%d ", m_LMChroma ); msg( VERBOSE, "HorCollocatedChroma:%d ", m_horCollocatedChromaFlag ); msg( VERBOSE, "VerCollocatedChroma:%d ", m_verCollocatedChromaFlag ); - msg( VERBOSE, "MTS: %1d(intra) %1d(inter) ", m_MTS & 1, ( m_MTS >> 1 ) & 1 ); + + { + std::string s; + const int m = m_mtsMode + 4 * m_mtsImplicitIntra; + if (m != 0) + { + s = "("; + s += (m & 1) != 0 ? "explicit intra" : "implicit intra"; + if (m & 2) + { + s += ", explicit inter"; + } + s += ")"; + } + msg(VERBOSE, "MTS:%d%s ", m != 0, s.c_str()); + } msg( VERBOSE, "SBT:%d ", m_SBT ); msg( VERBOSE, "ISP:%d ", m_ISP ); msg( VERBOSE, "SMVD:%d ", m_SMVD ); @@ -4754,7 +4770,10 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "FastMrg:%d ", m_useFastMrg ); msg( VERBOSE, "PBIntraFast:%d ", m_usePbIntraFast ); if( m_ImvMode ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast ); - if( m_MTS ) msg( VERBOSE, "MTSMaxCand: %1d(intra) %1d(inter) ", m_MTSIntraMaxCand, m_MTSInterMaxCand ); + if (m_mtsMode) + { + msg(VERBOSE, "MTSMaxCand: %1d(intra) %1d(inter) ", m_MTSIntraMaxCand, m_MTSInterMaxCand); + } if( m_ISP ) msg( VERBOSE, "ISPFast:%d ", m_useFastISP ); if( m_LFNST ) msg( VERBOSE, "FastLFNST:%d ", m_useFastLFNST ); msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT ); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 7428c281218e4c82b3f56c35e75383f459286dd0..dd82b5ea8d97a36c4f8c4ed0e393ae309775add0 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -352,10 +352,12 @@ protected: int m_LMChroma; bool m_horCollocatedChromaFlag; bool m_verCollocatedChromaFlag; - int m_MTS; ///< XZ: Multiple Transform Set + + int m_mtsMode; ///< XZ: Multiple Transform Set int m_MTSIntraMaxCand; ///< XZ: Number of additional candidates to test int m_MTSInterMaxCand; ///< XZ: Number of additional candidates to test - int m_MTSImplicit; + int m_mtsImplicitIntra; + bool m_SBT; ///< Sub-Block Transform for inter blocks int m_SBTFast64WidthTh; bool m_SMVD; diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index 607f4e416cf37ff564acad427f665dfb9f3c2772..d88bc9c911572eedc5a9302ba950e7a727888a47 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -1557,7 +1557,9 @@ namespace DQIntern bool zeroOut = false; bool zeroOutforThres = false; int effWidth = tuPars.m_width, effHeight = tuPars.m_height; - if( ( tu.mtsIdx[compID] > MTS_SKIP || (tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32)) && compID == COMPONENT_Y) + if ((tu.mtsIdx[compID] > MTS_SKIP + || (tu.cs->sps->getMtsEnabled() && tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32)) + && compID == COMPONENT_Y) { effHeight = (tuPars.m_height == 32) ? 16 : tuPars.m_height; effWidth = (tuPars.m_width == 32) ? 16 : tuPars.m_width; diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index 1befaf7c5c57f7ce72efd2a71d8af88f1a143c8b..145fc15e84f97625e30c33722ed51fb547d7a6a3 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -982,8 +982,8 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, unsigned zoTbWdith = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, cctx.width()); unsigned zoTbHeight = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, cctx.height()); - if (tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[compID].width <= 32 && tu.blocks[compID].height <= 32 - && compID == COMPONENT_Y) + if (tu.cs->sps->getMtsEnabled() && tu.cu->sbtInfo != 0 && tu.blocks[compID].width <= 32 + && tu.blocks[compID].height <= 32 && compID == COMPONENT_Y) { zoTbWdith = (tu.blocks[compID].width == 32) ? 16 : zoTbWdith; zoTbHeight = (tu.blocks[compID].height == 32) ? 16 : zoTbHeight; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 01ceb0010988190357416cb27a832263591cf544..99e26fd7c673824aa70e348ff38e509c3846cf40 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -2973,8 +2973,6 @@ SPS::SPS() , m_LMChroma ( false ) , m_horCollocatedChromaFlag ( true ) , m_verCollocatedChromaFlag ( false ) -, m_IntraMTS ( false ) -, m_InterMTS ( false ) , m_LFNST ( false ) , m_Affine ( false ) , m_AffineType ( false ) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 48769fe8c21cfb167891b9600d3438dcca0ff95d..c685d028091d3a220839f6660e23da6288850adc 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -1543,9 +1543,9 @@ private: bool m_LMChroma; bool m_horCollocatedChromaFlag; bool m_verCollocatedChromaFlag; - bool m_MTS; - bool m_IntraMTS; // 18 - bool m_InterMTS; // 19 + bool m_mtsEnabled{ false }; + bool m_explicitMtsIntra{ false }; + bool m_explicitMtsInter{ false }; bool m_LFNST; bool m_SMVD; bool m_Affine; @@ -1897,13 +1897,13 @@ void setCCALFEnabledFlag( bool b ) void setVerCollocatedChromaFlag( bool b ) { m_verCollocatedChromaFlag = b; } bool getVerCollocatedChromaFlag() const { return m_verCollocatedChromaFlag; } bool getCclmCollocatedChromaFlag() const { return m_verCollocatedChromaFlag; } - void setUseMTS ( bool b ) { m_MTS = b; } - bool getUseMTS () const { return m_MTS; } - bool getUseImplicitMTS () const { return m_MTS && !m_IntraMTS; } - void setUseIntraMTS ( bool b ) { m_IntraMTS = b; } - bool getUseIntraMTS () const { return m_IntraMTS; } - void setUseInterMTS ( bool b ) { m_InterMTS = b; } - bool getUseInterMTS () const { return m_InterMTS; } + void setMtsEnabled(bool b) { m_mtsEnabled = b; } + bool getMtsEnabled() const { return m_mtsEnabled; } + bool getImplicitMTSIntraEnabled() const { return m_mtsEnabled && !m_explicitMtsIntra; } + void setExplicitMtsIntraEnabled(bool b) { m_explicitMtsIntra = b; } + bool getExplicitMtsIntraEnabled() const { return m_explicitMtsIntra; } + void setExplicitMtsInterEnabled(bool b) { m_explicitMtsInter = b; } + bool getExplicitMtsInterEnabled() const { return m_explicitMtsInter; } void setUseLFNST ( bool b ) { m_LFNST = b; } bool getUseLFNST () const { return m_LFNST; } void setUseSMVD(bool b) { m_SMVD = b; } diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index 59d4c22de826684bbe3eb403ec2f66e4ecf7ded4..8c9ae4e1b582672f1b95aa63b214902818e8c075 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -621,8 +621,11 @@ std::vector<int> TrQuant::selectICTCandidates( const TransformUnit &tu, CompStor void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &trTypeHor, int &trTypeVer) { - const bool isExplicitMTS = (CU::isIntra(*tu.cu) ? tu.cs->sps->getUseIntraMTS() : tu.cs->sps->getUseInterMTS() && CU::isInter(*tu.cu)) && isLuma(compID); - const bool isImplicitMTS = CU::isIntra(*tu.cu) && tu.cs->sps->getUseImplicitMTS() && isLuma(compID) && tu.cu->lfnstIdx == 0 && tu.cu->mipFlag == 0; + const bool isExplicitMTS = (CU::isIntra(*tu.cu) ? tu.cs->sps->getExplicitMtsIntraEnabled() + : tu.cs->sps->getExplicitMtsInterEnabled() && CU::isInter(*tu.cu)) + && isLuma(compID); + const bool isImplicitMTS = CU::isIntra(*tu.cu) && tu.cs->sps->getImplicitMTSIntraEnabled() && isLuma(compID) + && tu.cu->lfnstIdx == 0 && tu.cu->mipFlag == 0; const bool isISP = CU::isIntra(*tu.cu) && tu.cu->ispMode && isLuma(compID); const bool isSBT = CU::isInter(*tu.cu) && tu.cu->sbtInfo && isLuma(compID); @@ -634,7 +637,7 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int & return; } - if (!tu.cs->sps->getUseMTS()) + if (!tu.cs->sps->getMtsEnabled()) { return; } diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 8f9787c6cf69d206445dc46e8a91b63100163fa9..8da9294d422b11a33aa9880a433abf2f2c398d4b 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -849,7 +849,8 @@ int TransformUnit::getTbAreaAfterCoefZeroOut(ComponentID compID) const int tbZeroOutWidth = blocks[compID].width; int tbZeroOutHeight = blocks[compID].height; - if ( cs->sps->getUseMTS() && cu->sbtInfo != 0 && blocks[compID].width <= 32 && blocks[compID].height <= 32 && compID == COMPONENT_Y ) + if (cs->sps->getMtsEnabled() && cu->sbtInfo != 0 && blocks[compID].width <= 32 && blocks[compID].height <= 32 + && compID == COMPONENT_Y) { tbZeroOutWidth = (blocks[compID].width == 32) ? 16 : tbZeroOutWidth; tbZeroOutHeight = (blocks[compID].height == 32) ? 16 : tbZeroOutHeight; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index f759784f30b2366ed78c3616714a39050b28f077..6284db9407ea57c95e1bf3e91f37fb9eacae561a 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -4826,7 +4826,8 @@ bool CU::isMTSAllowed(const CodingUnit &cu, const ComponentID compID) const int cuHeight = cu.blocks[0].lumaSize().height; bool mtsAllowed = cu.chType == CHANNEL_TYPE_LUMA && compID == COMPONENT_Y; - mtsAllowed &= CU::isIntra( cu ) ? cu.cs->sps->getUseIntraMTS() : cu.cs->sps->getUseInterMTS() && CU::isInter( cu ); + mtsAllowed &= CU::isIntra(cu) ? cu.cs->sps->getExplicitMtsIntraEnabled() + : cu.cs->sps->getExplicitMtsInterEnabled() && CU::isInter(cu); mtsAllowed &= cuWidth <= maxSize && cuHeight <= maxSize; mtsAllowed &= !cu.ispMode; mtsAllowed &= !cu.sbtInfo; diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 937c9e8075e57570666d9d15373f1c9ede42b773..799cd16ea9fd0668b26b6f272c075e9e9db6fcb7 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -2976,7 +2976,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& { cctx.initSubblock(subSetId); - if (tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[compID].height <= 32 + if (tu.cs->sps->getMtsEnabled() && tu.cu->sbtInfo != 0 && tu.blocks[compID].height <= 32 && tu.blocks[compID].width <= 32 && compID == COMPONENT_Y) { if ((tu.blocks[compID].height == 32 && cctx.cgPosY() >= (16 >> cctx.log2CGHeight())) @@ -3131,7 +3131,8 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, Co unsigned zoTbWdith = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, cctx.width()); unsigned zoTbHeight = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, cctx.height()); - if( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 && compID == COMPONENT_Y ) + if (tu.cs->sps->getMtsEnabled() && tu.cu->sbtInfo != 0 && tu.blocks[compID].width <= 32 + && tu.blocks[compID].height <= 32 && compID == COMPONENT_Y) { maxLastPosX = (tu.blocks[compID].width == 32) ? g_groupIdx[15] : maxLastPosX; maxLastPosY = (tu.blocks[compID].height == 32) ? g_groupIdx[15] : maxLastPosY; diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index a82bfe1f01bda127be82b811c393a0d1c9725226..0cc5dc0c788bd575ae5895e237c317e495a66db3 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1677,11 +1677,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setLog2MaxTransformSkipBlockSize(uiCode + 2); READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); pcSPS->setBDPCMEnabledFlag(uiCode ? true : false); } - READ_FLAG(uiCode, "sps_mts_enabled_flag"); pcSPS->setUseMTS(uiCode != 0); - if (pcSPS->getUseMTS()) - { - READ_FLAG(uiCode, "sps_explicit_mts_intra_enabled_flag"); pcSPS->setUseIntraMTS(uiCode != 0); - READ_FLAG(uiCode, "sps_explicit_mts_inter_enabled_flag"); pcSPS->setUseInterMTS(uiCode != 0); + READ_FLAG(uiCode, "sps_mts_enabled_flag"); + pcSPS->setMtsEnabled(uiCode != 0); + if (pcSPS->getMtsEnabled()) + { + READ_FLAG(uiCode, "sps_explicit_mts_intra_enabled_flag"); + pcSPS->setExplicitMtsIntraEnabled(uiCode != 0); + READ_FLAG(uiCode, "sps_explicit_mts_inter_enabled_flag"); + pcSPS->setExplicitMtsInterEnabled(uiCode != 0); } READ_FLAG(uiCode, "sps_lfnst_enabled_flag"); pcSPS->setUseLFNST(uiCode != 0); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index f27aa36b917f84820737f59de6880b20233f0a2a..01730b20c46956ec1acd933a1f0cd3b820bc6491 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -2721,7 +2721,8 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, { cctx.initSubblock ( subSetId, sigGroupFlags[subSetId] ); - if( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 && compID == COMPONENT_Y ) + if (tu.cs->sps->getMtsEnabled() && tu.cu->sbtInfo != 0 && tu.blocks[compID].height <= 32 + && tu.blocks[compID].width <= 32 && compID == COMPONENT_Y) { if( ( tu.blocks[ compID ].height == 32 && cctx.cgPosY() >= ( 16 >> cctx.log2CGHeight() ) ) || ( tu.blocks[ compID ].width == 32 && cctx.cgPosX() >= ( 16 >> cctx.log2CGWidth() ) ) ) @@ -2875,7 +2876,8 @@ void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx, const TransformUnit& unsigned zoTbWdith = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, cctx.width()); unsigned zoTbHeight = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, cctx.height()); - if( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 && compID == COMPONENT_Y ) + if (tu.cs->sps->getMtsEnabled() && tu.cu->sbtInfo != 0 && tu.blocks[compID].width <= 32 + && tu.blocks[compID].height <= 32 && compID == COMPONENT_Y) { maxLastPosX = (tu.blocks[compID].width == 32) ? g_groupIdx[15] : maxLastPosX; maxLastPosY = (tu.blocks[compID].height == 32) ? g_groupIdx[15] : maxLastPosY; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 3305cc82d01c818920e91aca6e35e38b3cddfde7..b56139655f100b406848476f114072183ea02fa8 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -336,11 +336,11 @@ protected: int m_LMChroma; bool m_horCollocatedChromaFlag; bool m_verCollocatedChromaFlag; - int m_IntraMTS; - int m_InterMTS; + int m_explicitMtsIntra; + int m_explicitMtsInter; int m_MTSIntraMaxCand; int m_MTSInterMaxCand; - int m_ImplicitMTS; + int m_implicitMtsIntra; bool m_SBT; ///< Sub-Block Transform for inter blocks int m_SBTFast64WidthTh; ///< Enable size-64 SBT in encoder RDO check for HD and above sequences @@ -1238,12 +1238,9 @@ public: unsigned getMTSIntraMaxCand () const { return m_MTSIntraMaxCand; } void setMTSInterMaxCand ( unsigned u ) { m_MTSInterMaxCand = u; } unsigned getMTSInterMaxCand () const { return m_MTSInterMaxCand; } - void setIntraMTS ( bool b ) { m_IntraMTS = b; } - bool getIntraMTS () const { return m_IntraMTS; } - void setInterMTS ( bool b ) { m_InterMTS = b; } - bool getInterMTS () const { return m_InterMTS; } - void setImplicitMTS ( bool b ) { m_ImplicitMTS = b; } - bool getImplicitMTS () const { return m_ImplicitMTS; } + void setExplicitMtsIntraEnabled(bool b) { m_explicitMtsIntra = b; } + void setExplicitMtsInterEnabled(bool b) { m_explicitMtsInter = b; } + void setImplicitMtsIntraEnabled(bool b) { m_implicitMtsIntra = b; } void setUseSBT ( bool b ) { m_SBT = b; } bool getUseSBT () const { return m_SBT; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 32265733b1c7e6e6b5a58552a6e7b99d4ded7e7e..c372e7292a6b2d23a2bfbfbb672c4d3221e14630 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -640,7 +640,8 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par } #endif - if( partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() && ( sps.getUseSBT() || sps.getUseInterMTS() ) ) + if (partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() + && (sps.getUseSBT() || sps.getExplicitMtsInterEnabled())) { auto slsSbt = dynamic_cast<SaveLoadEncInfoSbt*>( m_modeCtrl ); int maxSLSize = sps.getUseSBT() ? tempCS->slice->getSPS()->getMaxTbSize() : MTS_INTER_MAX_CU_SIZE; @@ -1471,7 +1472,11 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS bool skipSecondMtsPass = m_modeCtrl->getSkipSecondMTSPass(); const SPS& sps = *tempCS->sps; const int maxSizeMTS = MTS_INTRA_MAX_CU_SIZE; - uint8_t considerMtsSecondPass = ( sps.getUseIntraMTS() && isLuma( partitioner.chType ) && partitioner.currArea().lwidth() <= maxSizeMTS && partitioner.currArea().lheight() <= maxSizeMTS ) ? 1 : 0; + uint8_t considerMtsSecondPass = + (sps.getExplicitMtsIntraEnabled() && isLuma(partitioner.chType) && partitioner.currArea().lwidth() <= maxSizeMTS + && partitioner.currArea().lheight() <= maxSizeMTS) + ? 1 + : 0; bool useIntraSubPartitions = false; double maxCostAllowedForChroma = MAX_DOUBLE; @@ -4801,7 +4806,9 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS } } } - const bool mtsAllowed = tempCS->sps->getUseInterMTS() && CU::isInter( *cu ) && partitioner.currArea().lwidth() <= MTS_INTER_MAX_CU_SIZE && partitioner.currArea().lheight() <= MTS_INTER_MAX_CU_SIZE; + const bool mtsAllowed = tempCS->sps->getExplicitMtsInterEnabled() && CU::isInter(*cu) + && partitioner.currArea().lwidth() <= MTS_INTER_MAX_CU_SIZE + && partitioner.currArea().lheight() <= MTS_INTER_MAX_CU_SIZE; uint8_t sbtAllowed = cu->checkAllowedSbt(); //SBT resolution-dependent fast algorithm: not try size-64 SBT in RDO for low-resolution sequences (now resolution below HD) if( tempCS->pps->getPicWidthInLumaSamples() < (uint32_t)m_pcEncCfg->getSBTFast64WidthTh() ) diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 7d818c047eb87eef5383cb92a6627403886d24e2..edd78f26e85abe8a4ffc5e01a34f60d8f916f46e 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -1232,9 +1232,9 @@ void EncLib::xInitSPS( SPS& sps ) sps.setUseLMChroma ( m_LMChroma ? true : false ); sps.setHorCollocatedChromaFlag( m_horCollocatedChromaFlag ); sps.setVerCollocatedChromaFlag( m_verCollocatedChromaFlag ); - sps.setUseMTS ( m_IntraMTS || m_InterMTS || m_ImplicitMTS ); - sps.setUseIntraMTS ( m_IntraMTS ); - sps.setUseInterMTS ( m_InterMTS ); + sps.setMtsEnabled(m_explicitMtsIntra || m_explicitMtsInter || m_implicitMtsIntra); + sps.setExplicitMtsIntraEnabled(m_explicitMtsIntra); + sps.setExplicitMtsInterEnabled(m_explicitMtsInter); sps.setUseSBT ( m_SBT ); sps.setUseSMVD ( m_SMVD ); sps.setUseBcw ( m_bcw ); diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 2bacff384fdc3d61ee3358f3f84ed5b0796c7b30..4ef6ee7b63b4d0451c620c1ee1b2b48a22b6255e 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -545,7 +545,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c bool LFNSTLoadFlag = sps.getUseLFNST() && cu.lfnstIdx != 0; bool LFNSTSaveFlag = sps.getUseLFNST() && cu.lfnstIdx == 0; - LFNSTSaveFlag &= sps.getUseIntraMTS() ? cu.mtsFlag == 0 : true; + LFNSTSaveFlag &= sps.getExplicitMtsIntraEnabled() ? cu.mtsFlag == 0 : true; const uint32_t lfnstIdx = cu.lfnstIdx; double costInterCU = findInterCUCost( cu ); @@ -559,7 +559,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c // 2: MTS is being checked for current CU. Stored results of DCT2 can be utilized for speedup uint8_t mtsUsageFlag = 0; const int maxSizeEMT = MTS_INTRA_MAX_CU_SIZE; - if( width <= maxSizeEMT && height <= maxSizeEMT && sps.getUseIntraMTS() ) + if (width <= maxSizeEMT && height <= maxSizeEMT && sps.getExplicitMtsIntraEnabled()) { mtsUsageFlag = ( sps.getUseLFNST() && cu.mtsFlag == 1 ) ? 2 : 1; } diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index c09ad730389b4870099ca085dac8605371abffff..5a7b39339efffea89ff488a9d95340cdf8b520e9 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -969,11 +969,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) { CHECK(pcSPS->getBDPCMEnabledFlag(), "BDPCM cannot be used when transform skip is disabled"); } - WRITE_FLAG(pcSPS->getUseMTS() ? 1 : 0, "sps_mts_enabled_flag"); - if (pcSPS->getUseMTS()) + WRITE_FLAG(pcSPS->getMtsEnabled() ? 1 : 0, "sps_mts_enabled_flag"); + if (pcSPS->getMtsEnabled()) { - WRITE_FLAG(pcSPS->getUseIntraMTS() ? 1 : 0, "sps_explicit_mts_intra_enabled_flag"); - WRITE_FLAG(pcSPS->getUseInterMTS() ? 1 : 0, "sps_explicit_mts_inter_enabled_flag"); + WRITE_FLAG(pcSPS->getExplicitMtsIntraEnabled() ? 1 : 0, "sps_explicit_mts_intra_enabled_flag"); + WRITE_FLAG(pcSPS->getExplicitMtsInterEnabled() ? 1 : 0, "sps_explicit_mts_inter_enabled_flag"); } WRITE_FLAG(pcSPS->getUseLFNST() ? 1 : 0, "sps_lfnst_enabled_flag");