From 727288bd98608e24ebc1d6a4a6f5c7d0404a8f4a Mon Sep 17 00:00:00 2001 From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de> Date: Fri, 25 Jan 2019 15:42:47 +0100 Subject: [PATCH] first part of SPS syntax alignment: - sps_sao_enabled_flag - sps_alf_enabled_flag - pcm_enabled_flag - pcm_sample_bit_depth_luma_minus1 - pcm_sample_bit_depth_chroma_minus1 - log2_min_pcm_luma_coding_block_size_minus3 - log2_diff_max_min_pcm_luma_coding_block_size - pcm_loop_filter_disabled_flag - sps_ref_wraparound_enabled_flag - sps_ref_wraparound_offset - sps_temporal_mvp_enabled_flag - sps_sbtmvp_enabled_flag - sps_bdof_enabled_flag --- cfg/encoder_intra_vtm.cfg | 1 - cfg/encoder_lowdelay_P_vtm.cfg | 1 - cfg/encoder_lowdelay_vtm.cfg | 1 - cfg/encoder_randomaccess_vtm.cfg | 1 - source/App/EncoderApp/EncApp.cpp | 1 - source/App/EncoderApp/EncAppCfg.cpp | 3 - source/App/EncoderApp/EncAppCfg.h | 1 - source/Lib/CommonLib/InterPrediction.cpp | 6 +- source/Lib/CommonLib/LoopFilter.cpp | 4 +- source/Lib/CommonLib/Mv.cpp | 2 +- source/Lib/CommonLib/Picture.cpp | 2 +- source/Lib/CommonLib/SampleAdaptiveOffset.cpp | 2 +- source/Lib/CommonLib/Slice.cpp | 11 ++- source/Lib/CommonLib/Slice.h | 62 +++++++-------- source/Lib/CommonLib/UnitTools.cpp | 2 +- source/Lib/DecoderLib/CABACReader.cpp | 10 +-- source/Lib/DecoderLib/DecCu.cpp | 4 +- source/Lib/DecoderLib/DecLib.cpp | 12 +-- source/Lib/DecoderLib/VLCReader.cpp | 75 ++++++++++--------- source/Lib/EncoderLib/CABACWriter.cpp | 10 +-- source/Lib/EncoderLib/EncCfg.h | 3 - source/Lib/EncoderLib/EncCu.cpp | 6 +- source/Lib/EncoderLib/EncGOP.cpp | 12 +-- source/Lib/EncoderLib/EncLib.cpp | 14 ++-- source/Lib/EncoderLib/EncModeCtrl.cpp | 6 +- source/Lib/EncoderLib/InterSearch.cpp | 2 +- source/Lib/EncoderLib/VLCWriter.cpp | 63 +++++++++------- 27 files changed, 151 insertions(+), 166 deletions(-) diff --git a/cfg/encoder_intra_vtm.cfg b/cfg/encoder_intra_vtm.cfg index 751f31896..46a89c0a4 100644 --- a/cfg/encoder_intra_vtm.cfg +++ b/cfg/encoder_intra_vtm.cfg @@ -48,7 +48,6 @@ InternalBitDepth : 10 # codec operating bit-depth #=========== Coding Tools ================= SAO : 1 # Sample adaptive offset (0: OFF, 1: ON) -AMP : 1 # Asymmetric motion partitions (0: OFF, 1: ON) TransformSkip : 1 # Transform skipping (0: OFF, 1: ON) TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1: ON) TransformSkipLog2MaxSize : 5 diff --git a/cfg/encoder_lowdelay_P_vtm.cfg b/cfg/encoder_lowdelay_P_vtm.cfg index e6bb635cb..9ffa21be9 100644 --- a/cfg/encoder_lowdelay_P_vtm.cfg +++ b/cfg/encoder_lowdelay_P_vtm.cfg @@ -56,7 +56,6 @@ InternalBitDepth : 10 # codec operating bit-depth #=========== Coding Tools ================= SAO : 1 # Sample adaptive offset (0: OFF, 1: ON) -AMP : 1 # Asymmetric motion partitions (0: OFF, 1: ON) TransformSkip : 1 # Transform skipping (0: OFF, 1: ON) TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1: ON) TransformSkipLog2MaxSize : 5 diff --git a/cfg/encoder_lowdelay_vtm.cfg b/cfg/encoder_lowdelay_vtm.cfg index 4748271fa..4d5322596 100644 --- a/cfg/encoder_lowdelay_vtm.cfg +++ b/cfg/encoder_lowdelay_vtm.cfg @@ -56,7 +56,6 @@ InternalBitDepth : 10 # codec operating bit-depth #=========== Coding Tools ================= SAO : 1 # Sample adaptive offset (0: OFF, 1: ON) -AMP : 1 # Asymmetric motion partitions (0: OFF, 1: ON) TransformSkip : 1 # Transform skipping (0: OFF, 1: ON) TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1: ON) TransformSkipLog2MaxSize : 5 diff --git a/cfg/encoder_randomaccess_vtm.cfg b/cfg/encoder_randomaccess_vtm.cfg index f2c8530da..1280de857 100644 --- a/cfg/encoder_randomaccess_vtm.cfg +++ b/cfg/encoder_randomaccess_vtm.cfg @@ -70,7 +70,6 @@ InternalBitDepth : 10 # codec operating bit-depth #=========== Coding Tools ================= SAO : 1 # Sample adaptive offset (0: OFF, 1: ON) -AMP : 1 # Asymmetric motion partitions (0: OFF, 1: ON) TransformSkip : 1 # Transform skipping (0: OFF, 1: ON) TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1: ON) TransformSkipLog2MaxSize : 5 diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 42a467a34..ed905526d 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -141,7 +141,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setAccessUnitDelimiter ( m_AccessUnitDelimiter ); m_cEncLib.setMaxTempLayer ( m_maxTempLayer ); - m_cEncLib.setUseAMP( m_enableAMP ); //===== Slice ======== diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 77d82dd18..0a7490dfa 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -993,7 +993,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("DeblockingFilterMetric", m_DeblockingFilterMetric, false) #endif // Coding tools - ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") ("CrossComponentPrediction", m_crossComponentPredictionEnabledFlag, false, "Enable the use of cross-component prediction (not valid in V1 profiles)") ("ReconBasedCrossCPredictionEstimate", m_reconBasedCrossCPredictionEstimate, false, "When determining the alpha value for cross-component prediction, use the decoded residual rather than the pre-transform encoder-side residual") ("SaoLumaOffsetBitShift", saoOffsetBitShift[CHANNEL_TYPE_LUMA], 0, "Specify the luma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP") @@ -1927,8 +1926,6 @@ bool EncAppCfg::xCheckParameter() #endif xConfirmPara( m_LMChroma, "LMChroma only allowed with NEXT profile" ); xConfirmPara( m_LargeCTU, "Large CTU is only allowed with NEXT profile" ); - xConfirmPara( m_SubPuMvpMode != 0, "Sub-PU motion vector prediction is only allowed with NEXT profile" ); - xConfirmPara( m_BIO, "BIO only allowed with NEXT profile" ); xConfirmPara( m_DisableMotionCompression, "Disable motion data compression only allowed with NEXT profile" ); xConfirmPara( m_MTT, "Multi type tree is only allowed with NEXT profile" ); xConfirmPara( m_ImvMode, "IMV is only allowed with NEXT profile" ); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 3e56906da..55eb9608c 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -148,7 +148,6 @@ protected: bool m_transformSkipRotationEnabledFlag; ///< control flag for transform-skip/transquant-bypass residual rotation bool m_transformSkipContextEnabledFlag; ///< control flag for transform-skip/transquant-bypass single significance map context bool m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];///< control flags for residual DPCM - bool m_enableAMP; bool m_persistentRiceAdaptationEnabledFlag; ///< control flag for Golomb-Rice parameter adaptation over each slice bool m_cabacBypassAlignmentEnabledFlag; diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 923ebb2aa..8d14e7412 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -426,7 +426,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) const Slice &slice = *pu.cs->slice; bool bioApplied = false; - if (pu.cs->sps->getSpsNext().getUseBIO()) + if (pu.cs->sps->getBDOFEnabledFlag()) { if (pu.cu->affine || m_subPuMC) { @@ -686,7 +686,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio roundAffineMv(iMvScaleTmpHor, iMvScaleTmpVer, shift); // clip and scale - if (sps.getUseWrapAround()) + if (sps.getWrapAroundEnabledFlag()) { m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer); Mv tmpMv(iMvScaleTmpHor, iMvScaleTmpVer); @@ -710,7 +710,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)] + Mv(2, 2)); curMv.set(curMv.getHor() >> 2, curMv.getVer() >> 2); - if (sps.getUseWrapAround()) + if (sps.getWrapAroundEnabledFlag()) { clipMv(curMv, Position(pu.Y().x + (w << iScaleX), pu.Y().y + (h << iScaleY)), Size(blockWidth << iScaleX, blockHeight << iScaleY), sps); } diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index ffc117b1f..f8543f5bc 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -554,7 +554,7 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge unsigned uiBsAbsIdx = 0, uiBs = 0; int iOffset, iSrcStep; - bool bPCMFilter = (sps.getUsePCM() && sps.getPCMFilterDisableFlag()) ? true : false; + bool bPCMFilter = (sps.getPCMEnabledFlag() && sps.getPCMFilterDisableFlag()) ? true : false; bool bPartPNoFilter = false; bool bPartQNoFilter = false; int betaOffsetDiv2 = slice.getDeblockingFilterBetaOffsetDiv2(); @@ -704,7 +704,7 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed int iOffset, iSrcStep; unsigned uiLoopLength; - bool bPCMFilter = (sps.getUsePCM() && sps.getPCMFilterDisableFlag()) ? true : false; + bool bPCMFilter = (sps.getPCMEnabledFlag() && sps.getPCMFilterDisableFlag()) ? true : false; bool bPartPNoFilter = false; bool bPartQNoFilter = false; const int tcOffsetDiv2 = slice.getDeblockingFilterTcOffsetDiv2(); diff --git a/source/Lib/CommonLib/Mv.cpp b/source/Lib/CommonLib/Mv.cpp index 91f379414..7edfa2c56 100644 --- a/source/Lib/CommonLib/Mv.cpp +++ b/source/Lib/CommonLib/Mv.cpp @@ -61,7 +61,7 @@ void clipMv( Mv& rcMv, const Position& pos, int iVerMax = ( sps.getPicHeightInLumaSamples() + iOffset - ( int ) pos.y - 1 ) << iMvShift; int iVerMin = ( -( int ) sps.getMaxCUHeight() - iOffset - ( int ) pos.y + 1 ) << iMvShift; - if( sps.getUseWrapAround() ) + if( sps.getWrapAroundEnabledFlag() ) { int iHorMax = ( sps.getPicWidthInLumaSamples() + sps.getMaxCUWidth() - size.width + iOffset - ( int ) pos.x - 1 ) << iMvShift; int iHorMin = ( -( int ) sps.getMaxCUWidth() - iOffset - ( int ) pos.x + 1 ) << iMvShift; diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 0937fd1bf..4c96307cb 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -1004,7 +1004,7 @@ void Picture::extendPicBorder() Pel* pi = piTxt; // do left and right margins - if (cs->sps->getUseWrapAround()) + if (cs->sps->getWrapAroundEnabledFlag()) { int xoffset = cs->sps->getWrapAroundOffset() >> getComponentScaleX( compID, cs->area.chromaFormat ); for (int y = 0; y < p.height; y++) diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp index 14763c7f7..a048e366d 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp @@ -614,7 +614,7 @@ void SampleAdaptiveOffset::SAOProcess( CodingStructure& cs, SAOBlkParam* saoBlkP void SampleAdaptiveOffset::xPCMLFDisableProcess(CodingStructure& cs) { const PreCalcValues& pcv = *cs.pcv; - const bool bPCMFilter = (cs.sps->getUsePCM() && cs.sps->getPCMFilterDisableFlag()) ? true : false; + const bool bPCMFilter = (cs.sps->getPCMEnabledFlag() && cs.sps->getPCMFilterDisableFlag()) ? true : false; if( bPCMFilter || cs.pps->getTransquantBypassEnabledFlag() ) { diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 5fb5831f2..ef0a5f0a4 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -1733,9 +1733,7 @@ SPSNext::SPSNext( SPS& sps ) , m_NextEnabled ( false ) // disable all tool enabling flags by default , m_LargeCTU ( false ) - , m_SubPuMvp ( false ) , m_IMV ( false ) - , m_BIO ( false ) , m_DisableMotionCompression ( false ) , m_LMChroma ( false ) #if JVET_M0464_UNI_MTS @@ -1761,7 +1759,6 @@ SPSNext::SPSNext( SPS& sps ) #endif // default values for additional parameters - , m_subPuMrgMode ( 0 ) , m_ImvMode ( IMV_OFF ) , m_MTTMode ( 0 ) , m_compositeRefEnabled ( false ) @@ -1814,14 +1811,16 @@ SPS::SPS() , m_uiQuadtreeTUMaxDepthInter ( 0) , m_uiQuadtreeTUMaxDepthIntra ( 0) // Tool list -, m_usePCM (false) +, m_pcmEnabledFlag (false) , m_pcmLog2MaxSize ( 5) , m_uiPCMLog2MinSize ( 7) , m_bPCMFilterDisableFlag (false) +, m_sbtmvpEnabledFlag (false) +, m_bdofEnabledFlag (false) , m_uiBitsForPOC ( 8) , m_numLongTermRefPicSPS ( 0) , m_uiMaxTrSize ( 32) -, m_bUseSAO (false) +, m_saoEnabledFlag (false) , m_bTemporalIdNestingFlag (false) #if HEVC_USE_SCALING_LISTS , m_scalingListEnabledFlag (false) @@ -1832,7 +1831,7 @@ SPS::SPS() , m_vuiParametersPresentFlag (false) , m_vuiParameters () , m_spsNextExtension (*this) -, m_useWrapAround (false) +, m_wrapAroundEnabledFlag (false) , m_wrapAroundOffset ( 0) { for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 6b71c04aa..cdc6d343d 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -791,6 +791,8 @@ public: class SPS; + +// Deprecated: SPSNext is going to be removed! Do not add any parameters to SPSNext class SPSNext { private: @@ -799,9 +801,7 @@ private: bool m_NextEnabled; //===== tool enabling flags (4 bytes - NOTE: last flag must be used for new extensions) ===== bool m_LargeCTU; // 5 - bool m_SubPuMvp; bool m_IMV; // 9 - bool m_BIO; bool m_DisableMotionCompression; // 13 bool m_LMChroma; // 17 #if JVET_M0464_UNI_MTS @@ -833,19 +833,14 @@ public: private: //===== additional parameters ===== // qtbt - // sub-pu merging - int m_subPuMrgMode; //imv ImvMode m_ImvMode; // multi type tree (QTBT + triple split) unsigned m_MTTMode; - bool m_compositeRefEnabled; //composite longterm reference - + bool m_compositeRefEnabled; //composite longterm reference unsigned m_CPRMode; - // ADD_NEW_TOOL : (sps extension) add tool enabling flags and associated parameters here - public: SPSNext( SPS& sps ); @@ -857,17 +852,12 @@ public: //===== tool enabling flags and extension bit ===== void setUseLargeCTU ( bool b ) { m_LargeCTU = b; } bool getUseLargeCTU () const { return m_LargeCTU; } - bool getUseSubPuMvp() const { return m_SubPuMvp; } - void setSubPuMvpMode(int n) { m_subPuMrgMode = n; m_SubPuMvp = n != 0; } - bool getUseATMVP() const { return (m_subPuMrgMode & 1) == 1; } void setUseIMV ( bool b ) { m_IMV = b; } bool getUseIMV () const { return m_IMV; } void setUseAffine ( bool b ) { m_Affine = b; } bool getUseAffine () const { return m_Affine; } void setUseAffineType ( bool b ) { m_AffineType = b; } bool getUseAffineType () const { return m_AffineType; } - void setUseBIO(bool b) { m_BIO = b; } - bool getUseBIO() const { return m_BIO; } void setDisableMotCompress ( bool b ) { m_DisableMotionCompression = b; } bool getDisableMotCompress () const { return m_DisableMotionCompression; } bool getMTTEnabled () const { return m_MTTEnabled; } @@ -906,8 +896,6 @@ public: void setImvMode(ImvMode m) { m_ImvMode = m; m_IMV = m != 0; } ImvMode getImvMode () const { return m_ImvMode; } - - // multi type tree unsigned getMTTMode () const { return m_MTTMode; } void setMTTMode ( unsigned mode ) { m_MTTMode = mode; m_MTTEnabled = ( m_MTTMode != 0 ); } @@ -921,8 +909,6 @@ public: bool getUseTriangle () const { return m_Triangle; } void setCPRMode (unsigned CPRMode) { m_CPRMode = CPRMode; } unsigned getCPRMode () const { return m_CPRMode; } - // ADD_NEW_TOOL : (sps extension) add access functions for tool enabling flags and associated parameters here - }; @@ -985,10 +971,9 @@ private: uint32_t m_uiQuadtreeTULog2MinSize; uint32_t m_uiQuadtreeTUMaxDepthInter; uint32_t m_uiQuadtreeTUMaxDepthIntra; - bool m_usePCM; + bool m_pcmEnabledFlag; uint32_t m_pcmLog2MaxSize; uint32_t m_uiPCMLog2MinSize; - bool m_useAMP; // Parameter BitDepths m_bitDepths; @@ -996,6 +981,9 @@ private: int m_pcmBitDepths[MAX_NUM_CHANNEL_TYPE]; bool m_bPCMFilterDisableFlag; + bool m_sbtmvpEnabledFlag; + bool m_bdofEnabledFlag; + uint32_t m_uiBitsForPOC; uint32_t m_numLongTermRefPicSPS; uint32_t m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS]; @@ -1003,7 +991,7 @@ private: // Max physical transform size uint32_t m_uiMaxTrSize; - bool m_bUseSAO; + bool m_saoEnabledFlag; bool m_bTemporalIdNestingFlag; // temporal_id_nesting_flag @@ -1029,9 +1017,9 @@ private: static const int m_winUnitY[NUM_CHROMA_FORMAT]; PTL m_pcPTL; - bool m_useALF; + bool m_alfEnabledFlag; - bool m_useWrapAround; + bool m_wrapAroundEnabledFlag; unsigned m_wrapAroundOffset; public: @@ -1147,16 +1135,14 @@ public: uint32_t getMaxCUHeight() const { return m_uiMaxCUHeight; } void setMaxCodingDepth( uint32_t u ) { m_uiMaxCodingDepth = u; } uint32_t getMaxCodingDepth() const { return m_uiMaxCodingDepth; } - void setUsePCM( bool b ) { m_usePCM = b; } - bool getUsePCM() const { return m_usePCM; } + void setPCMEnabledFlag( bool b ) { m_pcmEnabledFlag = b; } + bool getPCMEnabledFlag() const { return m_pcmEnabledFlag; } void setPCMLog2MaxSize( uint32_t u ) { m_pcmLog2MaxSize = u; } uint32_t getPCMLog2MaxSize() const { return m_pcmLog2MaxSize; } void setPCMLog2MinSize( uint32_t u ) { m_uiPCMLog2MinSize = u; } uint32_t getPCMLog2MinSize() const { return m_uiPCMLog2MinSize; } void setBitsForPOC( uint32_t u ) { m_uiBitsForPOC = u; } uint32_t getBitsForPOC() const { return m_uiBitsForPOC; } - bool getUseAMP() const { return m_useAMP; } - void setUseAMP( bool b ) { m_useAMP = b; } void setQuadtreeTULog2MaxSize( uint32_t u ) { m_uiQuadtreeTULog2MaxSize = u; } uint32_t getQuadtreeTULog2MaxSize() const { return m_uiQuadtreeTULog2MaxSize; } void setQuadtreeTULog2MinSize( uint32_t u ) { m_uiQuadtreeTULog2MinSize = u; } @@ -1188,11 +1174,20 @@ public: int getQpBDOffset(ChannelType type) const { return m_qpBDOffset[type]; } void setQpBDOffset(ChannelType type, int i) { m_qpBDOffset[type] = i; } - void setUseSAO(bool bVal) { m_bUseSAO = bVal; } - bool getUseSAO() const { return m_bUseSAO; } + void setSAOEnabledFlag(bool bVal) { m_saoEnabledFlag = bVal; } + bool getSAOEnabledFlag() const { return m_saoEnabledFlag; } + + bool getALFEnabledFlag() const { return m_alfEnabledFlag; } + void setALFEnabledFlag( bool b ) { m_alfEnabledFlag = b; } - uint32_t getMaxTLayers() const { return m_uiMaxTLayers; } - void setMaxTLayers( uint32_t uiMaxTLayers ) { CHECK( uiMaxTLayers > MAX_TLAYER, "Invalid number T-layers" ); m_uiMaxTLayers = uiMaxTLayers; } + 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; } + + uint32_t getMaxTLayers() const { return m_uiMaxTLayers; } + void setMaxTLayers( uint32_t uiMaxTLayers ) { CHECK( uiMaxTLayers > MAX_TLAYER, "Invalid number T-layers" ); m_uiMaxTLayers = uiMaxTLayers; } bool getTemporalIdNestingFlag() const { return m_bTemporalIdNestingFlag; } void setTemporalIdNestingFlag( bool bValue ) { m_bTemporalIdNestingFlag = bValue; } @@ -1232,11 +1227,8 @@ public: const SPSNext& getSpsNext() const { return m_spsNextExtension; } SPSNext& getSpsNext() { return m_spsNextExtension; } - bool getUseALF() const { return m_useALF; } - void setUseALF( bool b ) { m_useALF = b; } - - void setUseWrapAround(bool b) { m_useWrapAround = b; } - bool getUseWrapAround() const { return m_useWrapAround; } + void setWrapAroundEnabledFlag(bool b) { m_wrapAroundEnabledFlag = b; } + bool getWrapAroundEnabledFlag() const { return m_wrapAroundEnabledFlag; } void setWrapAroundOffset(unsigned offset) { m_wrapAroundOffset = offset; } unsigned getWrapAroundOffset() const { return m_wrapAroundOffset; } }; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index ddcc17e6e..3c49c91ed 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -2664,7 +2664,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx affMrgCtx.numValidMergeCand = 0; affMrgCtx.maxNumMergeCand = maxNumAffineMergeCand; - bool enableSubPuMvp = slice.getSPS()->getSpsNext().getUseSubPuMvp() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP()); + bool enableSubPuMvp = slice.getSPS()->getSBTMVPEnabledFlag() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP()); bool isAvailableSubPu = false; if ( enableSubPuMvp && slice.getEnableTMVPFlag() ) { diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 757202d96..5afb01bc1 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -149,7 +149,7 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i AlfSliceParam& alfSliceParam = cs.slice->getAlfSliceParam(); - if( cs.sps->getUseALF() && ( alfSliceParam.enabledFlag[COMPONENT_Y] || alfSliceParam.enabledFlag[COMPONENT_Cb] || alfSliceParam.enabledFlag[COMPONENT_Cr] ) ) + if( cs.sps->getALFEnabledFlag() && ( alfSliceParam.enabledFlag[COMPONENT_Y] || alfSliceParam.enabledFlag[COMPONENT_Cb] || alfSliceParam.enabledFlag[COMPONENT_Cr] ) ) { const PreCalcValues& pcv = *cs.pcv; @@ -231,7 +231,7 @@ void CABACReader::sao( CodingStructure& cs, unsigned ctuRsAddr ) { const SPS& sps = *cs.sps; - if( !sps.getUseSAO() ) + if( !sps.getSAOEnabledFlag() ) { return; } @@ -944,7 +944,7 @@ void CABACReader::pred_mode( CodingUnit& cu ) void CABACReader::pcm_flag( CodingUnit& cu, Partitioner &partitioner ) { const SPS& sps = *cu.cs->sps; - if( !sps.getUsePCM() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize()) + if( !sps.getPCMEnabledFlag() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize()) || partitioner.currArea().lheight() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lheight() < (1 << sps.getPCMLog2MinSize()) ) { cu.ipcm = false; @@ -1406,7 +1406,7 @@ void CABACReader::subblock_merge_flag( CodingUnit& cu ) return; } - if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getSpsNext().getUseAffine() || cu.cs->sps->getSpsNext().getUseSubPuMvp()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) + if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getSpsNext().getUseAffine() || cu.cs->sps->getSBTMVPEnabledFlag()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG ); @@ -1478,7 +1478,7 @@ void CABACReader::merge_idx( PredictionUnit& pu ) { if ( m_BinDecoder.decodeBin( Ctx::AffMergeIdx() ) ) { - bool useExtCtx = pu.cs->sps->getSpsNext().getUseSubPuMvp(); + bool useExtCtx = pu.cs->sps->getSBTMVPEnabledFlag(); pu.mergeIdx++; for ( ; pu.mergeIdx < numCandminus1; pu.mergeIdx++ ) { diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index c18a57b9b..ed6949414 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -458,7 +458,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) if (pu.mmvdMergeFlag || pu.cu->mmvdSkip) { CHECK(pu.mhIntraFlag == true, "invalid MHIntra"); - if (pu.cs->sps->getSpsNext().getUseSubPuMvp()) + if (pu.cs->sps->getSBTMVPEnabledFlag()) { Size bufSize = g_miScaling.scale(pu.lumaSize()); mrgCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize); @@ -486,7 +486,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) if( pu.cu->affine ) { AffineMergeCtx affineMergeCtx; - if ( pu.cs->sps->getSpsNext().getUseSubPuMvp() ) + if ( pu.cs->sps->getSBTMVPEnabledFlag() ) { Size bufSize = g_miScaling.scale( pu.lumaSize() ); mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 0a1d88c69..a730340cf 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -168,12 +168,12 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri pcEncPic->cs->slice = pcEncPic->slices.back(); - if ( pic->cs->sps->getUseSAO() ) + if ( pic->cs->sps->getSAOEnabledFlag() ) { pcEncPic->copySAO( *pic, 0 ); } - if( pic->cs->sps->getUseALF() ) + if( pic->cs->sps->getALFEnabledFlag() ) { for( int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++ ) { @@ -187,7 +187,7 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri } pcDecLib->executeLoopFilters(); - if ( pic->cs->sps->getUseSAO() ) + if ( pic->cs->sps->getSAOEnabledFlag() ) { pcEncPic->copySAO( *pic, 1 ); } @@ -511,12 +511,12 @@ void DecLib::executeLoopFilters() // deblocking filter m_cLoopFilter.loopFilterPic( cs ); - if( cs.sps->getUseSAO() ) + if( cs.sps->getSAOEnabledFlag() ) { m_cSAO.SAOProcess( cs, cs.picture->getSAO() ); } - if( cs.sps->getUseALF() ) + if( cs.sps->getALFEnabledFlag() ) { m_cALF.ALFProcess( cs, cs.slice->getAlfSliceParam() ); } @@ -772,7 +772,7 @@ void DecLib::xActivateParameterSets() m_cSliceDecoder.create(); - if( sps->getUseALF() ) + if( sps->getALFEnabledFlag() ) { m_cALF.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCodingDepth(), sps->getBitDepths().recon ); } diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 0f0bbc947..205f40dd0 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -789,9 +789,7 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) // tool enabling flags READ_FLAG( symbol, "large_ctu_flag" ); spsNext.setUseLargeCTU ( symbol != 0 ); - READ_FLAG( symbol, "subpu_tmvp_flag" ); spsNext.setSubPuMvpMode (symbol); READ_FLAG( symbol, "imv_enable_flag" ); spsNext.setUseIMV ( symbol != 0 ); - READ_FLAG( symbol, "bio_enable_flag" ); spsNext.setUseBIO ( symbol != 0 ); READ_FLAG( symbol, "disable_motion_compression_flag" ); spsNext.setDisableMotCompress ( symbol != 0 ); READ_FLAG( symbol, "lm_chroma_enabled_flag" ); spsNext.setUseLMChroma ( symbol != 0 ); #if JVET_M0464_UNI_MTS @@ -821,14 +819,6 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) READ_FLAG( symbol, "reserved_flag" ); CHECK( symbol, "reserved flag not 0!" ); #endif - // additional parameters - if( spsNext.getUseSubPuMvp() ) - { - int subPuMode = 1; - spsNext.setSubPuMvpMode( subPuMode ); - } - - if( spsNext.getUseIMV() ) { READ_UVLC( symbol, "imv_mode_minus1" ); spsNext.setImvMode( ImvMode( symbol + 1 ) ); @@ -1019,8 +1009,39 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_UVLC( uiCode, "log2_diff_max_min_luma_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() ); pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) ); - READ_FLAG( uiCode, "sps_alf_enable_flag" ); pcSPS->setUseALF( uiCode ); + READ_FLAG( uiCode, "sps_sao_enabled_flag" ); pcSPS->setSAOEnabledFlag ( uiCode ? true : false ); + READ_FLAG( uiCode, "sps_alf_enabled_flag" ); pcSPS->setALFEnabledFlag ( uiCode ? true : false ); + + READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setPCMEnabledFlag( uiCode ? true : false ); + if( pcSPS->getPCMEnabledFlag() ) + { + READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_LUMA, 1 + uiCode ); + READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_CHROMA, 1 + uiCode ); + READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize ( uiCode+3 ); + READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); + READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); + } + + READ_FLAG(uiCode, "sps_ref_wraparound_enabled_flag"); pcSPS->setWrapAroundEnabledFlag( uiCode ? true : false ); + if (pcSPS->getWrapAroundEnabledFlag()) + { + READ_UVLC(uiCode, "sps_ref_wraparound_offset"); pcSPS->setWrapAroundOffset( uiCode ); + } + + READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" ); pcSPS->setSPSTemporalMVPEnabledFlag(uiCode); + + if ( pcSPS->getSPSTemporalMVPEnabledFlag() ) + { + READ_FLAG( uiCode, "sps_sbtmvp_enabled_flag" ); pcSPS->setSBTMVPEnabledFlag ( uiCode != 0 ); + } + else + { + pcSPS->setSBTMVPEnabledFlag(false); + } + + READ_FLAG( uiCode, "sps_bdof_enable_flag" ); pcSPS->setBDOFEnabledFlag ( uiCode != 0 ); + #if HEVC_USE_SCALING_LISTS READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); if(pcSPS->getScalingListFlag()) @@ -1032,24 +1053,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } } #endif - READ_FLAG( uiCode, "amp_enabled_flag" ); pcSPS->setUseAMP( uiCode ); - READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false ); - - READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false ); - if( pcSPS->getUsePCM() ) - { - READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_LUMA, 1 + uiCode ); - READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_CHROMA, 1 + uiCode ); - READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize (uiCode+3); - READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); - READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); - } - - READ_FLAG(uiCode, "ref_wraparound_enabled_flag"); pcSPS->setUseWrapAround( uiCode ? true : false ); - if (pcSPS->getUseWrapAround()) - { - READ_UVLC(uiCode, "ref_wraparound_offset"); pcSPS->setWrapAroundOffset( uiCode ); - } READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); CHECK(uiCode > 64, "Invalid code"); @@ -1076,8 +1079,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0); } } - READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" ); pcSPS->setSPSTemporalMVPEnabledFlag(uiCode); - #if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 READ_FLAG( uiCode, "strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); @@ -1142,7 +1143,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) case SPS_EXT__NEXT: { CHECK( !pcSPS->getSpsNext().nextToolsEnabled(), "Got SPS Next extension in non NEXT profile" ); - parseSPSNext( pcSPS->getSpsNext(), pcSPS->getUsePCM() ); + parseSPSNext( pcSPS->getSpsNext(), pcSPS->getPCMEnabledFlag() ); break; } default: @@ -1517,7 +1518,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setEnableTMVPFlag(false); } } - if(sps->getUseSAO()) + if(sps->getSAOEnabledFlag()) { READ_FLAG(uiCode, "slice_sao_luma_flag"); pcSlice->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, (bool)uiCode); @@ -1527,7 +1528,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para } } - if( sps->getUseALF() ) + if( sps->getALFEnabledFlag() ) { alf( pcSlice->getAlfSliceParam() ); } @@ -1746,11 +1747,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para READ_UVLC(uiCode, "six_minus_max_num_merge_cand"); pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); - if ( sps->getSpsNext().getUseSubPuMvp() && !sps->getSpsNext().getUseAffine() ) // ATMVP only + if ( sps->getSBTMVPEnabledFlag() && !sps->getSpsNext().getUseAffine() ) // ATMVP only { pcSlice->setMaxNumAffineMergeCand( 1 ); } - else if ( !sps->getSpsNext().getUseSubPuMvp() && !sps->getSpsNext().getUseAffine() ) // both off + else if ( !sps->getSBTMVPEnabledFlag() && !sps->getSpsNext().getUseAffine() ) // both off { pcSlice->setMaxNumAffineMergeCand( 0 ); } @@ -1838,7 +1839,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); } - bool isSAOEnabled = sps->getUseSAO() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (bChroma && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA))); + bool isSAOEnabled = sps->getSAOEnabledFlag() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (bChroma && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA))); bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable()); if(pps->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index d883588ed..14c1ef67d 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -215,7 +215,7 @@ void CABACWriter::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i void CABACWriter::sao( const Slice& slice, unsigned ctuRsAddr ) { const SPS& sps = *slice.getSPS(); - if( !sps.getUseSAO() ) + if( !sps.getSAOEnabledFlag() ) { return; } @@ -803,7 +803,7 @@ void CABACWriter::pcm_data( const CodingUnit& cu, Partitioner& partitioner ) void CABACWriter::pcm_flag( const CodingUnit& cu, Partitioner& partitioner ) { const SPS& sps = *cu.cs->sps; - if( !sps.getUsePCM() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize()) + if( !sps.getPCMEnabledFlag() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize()) || partitioner.currArea().lheight() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lheight() < (1 << sps.getPCMLog2MinSize()) ) { return; @@ -1377,7 +1377,7 @@ void CABACWriter::subblock_merge_flag( const CodingUnit& cu ) return; } - if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getSpsNext().getUseAffine() || cu.cs->sps->getSpsNext().getUseATMVP()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) + if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getSpsNext().getUseAffine() || cu.cs->sps->getSBTMVPEnabledFlag()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) { unsigned ctxId = DeriveCtx::CtxAffineFlag( cu ); m_BinEncoder.encodeBin( cu.affine, Ctx::AffineFlag( ctxId ) ); @@ -1459,7 +1459,7 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) } else { - bool useExtCtx = pu.cs->sps->getSpsNext().getUseSubPuMvp(); + bool useExtCtx = pu.cs->sps->getSBTMVPEnabledFlag(); m_BinEncoder.encodeBin( 1, Ctx::AffMergeIdx() ); for ( unsigned idx = 1; idx < numCandminus1; idx++ ) { @@ -2749,7 +2749,7 @@ void CABACWriter::codeAlfCtuEnableFlag( CodingStructure& cs, uint32_t ctuRsAddr, { AlfSliceParam& alfSliceParam = alfParam ? (*alfParam) : cs.slice->getAlfSliceParam(); - if( cs.sps->getUseALF() && alfSliceParam.enabledFlag[compIdx] ) + if( cs.sps->getALFEnabledFlag() && alfSliceParam.enabledFlag[compIdx] ) { const PreCalcValues& pcv = *cs.pcv; int frame_width_in_ctus = pcv.widthInCtus; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index a0020e5a4..90fe26e0a 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -188,7 +188,6 @@ protected: // TODO: We need to have a common sliding mechanism used by both the encoder and decoder int m_maxTempLayer; ///< Max temporal layer - bool m_useAMP; unsigned m_CTUSize; bool m_useSplitConsOverride; unsigned m_uiMinQT[3]; //0: I slice; 1: P/B slice, 2: I slice chroma @@ -801,8 +800,6 @@ public: void setQuadtreeTUMaxDepthInter ( uint32_t u ) { m_uiQuadtreeTUMaxDepthInter = u; } void setQuadtreeTUMaxDepthIntra ( uint32_t u ) { m_uiQuadtreeTUMaxDepthIntra = u; } - void setUseAMP( bool b ) { m_useAMP = b; } - //====== Loop/Deblock Filter ======== void setLoopFilterDisable ( bool b ) { m_bLoopFilterDisable = b; } void setLoopFilterOffsetInPPS ( bool b ) { m_loopFilterOffsetInPPS = b; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 7bbda75b3..3e0dfac33 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -1582,7 +1582,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& MergeCtx mergeCtx; const SPS &sps = *tempCS->sps; - if( sps.getSpsNext().getUseSubPuMvp() ) + if( sps.getSBTMVPEnabledFlag() ) { Size bufSize = g_miScaling.scale( tempCS->area.lumaSize() ); mergeCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); @@ -2390,7 +2390,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct const SPS &sps = *tempCS->sps; MergeCtx mrgCtx; - if ( sps.getSpsNext().getUseSubPuMvp() ) + if ( sps.getSBTMVPEnabledFlag() ) { Size bufSize = g_miScaling.scale( tempCS->area.lumaSize() ); mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); @@ -2664,7 +2664,7 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct MergeCtx mergeCtx; - if (sps.getSpsNext().getUseSubPuMvp()) + if (sps.getSBTMVPEnabledFlag()) { Size bufSize = g_miScaling.scale(tempCS->area.lumaSize()); mergeCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize); diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index cc12a9a9f..bd3e0b7ea 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -1983,14 +1983,14 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcPic->m_uEnerHpCtu.resize( numberOfCtusInFrame ); pcPic->m_iOffsetCtu.resize( numberOfCtusInFrame ); #endif - if (pcSlice->getSPS()->getUseSAO()) + if (pcSlice->getSPS()->getSAOEnabledFlag()) { pcPic->resizeSAO( numberOfCtusInFrame, 0 ); pcPic->resizeSAO( numberOfCtusInFrame, 1 ); } // it is used for signalling during CTU mode decision, i.e. before ALF processing - if( pcSlice->getSPS()->getUseALF() ) + if( pcSlice->getSPS()->getALFEnabledFlag() ) { pcPic->resizeAlfCtuEnableFlag( numberOfCtusInFrame ); std::memset( pcSlice->getAlfSliceParam().enabledFlag, false, sizeof( pcSlice->getAlfSliceParam().enabledFlag ) ); @@ -2087,7 +2087,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice = pcPic->slices[0]; // SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas - if( pcSlice->getSPS()->getUseSAO() && m_pcCfg->getSaoCtuBoundary() ) + if( pcSlice->getSPS()->getSAOEnabledFlag() && m_pcCfg->getSaoCtuBoundary() ) { m_pcSAO->getPreDBFStatistics( cs ); } @@ -2113,7 +2113,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "final", 1 ) ) ); - if( pcSlice->getSPS()->getUseSAO() ) + if( pcSlice->getSPS()->getSAOEnabledFlag() ) { bool sliceEnabled[MAX_NUM_COMPONENT]; m_pcSAO->initCABACEstimator( m_pcEncLib->getCABACEncoder(), m_pcEncLib->getCtxCache(), pcSlice ); @@ -2136,7 +2136,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } - if( pcSlice->getSPS()->getUseALF() ) + if( pcSlice->getSPS()->getALFEnabledFlag() ) { AlfSliceParam alfSliceParam; m_pcALF->initCABACEstimator( m_pcEncLib->getCABACEncoder(), m_pcEncLib->getCtxCache(), pcSlice ); @@ -2172,7 +2172,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } #endif - if( pcSlice->getSPS()->getUseSAO() ) + if( pcSlice->getSPS()->getSAOEnabledFlag() ) { m_pcSAO->disabledRate( *pcPic->cs, pcPic->getSAO(1), m_pcCfg->getSaoEncodingRate(), m_pcCfg->getSaoEncodingRateChroma()); } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index c996912c6..4b5b824d1 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -851,10 +851,10 @@ void EncLib::xInitSPS(SPS &sps) sps.getSpsNext().setUseLargeCTU ( m_LargeCTU ); sps.setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma ); sps.setUseDualITree ( m_dualITree ); - sps.getSpsNext().setSubPuMvpMode ( m_SubPuMvpMode ); + sps.setSBTMVPEnabledFlag ( m_SubPuMvpMode ); sps.getSpsNext().setImvMode ( ImvMode(m_ImvMode) ); sps.getSpsNext().setUseIMV ( m_ImvMode != IMV_OFF ); - sps.getSpsNext().setUseBIO ( m_BIO ); + sps.setBDOFEnabledFlag ( m_BIO ); sps.getSpsNext().setUseAffine ( m_Affine ); sps.getSpsNext().setUseAffineType ( m_AffineType ); sps.getSpsNext().setDisableMotCompress ( m_DisableMotionCompression ); @@ -891,7 +891,7 @@ void EncLib::xInitSPS(SPS &sps) sps.getSpsNext().setCPRMode ( m_CPRMode ); - sps.setUseWrapAround ( m_wrapAround ); + sps.setWrapAroundEnabledFlag ( m_wrapAround ); sps.setWrapAroundOffset ( m_wrapAroundOffset ); // ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here @@ -906,7 +906,7 @@ void EncLib::xInitSPS(SPS &sps) sps.setLog2MinCodingBlockSize(log2MinCUSize); sps.setPCMLog2MinSize (m_uiPCMLog2MinSize); - sps.setUsePCM ( m_usePCM ); + sps.setPCMEnabledFlag ( m_usePCM ); sps.setPCMLog2MaxSize( m_pcmLog2MaxSize ); sps.setQuadtreeTULog2MaxSize( m_uiQuadtreeTULog2MaxSize ); @@ -918,8 +918,6 @@ void EncLib::xInitSPS(SPS &sps) sps.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); - sps.setUseAMP ( m_useAMP ); - for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) { sps.setBitDepth (ChannelType(channelType), m_bitDepth[channelType] ); @@ -927,7 +925,7 @@ void EncLib::xInitSPS(SPS &sps) sps.setPCMBitDepth (ChannelType(channelType), m_PCMBitDepth[channelType] ); } - sps.setUseSAO( m_bUseSAO ); + sps.setSAOEnabledFlag( m_bUseSAO ); sps.setMaxTLayers( m_maxTempLayer ); sps.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false ); @@ -945,7 +943,7 @@ void EncLib::xInitSPS(SPS &sps) #if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 sps.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); #endif - sps.setUseALF( m_alf ); + sps.setALFEnabledFlag( m_alf ); sps.setVuiParametersPresentFlag(getVuiParametersPresentFlag()); if (sps.getVuiParametersPresentFlag()) diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index a1a47b7c1..483060d46 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1112,7 +1112,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp, lossless } ); } m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp, lossless } ); - if ( cs.sps->getSpsNext().getUseAffine() || cs.sps->getSpsNext().getUseSubPuMvp() ) + if ( cs.sps->getSpsNext().getUseAffine() || cs.sps->getSBTMVPEnabledFlag() ) { m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } ); } @@ -1126,7 +1126,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp, lossless } ); } m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp, lossless } ); - if ( cs.sps->getSpsNext().getUseAffine() || cs.sps->getSpsNext().getUseSubPuMvp() ) + if ( cs.sps->getSpsNext().getUseAffine() || cs.sps->getSBTMVPEnabledFlag() ) { m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } ); } @@ -1294,7 +1294,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt } // PCM MODES - return sps.getUsePCM() && width <= ( 1 << sps.getPCMLog2MaxSize() ) && width >= ( 1 << sps.getPCMLog2MinSize() ); + return sps.getPCMEnabledFlag() && width <= ( 1 << sps.getPCMLog2MaxSize() ) && width >= ( 1 << sps.getPCMLog2MinSize() ); } else if (encTestmode.type == ETM_CPR || encTestmode.type == ETM_CPR_MERGE) { diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index c9e0f2f80..c12de393c 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -1543,7 +1543,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) CHECK(pu.cu != &cu, "PU is contained in another CU"); - if (cu.cs->sps->getSpsNext().getUseSubPuMvp()) + if (cu.cs->sps->getSBTMVPEnabledFlag()) { Size bufSize = g_miScaling.scale(pu.lumaSize()); mergeCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 410a9dede..ee01e5c32 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -529,9 +529,7 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) { // tool enabling flags WRITE_FLAG( spsNext.getUseLargeCTU() ? 1 : 0, "large_ctu_flag" ); - WRITE_FLAG(spsNext.getUseSubPuMvp() ? 1 : 0, "subpu_tmvp_flag"); WRITE_FLAG( spsNext.getUseIMV() ? 1 : 0, "imv_enable_flag" ); - WRITE_FLAG( spsNext.getUseBIO() ? 1 : 0, "bio_enable_flag" ); WRITE_FLAG( spsNext.getDisableMotCompress() ? 1 : 0, "disable_motion_compression_flag" ); WRITE_FLAG( spsNext.getUseLMChroma() ? 1 : 0, "lm_chroma_enabled_flag" ); #if JVET_M0464_UNI_MTS @@ -689,23 +687,12 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2, "log2_min_luma_transform_block_size_minus2" ); WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_luma_transform_block_size" ); - WRITE_FLAG( pcSPS->getUseALF(), "sps_alf_enable_flag" ); -#if HEVC_USE_SCALING_LISTS - WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0, "scaling_list_enabled_flag" ); - if(pcSPS->getScalingListFlag()) - { - WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0, "sps_scaling_list_data_present_flag" ); - if(pcSPS->getScalingListPresentFlag()) - { - codeScalingList( pcSPS->getScalingList() ); - } - } -#endif - WRITE_FLAG( pcSPS->getUseAMP() ? 1 : 0, "amp_enabled_flag" ); - WRITE_FLAG( pcSPS->getUseSAO() ? 1 : 0, "sample_adaptive_offset_enabled_flag"); - WRITE_FLAG( pcSPS->getUsePCM() ? 1 : 0, "pcm_enabled_flag"); - if( pcSPS->getUsePCM() ) + WRITE_FLAG( pcSPS->getSAOEnabledFlag(), "sps_sao_enabled_flag"); + WRITE_FLAG( pcSPS->getALFEnabledFlag(), "sps_alf_enabled_flag" ); + + WRITE_FLAG( pcSPS->getPCMEnabledFlag() ? 1 : 0, "pcm_enabled_flag"); + if( pcSPS->getPCMEnabledFlag() ) { WRITE_CODE( pcSPS->getPCMBitDepth(CHANNEL_TYPE_LUMA) - 1, 4, "pcm_sample_bit_depth_luma_minus1" ); WRITE_CODE( chromaEnabled ? (pcSPS->getPCMBitDepth(CHANNEL_TYPE_CHROMA) - 1) : 0, 4, "pcm_sample_bit_depth_chroma_minus1" ); @@ -714,12 +701,33 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getPCMFilterDisableFlag()?1 : 0, "pcm_loop_filter_disable_flag"); } - WRITE_FLAG( pcSPS->getUseWrapAround() ? 1 : 0, "ref_wraparound_enabled_flag" ); - if( pcSPS->getUseWrapAround() ) + WRITE_FLAG( pcSPS->getWrapAroundEnabledFlag() ? 1 : 0, "sps_ref_wraparound_enabled_flag" ); + if( pcSPS->getWrapAroundEnabledFlag() ) { - WRITE_UVLC( pcSPS->getWrapAroundOffset(), "ref_wraparound_offset" ); + WRITE_UVLC( pcSPS->getWrapAroundOffset(), "sps_ref_wraparound_offset" ); } + WRITE_FLAG( pcSPS->getSPSTemporalMVPEnabledFlag() ? 1 : 0, "sps_temporal_mvp_enabled_flag" ); + + if ( pcSPS->getSPSTemporalMVPEnabledFlag() ) + { + WRITE_FLAG( pcSPS->getSBTMVPEnabledFlag() ? 1 : 0, "sps_sbtmvp_enabled_flag"); + } + + WRITE_FLAG( pcSPS->getBDOFEnabledFlag() ? 1 : 0, "sps_bdof_enabled_flag" ); + +#if HEVC_USE_SCALING_LISTS + WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0, "scaling_list_enabled_flag" ); + if(pcSPS->getScalingListFlag()) + { + WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0, "sps_scaling_list_data_present_flag" ); + if(pcSPS->getScalingListPresentFlag()) + { + codeScalingList( pcSPS->getScalingList() ); + } + } +#endif + CHECK( pcSPS->getMaxTLayers() == 0, "Maximum number of T-layers is '0'" ); const RPSList* rpsList = pcSPS->getRPSList(); @@ -740,7 +748,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getUsedByCurrPicLtSPSFlag(k), "used_by_curr_pic_lt_sps_flag[i]"); } } - WRITE_FLAG( pcSPS->getSPSTemporalMVPEnabledFlag() ? 1 : 0, "sps_temporal_mvp_enabled_flag" ); #if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 WRITE_FLAG( pcSPS->getUseStrongIntraSmoothing(), "strong_intra_smoothing_enable_flag" ); @@ -810,7 +817,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } case SPS_EXT__NEXT: { - codeSPSNext( pcSPS->getSpsNext(), pcSPS->getUsePCM() ); + codeSPSNext( pcSPS->getSpsNext(), pcSPS->getPCMEnabledFlag() ); break; } default: @@ -1088,7 +1095,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enabled_flag" ); } } - if( pcSlice->getSPS()->getUseSAO() ) + if( pcSlice->getSPS()->getSAOEnabledFlag() ) { WRITE_FLAG( pcSlice->getSaoEnabledFlag( CHANNEL_TYPE_LUMA ), "slice_sao_luma_flag" ); if( chromaEnabled ) @@ -1097,7 +1104,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) } } - if( pcSlice->getSPS()->getUseALF() ) + if( pcSlice->getSPS()->getALFEnabledFlag() ) { alf( pcSlice->getAlfSliceParam() ); } @@ -1257,12 +1264,12 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) CHECK( pcSlice->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported" ); WRITE_UVLC( MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "six_minus_max_num_merge_cand" ); - if ( pcSlice->getSPS()->getSpsNext().getUseSubPuMvp() && !pcSlice->getSPS()->getSpsNext().getUseAffine() ) // ATMVP only + if ( pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getSpsNext().getUseAffine() ) // ATMVP only { CHECK( pcSlice->getMaxNumAffineMergeCand() != 1, "Sub-block merge can number should be 1" ); } else - if ( !pcSlice->getSPS()->getSpsNext().getUseSubPuMvp() && !pcSlice->getSPS()->getSpsNext().getUseAffine() ) // both off + if ( !pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getSpsNext().getUseAffine() ) // both off { CHECK( pcSlice->getMaxNumAffineMergeCand() != 0, "Sub-block merge can number should be 0" ); } @@ -1310,7 +1317,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) } } - bool isSAOEnabled = pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (chromaEnabled && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA))); + bool isSAOEnabled = pcSlice->getSPS()->getSAOEnabledFlag() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (chromaEnabled && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA))); bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable()); if(pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) -- GitLab