Commit 461cdbcd authored by Karsten Suehring's avatar Karsten Suehring

remove deprecated IMV mode SPS parameter

AMVR (formely IMV) now has only one mode, which used to be mode #2
- remove SPS imv_mode parameter
- remove encoder configuration for mode #1 (mode #2 replaces mode #1)
- adapt config files to refer tp mode #1
- rename SPS syntax elements and access functions to AMVR

Note: IMV to AMVR renaming in other parts of the software should be done by proponents.
parent e704b84f
......@@ -108,7 +108,7 @@ SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
IMV : 2
IMV : 1
ALF : 1
IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
......
......@@ -124,7 +124,7 @@ SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
IMV : 2
IMV : 1
ALF : 1
MHIntra : 1
IBC : 0 # turned off in CTC
......
......@@ -124,7 +124,7 @@ SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
IMV : 2
IMV : 1
ALF : 1
GBi : 1
GBiFast : 1
......
......@@ -138,7 +138,7 @@ SubPuMvp : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
IMV : 2
IMV : 1
ALF : 1
GBi : 1
GBiFast : 1
......
......@@ -814,10 +814,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("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]" )
("BIO", m_BIO, false, "Enable bi-directional optical flow")
("IMV", m_ImvMode, 2, "Adaptive MV precision Mode (IMV)\n"
"\t0: disabled IMV\n"
"\t1: IMV default (Full-Pel)\n"
"\t2: IMV Full-Pel and 4-PEL\n")
("IMV", m_ImvMode, 1, "Adaptive MV precision Mode (IMV)\n"
"\t0: disabled\n"
"\t1: enabled (Full-Pel and 4-PEL)\n")
("IMV4PelFast", m_Imv4PelFast, 1, "Fast 4-Pel Adaptive MV precision Mode 0:disabled, 1:enabled) [default: 1]")
("LMChroma", m_LMChroma, 1, " LMChroma prediction "
"\t0: Disable LMChroma\n"
......@@ -2930,7 +2929,7 @@ bool EncAppCfg::xCheckParameter()
#if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
xConfirmPara(m_preferredTransferCharacteristics > 255, "transfer_characteristics_idc should not be greater than 255.");
#endif
xConfirmPara( unsigned(m_ImvMode) > 2, "ImvMode exceeds range (0 to 2)" );
xConfirmPara( unsigned(m_ImvMode) > 1, "ImvMode exceeds range (0 to 1)" );
xConfirmPara( m_decodeBitstreams[0] == m_bitstreamFileName, "Debug bitstream and the output bitstream cannot be equal.\n" );
xConfirmPara( m_decodeBitstreams[1] == m_bitstreamFileName, "Decode2 bitstream and the output bitstream cannot be equal.\n" );
xConfirmPara(unsigned(m_LMChroma) > 1, "LMMode exceeds range (0 to 1)");
......@@ -3231,7 +3230,7 @@ void EncAppCfg::xPrintParameter()
msg( VERBOSE, "LCTUFast:%d ", m_useFastLCTU );
msg( VERBOSE, "FastMrg:%d ", m_useFastMrg );
msg( VERBOSE, "PBIntraFast:%d ", m_usePbIntraFast );
if( m_ImvMode == 2 ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast );
if( m_ImvMode ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast );
#if JVET_M0464_UNI_MTS
if( m_MTS ) msg( VERBOSE, "MTSMaxCand: %1d(intra) %1d(inter) ", m_MTSIntraMaxCand, m_MTSInterMaxCand );
#else
......
......@@ -1967,7 +1967,7 @@ SPS::SPS()
, m_lumaReshapeEnable (false)
#endif
// KJS: BEGIN former SPSNext parameters
, m_IMV ( false )
, m_AMVREnabledFlag ( false )
, m_LMChroma ( false )
#if JVET_M0142_CCLM_COLLOCATED_CHROMA
, m_cclmCollocatedChromaFlag ( false )
......@@ -1989,9 +1989,6 @@ SPS::SPS()
, m_LadfQpOffset { 0 }
, m_LadfIntervalLowerBound { 0 }
#endif
// default values for additional parameters
, m_ImvMode ( IMV_OFF )
, m_compositeRefEnabled ( false )
#if !JVET_M0483_IBC
, m_IBCMode ( 0 )
......
......@@ -950,7 +950,7 @@ private:
bool m_lumaReshapeEnable;
#endif
// KJS: BEGIN former SPSNext parameters
bool m_IMV; // 9
bool m_AMVREnabledFlag;
bool m_LMChroma; // 17
#if JVET_M0142_CCLM_COLLOCATED_CHROMA
bool m_cclmCollocatedChromaFlag;
......@@ -976,9 +976,6 @@ private:
int m_LadfQpOffset[MAX_LADF_INTERVALS];
int m_LadfIntervalLowerBound[MAX_LADF_INTERVALS];
#endif
//===== additional parameters =====
//imv
ImvMode m_ImvMode;
bool m_compositeRefEnabled; //composite longterm reference
#if !JVET_M0483_IBC
......@@ -1221,8 +1218,8 @@ public:
#endif
// KJS: BEGIN former SPSNext parameters
void setUseIMV ( bool b ) { m_IMV = b; }
bool getUseIMV () const { return m_IMV; }
void setAMVREnabledFlag ( bool b ) { m_AMVREnabledFlag = b; }
bool getAMVREnabledFlag () const { return m_AMVREnabledFlag; }
void setUseAffine ( bool b ) { m_Affine = b; }
bool getUseAffine () const { return m_Affine; }
void setUseAffineType ( bool b ) { m_AffineType = b; }
......@@ -1265,12 +1262,7 @@ public:
void setLadfIntervalLowerBound( int value, int idx ) { m_LadfIntervalLowerBound[ idx ] = value; }
int getLadfIntervalLowerBound( int idx ) const { return m_LadfIntervalLowerBound[ idx ]; }
#endif
//===== additional parameters =====
// qtbt
// sub pu tmvp
void setImvMode(ImvMode m) { m_ImvMode = m; m_IMV = m != 0; }
ImvMode getImvMode () const { return m_ImvMode; }
// KJS: this is encoder only, right?
void setUseCompositeRef(bool b) { m_compositeRefEnabled = b; }
bool getUseCompositeRef() const { return m_compositeRefEnabled; }
......
......@@ -1006,7 +1006,7 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx )
{
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__OTHER );
if( !cu.cs->sps->getUseIMV() )
if( !cu.cs->sps->getAMVREnabledFlag() )
{
return;
}
......@@ -1038,7 +1038,7 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx )
value = m_BinDecoder.decodeBin( Ctx::ImvFlag( ctxId ) );
DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, ctxId );
if( sps->getImvMode() == IMV_4PEL && value )
if( sps->getAMVREnabledFlag() && value )
{
value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 3 ) );
DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 3 );
......
......@@ -1020,8 +1020,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
pcSPS->setSBTMVPEnabledFlag(false);
}
// KJS: sps_amvr_enabled_flag
READ_FLAG( uiCode, "imv_enable_flag" ); pcSPS->setUseIMV ( uiCode != 0 );
READ_FLAG( uiCode, "sps_amvr_enabled_flag" ); pcSPS->setAMVREnabledFlag ( uiCode != 0 );
READ_FLAG( uiCode, "sps_bdof_enabled_flag" ); pcSPS->setBDOFEnabledFlag ( uiCode != 0 );
......@@ -1106,14 +1105,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
}
}
#endif
// KJS: BEGIN former SPSNext parameters
if( pcSPS->getUseIMV() )
{
READ_UVLC( uiCode, "imv_mode_minus1" ); pcSPS->setImvMode( ImvMode( uiCode + 1 ) );
}
// KJS: END former SPSNext parameters
// KJS: reference picture sets to be replaced
READ_UVLC( uiCode, "num_short_term_ref_pic_sets" );
CHECK(uiCode > 64, "Invalid code");
......
......@@ -1669,7 +1669,7 @@ void CABACWriter::imv_mode( const CodingUnit& cu )
{
const SPS *sps = cu.cs->sps;
if( !sps->getUseIMV() )
if( !sps->getAMVREnabledFlag() )
{
return;
}
......@@ -1695,7 +1695,7 @@ void CABACWriter::imv_mode( const CodingUnit& cu )
m_BinEncoder.encodeBin( ( cu.imv > 0 ), Ctx::ImvFlag( ctxId ) );
DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", (cu.imv > 0), ctxId );
if( sps->getImvMode() == IMV_4PEL && cu.imv > 0 )
if( sps->getAMVREnabledFlag() && cu.imv > 0 )
{
m_BinEncoder.encodeBin( ( cu.imv > 1 ), Ctx::ImvFlag( 3 ) );
DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", ( cu.imv > 1 ), 3 );
......
......@@ -881,8 +881,7 @@ void EncLib::xInitSPS(SPS &sps)
sps.setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma );
sps.setUseDualITree ( m_dualITree );
sps.setSBTMVPEnabledFlag ( m_SubPuMvpMode );
sps.setImvMode ( ImvMode(m_ImvMode) );
sps.setUseIMV ( m_ImvMode != IMV_OFF );
sps.setAMVREnabledFlag ( m_ImvMode != IMV_OFF );
sps.setBDOFEnabledFlag ( m_BIO );
sps.setUseAffine ( m_Affine );
sps.setUseAffineType ( m_AffineType );
......
......@@ -1335,15 +1335,8 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
if( m_pcEncCfg->getIMV() )
#endif
{
#if JVET_M0246_AFFINE_AMVR
if( m_pcEncCfg->getIMV() == IMV_4PEL || m_pcEncCfg->getUseAffineAmvr() )
#else
if( m_pcEncCfg->getIMV() == IMV_4PEL )
#endif
{
int imv = m_pcEncCfg->getIMV4PelFast() ? 3 : 2;
m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, EncTestModeOpts( imv << ETO_IMV_SHIFT ), qp, lossless } );
}
int imv = m_pcEncCfg->getIMV4PelFast() ? 3 : 2;
m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, EncTestModeOpts( imv << ETO_IMV_SHIFT ), qp, lossless } );
m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, EncTestModeOpts( 1 << ETO_IMV_SHIFT ), qp, lossless } );
}
// add inter modes
......
......@@ -988,7 +988,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
if (validCand)
{
sad = m_pcRdCost->getBvCostMultiplePreds(xPred, yPred, pu.cs->sps->getImvMode() == IMV_4PEL);
sad = m_pcRdCost->getBvCostMultiplePreds(xPred, yPred, pu.cs->sps->getAMVREnabledFlag());
m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * yPred + xPred;
sad += m_cDistParam.distFunc(m_cDistParam);
......@@ -1010,7 +1010,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
continue;
}
sad = m_pcRdCost->getBvCostMultiplePreds(0, y, pu.cs->sps->getImvMode() == IMV_4PEL);
sad = m_pcRdCost->getBvCostMultiplePreds(0, y, pu.cs->sps->getAMVREnabledFlag());
m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y;
sad += m_cDistParam.distFunc(m_cDistParam);
......@@ -1035,7 +1035,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
continue;
}
sad = m_pcRdCost->getBvCostMultiplePreds(x, 0, pu.cs->sps->getImvMode() == IMV_4PEL);
sad = m_pcRdCost->getBvCostMultiplePreds(x, 0, pu.cs->sps->getAMVREnabledFlag());
m_cDistParam.cur.buf = piRefSrch + x;
sad += m_cDistParam.distFunc(m_cDistParam);
......@@ -1056,7 +1056,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
bestX = cMVCand[0].getHor();
bestY = cMVCand[0].getVer();
sadBest = sadBestCand[0];
if ((!bestX && !bestY) || (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getImvMode() == IMV_4PEL) <= 32))
if ((!bestX && !bestY) || (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getAMVREnabledFlag()) <= 32))
{
//chroma refine
bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand);
......@@ -1086,7 +1086,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
continue;
}
sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getImvMode() == IMV_4PEL);
sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getAMVREnabledFlag());
m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y + x;
sad += m_cDistParam.distFunc(m_cDistParam);
......@@ -1097,7 +1097,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
bestX = cMVCand[0].getHor();
bestY = cMVCand[0].getVer();
sadBest = sadBestCand[0];
if (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getImvMode() == IMV_4PEL) <= 16)
if (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getAMVREnabledFlag()) <= 16)
{
//chroma refine
bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand);
......@@ -1126,7 +1126,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
continue;
}
sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getImvMode() == IMV_4PEL);
sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getAMVREnabledFlag());
m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y + x;
sad += m_cDistParam.distFunc(m_cDistParam);
......@@ -1150,7 +1150,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
bestY = cMVCand[0].getVer();
sadBest = sadBestCand[0];
if ((sadBest >= tempSadBest) || ((sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getImvMode() == IMV_4PEL)) <= 32))
if ((sadBest >= tempSadBest) || ((sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getAMVREnabledFlag())) <= 32))
{
//chroma refine
bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand);
......@@ -1183,7 +1183,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS
continue;
}
sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getImvMode() == IMV_4PEL);
sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getAMVREnabledFlag());
m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y + x;
sad += m_cDistParam.distFunc(m_cDistParam);
......@@ -1444,7 +1444,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const
bitsBVPBest = bitsBVPTemp;
bvpIdxBest = bvpIdxTemp;
if (cu.cs->sps->getImvMode() && cMv != cMvPred[bvpIdxTemp])
if (cu.cs->sps->getAMVREnabledFlag() && cMv != cMvPred[bvpIdxTemp])
pu.cu->imv = 1; // set as full-pel
else
pu.cu->imv = 0; // set as fractional-pel
......@@ -1455,7 +1455,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const
Mv mvPredQuadPel;
if ((cMv.getHor() % 4 == 0) && (cMv.getVer() % 4 == 0) && (pu.cs->sps->getImvMode() == IMV_4PEL))
if ((cMv.getHor() % 4 == 0) && (cMv.getVer() % 4 == 0) && (pu.cs->sps->getAMVREnabledFlag()))
{
mvPredQuadPel = amvpInfo4Pel.mvCand[bvpIdxTemp];// cMvPred[bvpIdxTemp];
......@@ -1472,7 +1472,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const
bitsBVPBest = bitsBVPQP;
bvpIdxBest = bvpIdxTemp;
if (cu.cs->sps->getImvMode())
if (cu.cs->sps->getAMVREnabledFlag())
pu.cu->imv = 2; // set as quad-pel
}
......@@ -1493,10 +1493,10 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const
pu.cu->imv = 0;
if (pu.cu->imv == 2)
assert((cMv.getHor() % 16 == 0) && (cMv.getVer() % 16 == 0));
if (cu.cs->sps->getUseIMV())
if (cu.cs->sps->getAMVREnabledFlag())
assert(pu.cu->imv>0 || pu.mvd[REF_PIC_LIST_0] == Mv());
if (!cu.cs->sps->getUseIMV())
if (!cu.cs->sps->getAMVREnabledFlag())
pu.mvd[REF_PIC_LIST_0] >>= (2);
#if JVET_M0483_IBC
......@@ -1558,7 +1558,7 @@ void InterSearch::xxIBCHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred,
}
int costQuadPel = MAX_UINT;
if ((candMv.getHor() % 4 == 0) && (candMv.getVer() % 4 == 0) && (pu.cs->sps->getImvMode() == IMV_4PEL))
if ((candMv.getHor() % 4 == 0) && (candMv.getVer() % 4 == 0) && (pu.cs->sps->getAMVREnabledFlag()))
{
Mv mvPredQuadPel;
int imvShift = 2;
......@@ -1952,8 +1952,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
#if JVET_M0246_AFFINE_AMVR
bool checkAffine = pu.cu->imv == 0 || pu.cu->slice->getSPS()->getAffineAmvrEnabledFlag();
bool checkNonAffine = pu.cu->imv == 0 || ( pu.cu->slice->getSPS()->getUseIMV() &&
pu.cu->imv <= pu.cu->slice->getSPS()->getImvMode() );
bool checkNonAffine = pu.cu->imv == 0 || ( pu.cu->slice->getSPS()->getAMVREnabledFlag() &&
pu.cu->imv <= (pu.cu->slice->getSPS()->getAMVREnabledFlag() ? IMV_4PEL : 0));
CodingUnit *bestCU = pu.cu->cs->bestCS != nullptr ? pu.cu->cs->bestCS->getCU( CHANNEL_TYPE_LUMA ) : nullptr;
#if JVET_M0444_SMVD
bool trySmvd = ( bestCU != nullptr && pu.cu->imv == 2 && checkAffine ) ? ( !bestCU->firstPU->mergeFlag && !bestCU->affine ) : true;
......
......@@ -695,8 +695,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
WRITE_FLAG( pcSPS->getSBTMVPEnabledFlag() ? 1 : 0, "sps_sbtmvp_enabled_flag");
}
// KJS: sps_amvr_enabled_flag
WRITE_FLAG( pcSPS->getUseIMV() ? 1 : 0, "imv_enable_flag" );
WRITE_FLAG( pcSPS->getAMVREnabledFlag() ? 1 : 0, "sps_amvr_enabled_flag" );
WRITE_FLAG( pcSPS->getBDOFEnabledFlag() ? 1 : 0, "sps_bdof_enabled_flag" );
......@@ -781,18 +780,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
}
#endif
// KJS: BEGIN former SPSNext parameters
// additional parameters
if( pcSPS->getUseIMV() )
{
WRITE_UVLC( pcSPS->getImvMode()-1, "imv_mode_minus1" );
}
// KJS: END former SPSNext parameters
// KJS: reference picture sets to be replaced
const RPSList* rpsList = pcSPS->getRPSList();
......
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