diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index c14c2b68efbfe8bef9961e3c5f53b2195f64a04f..b42f52342eda15e1c663d0b8845d521ff76c9edf 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -1900,9 +1900,6 @@ SPSNext::SPSNext( SPS& sps ) #else , m_IntraEMT ( false ) , m_InterEMT ( false ) -#endif -#if JVET_M0140_SBT - , m_SBT ( false ) #endif , m_Affine ( false ) , m_AffineType ( false ) @@ -1954,6 +1951,10 @@ SPS::SPS() #if JVET_M0147_DMVR , m_DMVR ( false ) #endif +#if JVET_M0140_SBT +, m_SBT ( false ) +, m_MaxSbtSize ( 32 ) +#endif #if HEVC_VPS , m_VPSId ( 0) #endif diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index f2688be6a1d5e5856199de7a7eb71bb344026251..63a2bd032ab21892b74b5ca0ad7ecf8f2d28a38f 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -848,10 +848,6 @@ private: #else bool m_IntraEMT; // 18 bool m_InterEMT; // 19 -#endif -#if JVET_M0140_SBT - bool m_SBT; - uint8_t m_MaxSbtSize; #endif bool m_Affine; bool m_AffineType; @@ -932,12 +928,6 @@ public: bool getUseIntraEMT () const { return m_IntraEMT; } void setUseInterEMT ( bool b ) { m_InterEMT = b; } bool getUseInterEMT () const { return m_InterEMT; } -#endif -#if JVET_M0140_SBT - void setUseSBT ( bool b ) { m_SBT = b; } - bool getUseSBT () const { return m_SBT; } - void setMaxSbtSize ( uint8_t val ) { m_MaxSbtSize = val; } - uint8_t getMaxSbtSize () const { return m_MaxSbtSize; } #endif void setUseGBi ( bool b ) { m_GBi = b; } bool getUseGBi () const { return m_GBi; } @@ -1002,6 +992,10 @@ private: #if JVET_M0147_DMVR bool m_DMVR; #endif +#if JVET_M0140_SBT + bool m_SBT; + uint8_t m_MaxSbtSize; +#endif #if HEVC_VPS int m_VPSId; #endif @@ -1327,6 +1321,12 @@ public: void setIBCFlag(unsigned IBCFlag) { m_IBCFlag = IBCFlag; } unsigned getIBCFlag() const { return m_IBCFlag; } #endif +#if JVET_M0140_SBT + void setUseSBT( bool b ) { m_SBT = b; } + bool getUseSBT() const { return m_SBT; } + void setMaxSbtSize( uint8_t val ) { m_MaxSbtSize = val; } + uint8_t getMaxSbtSize() const { return m_MaxSbtSize; } +#endif }; diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index a2f4bc6ecd06ce6905415b7aa95fe22be017a974..aed894214e8ef54511e2fa2b3df9679bff5ae53e 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -353,13 +353,17 @@ void CodingUnit::initData() #if JVET_M0140_SBT const uint8_t CodingUnit::checkAllowedSbt() const { - if( !slice->getSPS()->getSpsNext().getUseSBT() ) + if( !slice->getSPS()->getUseSBT() ) { return 0; } //check on prediction mode - if( predMode == MODE_INTRA ) //intra +#if JVET_M0483_IBC + if( predMode == MODE_INTRA || predMode == MODE_IBC ) //intra or IBC +#else + if( predMode == MODE_INTRA || ibc ) //intra or IBC +#endif { return 0; } @@ -375,7 +379,7 @@ const uint8_t CodingUnit::checkAllowedSbt() const memset( allow_type, false, NUMBER_SBT_IDX * sizeof( bool ) ); //parameter - int maxSbtCUSize = cs->sps->getSpsNext().getMaxSbtSize(); + int maxSbtCUSize = cs->sps->getMaxSbtSize(); int minSbtCUSize = 1 << ( MIN_CU_LOG2 + 1 ); //check on size diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index a94f9710d62db7b0f034d2c77d1f5d7b15628ff0..4eb2afbab5acf94be7d067f87f7862dc519431f3 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -815,13 +815,6 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) } #endif -#if JVET_M0140_SBT - READ_FLAG( symbol, "sbt_enable_flag" ); spsNext.setUseSBT ( symbol != 0 ); - if( spsNext.getUseSBT() ) - { - READ_FLAG( symbol, "max_sbt_size_64_flag" ); spsNext.setMaxSbtSize ( symbol ? 64 : 32 ); - } -#endif READ_FLAG( symbol, "affine_flag" ); spsNext.setUseAffine ( symbol != 0 ); if ( spsNext.getUseAffine() ) { @@ -1127,6 +1120,13 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } } #endif +#if JVET_M0140_SBT + READ_FLAG(uiCode, "sbt_enable_flag"); pcSPS->setUseSBT(uiCode != 0); + if( pcSPS->getUseSBT() ) + { + READ_FLAG(uiCode, "max_sbt_size_64_flag"); pcSPS->setMaxSbtSize(uiCode != 0 ? 64 : 32); + } +#endif READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); CHECK(uiCode > 64, "Invalid code"); diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index b93231088587e50d5fab776cd78de6e3bfdd7015..4317ca13d9405822fe80eaa761733acb20cd6c9f 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -714,10 +714,10 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par bestCS->chType = partitioner.chType; m_modeCtrl->initCULevel( partitioner, *tempCS ); #if JVET_M0140_SBT - if( partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() && ( sps.getSpsNext().getUseSBT() || sps.getSpsNext().getUseInterMTS() ) ) + if( partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() && ( sps.getUseSBT() || sps.getSpsNext().getUseInterMTS() ) ) { auto slsSbt = dynamic_cast<SaveLoadEncInfoSbt*>( m_modeCtrl ); - int maxSLSize = sps.getSpsNext().getUseSBT() ? tempCS->slice->getSPS()->getSpsNext().getMaxSbtSize() : MTS_INTER_MAX_CU_SIZE; + int maxSLSize = sps.getUseSBT() ? tempCS->slice->getSPS()->getMaxSbtSize() : MTS_INTER_MAX_CU_SIZE; slsSbt->resetSaveloadSbt( maxSLSize ); } m_sbtCostSave[0] = m_sbtCostSave[1] = MAX_DOUBLE; @@ -3504,6 +3504,9 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct #if !JVET_M0464_UNI_MTS cu.emtFlag = false; #endif +#if JVET_M0140_SBT + cu.sbtInfo = 0; +#endif PredictionUnit &pu = tempCS->addPU(cu, partitioner.chType);// tempCS->addPU(cu); pu.intraDir[0] = DC_IDX; // set intra pred for ibc block @@ -3591,6 +3594,9 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best cu.ibc = true; #endif cu.imv = 0; +#if JVET_M0140_SBT + cu.sbtInfo = 0; +#endif CU::addPUs(cu); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 76b3aef55aec3723872343c0bdee53683daead2c..ebe96c8a98fe743422d72aa4d7046cc5c93a80cc 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -911,10 +911,10 @@ void EncLib::xInitSPS(SPS &sps) sps.getSpsNext().setUseInterEMT ( m_InterEMT ); #endif #if JVET_M0140_SBT - sps.getSpsNext().setUseSBT ( m_SBT ); - if( sps.getSpsNext().getUseSBT() ) + sps.setUseSBT ( m_SBT ); + if( sps.getUseSBT() ) { - sps.getSpsNext().setMaxSbtSize ( m_iSourceWidth >= 1920 ? 64 : 32 ); + sps.setMaxSbtSize ( m_iSourceWidth >= 1920 ? 64 : 32 ); } #endif sps.getSpsNext().setUseCompositeRef ( m_compositeRefEnabled ); diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 22b5d5e4b828bbe9110ecab4f723a92a7f6361b6..b609261953894e51f221f858df5496a6c4367f2e 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -6425,7 +6425,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par #if APPLY_SBT_SL_ON_MTS //skip MTS if DCT2 is the best - if( mtsAllowed && ( !tu.cu->slice->getSPS()->getSpsNext().getUseSBT() || CU::getSbtIdx( m_histBestSbt ) != SBT_OFF_DCT ) ) + if( mtsAllowed && ( !tu.cu->slice->getSPS()->getUseSBT() || CU::getSbtIdx( m_histBestSbt ) != SBT_OFF_DCT ) ) #else if( mtsAllowed ) #endif @@ -6434,7 +6434,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { #if APPLY_SBT_SL_ON_MTS //skip the non-best Mts mode - if( !tu.cu->slice->getSPS()->getSpsNext().getUseSBT() || ( m_histBestMtsIdx == MAX_UCHAR || m_histBestMtsIdx == i ) ) + if( !tu.cu->slice->getSPS()->getUseSBT() || ( m_histBestMtsIdx == MAX_UCHAR || m_histBestMtsIdx == i ) ) { #endif trModes.push_back( TrMode( i, true ) ); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 823751dc792402248f445100f41d940d689eaec5..4bed5da8cd9df34c803d4c6e993743e860aae4f1 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -555,13 +555,6 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) } #endif -#if JVET_M0140_SBT - WRITE_FLAG( spsNext.getUseSBT() ? 1 : 0, "sbt_enable_flag" ); - if( spsNext.getUseSBT() ) - { - WRITE_FLAG( spsNext.getMaxSbtSize() == 64 ? 1 : 0, "max_sbt_size_64_flag" ); - } -#endif WRITE_FLAG( spsNext.getUseAffine() ? 1 : 0, "affine_flag" ); if ( spsNext.getUseAffine() ) { @@ -797,6 +790,13 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } #endif +#if JVET_M0140_SBT + WRITE_FLAG( pcSPS->getUseSBT() ? 1 : 0, "sbt_enable_flag"); + if( pcSPS->getUseSBT() ) + { + WRITE_FLAG(pcSPS->getMaxSbtSize() == 64 ? 1 : 0, "max_sbt_size_64_flag"); + } +#endif CHECK( pcSPS->getMaxTLayers() == 0, "Maximum number of T-layers is '0'" );