Commit cbd179cb authored by Yin Zhao's avatar Yin Zhao

disable SBT for IBC mode and init cu.sbtInfo = 0 in IBC RDO; move SBT sps flag from SpsNext to Sps

parent 68cf1ee8
......@@ -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
......
......@@ -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
};
......
......@@ -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
......
......@@ -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");
......
......@@ -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);
......
......@@ -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 );
......
......@@ -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 ) );
......
......@@ -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'" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment