Commit e275b6f4 authored by Xiang Li's avatar Xiang Li

Merge branch 'fix738' into 'master'

Cleanup configuration of SbTMVP

See merge request !1805
parents 4461a9fe 974c2b93
......@@ -82,7 +82,7 @@ SBT : 1
LFNST : 1
ISP : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -105,7 +105,7 @@ MTSInterMaxCand : 4
SBT : 1
ISP : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -106,7 +106,7 @@ SBT : 1
ISP : 1
MMVD : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -118,7 +118,7 @@ LFNST : 1
ISP : 1
MMVD : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -134,7 +134,7 @@ LFNST : 1
ISP : 1
MMVD : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -2766,6 +2766,12 @@ Controls the temporal motion vector prediction mode.
\end{tabular}
\\
\Option{SbTMVP} &
%\ShortOption{\None} &
\Default{false} &
Enables Subblock Temporal Motion Vector Prediction mode.
\\
\Option{SliceLevelRpl} &
%\ShortOption{\None} &
\Default{true} &
......
......@@ -307,7 +307,8 @@ void EncApp::xInitLibCfg()
CHECK(m_bNoTemporalMvpConstraintFlag && m_TMVPModeId, "Temporal MVP shall be deactivated when m_bNoTemporalMvpConstraintFlag is equal to 1");
m_cEncLib.setNoSbtmvpConstraintFlag(m_bNoSbtmvpConstraintFlag);
CHECK(m_bNoSbtmvpConstraintFlag && m_SubPuMvpMode, "SbTMVP shall be deactivated when m_bNoSbtmvpConstraintFlag is equal to 1");
CHECK(m_bNoSbtmvpConstraintFlag && m_sbTmvpEnableFlag,
"SbTMVP shall be deactivated when m_bNoSbtmvpConstraintFlag is equal to 1");
m_cEncLib.setNoAmvrConstraintFlag(m_bNoAmvrConstraintFlag);
CHECK(m_bNoAmvrConstraintFlag && (m_ImvMode != IMV_OFF || m_AffineAmvr), "AMVR shall be deactivated when m_bNoAmvrConstraintFlag is equal to 1");
......@@ -611,7 +612,7 @@ void EncApp::xInitLibCfg()
m_cEncLib.setDualITree ( m_dualTree );
m_cEncLib.setLFNST ( m_LFNST );
m_cEncLib.setUseFastLFNST ( m_useFastLFNST );
m_cEncLib.setSubPuMvpMode ( m_SubPuMvpMode );
m_cEncLib.setSbTmvpEnabledFlag(m_sbTmvpEnableFlag);
m_cEncLib.setAffine ( m_Affine );
m_cEncLib.setAffineType ( m_AffineType );
m_cEncLib.setPROF ( m_PROF );
......
......@@ -676,6 +676,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
bool sdr = false;
// clang-format off
po::Options opts;
opts.addOptions()
("help", do_help, false, "this help text")
......@@ -873,7 +874,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("DualITree", m_dualTree, false, "Use separate QTBT trees for intra slice luma and chroma channel types")
( "LFNST", m_LFNST, false, "Enable LFNST (0:off, 1:on) [default: off]" )
( "FastLFNST", m_useFastLFNST, false, "Fast methods for LFNST" )
("SubPuMvp", m_SubPuMvpMode, 0, "Enable Sub-PU temporal motion vector prediction (0:off, 1:ATMVP, 2:STMVP, 3:ATMVP+STMVP) [default: off]")
("SbTMVP", m_sbTmvpEnableFlag, false, "Enable Subblock Temporal Motion Vector Prediction (0: off, 1: on) [default: off]")
("MMVD", m_MMVD, true, "Enable Merge mode with Motion Vector Difference (0:off, 1:on) [default: 1]")
("Affine", m_Affine, false, "Enable affine prediction (0:off, 1:on) [default: off]")
("AffineType", m_AffineType, true, "Enable affine type prediction (0:off, 1:on) [default: on]" )
......@@ -1397,6 +1398,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("TemporalFilterFutureReference", m_gopBasedTemporalFilterFutureReference, true, "Enable referencing of future frames in the GOP based temporal filter. This is typically disabled for Low Delay configurations.")
("TemporalFilterStrengthFrame*", m_gopBasedTemporalFilterStrengths, std::map<int, double>(), "Strength for every * frame in GOP based temporal filter, where * is an integer."
" E.g. --TemporalFilterStrengthFrame8 0.95 will enable GOP based temporal filter at every 8th frame with strength 0.95");
// clang-format on
#if EXTENSION_360_VIDEO
TExt360AppEncCfg::TExt360AppEncCfgContext ext360CfgContext;
......@@ -2605,20 +2607,6 @@ bool EncAppCfg::xCheckParameter()
xConfirmPara ( m_level==Level::LEVEL15_5 && !m_onePictureOnlyConstraintFlag, "Currently the only profiles that support level 15.5 are still pictures, which require onePictureOnlyConstraintFlag to be 1" );
}
if( m_SubPuMvpMode == 3 && m_maxNumMergeCand < 7 )
{
msg( WARNING, "****************************************************************************\n" );
msg( WARNING, "** WARNING: Allowing less than 7 merge candidates, although both **\n" );
msg( WARNING, "** advanced sup-pu temporal merging modes are enabled. **\n" );
msg( WARNING, "****************************************************************************\n" );
}
else if( m_SubPuMvpMode != 0 && m_maxNumMergeCand < 6 )
{
msg( WARNING, "****************************************************************************\n" );
msg( WARNING, "** WARNING: Allowing less than 6 merge candidates, although **\n" );
msg( WARNING, "** an advanced sup-pu temporal merging mode is enabled. **\n" );
msg( WARNING, "****************************************************************************\n" );
}
xConfirmPara( m_iQP < -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > MAX_QP, "QP exceeds supported range (-QpBDOffsety to 63)" );
#if W0038_DB_OPT
xConfirmPara( m_deblockingFilterMetric!=0 && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is non-zero then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
......@@ -2779,11 +2767,12 @@ bool EncAppCfg::xCheckParameter()
xConfirmPara( 0 < m_maxNumGeoCand && m_maxNumGeoCand < 2, "MaxNumGeoCand must be no less than 2 unless MaxNumGeoCand is 0." );
xConfirmPara( m_maxNumIBCMergeCand < 1, "MaxNumIBCMergeCand must be 1 or greater." );
xConfirmPara( m_maxNumIBCMergeCand > IBC_MRG_MAX_NUM_CANDS, "MaxNumIBCMergeCand must be no more than IBC_MRG_MAX_NUM_CANDS." );
xConfirmPara( m_maxNumAffineMergeCand < (m_SubPuMvpMode ? 1 : 0), "MaxNumAffineMergeCand must be greater or equal to SubPuMvp." );
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 ( m_Affine == 0 )
{
m_maxNumAffineMergeCand = m_SubPuMvpMode;
m_maxNumAffineMergeCand = m_sbTmvpEnableFlag ? 1 : 0;
if (m_PROF) msg(WARNING, "PROF is forcefully disabled when Affine is off \n");
m_PROF = false;
}
......@@ -3847,7 +3836,7 @@ void EncAppCfg::xPrintParameter()
msg( VERBOSE, "AffineType:%d ", m_AffineType );
}
msg(VERBOSE, "PROF:%d ", m_PROF);
msg(VERBOSE, "SubPuMvp:%d+%d ", m_SubPuMvpMode & 1, (m_SubPuMvpMode & 2) == 2);
msg(VERBOSE, "SbTMVP:%d ", m_sbTmvpEnableFlag);
msg( VERBOSE, "DualITree:%d ", m_dualTree );
msg( VERBOSE, "IMV:%d ", m_ImvMode );
msg( VERBOSE, "BIO:%d ", m_BIO );
......
......@@ -307,7 +307,7 @@ protected:
bool m_dualTree;
bool m_LFNST;
bool m_useFastLFNST;
int m_SubPuMvpMode;
bool m_sbTmvpEnableFlag;
bool m_Affine;
bool m_AffineType;
bool m_PROF;
......
......@@ -1748,8 +1748,8 @@ void setCCALFEnabledFlag( bool b )
void setJointCbCrEnabledFlag(bool bVal) { m_JointCbCrEnabledFlag = bVal; }
bool getJointCbCrEnabledFlag() const { return m_JointCbCrEnabledFlag; }
bool getSBTMVPEnabledFlag() const { return m_sbtmvpEnabledFlag; }
void setSBTMVPEnabledFlag(bool b) { m_sbtmvpEnabledFlag = b; }
bool getSbTMVPEnabledFlag() const { return m_sbtmvpEnabledFlag; }
void setSbTMVPEnabledFlag(bool b) { m_sbtmvpEnabledFlag = b; }
void setBDOFEnabledFlag(bool b) { m_bdofEnabledFlag = b; }
bool getBDOFEnabledFlag() const { return m_bdofEnabledFlag; }
......
......@@ -2623,9 +2623,10 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
affMrgCtx.numValidMergeCand = 0;
affMrgCtx.maxNumMergeCand = maxNumAffineMergeCand;
bool enableSubPuMvp = slice.getSPS()->getSBTMVPEnabledFlag() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP());
bool sbTmvpEnableFlag = slice.getSPS()->getSbTMVPEnabledFlag()
&& !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP());
bool isAvailableSubPu = false;
if ( enableSubPuMvp && slice.getPicHeader()->getEnableTMVPFlag() )
if (sbTmvpEnableFlag && slice.getPicHeader()->getEnableTMVPFlag())
{
MergeCtx mrgCtx = *affMrgCtx.mrgCtx;
bool tmpLICFlag = false;
......
......@@ -907,7 +907,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
if (pu.mmvdMergeFlag || pu.cu->mmvdSkip)
{
CHECK(pu.ciipFlag == true, "invalid Ciip");
if (pu.cs->sps->getSBTMVPEnabledFlag())
if (pu.cs->sps->getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale(pu.lumaSize());
mrgCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize);
......@@ -934,7 +934,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
if( pu.cu->affine )
{
AffineMergeCtx affineMergeCtx;
if ( pu.cs->sps->getSBTMVPEnabledFlag() )
if (pu.cs->sps->getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale( pu.lumaSize() );
mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize );
......
......@@ -1953,11 +1953,12 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
if ( pcSPS->getSPSTemporalMVPEnabledFlag() )
{
READ_FLAG( uiCode, "sps_sbtmvp_enabled_flag" ); pcSPS->setSBTMVPEnabledFlag ( uiCode != 0 );
READ_FLAG(uiCode, "sps_sbtmvp_enabled_flag");
pcSPS->setSbTMVPEnabledFlag(uiCode != 0);
}
else
{
pcSPS->setSBTMVPEnabledFlag(false);
pcSPS->setSbTMVPEnabledFlag(false);
}
READ_FLAG( uiCode, "sps_amvr_enabled_flag" ); pcSPS->setAMVREnabledFlag ( uiCode != 0 );
......@@ -1997,7 +1998,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
if ( pcSPS->getUseAffine() )
{
READ_UVLC(uiCode, "five_minus_max_num_subblock_merge_cand");
CHECK(uiCode > 5 - (pcSPS->getSBTMVPEnabledFlag() ? 1 : 0), "The value of five_minus_max_num_subblock_merge_cand shall be in the range of 0 to 5 - sps_sbtmvp_enabled_flag");
CHECK(
uiCode > 5 - (pcSPS->getSbTMVPEnabledFlag() ? 1 : 0),
"The value of five_minus_max_num_subblock_merge_cand shall be in the range of 0 to 5 - sps_sbtmvp_enabled_flag");
CHECK(AFFINE_MRG_MAX_NUM_CANDS < uiCode, "The value of five_minus_max_num_subblock_merge_cand shall be in the range of 0 to 5 - sps_sbtmvp_enabled_flag");
pcSPS->setMaxNumAffineMergeCand(AFFINE_MRG_MAX_NUM_CANDS - uiCode);
READ_FLAG( uiCode, "sps_affine_type_flag" ); pcSPS->setUseAffineType ( uiCode != 0 );
......@@ -3240,7 +3243,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
}
else
{
picHeader->setMaxNumAffineMergeCand( sps->getSBTMVPEnabledFlag() && picHeader->getEnableTMVPFlag() );
picHeader->setMaxNumAffineMergeCand(sps->getSbTMVPEnabledFlag() && picHeader->getEnableTMVPFlag());
}
// full-pel MMVD flag
......
......@@ -321,7 +321,7 @@ protected:
bool m_LFNST;
bool m_useFastLFNST;
int m_SubPuMvpMode;
bool m_sbTmvpEnableFlag;
bool m_Affine;
bool m_AffineType;
bool m_PROF;
......@@ -1037,8 +1037,7 @@ public:
void setVerCollocatedChromaFlag( bool b ) { m_verCollocatedChromaFlag = b; }
bool getVerCollocatedChromaFlag() const { return m_verCollocatedChromaFlag; }
void setSubPuMvpMode(int n) { m_SubPuMvpMode = n; }
bool getSubPuMvpMode() const { return m_SubPuMvpMode; }
void setSbTmvpEnabledFlag(bool val) { m_sbTmvpEnableFlag = val; }
void setAffine ( bool b ) { m_Affine = b; }
bool getAffine () const { return m_Affine; }
......
......@@ -2252,7 +2252,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
MergeCtx mergeCtx;
const SPS &sps = *tempCS->sps;
if( sps.getSBTMVPEnabledFlag() )
if (sps.getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale( tempCS->area.lumaSize() );
mergeCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize );
......@@ -2821,7 +2821,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure
MergeCtx mergeCtx;
const SPS &sps = *tempCS->sps;
if (sps.getSBTMVPEnabledFlag())
if (sps.getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale(tempCS->area.lumaSize());
mergeCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize);
......@@ -3118,7 +3118,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
setAFFBestSATDCost(MAX_DOUBLE);
MergeCtx mrgCtx;
if ( sps.getSBTMVPEnabledFlag() )
if (sps.getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale( tempCS->area.lumaSize() );
mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize );
......@@ -3390,8 +3390,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct
tempCS->initStructData(encTestMode.qp);
MergeCtx mergeCtx;
if (sps.getSBTMVPEnabledFlag())
if (sps.getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale(tempCS->area.lumaSize());
mergeCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize);
......
......@@ -1232,7 +1232,7 @@ void EncLib::xInitSPS( SPS& sps )
sps.setIDRRefParamListPresent ( m_idrRefParamList );
sps.setUseDualITree ( m_dualITree );
sps.setUseLFNST ( m_LFNST );
sps.setSBTMVPEnabledFlag ( m_SubPuMvpMode );
sps.setSbTMVPEnabledFlag(m_sbTmvpEnableFlag);
sps.setAMVREnabledFlag ( m_ImvMode != IMV_OFF );
sps.setBDOFEnabledFlag ( m_BIO );
sps.setMaxNumMergeCand(getMaxNumMergeCand());
......
......@@ -1369,7 +1369,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_GEO, ETO_STANDARD, qp } );
}
m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp } );
if ( cs.sps->getUseAffine() || cs.sps->getSBTMVPEnabledFlag() )
if (cs.sps->getUseAffine() || cs.sps->getSbTMVPEnabledFlag())
{
m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp } );
}
......@@ -1383,7 +1383,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_GEO, ETO_STANDARD, qp } );
}
m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp } );
if ( cs.sps->getUseAffine() || cs.sps->getSBTMVPEnabledFlag() )
if (cs.sps->getUseAffine() || cs.sps->getSbTMVPEnabledFlag())
{
m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp } );
}
......
......@@ -2321,7 +2321,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
CHECK(pu.cu != &cu, "PU is contained in another CU");
if (cu.cs->sps->getSBTMVPEnabledFlag())
if (cu.cs->sps->getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale(pu.lumaSize());
mergeCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize);
......
......@@ -1157,7 +1157,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
if ( pcSPS->getSPSTemporalMVPEnabledFlag() )
{
WRITE_FLAG( pcSPS->getSBTMVPEnabledFlag() ? 1 : 0, "sps_sbtmvp_enabled_flag");
WRITE_FLAG(pcSPS->getSbTMVPEnabledFlag() ? 1 : 0, "sps_sbtmvp_enabled_flag");
}
WRITE_FLAG( pcSPS->getAMVREnabledFlag() ? 1 : 0, "sps_amvr_enabled_flag" );
......@@ -2035,7 +2035,7 @@ WRITE_FLAG(picHeader->getGdrOrIrapPicFlag(), "gdr_or_irap_pic_flag");
}
else
{
picHeader->setMaxNumAffineMergeCand( sps->getSBTMVPEnabledFlag() && picHeader->getEnableTMVPFlag() );
picHeader->setMaxNumAffineMergeCand(sps->getSbTMVPEnabledFlag() && picHeader->getEnableTMVPFlag());
}
// full-pel MMVD flag
......
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