diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 0127ac3d9961ecf987fa3736c72339f4161f6e82..14f7545b457a4eec0e32baf3b979e12dc80fa4c4 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -502,11 +502,9 @@ void EncApp::xInitLibCfg() m_cEncLib.setSummaryOutFilename ( m_summaryOutFilename ); m_cEncLib.setSummaryPicFilenameBase ( m_summaryPicFilenameBase ); m_cEncLib.setSummaryVerboseness ( m_summaryVerboseness ); -#if JVET_K0357_AMVR m_cEncLib.setIMV ( m_ImvMode ); m_cEncLib.setIMV4PelFast ( m_Imv4PelFast ); m_cEncLib.setIMVMaxCand ( m_ImvMaxCand ); -#endif m_cEncLib.setDecodeBitstream ( 0, m_decodeBitstreams[0] ); m_cEncLib.setDecodeBitstream ( 1, m_decodeBitstreams[1] ); m_cEncLib.setSwitchPOC ( m_switchPOC ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index f44ec211f60d2066c6e778d8876faef6fde0b10f..89d0d930de6d0fcb72e89622923cf5676bc97825 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -823,14 +823,12 @@ 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]" ) ("DisableMotCompression", m_DisableMotionCompression, false, "Disable motion data compression for all modes") -#if JVET_K0357_AMVR ("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") ("IMV4PelFast", m_Imv4PelFast, 1, "Fast 4-Pel Adaptive MV precision Mode 0:disabled, 1:enabled) [default: 1]") ("IMVMaxCand", m_ImvMaxCand, 4, "max IMV cand (QTBF off only)") -#endif #if ENABLE_WPP_PARALLELISM ("AltDQPCoding", m_AltDQPCoding, false, "Improved predictive delta-QP coding (0:off, 1:on) [default: off]") #endif @@ -1926,9 +1924,7 @@ bool EncAppCfg::xCheckParameter() #endif xConfirmPara( m_DisableMotionCompression, "Disable motion data compression only allowed with NEXT profile" ); xConfirmPara( m_MTT, "Multi type tree is only allowed with NEXT profile" ); -#if JVET_K0357_AMVR xConfirmPara( m_ImvMode, "IMV is only allowed with NEXT profile" ); -#endif xConfirmPara( m_useFastLCTU, "Fast large CTU can only be applied when encoding with NEXT profile" ); #if !JVET_K0220_ENC_CTRL xConfirmPara( m_useSaveLoadEncInfo, "Encoder decision saving can only be applied when encoding with NEXT profile" ); @@ -2912,9 +2908,7 @@ bool EncAppCfg::xCheckParameter() #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI xConfirmPara(m_preferredTransferCharacteristics > 255, "transfer_characteristics_idc should not be greater than 255."); #endif -#if JVET_K0357_AMVR xConfirmPara( unsigned(m_ImvMode) > 2, "ImvMode exceeds range (0 to 2)" ); -#endif 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)"); @@ -3162,10 +3156,8 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "QTBT:%d ", m_QTBT ); if( m_QTBT ) msg( VERBOSE, "DualITree:%d ", m_dualTree ); msg( VERBOSE, "LargeCTU:%d ", m_LargeCTU ); -#if JVET_K0357_AMVR msg( VERBOSE, "IMV:%d ", m_ImvMode ); if( !m_QTBT ) msg( VERBOSE, "IMVMaxCand:%d ", m_ImvMaxCand ); -#endif #if !REMOVE_MV_ADAPT_PREC msg(VERBOSE, "HighPrecMv:%d ", m_highPrecisionMv); #endif @@ -3196,9 +3188,7 @@ void EncAppCfg::xPrintParameter() #endif msg( VERBOSE, "FastMrg:%d ", m_useFastMrg ); msg( VERBOSE, "PBIntraFast:%d ", m_usePbIntraFast ); -#if JVET_K0357_AMVR if( m_ImvMode == 2 ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast ); -#endif if( m_EMT ) msg( VERBOSE, "EMTFast: %1d(intra) %1d(inter) ", ( m_FastEMT & m_EMT & 1 ), ( m_FastEMT >> 1 ) & ( m_EMT >> 1 ) & 1 ); if( m_QTBT ) msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT ); if( m_QTBT ) msg( VERBOSE, "E0023FastEnc:%d ", m_e0023FastEnc ); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 81fafeac619280b7700d3212bec5a6f0f527190c..3be2cc2e429b7dd1861a2e424c66bdca7c92fdef 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -491,11 +491,9 @@ protected: int m_maxBitsPerMinCuDenom; ///< Indicates an upper bound for the number of bits of coding_unit() data int m_log2MaxMvLengthHorizontal; ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units int m_log2MaxMvLengthVertical; ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units -#if JVET_K0357_AMVR int m_ImvMode; ///< imv mode int m_Imv4PelFast; ///< imv 4-Pel fast mode int m_ImvMaxCand; ///< imv max num cand for test (QTBT off only) -#endif std::string m_colourRemapSEIFileRoot; std::string m_summaryOutFilename; ///< filename to use for producing summary output file. diff --git a/source/Lib/CommonLib/CodingStatistics.h b/source/Lib/CommonLib/CodingStatistics.h index 9d5e3d9bd6fd89aa20a9a9d33fe03ad286dd186a..57a3263fee2d321728311da4a35a347a03484ffc 100644 --- a/source/Lib/CommonLib/CodingStatistics.h +++ b/source/Lib/CommonLib/CodingStatistics.h @@ -99,9 +99,7 @@ enum CodingStatisticsType STATS__CABAC_BITS__AFFINE_TYPE, STATS__CABAC_BITS__PAR_FLAG, STATS__CABAC_BITS__ALF, -#if JVET_K0357_AMVR STATS__CABAC_BITS__IMV_FLAG, -#endif STATS__CABAC_BITS__EMT_CU_FLAG, STATS__CABAC_BITS__EMT_TU_INDEX, STATS__TOOL_EMT, @@ -171,9 +169,7 @@ static inline const char* getName(CodingStatisticsType name) "CABAC_EP_BIT_ALIGNMENT", "CABAC_BITS__ALIGNED_SIGN_BIT", "CABAC_BITS__ALIGNED_ESCAPE_BITS", -#if JVET_K0357_AMVR "CABAC_BITS__IMV_FLAG", -#endif "CABAC_BITS__EMT_CU_FLAG", "CABAC_BITS__EMT_TU_INDX", "CABAC_BITS__OTHER", diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index b8af58ba2cd2be63ef3af0c60c5a6d41e251731b..cfd5e8b1adf6e7ff1ec4aa399ac229f548fa6bed 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -284,7 +284,6 @@ unsigned DeriveCtx::CtxSkipFlag( const CodingUnit& cu ) } -#if JVET_K0357_AMVR unsigned DeriveCtx::CtxIMVFlag( const CodingUnit& cu ) { const CodingStructure *cs = cu.cs; @@ -300,7 +299,6 @@ unsigned DeriveCtx::CtxIMVFlag( const CodingUnit& cu ) return ctxId; } -#endif unsigned DeriveCtx::CtxBTsplit(const CodingStructure& cs, Partitioner& partitioner) { diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index c17b6ed31d4f2ad94b3a346fdf8575c04a1add93..0b3df9dccf192aba9f830328c7cf1e4aeef77b82 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -289,9 +289,7 @@ unsigned CtxQtCbf ( const ComponentID compID, const bool prevCbCbf ); #endif unsigned CtxInterDir ( const PredictionUnit& pu ); unsigned CtxSkipFlag ( const CodingUnit& cu ); -#if JVET_K0357_AMVR unsigned CtxIMVFlag ( const CodingUnit& cu ); -#endif unsigned CtxAffineFlag( const CodingUnit& cu ); } diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index c03ac34b5bb58dbc1051e4db0e8e2f8c9a68dc51..c735ab2d932ef6917a7797c16786d6b45400e7c4 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -641,14 +641,12 @@ const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet { 154,}, }); -#if JVET_K0357_AMVR const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet ({ { 197, 185, 201, 185,}, { 197, 185, 201, 185,}, { CNU, CNU, CNU, CNU,}, }); -#endif const CtxSet ContextSetCfg::ctbAlfFlag = { diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h index 32760c17a33cd1c85af5cc1b9467b809c9378fc3..8f18ae58e7bf974738cddbe5edfb4ebe96373c92 100644 --- a/source/Lib/CommonLib/Contexts.h +++ b/source/Lib/CommonLib/Contexts.h @@ -190,9 +190,7 @@ public: static const CtxSet CrossCompPred; static const CtxSet ChromaQpAdjFlag; static const CtxSet ChromaQpAdjIdc; -#if JVET_K0357_AMVR static const CtxSet ImvFlag; -#endif static const CtxSet ctbAlfFlag; static const unsigned NumberOfContexts; diff --git a/source/Lib/CommonLib/Mv.cpp b/source/Lib/CommonLib/Mv.cpp index 6e087339e4d2a95a2addaff8da091afb8bfdb30b..17d677d84d0a437e61637737909e812108b7e3a5 100644 --- a/source/Lib/CommonLib/Mv.cpp +++ b/source/Lib/CommonLib/Mv.cpp @@ -40,7 +40,6 @@ #include "Common.h" #include "Slice.h" -#if JVET_K0357_AMVR void roundMV( Mv & rMV, unsigned imvShift ) { CHECK( imvShift == 0, "roundMV called for imvShift=0" ); @@ -52,7 +51,6 @@ void roundMV( Mv & rMV, unsigned imvShift ) rMV.setHor( ( ( rMV.getHor() + offset ) >> imvShift ) << imvShift ); rMV.setVer( ( ( rMV.getVer() + offset ) >> imvShift ) << imvShift ); } -#endif void roundAffineMv( int& mvx, int& mvy, int nShift ) { diff --git a/source/Lib/CommonLib/Mv.h b/source/Lib/CommonLib/Mv.h index 6fb631746e6623c47a06d63b1e142d872a3b9d85..c010d28c1e5fd071d29211bf94f2141bd44727bb 100644 --- a/source/Lib/CommonLib/Mv.h +++ b/source/Lib/CommonLib/Mv.h @@ -273,9 +273,7 @@ public: } #endif };// END CLASS DEFINITION MV -#if JVET_K0357_AMVR void roundMV( Mv& rcMv, unsigned imvShift ); -#endif void clipMv ( Mv& rcMv, const struct Position& pos, const class SPS& sps ); void roundAffineMv( int& mvx, int& mvy, int nShift ); diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index 5d81ad10c1527845d21c3d7ccaefac77c5ffdcf9..4e79040c21fb739fc75a13b0643d4798989099d7 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -190,13 +190,8 @@ public: return uiLength2 + ( g_aucPrevLog2[uiTemp2] << 1 ); } -#if JVET_K0357_AMVR Distortion getCostOfVectorWithPredictor( const int x, const int y, const unsigned imvShift ) { return Distortion( m_motionLambda * getBitsOfVectorWithPredictor(x, y, imvShift )); } uint32_t getBitsOfVectorWithPredictor( const int x, const int y, const unsigned imvShift ) { return xGetExpGolombNumberOfBits(((x << m_iCostScale) - m_mvPredictor.getHor())>>imvShift) + xGetExpGolombNumberOfBits(((y << m_iCostScale) - m_mvPredictor.getVer())>>imvShift); } -#else - Distortion getCostOfVectorWithPredictor( const int x, const int y ) { return Distortion( m_motionLambda * getBitsOfVectorWithPredictor(x, y )); } - uint32_t getBitsOfVectorWithPredictor( const int x, const int y ) { return xGetExpGolombNumberOfBits(((x << m_iCostScale) - m_mvPredictor.getHor())) + xGetExpGolombNumberOfBits(((y << m_iCostScale) - m_mvPredictor.getVer())); } -#endif #if WCG_EXT void saveUnadjustedLambda (); void initLumaLevelToWeightTable (); diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 7a00e06cff0a80dba7499fb23cb36f26cc1e53a7..69173a5921247fa7b271327cf2c731f005c965b4 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -1649,9 +1649,7 @@ SPSNext::SPSNext( SPS& sps ) #if JVET_K0346 , m_SubPuMvp ( false ) #endif -#if JVET_K0357_AMVR , m_IMV ( false ) -#endif #if !REMOVE_MV_ADAPT_PREC , m_highPrecMv ( false ) #endif @@ -1675,9 +1673,7 @@ SPSNext::SPSNext( SPS& sps ) , m_subPuLog2Size ( 0 ) , m_subPuMrgMode ( 0 ) #endif -#if JVET_K0357_AMVR , m_ImvMode ( IMV_OFF ) -#endif , m_MTTMode ( 0 ) #if JVET_K0157 , m_compositeRefEnabled ( false ) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index c1cbc3460bb61ebb4808be345181618da6226913..931054908935712e92c73f999550888e7e05456f 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -802,9 +802,7 @@ private: #if JVET_K0346 bool m_SubPuMvp; #endif -#if JVET_K0357_AMVR bool m_IMV; // 9 -#endif #if !REMOVE_MV_ADAPT_PREC bool m_highPrecMv; #endif @@ -835,10 +833,8 @@ private: unsigned m_subPuLog2Size; int m_subPuMrgMode; #endif -#if JVET_K0357_AMVR //imv ImvMode m_ImvMode; -#endif // multi type tree (QTBT + triple split) unsigned m_MTTMode; @@ -865,10 +861,8 @@ public: void setSubPuMvpMode(int n) { m_subPuMrgMode = n; m_SubPuMvp = n != 0; } bool getUseATMVP() const { return (m_subPuMrgMode & 1) == 1; } #endif -#if JVET_K0357_AMVR void setUseIMV ( bool b ) { m_IMV = b; } bool getUseIMV () const { return m_IMV; } -#endif void setUseAffine ( bool b ) { m_Affine = b; } bool getUseAffine () const { return m_Affine; } void setUseAffineType ( bool b ) { m_AffineType = b; } @@ -919,10 +913,8 @@ public: void setSubPuMvpLog2Size ( unsigned log2Size ) { m_subPuLog2Size = log2Size; } unsigned getSubPuMvpLog2Size () const { return m_subPuLog2Size; } #endif -#if JVET_K0357_AMVR void setImvMode(ImvMode m) { m_ImvMode = m; m_IMV = m != 0; } ImvMode getImvMode () const { return m_ImvMode; } -#endif diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index d84c8d808712f8569f985ebd8eda6759733f607b..550bffc5e32937f07106ba1f80791d332b7e29f9 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -86,7 +86,6 @@ -#define JVET_K0357_AMVR 1 // Adaptive motion vector resolution separated from JEM_TOOLS macro #define REMOVE_MV_ADAPT_PREC 1 // remove the high precision flag in the MV class diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 7071a478ce07ab4bf8b8dc1a2967abc82bd4106c..7483af675d2db2af484d9ed6579645714d50ee37 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -264,10 +264,8 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) #if HEVC_TILES_WPP tileIdx = other.tileIdx; #endif -#if JVET_K0357_AMVR imv = other.imv; imvNumCand = other.imvNumCand; -#endif return *this; } @@ -292,10 +290,8 @@ void CodingUnit::initData() #if HEVC_TILES_WPP tileIdx = 0; #endif -#if JVET_K0357_AMVR imv = 0; imvNumCand = 0; -#endif } diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 2545d62f39fae95c6c7c1f52848f079336a046cb..9085d6e2285e5c72da206142e043edce2c2a6fab 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -299,9 +299,7 @@ struct CodingUnit : public UnitArea int affineType; bool transQuantBypass; bool ipcm; -#if JVET_K0357_AMVR uint8_t imv; -#endif bool rootCbf; #if HEVC_TILES_WPP uint32_t tileIdx; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index fda900c77eb6d84364f48d45dc48d1b6670fb4c5..16ece3873f59a32b0cf1a5c5a0ae51d000ab6b2c 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -1203,7 +1203,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in } } -#if JVET_K0357_AMVR if( pu.cu->imv != 0) { unsigned imvShift = pu.cu->imv << 1; @@ -1215,7 +1214,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in roundMV( pInfo->mvCand[i], imvShift ); } } -#endif if( pInfo->numCand == 2 ) { @@ -1305,7 +1303,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in #if !REMOVE_MV_ADAPT_PREC } #endif -#if JVET_K0357_AMVR if (pu.cu->imv != 0) { unsigned imvShift = pu.cu->imv << 1; @@ -1314,7 +1311,6 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in roundMV(pInfo->mvCand[i], imvShift); } } -#endif #if !REMOVE_MV_ADAPT_PREC if (pu.cs->sps->getSpsNext().getUseHighPrecMv()) { @@ -2541,7 +2537,6 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx ) } } -#if JVET_K0357_AMVR void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interPred ) { if( !pu.mergeFlag ) @@ -2601,7 +2596,6 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP PU::spanMotionInfo( pu, mrgCtx ); } -#endif bool PU::isBiPredFromDifferentDir( const PredictionUnit& pu ) { @@ -2634,7 +2628,6 @@ void PU::restrictBiPredMergeCands( const PredictionUnit &pu, MergeCtx& mergeCtx } } -#if JVET_K0357_AMVR void CU::resetMVDandMV2Int( CodingUnit& cu, InterPrediction *interPred ) { for( auto &pu : CU::traversePUs( cu ) ) @@ -2745,7 +2738,6 @@ int CU::getMaxNeighboriMVCandNum( const CodingStructure& cs, const Position& pos return maxImvNumCand; } -#endif diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index 66cb9e6f83824ef0899899e941529520542204d6..3f77682f7dd70c8a9a1293358c4e470909a3ab2e 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -90,11 +90,9 @@ namespace CU cPUTraverser traversePUs (const CodingUnit& cu); cTUTraverser traverseTUs (const CodingUnit& cu); -#if JVET_K0357_AMVR bool hasSubCUNonZeroMVd (const CodingUnit& cu); int getMaxNeighboriMVCandNum (const CodingStructure& cs, const Position& pos); void resetMVDandMV2Int ( CodingUnit& cu, InterPrediction *interPred ); -#endif } @@ -116,9 +114,7 @@ namespace PU void xInheritedAffineMv ( const PredictionUnit &pu, const PredictionUnit* puNeighbour, RefPicList eRefPicList, Mv rcMv[3] ); bool isBipredRestriction (const PredictionUnit &pu); void spanMotionInfo ( PredictionUnit &pu, const MergeCtx &mrgCtx = MergeCtx() ); -#if JVET_K0357_AMVR void applyImv ( PredictionUnit &pu, MergeCtx &mrgCtx, InterPrediction *interPred = NULL ); -#endif void getAffineMergeCand (const PredictionUnit &pu, MvField (*mvFieldNeighbours)[3], unsigned char &interDirNeighbours, int &numValidMergeCand ); bool isAffineMrgFlagCoded (const PredictionUnit &pu ); void getAffineMergeCand (const PredictionUnit &pu, MvField (*mvFieldNeighbours)[3], unsigned char &interDirNeighbours, int &numValidMergeCand ); diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index f2b1193c1ad03babc5580cbfe456ac1ebdf32b12..a2483324fde0ee865ae776d444bffaa21c22f4e6 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -455,9 +455,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } } } -#if JVET_K0357_AMVR DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::IMVMode), cu.imv); -#endif DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::RootCbf), cu.rootCbf); } @@ -746,12 +744,10 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) DTRACE_BLOCK_AFFINETF(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::AffineMVL1), mv[0].hor, mv[0].ver, mv[1].hor, mv[1].ver, mv[2].hor, mv[2].ver); } } -#if JVET_K0357_AMVR if (cu.cs->sps->getSpsNext().getUseIMV() && CU::hasSubCUNonZeroMVd(cu)) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::IMVMode), cu.imv); } -#endif break; } diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index 318982cd30a455346e95261a16ba37d755147bab..45a963ff13988debc8091ea56107bbdf4f2f8521 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -78,9 +78,7 @@ enum class BlockStatistic { Cbf_Y, Cbf_Cb, Cbf_Cr, -#if JVET_K0357_AMVR IMVMode, -#endif InterDir, MergeFlag, MergeIdx, @@ -161,9 +159,7 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::MVPIdxL1, std::tuple<std::string, BlockStatisticType, std::string>{"MVPIdxL1", BlockStatisticType::Integer, "[0, 1]"}}, { BlockStatistic::MVDL1, std::tuple<std::string, BlockStatisticType, std::string>{"MVDL1", BlockStatisticType::Vector, "Scale: 4"}}, { BlockStatistic::RefIdxL1, std::tuple<std::string, BlockStatisticType, std::string>{"RefIdxL1", BlockStatisticType::Integer, "[0, 4]"}}, -#if JVET_K0357_AMVR { BlockStatistic::IMVMode, std::tuple<std::string, BlockStatisticType, std::string>{"IMVMode", BlockStatisticType::Integer, "[0, 2]"}}, -#endif { BlockStatistic::AffineFlag, std::tuple<std::string, BlockStatisticType, std::string>{"AffineFlag", BlockStatisticType::Flag, ""}}, { BlockStatistic::AffineMVL0, std::tuple<std::string, BlockStatisticType, std::string>{"AffineMVL0", BlockStatisticType::AffineTFVectors, "Scale: 4"}}, { BlockStatistic::AffineMVL1, std::tuple<std::string, BlockStatisticType, std::string>{"AffineMVL1", BlockStatisticType::AffineTFVectors, "Scale: 4"}}, diff --git a/source/Lib/CommonLib/dtrace_codingstruct.h b/source/Lib/CommonLib/dtrace_codingstruct.h index 71bfa7ac52b5c0e86adc7911a9a7c8497d1d33dc..51c9aefe8fc1d2433acd67e587dfd2e1701817ef 100644 --- a/source/Lib/CommonLib/dtrace_codingstruct.h +++ b/source/Lib/CommonLib/dtrace_codingstruct.h @@ -96,9 +96,7 @@ inline void dtraceModeCost(CodingStructure &cs, double lambda) if (isIntra && intraModeC == DM_CHROMA_IDX) intraModeC = 68; int imvVal = 0; -#if JVET_K0357_AMVR imvVal = cs.cus[0]->imv; -#endif DTRACE( g_trace_ctx, D_MODE_COST, "ModeCost: %6lld %3d @(%4d,%4d) [%2dx%2d] %d (qp%d,pm%d,ptSize%d,skip%d,mrg%d,fruc%d,obmc%d,ic%d,imv%d,affn%d,%d,%d) tempCS = %lld (%d,%d)\n", DTRACE_GET_COUNTER( g_trace_ctx, D_MODE_COST ), cs.slice->getPOC(), diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 405a67bcdc93a0b5f3b9e226f7d540abf2fcc79e..7cf8a5a5d4adc1fc16ed51bc403611efa182aa98 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -779,7 +779,6 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) } } -#if JVET_K0357_AMVR void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__OTHER ); @@ -812,7 +811,6 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) cu.imv = value; DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() IMVFlag=%d\n", cu.imv ); } -#endif void CABACReader::pred_mode( CodingUnit& cu ) { @@ -856,9 +854,7 @@ void CABACReader::cu_pred_data( CodingUnit &cu ) prediction_unit( pu, mrgCtx ); } -#if JVET_K0357_AMVR imv_mode ( cu, mrgCtx ); -#endif } diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h index 8c42dd8b719fbb7226a3bc61de39e2b60a335c4f..b03c5b3d475c63a68ac7cc7c45c937fbe481fbe8 100644 --- a/source/Lib/DecoderLib/CABACReader.h +++ b/source/Lib/DecoderLib/CABACReader.h @@ -98,9 +98,7 @@ public: void merge_data ( PredictionUnit& pu ); void affine_flag ( CodingUnit& cu ); void merge_idx ( PredictionUnit& pu ); -#if JVET_K0357_AMVR void imv_mode ( CodingUnit& cu, MergeCtx& mrgCtx ); -#endif void inter_pred_idc ( PredictionUnit& pu ); void ref_idx ( PredictionUnit& pu, RefPicList eRefList ); void mvp_flag ( PredictionUnit& pu, RefPicList eRefList ); diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 8d00eac7379ca84a7fc8d02839e90242ab326add..fc7bbdc0ce3456882c37bf8a72c15008afcc52b8 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -476,7 +476,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) } else { -#if JVET_K0357_AMVR #if REUSE_CU_RESULTS if (cu.imv && !cu.cs->pcv->isEncoder) #else @@ -486,7 +485,6 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) PU::applyImv(pu, mrgCtx, m_pcInterPred); } else -#endif { if( pu.cu->affine ) { diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index d7559e5727202db6ded6a37e56ed06ce8f716fa1..58ddcd4aeaf5703e63faa1ead1e12e69394d3387 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -793,9 +793,7 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) #if JVET_K0346 READ_FLAG( symbol, "subpu_tmvp_flag" ); spsNext.setSubPuMvpMode (symbol); #endif -#if JVET_K0357_AMVR READ_FLAG( symbol, "imv_enable_flag" ); spsNext.setUseIMV ( symbol != 0 ); -#endif #if !REMOVE_MV_ADAPT_PREC READ_FLAG( symbol, "high_precision_motion_vectors" ); spsNext.setUseHighPrecMv(symbol != 0); #endif @@ -859,12 +857,10 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) #endif -#if JVET_K0357_AMVR if( spsNext.getUseIMV() ) { READ_UVLC( symbol, "imv_mode_minus1" ); spsNext.setImvMode( ImvMode( symbol + 1 ) ); } -#endif if( spsNext.getMTTEnabled() ) { READ_UVLC( symbol, "mtt_mode_minus1" ); spsNext.setMTTMode( symbol + 1 ); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 32dda6cc0df57e9970e3ce1d4c9dad0398db1f7a..a612fc5db6ba41296e8e4f0d345df2a4597c4e9d 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -747,9 +747,7 @@ void CABACWriter::cu_pred_data( const CodingUnit& cu ) prediction_unit( pu ); } -#if JVET_K0357_AMVR imv_mode ( cu ); -#endif } @@ -1114,29 +1112,16 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu ) ref_idx ( pu, REF_PIC_LIST_0 ); if ( pu.cu->affine ) { -#if JVET_K0357_AMVR mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][0], 0); mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][1], 0); -#else - mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][0]); - mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][1]); -#endif if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) { -#if JVET_K0357_AMVR mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][2], 0); -#else - mvd_coding(pu.mvdAffi[REF_PIC_LIST_0][2]); -#endif } } else { -#if JVET_K0357_AMVR mvd_coding( pu.mvd[REF_PIC_LIST_0], pu.cu->imv ); -#else - mvd_coding( pu.mvd[REF_PIC_LIST_0] ); -#endif } mvp_flag ( pu, REF_PIC_LIST_0 ); } @@ -1147,29 +1132,16 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu ) { if ( pu.cu->affine ) { -#if JVET_K0357_AMVR mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][0], 0); mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][1], 0); -#else - mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][0]); - mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][1]); -#endif if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) { -#if JVET_K0357_AMVR mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][2], 0); -#else - mvd_coding(pu.mvdAffi[REF_PIC_LIST_1][2]); -#endif } } else { -#if JVET_K0357_AMVR mvd_coding( pu.mvd[REF_PIC_LIST_1], pu.cu->imv ); -#else - mvd_coding( pu.mvd[REF_PIC_LIST_1] ); -#endif } } mvp_flag ( pu, REF_PIC_LIST_1 ); @@ -1219,7 +1191,6 @@ void CABACWriter::merge_flag( const PredictionUnit& pu ) DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height ); } -#if JVET_K0357_AMVR void CABACWriter::imv_mode( const CodingUnit& cu ) { const SPSNext& spsNext = cu.cs->sps->getSpsNext(); @@ -1247,7 +1218,6 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() IMVFlag=%d\n", cu.imv ); } -#endif void CABACWriter::merge_idx( const PredictionUnit& pu ) { @@ -1591,15 +1561,10 @@ void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea& // void mvd_coding( pu, refList ) //================================================================================ -#if JVET_K0357_AMVR void CABACWriter::mvd_coding( const Mv &rMvd, uint8_t imv ) -#else -void CABACWriter::mvd_coding( const Mv &rMvd ) -#endif { int horMvd = rMvd.getHor(); int verMvd = rMvd.getVer(); -#if JVET_K0357_AMVR if( imv ) { CHECK( (horMvd % 4) != 0 && (verMvd % 4) != 0, "IMV: MVD is not a multiple of 4" ); @@ -1612,7 +1577,6 @@ void CABACWriter::mvd_coding( const Mv &rMvd ) verMvd >>= 2; } } -#endif unsigned horAbs = unsigned( horMvd < 0 ? -horMvd : horMvd ); unsigned verAbs = unsigned( verMvd < 0 ? -verMvd : verMvd ); diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h index 06d0187594c8a003a3f9e0082c572fd169fa4a06..64d1d0f159a68925b1502cfc391a43b55b9545cf 100644 --- a/source/Lib/EncoderLib/CABACWriter.h +++ b/source/Lib/EncoderLib/CABACWriter.h @@ -119,9 +119,7 @@ public: void merge_flag ( const PredictionUnit& pu ); void affine_flag ( const CodingUnit& cu ); void merge_idx ( const PredictionUnit& pu ); -#if JVET_K0357_AMVR void imv_mode ( const CodingUnit& cu ); -#endif void inter_pred_idc ( const PredictionUnit& pu ); void ref_idx ( const PredictionUnit& pu, RefPicList eRefList ); void mvp_flag ( const PredictionUnit& pu, RefPicList eRefList ); @@ -138,12 +136,8 @@ public: void cbf_comp ( const CodingStructure& cs, bool cbf, const CompArea& area, const bool prevCbCbf = false ); #endif -#if JVET_K0357_AMVR // mvd coding (clause 7.3.8.9) void mvd_coding ( const Mv &rMvd, uint8_t imv ); -#else - void mvd_coding ( const Mv &rMvd ); -#endif // transform unit (clause 7.3.8.10) void transform_unit ( const TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& chromaCbfs ); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index a10fdb7cc95fc91d7593aa4eed0a69c382e3a75b..e3aff34d00ccb340b14457044b5acdf9e1b31f56 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -500,11 +500,9 @@ protected: std::string m_summaryOutFilename; ///< filename to use for producing summary output file. std::string m_summaryPicFilenameBase; ///< Base filename to use for producing summary picture output files. The actual filenames used will have I.txt, P.txt and B.txt appended. uint32_t m_summaryVerboseness; ///< Specifies the level of the verboseness of the text output. -#if JVET_K0357_AMVR int m_ImvMode; int m_Imv4PelFast; int m_ImvMaxCand; -#endif std::string m_decodeBitstreams[2]; ///< filename for decode bitstreams. bool m_forceDecodeBitstream1; ///< guess what it means int m_switchPOC; ///< dbg poc. @@ -1292,14 +1290,12 @@ public: void setSummaryVerboseness(uint32_t v) { m_summaryVerboseness = v; } uint32_t getSummaryVerboseness( ) const { return m_summaryVerboseness; } -#if JVET_K0357_AMVR void setIMV(int n) { m_ImvMode = n; } int getIMV() const { return m_ImvMode; } void setIMV4PelFast(int n) { m_Imv4PelFast = n; } int getIMV4PelFast() const { return m_Imv4PelFast; } void setIMVMaxCand(int n) { m_ImvMaxCand = n; } int getIMVMaxCand() const { return m_ImvMaxCand; } -#endif void setDecodeBitstream( int i, const std::string& s ) { m_decodeBitstreams[i] = s; } const std::string& getDecodeBitstream( int i ) const { return m_decodeBitstreams[i]; } bool getForceDecodeBitstream1() const { return m_forceDecodeBitstream1; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index a2150d87909173b0ff1c6a45ba3726e824f07195..486922950b5f520af239b0b7710c2177731fe24c 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -74,9 +74,7 @@ void EncCu::create( EncCfg* encCfg ) unsigned numWidths = gp_sizeIdxInfo->numWidths(); unsigned numHeights = gp_sizeIdxInfo->numHeights(); -#if JVET_K0357_AMVR unsigned maxMEPart = BTnoRQT ? 1 : NUMBER_OF_PART_SIZES; -#endif m_pTempCS = new CodingStructure** [numWidths]; m_pBestCS = new CodingStructure** [numWidths]; @@ -106,7 +104,6 @@ void EncCu::create( EncCfg* encCfg ) } } -#if JVET_K0357_AMVR // WIA: only the weight==height case is relevant without QTBT m_pImvTempCS = nullptr; @@ -135,7 +132,6 @@ void EncCu::create( EncCfg* encCfg ) } } } -#endif m_cuChromaQpOffsetIdxPlus1 = 0; @@ -168,9 +164,7 @@ void EncCu::create( EncCfg* encCfg ) void EncCu::destroy() { bool BTnoRQT = m_pcEncCfg->getQTBT(); -#if JVET_K0357_AMVR unsigned maxMEPart = BTnoRQT ? 1 : NUMBER_OF_PART_SIZES; -#endif unsigned numWidths = gp_sizeIdxInfo->numWidths(); unsigned numHeights = gp_sizeIdxInfo->numHeights(); @@ -203,7 +197,6 @@ void EncCu::destroy() delete m_modeCtrl; m_modeCtrl = nullptr; -#if JVET_K0357_AMVR // WIA: only the weight==height case is relevant without QTBT if( m_pImvTempCS ) { @@ -221,7 +214,6 @@ void EncCu::destroy() m_pImvTempCS = nullptr; } -#endif for( unsigned ui = 0; ui < MRG_MAX_NUM_CANDS; ui++ ) { m_acMergeBuffer[ui].destroy(); @@ -544,12 +536,9 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par const uint32_t uiLPelX = tempCS->area.Y().lumaPos().x; const uint32_t uiTPelY = tempCS->area.Y().lumaPos().y; -#if JVET_K0357_AMVR const unsigned wIdx = gp_sizeIdxInfo->idxFrom( partitioner.currArea().lwidth() ); -#endif const UnitArea currCsArea = clipArea( CS::getArea( *bestCS, bestCS->area, partitioner.chType ), *tempCS->picture ); -#if JVET_K0357_AMVR if( m_pImvTempCS && !slice.isIntra() ) { const unsigned maxMEPart = tempCS->pcv->only2Nx2N ? 1 : NUMBER_OF_PART_SIZES; @@ -558,7 +547,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par tempCS->initSubStructure( *m_pImvTempCS[wIdx][p], partitioner.chType, partitioner.currArea(), false ); } } -#endif m_modeCtrl->initCULevel( partitioner, *tempCS ); @@ -604,13 +592,11 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par if( currTestMode.type == ETM_INTER_ME ) { -#if JVET_K0357_AMVR if( ( currTestMode.opts & ETO_IMV ) != 0 ) { xCheckRDCostInterIMV(tempCS, bestCS, partitioner, currTestMode); } else -#endif { xCheckRDCostInter( tempCS, bestCS, partitioner, currTestMode ); } @@ -1648,9 +1634,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& } xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, uiNoResidualPass -#if JVET_K0357_AMVR , NULL -#endif , 1 , uiNoResidualPass == 0 ? &candHasNoResidual[uiMergeCand] : NULL ); @@ -1748,9 +1732,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct m_pcInterSearch->motionCompensation( cu ); xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, 0 -#if JVET_K0357_AMVR , NULL -#endif , 1 , &hasNoResidual); @@ -1761,9 +1743,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct tempCS->getPredBuf().copyFrom( bestCS->getPredBuf() ); xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, 1 -#if JVET_K0357_AMVR , NULL -#endif , 1 , &hasNoResidual); } @@ -1792,15 +1772,11 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC m_pcInterSearch->predInterSearch( cu, partitioner ); -#if JVET_K0357_AMVR const unsigned wIdx = gp_sizeIdxInfo->idxFrom( tempCS->area.lwidth () ); -#endif xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, 0 -#if JVET_K0357_AMVR , m_pImvTempCS ? m_pImvTempCS[wIdx][encTestMode.partSize] : NULL -#endif , 1 , 0 ); @@ -1811,7 +1787,6 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC -#if JVET_K0357_AMVR bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ) { int iIMV = int( ( encTestMode.opts & ETO_IMV ) >> ETO_IMV_SHIFT ); @@ -1905,21 +1880,16 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be } xEncodeInterResidual( tempCS, bestCS, partitioner, encTestModeBase, 0 -#if JVET_K0357_AMVR , NULL -#endif , true , 0 ); return true; } -#endif void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode, int residualPass -#if JVET_K0357_AMVR , CodingStructure* imvCS -#endif , int emtMode , bool* bestHasNonResi ) @@ -1989,7 +1959,6 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be double emtFirstPassCost = tempCS->cost; -#if JVET_K0357_AMVR if( imvCS && (tempCS->cost < imvCS->cost) ) { if( imvCS->cost != MAX_DOUBLE ) @@ -1998,7 +1967,6 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be } imvCS->copyStructure( *tempCS, partitioner.chType ); } -#endif if( NULL != bestHasNonResi && (bestCostInternal > tempCS->cost) ) { bestCostInternal = tempCS->cost; diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index 92f5e587824d51a983dd571159914a1d01443726..c2c463e3dd3dbb425f0b90f6968b720f47bcf32d 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -105,9 +105,7 @@ private: CABACWriter* m_CABACEstimator; RateCtrl* m_pcRateCtrl; -#if JVET_K0357_AMVR CodingStructure ***m_pImvTempCS; -#endif EncModeCtrl *m_modeCtrl; PelStorage m_acMergeBuffer[MRG_MAX_NUM_CANDS]; @@ -191,17 +189,13 @@ protected: void xCheckRDCostAffineMerge2Nx2N ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode ); void xCheckRDCostInter ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#if JVET_K0357_AMVR bool xCheckRDCostInterIMV ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); -#endif void xEncodeDontSplit ( CodingStructure &cs, Partitioner &partitioner); void xCheckRDCostMerge2Nx2N ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &pm, const EncTestMode& encTestMode ); void xEncodeInterResidual ( CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode, int residualPass = 0 -#if JVET_K0357_AMVR , CodingStructure* imvCS = NULL -#endif , int emtMode = 1 , bool* bestHasNonResi = NULL ); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index e748baa8606e89bd2ef1b64db72121338461117d..56a97c36b4303e237673d629533e293380cd230b 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -867,10 +867,8 @@ void EncLib::xInitSPS(SPS &sps) sps.getSpsNext().setSubPuMvpMode(m_SubPuMvpMode); sps.getSpsNext().setSubPuMvpLog2Size(m_SubPuMvpLog2Size); #endif -#if JVET_K0357_AMVR sps.getSpsNext().setImvMode ( ImvMode(m_ImvMode) ); sps.getSpsNext().setUseIMV ( m_ImvMode != IMV_OFF ); -#endif #if !REMOVE_MV_ADAPT_PREC sps.getSpsNext().setUseHighPrecMv ( m_highPrecMv ); #endif diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 126bef866871c0ebb9d3b685ed866b49d30cf9c6..aaa167f0296da1f9ad2f097be8e263990a8189c4 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1019,10 +1019,8 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru cuECtx.set( SAVE_LOAD_TAG, sls.partIdx == cuECtx.partIdx ? sls.tag : SAVE_LOAD_INIT ); cuECtx.set( HISTORY_NEED_TO_SAVE, m_pcEncCfg->getUseSaveLoadEncInfo() && cs.area.lwidth() > ( 1 << MIN_CU_LOG2 ) && cs.area.lheight() > ( 1 << MIN_CU_LOG2 ) ); #endif -#if JVET_K0357_AMVR cuECtx.set( BEST_IMV_COST, MAX_DOUBLE * .5 ); cuECtx.set( BEST_NO_IMV_COST, MAX_DOUBLE * .5 ); -#endif #if !HM_NO_ADDITIONAL_SPEEDUPS || JVET_K0220_ENC_CTRL cuECtx.set( QT_BEFORE_BT, qtBeforeBt ); cuECtx.set( DID_QUAD_SPLIT, false ); @@ -1186,7 +1184,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru const int qp = std::max( qpLoop, lowestQP ); const bool lossless = useLossless && qpLoop == minQP; -#if JVET_K0357_AMVR if( m_pcEncCfg->getIMV() ) { if( m_pcEncCfg->getIMV() == IMV_4PEL ) @@ -1196,7 +1193,6 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru } m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, SIZE_2Nx2N, EncTestModeOpts( 1 << ETO_IMV_SHIFT ), qp, lossless } ); } -#endif // add inter modes if( m_pcEncCfg->getUseEarlySkipDetection() ) { @@ -1503,7 +1499,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt return false; } #endif -#if JVET_K0357_AMVR else if ((encTestmode.opts & ETO_IMV) != 0) { int imvOpt = (encTestmode.opts & ETO_IMV) >> ETO_IMV_SHIFT; @@ -1513,7 +1508,6 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt return false; } } -#endif } #if JVET_K0220_ENC_CTRL @@ -1839,9 +1833,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { sls.mergeFlag = bestCU->firstPU->mergeFlag; sls.interDir = bestCU->firstPU->interDir; -#if JVET_K0357_AMVR sls.imv = bestCU->imv; -#endif sls.affineFlag = bestCU->affine; } else @@ -1899,7 +1891,6 @@ bool EncModeCtrlMTnoRQT::useModeResult( const EncTestMode& encTestmode, CodingSt } } -#if JVET_K0357_AMVR if( m_pcEncCfg->getIMV4PelFast() && m_pcEncCfg->getIMV() && encTestmode.type == ETM_INTER_ME ) { int imvMode = ( encTestmode.opts & ETO_IMV ) >> ETO_IMV_SHIFT; @@ -1919,7 +1910,6 @@ bool EncModeCtrlMTnoRQT::useModeResult( const EncTestMode& encTestmode, CodingSt } } } -#endif #if !HM_NO_ADDITIONAL_SPEEDUPS || JVET_K0220_ENC_CTRL if( encTestmode.type == ETM_SPLIT_QT ) diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index 05f399f8dbc27462d8062c369cf39711a01fbc9c..3965a5e0ac67ba3e4a19cc8f664ed9cc29a0e7d9 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -68,9 +68,7 @@ enum EncTestModeType #if REUSE_CU_RESULTS ETM_RECO_CACHED, #endif -#if JVET_K0357_AMVR ETM_TRIGGER_IMV_LIST, -#endif ETM_INVALID }; @@ -78,10 +76,8 @@ enum EncTestModeOpts { ETO_STANDARD = 0, // empty (standard option) ETO_FORCE_MERGE = 1<<0, // bit 0 (indicates forced merge) -#if JVET_K0357_AMVR ETO_IMV_SHIFT = 1, // bits 1-3 (imv parameter starts at bit 1) ETO_IMV = 7<<ETO_IMV_SHIFT, // bits 1-3 (imv parameter uses 3 bits) -#endif ETO_DUMMY = 1<<5, // bit 5 (dummy) ETO_INVALID = 0xffffffff // bits 0-31 (invalid option) }; @@ -328,9 +324,7 @@ struct SaveLoadStruct SaveLoadTag tag; unsigned interDir; bool mergeFlag; -#if JVET_K0357_AMVR unsigned imv; -#endif unsigned partIdx; bool affineFlag; }; @@ -500,10 +494,8 @@ class EncModeCtrlMTnoRQT : public EncModeCtrl, public SaveLoadEncInfoCtrl, publi HISTORY_DO_SAVE, SAVE_LOAD_TAG, #endif -#if JVET_K0357_AMVR BEST_NO_IMV_COST, BEST_IMV_COST, -#endif #if !HM_NO_ADDITIONAL_SPEEDUPS || JVET_K0220_ENC_CTRL QT_BEFORE_BT, IS_BEST_NOSPLIT_SKIP, diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 779df438488fdff37bc06d0d688aed38f4e206aa..fca167ee8bad82c446772455cf02046bbd737e9f 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -253,11 +253,7 @@ inline void InterSearch::xTZSearchHelp( IntTZSearchStruct& rcStruct, const int i if( 1 == rcStruct.subShiftMode ) { // motion cost -#if JVET_K0357_AMVR Distortion uiBitCost = m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY, rcStruct.imvShift ); -#else - Distortion uiBitCost = m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY ); -#endif // Skip search if bit cost is already larger than best SAD if (uiBitCost < rcStruct.uiBestSad) @@ -318,11 +314,7 @@ inline void InterSearch::xTZSearchHelp( IntTZSearchStruct& rcStruct, const int i if( uiSad < rcStruct.uiBestSad ) { // motion cost -#if JVET_K0357_AMVR uiSad += m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY, rcStruct.imvShift ); -#else - uiSad += m_pcRdCost->getCostOfVectorWithPredictor( iSearchX, iSearchY ); -#endif if( uiSad < rcStruct.uiBestSad ) { @@ -662,11 +654,7 @@ Distortion InterSearch::xPatternRefinement( const CPelBuf* pcPatternKey, m_cDistParam.cur.buf = piRefPos; uiDist = m_cDistParam.distFunc( m_cDistParam ); -#if JVET_K0357_AMVR uiDist += m_pcRdCost->getCostOfVectorWithPredictor( cMvTest.getHor(), cMvTest.getVer(), 0 ); -#else - uiDist += m_pcRdCost->getCostOfVectorWithPredictor( cMvTest.getHor(), cMvTest.getVer() ); -#endif if ( uiDist < uiDistBest ) { @@ -856,9 +844,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) bFastSkipAffine = modeCtrl && LOAD_ENC_INFO == modeCtrl->getSaveLoadTag( pu ) && !modeCtrl->getSaveLoadAffineFlag( pu ); } #endif -#if JVET_K0357_AMVR unsigned imvShift = pu.cu->imv << 1; -#endif // Uni-directional prediction for ( int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) { @@ -898,11 +884,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[cs.slice->getList1IdxToList0Idx( iRefIdxTemp )] ); /*correct the bit-rate part of the current ref*/ m_pcRdCost->setPredictor ( cMvPred[iRefList][iRefIdxTemp] ); -#if JVET_K0357_AMVR uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer(), imvShift ); -#else - uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() ); -#endif /*calculate the correct cost*/ uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); } @@ -916,11 +898,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) xMotionEstimation( pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList] ); } xCopyAMVPInfo( &amvp[eRefPicList], &aacAMVPInfo[iRefList][iRefIdxTemp]); // must always be done ( also when AMVP_MODE = AM_NONE ) -#if JVET_K0357_AMVR xCheckBestMVP( eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], amvp[eRefPicList], uiBitsTemp, uiCostTemp, pu.cu->imv ); -#else - xCheckBestMVP( eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], amvp[eRefPicList], uiBitsTemp, uiCostTemp ); -#endif if ( iRefList == 0 ) { @@ -951,15 +929,11 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) #if JVET_K0220_ENC_CTRL if (cu.Y().width > 8 && cu.Y().height > 8 && cu.partSize == SIZE_2Nx2N && cu.slice->getSPS()->getSpsNext().getUseAffine() -#if JVET_K0357_AMVR && cu.imv == 0 -#endif ) #else if (cu.Y().width > 8 && cu.Y().height > 8 && cu.partSize == SIZE_2Nx2N && cu.slice->getSPS()->getSpsNext().getUseAffine() -#if JVET_K0357_AMVR && cu.imv == 0 -#endif && !bFastSkipAffine) #endif { @@ -1103,11 +1077,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) // call ME xCopyAMVPInfo(&aacAMVPInfo[iRefList][iRefIdxTemp], &amvp[eRefPicList] ); xMotionEstimation ( pu, origBuf, eRefPicList, cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList], true ); -#if JVET_K0357_AMVR xCheckBestMVP( eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], amvp[eRefPicList], uiBitsTemp, uiCostTemp, pu.cu->imv); -#else - xCheckBestMVP( eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], amvp[eRefPicList], uiBitsTemp, uiCostTemp); -#endif if ( uiCostTemp < uiCostBi ) { bChanged = true; @@ -1140,19 +1110,11 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) { xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], &amvp[REF_PIC_LIST_0]); -#if JVET_K0357_AMVR xCheckBestMVP( REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], amvp[eRefPicList], uiBits[2], uiCostBi, pu.cu->imv); -#else - xCheckBestMVP( REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], amvp[eRefPicList], uiBits[2], uiCostBi); -#endif if(!cs.slice->getMvdL1ZeroFlag()) { xCopyAMVPInfo(&aacAMVPInfo[1][iRefIdxBi[1]], &amvp[REF_PIC_LIST_1]); -#if JVET_K0357_AMVR xCheckBestMVP( REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], amvp[eRefPicList], uiBits[2], uiCostBi, pu.cu->imv); -#else - xCheckBestMVP( REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], amvp[eRefPicList], uiBits[2], uiCostBi); -#endif } } break; @@ -1276,17 +1238,9 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } CHECK( !( !cu.cs->pcv->only2Nx2N || cu.partSize == SIZE_2Nx2N ), "Unexpected part size for QTBT." ); #if JVET_K0220_ENC_CTRL -#if JVET_K0357_AMVR if (cu.Y().width > 8 && cu.Y().height > 8 && cu.partSize == SIZE_2Nx2N && cu.slice->getSPS()->getSpsNext().getUseAffine() && cu.imv == 0) #else - if (cu.Y().width > 8 && cu.Y().height > 8 && cu.partSize == SIZE_2Nx2N && cu.slice->getSPS()->getSpsNext().getUseAffine()) -#endif -#else -#if JVET_K0357_AMVR if (cu.Y().width > 8 && cu.Y().height > 8 && cu.partSize == SIZE_2Nx2N && cu.slice->getSPS()->getSpsNext().getUseAffine() && cu.imv == 0 && !bFastSkipAffine) -#else - if (cu.Y().width > 8 && cu.Y().height > 8 && cu.partSize == SIZE_2Nx2N && cu.slice->getSPS()->getSpsNext().getUseAffine() && !bFastSkipAffine) -#endif #endif { // save normal hevc result @@ -1535,19 +1489,13 @@ void InterSearch::xCopyAMVPInfo (AMVPInfo* pSrc, AMVPInfo* pDst) } } -#if JVET_K0357_AMVR void InterSearch::xCheckBestMVP ( RefPicList eRefPicList, Mv cMv, Mv& rcMvPred, int& riMVPIdx, AMVPInfo& amvpInfo, uint32_t& ruiBits, Distortion& ruiCost, const uint8_t imv ) -#else -void InterSearch::xCheckBestMVP ( RefPicList eRefPicList, Mv cMv, Mv& rcMvPred, int& riMVPIdx, AMVPInfo& amvpInfo, uint32_t& ruiBits, Distortion& ruiCost ) -#endif { -#if JVET_K0357_AMVR if( imv > 0 ) { return; } unsigned imvshift = imv << 1; -#endif AMVPInfo* pcAMVPInfo = &amvpInfo; @@ -1563,11 +1511,7 @@ void InterSearch::xCheckBestMVP ( RefPicList eRefPicList, Mv cMv, Mv& rcMvPred, int iBestMVPIdx = riMVPIdx; m_pcRdCost->setPredictor( rcMvPred ); -#if JVET_K0357_AMVR int iOrgMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer(), imvshift); -#else - int iOrgMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer()); -#endif iOrgMvBits += m_auiMVPIdxCost[riMVPIdx][AMVP_MAX_NUM_CANDS]; int iBestMvBits = iOrgMvBits; @@ -1579,11 +1523,7 @@ void InterSearch::xCheckBestMVP ( RefPicList eRefPicList, Mv cMv, Mv& rcMvPred, } m_pcRdCost->setPredictor( pcAMVPInfo->mvCand[iMVPIdx] ); -#if JVET_K0357_AMVR int iMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer(), imvshift); -#else - int iMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer()); -#endif iMvBits += m_auiMVPIdxCost[iMVPIdx][AMVP_MAX_NUM_CANDS]; if (iMvBits < iBestMvBits) @@ -1718,9 +1658,7 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref cStruct.pcPatternKey = pcPatternKey; cStruct.iRefStride = buf.stride; cStruct.piRefY = buf.buf; -#if JVET_K0357_AMVR cStruct.imvShift = pu.cu->imv << 1; -#endif #if JVET_K0157 cStruct.inCtuSearch = false; cStruct.zeroMV = false; @@ -1801,24 +1739,17 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref DTRACE( g_trace_ctx, D_ME, "%d %d %d :MECostFPel<L%d,%d>: %d,%d,%dx%d,%2d: %d", DTRACE_GET_COUNTER( g_trace_ctx, D_ME ), pu.cu->slice->getPOC(), 0, ( int ) eRefPicList, ( int ) bBi, pu.Y().x, pu.Y().y, pu.Y().width, pu.Y().height, pu.cu->partSize, ruiCost ); // sub-pel refinement for sub-pel resolution -#if JVET_K0357_AMVR if( pu.cu->imv == 0 ) -#endif { xPatternSearchFracDIF( pu, eRefPicList, iRefIdxPred, cStruct, rcMv, cMvHalf, cMvQter, ruiCost ); m_pcRdCost->setCostScale( 0 ); rcMv <<= 2; rcMv += ( cMvHalf <<= 1 ); rcMv += cMvQter; -#if JVET_K0357_AMVR uint32_t uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( rcMv.getHor(), rcMv.getVer(), cStruct.imvShift ); -#else - uint32_t uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( rcMv.getHor(), rcMv.getVer() ); -#endif ruiBits += uiMvBits; ruiCost = ( Distortion ) ( floor( fWeight * ( ( double ) ruiCost - ( double ) m_pcRdCost->getCost( uiMvBits ) ) ) + ( double ) m_pcRdCost->getCost( ruiBits ) ); } -#if JVET_K0357_AMVR else // integer refinement for integer-pel and 4-pel resolution { xPatternSearchIntRefine( pu, cStruct, rcMv, rcMvPred, riMVPIdx, ruiBits, ruiCost, amvpInfo, fWeight); @@ -1828,9 +1759,6 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref #else DTRACE(g_trace_ctx, D_ME, " MECost<L%d,%d>: %6d (%d) MV:%d,%d\n", (int)eRefPicList, (int)bBi, ruiCost, ruiBits, rcMv.getHor() << (pu.cs->sps->getSpsNext().getUseHighPrecMv() ? 2 : 0), rcMv.getVer() << (pu.cs->sps->getSpsNext().getUseHighPrecMv() ? 2 : 0)); #endif -#else - DTRACE( g_trace_ctx, D_ME, " MECost<L%d,%d>: %6d (%d) MV:%d,%d\n", ( int ) eRefPicList, ( int ) bBi, ruiCost, ruiBits, rcMv.getHor(), rcMv.getVer() ); -#endif } @@ -1935,11 +1863,7 @@ void InterSearch::xPatternSearch( IntTZSearchStruct& cStruct, uiSad = m_cDistParam.distFunc( m_cDistParam ); // motion cost -#if JVET_K0357_AMVR uiSad += m_pcRdCost->getCostOfVectorWithPredictor( x, y, cStruct.imvShift ); -#else - uiSad += m_pcRdCost->getCostOfVectorWithPredictor( x, y ); -#endif if ( uiSad < uiSadBest ) { @@ -1957,11 +1881,7 @@ void InterSearch::xPatternSearch( IntTZSearchStruct& cStruct, rcMv.set( iBestX, iBestY ); cStruct.uiBestSad = uiSadBest; // th for testing -#if JVET_K0357_AMVR ruiSAD = uiSadBest - m_pcRdCost->getCostOfVectorWithPredictor( iBestX, iBestY, cStruct.imvShift ); -#else - ruiSAD = uiSadBest - m_pcRdCost->getCostOfVectorWithPredictor( iBestX, iBestY ); -#endif return; } @@ -2284,11 +2204,7 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, CHECK(rcMv.highPrec, "Unexpected high precision MV."); #endif rcMv.set( cStruct.iBestX, cStruct.iBestY ); -#if JVET_K0357_AMVR ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY, cStruct.imvShift ); -#else - ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY ); -#endif } @@ -2451,14 +2367,9 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, CHECK(rcMv.highPrec, "Unexpected high precision MV."); #endif rcMv.set( cStruct.iBestX, cStruct.iBestY ); -#if JVET_K0357_AMVR ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY, cStruct.imvShift ); -#else - ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY ); -#endif } -#if JVET_K0357_AMVR void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& cStruct, Mv& rcMv, Mv& rcMvPred, int& riMVPIdx, uint32_t& ruiBits, Distortion& ruiCost, const AMVPInfo& amvpInfo, double fWeight) { @@ -2559,7 +2470,6 @@ void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& return; } -#endif void InterSearch::xPatternSearchFracDIF( const PredictionUnit& pu, @@ -2579,7 +2489,6 @@ void InterSearch::xPatternSearchFracDIF( CPelBuf cPatternRoi(cStruct.piRefY + iOffset, cStruct.iRefStride, *cStruct.pcPatternKey); -#if JVET_K0357_AMVR #if JVET_K0157 if (cStruct.imvShift || (pu.cs->sps->getSpsNext().getUseCompositeRef() && cStruct.zeroMV)) #else @@ -2591,7 +2500,6 @@ void InterSearch::xPatternSearchFracDIF( ruiCost += m_pcRdCost->getCostOfVectorWithPredictor( rcMvInt.getHor(), rcMvInt.getVer(), cStruct.imvShift ); return; } -#endif // Half-pel refinement m_pcRdCost->setCostScale(1); @@ -2835,11 +2743,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, secondPred = cMvPred[iRefList][iRefIdxTemp][iVerIdx] + (cMvTemp[1][iRefIdxTemp][0] - cMvPred[1][iRefIdxTemp][0]); m_pcRdCost->setPredictor( secondPred ); } -#if JVET_K0357_AMVR uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( cMvTemp[1][iRefIdxTemp][iVerIdx].getHor()>>shift, cMvTemp[1][iRefIdxTemp][iVerIdx].getVer()>>shift, 0 ); -#else - uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( cMvTemp[1][iRefIdxTemp][iVerIdx].getHor() >> shift, cMvTemp[1][iRefIdxTemp][iVerIdx].getVer() >> shift ); -#endif } /*calculate the correct cost*/ uiCostTemp += m_pcRdCost->getCost( uiBitsTemp ); @@ -3292,11 +3196,7 @@ void InterSearch::xCheckBestAffineMVP( PredictionUnit &pu, AffineAMVPInfo &affin secondPred = acMvPred[iVerIdx] + (acMv[0] - acMvPred[0]); m_pcRdCost->setPredictor( secondPred ); } -#if JVET_K0357_AMVR iOrgMvBits += m_pcRdCost->getBitsOfVectorWithPredictor( acMv[iVerIdx].getHor()>>shift, acMv[iVerIdx].getVer()>>shift, 0 ); -#else - iOrgMvBits += m_pcRdCost->getBitsOfVectorWithPredictor( acMv[iVerIdx].getHor() >> shift, acMv[iVerIdx].getVer() >> shift ); -#endif } iOrgMvBits += m_auiMVPIdxCost[riMVPIdx][AMVP_MAX_NUM_CANDS]; @@ -3325,11 +3225,7 @@ void InterSearch::xCheckBestAffineMVP( PredictionUnit &pu, AffineAMVPInfo &affin secondPred = (iVerIdx == 1 ? affineAMVPInfo.mvCandRT[iMVPIdx] : affineAMVPInfo.mvCandLB[iMVPIdx]) + (acMv[0] - affineAMVPInfo.mvCandLT[iMVPIdx]); m_pcRdCost->setPredictor( secondPred ); } -#if JVET_K0357_AMVR iMvBits += m_pcRdCost->getBitsOfVectorWithPredictor( acMv[iVerIdx].getHor()>>shift, acMv[iVerIdx].getVer()>>shift, 0 ); -#else - iMvBits += m_pcRdCost->getBitsOfVectorWithPredictor( acMv[iVerIdx].getHor() >> shift, acMv[iVerIdx].getVer() >> shift ); -#endif } iMvBits += m_auiMVPIdxCost[iMVPIdx][AMVP_MAX_NUM_CANDS]; @@ -3467,11 +3363,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, #endif m_pcRdCost->setPredictor( secondPred ); } -#if JVET_K0357_AMVR uiBitsBest += m_pcRdCost->getBitsOfVectorWithPredictor( acMvTemp[i].getHor()>>shift, acMvTemp[i].getVer()>>shift, 0 ); -#else - uiBitsBest += m_pcRdCost->getBitsOfVectorWithPredictor( acMvTemp[i].getHor() >> shift, acMvTemp[i].getVer() >> shift ); -#endif DTRACE( g_trace_ctx, D_COMMON, " (%d) yy uiBitsBest=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiBitsBest ); } uiCostBest = (Distortion)( floor( fWeight * (double)uiCostBest ) + (double)m_pcRdCost->getCost( uiBitsBest ) ); @@ -3642,11 +3534,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, #endif m_pcRdCost->setPredictor( secondPred ); } -#if JVET_K0357_AMVR uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( acMvTemp[i].getHor()>>shift, acMvTemp[i].getVer()>>shift, 0 ); -#else - uiBitsTemp += m_pcRdCost->getBitsOfVectorWithPredictor( acMvTemp[i].getHor() >> shift, acMvTemp[i].getVer() >> shift ); -#endif } uiCostTemp = (Distortion)( floor( fWeight * (double)uiCostTemp ) + (double)m_pcRdCost->getCost( uiBitsTemp ) ); diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index 68d946355379779a3df16a1aea86f18ed38c4068..8a070b9896fd0e4b112ddb94e6142aa0c3c906d4 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -160,9 +160,7 @@ protected: Distortion uiBestSad; uint8_t ucPointNr; int subShiftMode; -#if JVET_K0357_AMVR unsigned imvShift; -#endif #if JVET_K0157 bool inCtuSearch; bool zeroMV; @@ -210,10 +208,8 @@ protected: AMVPInfo& amvpInfo, uint32_t& ruiBits, Distortion& ruiCost -#if JVET_K0357_AMVR , const uint8_t imv -#endif ); Distortion xGetTemplateCost ( const PredictionUnit& pu, diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 454cbaf1179da105f657546272c64b177b78ec6c..43274b3efd479dbc35ca6cc7a779cb6b0ee9e156 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -533,9 +533,7 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) #if JVET_K0346 WRITE_FLAG(spsNext.getUseSubPuMvp() ? 1 : 0, "subpu_tmvp_flag"); #endif -#if JVET_K0357_AMVR WRITE_FLAG( spsNext.getUseIMV() ? 1 : 0, "imv_enable_flag" ); -#endif #if !REMOVE_MV_ADAPT_PREC WRITE_FLAG( spsNext.getUseHighPrecMv() ? 1 : 0, "high_precision_motion_vectors"); #endif @@ -586,12 +584,10 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) } #endif -#if JVET_K0357_AMVR if( spsNext.getUseIMV() ) { WRITE_UVLC( spsNext.getImvMode()-1, "imv_mode_minus1" ); } -#endif if( spsNext.getMTTEnabled() ) {