diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index d96918acc4d041103796214cdff550ff7a83c7df..2623b68cfa205f29417958f6599fb4a04ab5b924 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -349,7 +349,7 @@ unsigned DeriveCtx::CtxQtCbf( const ComponentID compID, const unsigned trDepth, unsigned DeriveCtx::CtxInterDir( const PredictionUnit& pu ) { - if( pu.cs->sps->getSpsNext().getUseLargeCTU() ) + if( pu.cs->sps->getUseLargeCTU() ) { return Clip3( 0, 3, 7 - ( ( g_aucLog2[pu.lumaSize().width] + g_aucLog2[pu.lumaSize().height] + 1 ) >> 1 ) ); // VG-ASYMM DONE } diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 47ef0df979b85e92a2b0a499fd8bdd48b3bc62ce..6e35e11fd67f2dfda8550b54424ed0854e803e89 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -516,7 +516,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) } #endif - if (pu.cu->cs->sps->getSpsNext().getUseGBi() && bioApplied && pu.cu->GBiIdx != GBI_DEFAULT) + if (pu.cu->cs->sps->getUseGBi() && bioApplied && pu.cu->GBiIdx != GBI_DEFAULT) { bioApplied = false; } diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index 07b2d366e5bf57f777e03c195453ba39283047c4..76b033f697806ac46c4dc94d3adfdc1678b9a5c0 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -1639,7 +1639,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom } } #if JVET_M0142_CCLM_COLLOCATED_CHROMA - else if( pu.cs->sps->getSpsNext().getCclmCollocatedChromaFlag() ) + else if( pu.cs->sps->getCclmCollocatedChromaFlag() ) { piSrc = pRecSrc0 - iRecStride2; @@ -1686,7 +1686,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom for (int j = 0; j < uiCHeight + addedLeftBelow; j++) { #if JVET_M0142_CCLM_COLLOCATED_CHROMA - if( pu.cs->sps->getSpsNext().getCclmCollocatedChromaFlag() ) + if( pu.cs->sps->getCclmCollocatedChromaFlag() ) { if( j == 0 && !bAboveAvaillable ) { @@ -1722,7 +1722,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom for( int i = 0; i < uiCWidth; i++ ) { #if JVET_M0142_CCLM_COLLOCATED_CHROMA - if( pu.cs->sps->getSpsNext().getCclmCollocatedChromaFlag() ) + if( pu.cs->sps->getCclmCollocatedChromaFlag() ) { if( i == 0 && !bLeftAvaillable ) { diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index 32e4f6d190452d6cf7f3469c078fcd7acac3775d..4a484f6c43082285884d61a766d2fb6934efafa2 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -696,7 +696,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De void LoopFilter::deriveLADFShift( const Pel* src, const int stride, int& shift, const DeblockEdgeDir edgeDir, const SPS sps ) { uint32_t lumaLevel = 0; - shift = sps.getSpsNext().getLadfQpOffset(0); + shift = sps.getLadfQpOffset(0); if (edgeDir == EDGE_VER) { @@ -707,12 +707,12 @@ void LoopFilter::deriveLADFShift( const Pel* src, const int stride, int& shift, lumaLevel = (src[0] + src[3] + src[-stride] + src[-stride + 3]) >> 2; } - for ( int k = 1; k < sps.getSpsNext().getLadfNumIntervals(); k++ ) + for ( int k = 1; k < sps.getLadfNumIntervals(); k++ ) { - const int th = sps.getSpsNext().getLadfIntervalLowerBound( k ); + const int th = sps.getLadfIntervalLowerBound( k ); if ( lumaLevel > th ) { - shift = sps.getSpsNext().getLadfQpOffset( k ); + shift = sps.getLadfQpOffset( k ); } else { @@ -816,7 +816,7 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge iQP = (cuP.qp + cuQ.qp + 1) >> 1; #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET - if ( sps.getSpsNext().getLadfEnabled() ) + if ( sps.getLadfEnabled() ) { int iShift = 0; deriveLADFShift( piTmpSrc + iSrcStep * (iIdx*pelsInPart), iStride, iShift, edgeDir, sps ); diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 4d7baad355343c9e09df8a461667fbaafb5469be..2d133ae86f75ad6a3d8e54b25172c79f009fe48c 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -451,7 +451,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b } } #if JVET_M0483_IBC==0 - if (getSPS()->getSpsNext().getIBCMode()) + if (getSPS()->getIBCMode()) { RefPicSetLtCurr[NumPicLtCurr] = getPic(); //getPic()->setIsLongTerm(true); @@ -472,7 +472,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b if (getRapPicFlag()) { #if JVET_M0483_IBC==0 - if (getSPS()->getSpsNext().getIBCMode()) + if (getSPS()->getIBCMode()) { CHECK(numPicTotalCurr != 1, "Invalid state"); } @@ -549,7 +549,7 @@ void Slice::setRefPicList( PicList& rcListPic, bool checkNumPocTotalCurr, bool b } } #if JVET_M0483_IBC==0 - if (getSPS()->getSpsNext().getIBCMode()) + if (getSPS()->getIBCMode()) { m_apcRefPicList[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = getPic(); m_bIsUsedAsLongTerm[REF_PIC_LIST_0][m_aiNumRefIdx[REF_PIC_LIST_0] - 1] = true; @@ -588,7 +588,7 @@ int Slice::getNumRpsCurrTempList() const #if JVET_M0483_IBC if (getSPS()->getIBCFlag()) #else - if (getSPS()->getSpsNext().getIBCMode()) + if (getSPS()->getIBCMode()) #endif { return numRpsCurrTempList + 1; @@ -1883,51 +1883,6 @@ SPSRExt::SPSRExt() } -SPSNext::SPSNext( SPS& sps ) - : m_SPS ( sps ) - , m_NextEnabled ( false ) - // disable all tool enabling flags by default - , m_LargeCTU ( false ) - , m_IMV ( false ) - , m_DisableMotionCompression ( false ) - , m_LMChroma ( false ) -#if JVET_M0142_CCLM_COLLOCATED_CHROMA - , m_cclmCollocatedChromaFlag ( false ) -#endif -#if JVET_M0464_UNI_MTS - , m_IntraMTS ( false ) - , m_InterMTS ( false ) -#else - , m_IntraEMT ( false ) - , m_InterEMT ( false ) -#endif - , m_Affine ( false ) - , m_AffineType ( false ) - , m_MTTEnabled ( false ) - , m_MHIntra ( false ) - , m_Triangle ( false ) -#if ENABLE_WPP_PARALLELISM - , m_NextDQP ( false ) -#endif -#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET - , m_LadfEnabled ( false ) - , m_LadfNumIntervals ( 0 ) - , m_LadfQpOffset { 0 } - , m_LadfIntervalLowerBound { 0 } -#endif - - // default values for additional parameters - , m_ImvMode ( IMV_OFF ) - , m_MTTMode ( 0 ) - , m_compositeRefEnabled ( false ) -#if !JVET_M0483_IBC - , m_IBCMode ( 0 ) -#endif -// ADD_NEW_TOOL : (sps extension) add tool enabling flags here (with "false" as default values) -{ -} - - SPS::SPS() : m_SPSId ( 0) , m_bIntraOnlyConstraintFlag (false) @@ -2003,7 +1958,6 @@ SPS::SPS() #endif , m_vuiParametersPresentFlag (false) , m_vuiParameters () -, m_spsNextExtension (*this) , m_wrapAroundEnabledFlag (false) , m_wrapAroundOffset ( 0) #if JVET_M0483_IBC @@ -2012,6 +1966,44 @@ SPS::SPS() #if JVET_M0427_INLOOP_RESHAPER , m_lumaReshapeEnable (false) #endif +// KJS: BEGIN former SPSNext parameters +, m_LargeCTU ( false ) +, m_IMV ( false ) +, m_DisableMotionCompression ( false ) +, m_LMChroma ( false ) +#if JVET_M0142_CCLM_COLLOCATED_CHROMA +, m_cclmCollocatedChromaFlag ( false ) +#endif +#if JVET_M0464_UNI_MTS +, m_IntraMTS ( false ) +, m_InterMTS ( false ) +#else +, m_IntraEMT ( false ) +, m_InterEMT ( false ) +#endif +, m_Affine ( false ) +, m_AffineType ( false ) +, m_MTTEnabled ( false ) +, m_MHIntra ( false ) +, m_Triangle ( false ) +#if ENABLE_WPP_PARALLELISM +, m_NextDQP ( false ) +#endif +#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET +, m_LadfEnabled ( false ) +, m_LadfNumIntervals ( 0 ) +, m_LadfQpOffset { 0 } +, m_LadfIntervalLowerBound { 0 } +#endif + +// default values for additional parameters +, m_ImvMode ( IMV_OFF ) +, m_MTTMode ( 0 ) +, m_compositeRefEnabled ( false ) +#if !JVET_M0483_IBC +, m_IBCMode ( 0 ) +#endif +// KJS: END former SPSNext parameters { 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 9fc9cca4f2357b67d16f09c708465d9888d4e812..df6cb19ccdebdad3f634c7593fb13ff3f309ab9d 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -822,151 +822,6 @@ public: }; -class SPS; - -// Deprecated: SPSNext is going to be removed! Do not add any parameters to SPSNext -class SPSNext -{ -private: - SPS& m_SPS; - - bool m_NextEnabled; - //===== tool enabling flags (4 bytes - NOTE: last flag must be used for new extensions) ===== - bool m_LargeCTU; // 5 - bool m_IMV; // 9 - bool m_DisableMotionCompression; // 13 - bool m_LMChroma; // 17 -#if JVET_M0142_CCLM_COLLOCATED_CHROMA - bool m_cclmCollocatedChromaFlag; -#endif -#if JVET_M0303_IMPLICIT_MTS - bool m_MTS; -#endif -#if JVET_M0464_UNI_MTS - bool m_IntraMTS; // 18 - bool m_InterMTS; // 19 -#else - bool m_IntraEMT; // 18 - bool m_InterEMT; // 19 -#endif - bool m_Affine; - bool m_AffineType; - bool m_GBi; // - bool m_MTTEnabled; // - bool m_MHIntra; - bool m_Triangle; -#if ENABLE_WPP_PARALLELISM - bool m_NextDQP; -#endif -#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET - bool m_LadfEnabled; - int m_LadfNumIntervals; - int m_LadfQpOffset[MAX_LADF_INTERVALS]; - int m_LadfIntervalLowerBound[MAX_LADF_INTERVALS]; -#endif - -public: - const static int NumReservedFlags = 32 - 27; /* current number of tool enabling flags */ - -private: - //===== additional parameters ===== - // qtbt - //imv - ImvMode m_ImvMode; - // multi type tree (QTBT + triple split) - unsigned m_MTTMode; - - bool m_compositeRefEnabled; //composite longterm reference -#if !JVET_M0483_IBC - unsigned m_IBCMode; -#endif - -public: - SPSNext( SPS& sps ); - - const SPS& getSPS () const { return m_SPS; } - SPS& getSPS () { return m_SPS; } - bool nextToolsEnabled () const { return m_NextEnabled; } - void setNextToolsEnabled ( bool next ) { m_NextEnabled = next; } - - //===== tool enabling flags and extension bit ===== - void setUseLargeCTU ( bool b ) { m_LargeCTU = b; } - bool getUseLargeCTU () const { return m_LargeCTU; } - 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 setDisableMotCompress ( bool b ) { m_DisableMotionCompression = b; } - bool getDisableMotCompress () const { return m_DisableMotionCompression; } - bool getMTTEnabled () const { return m_MTTEnabled; } -#if ENABLE_WPP_PARALLELISM - void setUseNextDQP ( bool b ) { m_NextDQP = b; } - bool getUseNextDQP () const { return m_NextDQP; } -#endif - void setUseLMChroma ( bool b ) { m_LMChroma = b; } - bool getUseLMChroma () const { return m_LMChroma; } -#if JVET_M0142_CCLM_COLLOCATED_CHROMA - void setCclmCollocatedChromaFlag( bool b ) { m_cclmCollocatedChromaFlag = b; } - bool getCclmCollocatedChromaFlag() const { return m_cclmCollocatedChromaFlag; } -#endif -#if JVET_M0303_IMPLICIT_MTS - void setUseMTS ( bool b ) { m_MTS = b; } - bool getUseMTS () const { return m_MTS; } -#if JVET_M0464_UNI_MTS - bool getUseImplicitMTS () const { return m_MTS && !m_IntraMTS && !m_InterMTS; } -#else - bool getUseImplicitMTS () const { return m_MTS && !m_IntraEMT && !m_InterEMT; } -#endif -#endif -#if JVET_M0464_UNI_MTS - void setUseIntraMTS ( bool b ) { m_IntraMTS = b; } - bool getUseIntraMTS () const { return m_IntraMTS; } - void setUseInterMTS ( bool b ) { m_InterMTS = b; } - bool getUseInterMTS () const { return m_InterMTS; } -#else - void setUseIntraEMT ( bool b ) { m_IntraEMT = b; } - bool getUseIntraEMT () const { return m_IntraEMT; } - void setUseInterEMT ( bool b ) { m_InterEMT = b; } - bool getUseInterEMT () const { return m_InterEMT; } -#endif - void setUseGBi ( bool b ) { m_GBi = b; } - bool getUseGBi () const { return m_GBi; } -#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET - void setLadfEnabled ( bool b ) { m_LadfEnabled = b; } - bool getLadfEnabled () const { return m_LadfEnabled; } - void setLadfNumIntervals ( int i ) { m_LadfNumIntervals = i; } - int getLadfNumIntervals () const { return m_LadfNumIntervals; } - void setLadfQpOffset ( int value, int idx ) { m_LadfQpOffset[ idx ] = value; } - int getLadfQpOffset ( int idx ) const { return m_LadfQpOffset[ idx ]; } - void setLadfIntervalLowerBound( int value, int idx ) { m_LadfIntervalLowerBound[ idx ] = value; } - int getLadfIntervalLowerBound( int idx ) const { return m_LadfIntervalLowerBound[ idx ]; } -#endif - //===== additional parameters ===== - // qtbt - // sub pu tmvp - void setImvMode(ImvMode m) { m_ImvMode = m; m_IMV = m != 0; } - ImvMode getImvMode () const { return m_ImvMode; } - - // multi type tree - unsigned getMTTMode () const { return m_MTTMode; } - void setMTTMode ( unsigned mode ) { m_MTTMode = mode; m_MTTEnabled = ( m_MTTMode != 0 ); } - - void setUseCompositeRef(bool b) { m_compositeRefEnabled = b; } - bool getUseCompositeRef() const { return m_compositeRefEnabled; } - - void setUseMHIntra ( bool b ) { m_MHIntra = b; } - bool getUseMHIntra () const { return m_MHIntra; } - void setUseTriangle ( bool b ) { m_Triangle = b; } - bool getUseTriangle () const { return m_Triangle; } -#if !JVET_M0483_IBC - void setIBCMode (unsigned IBCMode) { m_IBCMode = IBCMode; } - unsigned getIBCMode () const { return m_IBCMode; } -#endif -}; - - /// SPS class class SPS { @@ -1078,7 +933,6 @@ private: VUI m_vuiParameters; SPSRExt m_spsRangeExtension; - SPSNext m_spsNextExtension; static const int m_winUnitX[NUM_CHROMA_FORMAT]; static const int m_winUnitY[NUM_CHROMA_FORMAT]; @@ -1095,6 +949,51 @@ private: #if JVET_M0427_INLOOP_RESHAPER bool m_lumaReshapeEnable; #endif + // KJS: BEGIN former SPSNext parameters + bool m_LargeCTU; // 5 + bool m_IMV; // 9 + bool m_DisableMotionCompression; // 13 + bool m_LMChroma; // 17 +#if JVET_M0142_CCLM_COLLOCATED_CHROMA + bool m_cclmCollocatedChromaFlag; +#endif +#if JVET_M0303_IMPLICIT_MTS + bool m_MTS; +#endif +#if JVET_M0464_UNI_MTS + bool m_IntraMTS; // 18 + bool m_InterMTS; // 19 +#else + bool m_IntraEMT; // 18 + bool m_InterEMT; // 19 +#endif + bool m_Affine; + bool m_AffineType; + bool m_GBi; // + bool m_MTTEnabled; // + bool m_MHIntra; + bool m_Triangle; +#if ENABLE_WPP_PARALLELISM + bool m_NextDQP; +#endif +#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET + bool m_LadfEnabled; + int m_LadfNumIntervals; + int m_LadfQpOffset[MAX_LADF_INTERVALS]; + int m_LadfIntervalLowerBound[MAX_LADF_INTERVALS]; +#endif + //===== additional parameters ===== + //imv + ImvMode m_ImvMode; + // multi type tree (QTBT + triple split) + unsigned m_MTTMode; + + bool m_compositeRefEnabled; //composite longterm reference +#if !JVET_M0483_IBC + unsigned m_IBCMode; +#endif + // KJS: END former SPSNext parameters + public: @@ -1310,9 +1209,6 @@ public: const SPSRExt& getSpsRangeExtension() const { return m_spsRangeExtension; } SPSRExt& getSpsRangeExtension() { return m_spsRangeExtension; } - const SPSNext& getSpsNext() const { return m_spsNextExtension; } - SPSNext& getSpsNext() { return m_spsNextExtension; } - void setWrapAroundEnabledFlag(bool b) { m_wrapAroundEnabledFlag = b; } bool getWrapAroundEnabledFlag() const { return m_wrapAroundEnabledFlag; } void setWrapAroundOffset(unsigned offset) { m_wrapAroundOffset = offset; } @@ -1331,6 +1227,83 @@ public: void setMaxSbtSize( uint8_t val ) { m_MaxSbtSize = val; } uint8_t getMaxSbtSize() const { return m_MaxSbtSize; } #endif + + // KJS: BEGIN former SPSNext parameters + void setUseLargeCTU ( bool b ) { m_LargeCTU = b; } + bool getUseLargeCTU () const { return m_LargeCTU; } + 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 setDisableMotCompress ( bool b ) { m_DisableMotionCompression = b; } + bool getDisableMotCompress () const { return m_DisableMotionCompression; } + bool getMTTEnabled () const { return m_MTTEnabled; } +#if ENABLE_WPP_PARALLELISM + void setUseNextDQP ( bool b ) { m_NextDQP = b; } + bool getUseNextDQP () const { return m_NextDQP; } +#endif + void setUseLMChroma ( bool b ) { m_LMChroma = b; } + bool getUseLMChroma () const { return m_LMChroma; } +#if JVET_M0142_CCLM_COLLOCATED_CHROMA + void setCclmCollocatedChromaFlag( bool b ) { m_cclmCollocatedChromaFlag = b; } + bool getCclmCollocatedChromaFlag() const { return m_cclmCollocatedChromaFlag; } +#endif +#if JVET_M0303_IMPLICIT_MTS + void setUseMTS ( bool b ) { m_MTS = b; } + bool getUseMTS () const { return m_MTS; } +#if JVET_M0464_UNI_MTS + bool getUseImplicitMTS () const { return m_MTS && !m_IntraMTS && !m_InterMTS; } +#else + bool getUseImplicitMTS () const { return m_MTS && !m_IntraEMT && !m_InterEMT; } +#endif +#endif +#if JVET_M0464_UNI_MTS + void setUseIntraMTS ( bool b ) { m_IntraMTS = b; } + bool getUseIntraMTS () const { return m_IntraMTS; } + void setUseInterMTS ( bool b ) { m_InterMTS = b; } + bool getUseInterMTS () const { return m_InterMTS; } +#else + void setUseIntraEMT ( bool b ) { m_IntraEMT = b; } + bool getUseIntraEMT () const { return m_IntraEMT; } + void setUseInterEMT ( bool b ) { m_InterEMT = b; } + bool getUseInterEMT () const { return m_InterEMT; } +#endif + void setUseGBi ( bool b ) { m_GBi = b; } + bool getUseGBi () const { return m_GBi; } +#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET + void setLadfEnabled ( bool b ) { m_LadfEnabled = b; } + bool getLadfEnabled () const { return m_LadfEnabled; } + void setLadfNumIntervals ( int i ) { m_LadfNumIntervals = i; } + int getLadfNumIntervals () const { return m_LadfNumIntervals; } + void setLadfQpOffset ( int value, int idx ) { m_LadfQpOffset[ idx ] = value; } + int getLadfQpOffset ( int idx ) const { return m_LadfQpOffset[ idx ]; } + void setLadfIntervalLowerBound( int value, int idx ) { m_LadfIntervalLowerBound[ idx ] = value; } + int getLadfIntervalLowerBound( int idx ) const { return m_LadfIntervalLowerBound[ idx ]; } +#endif + //===== additional parameters ===== + // qtbt + // sub pu tmvp + void setImvMode(ImvMode m) { m_ImvMode = m; m_IMV = m != 0; } + ImvMode getImvMode () const { return m_ImvMode; } + + // multi type tree + unsigned getMTTMode () const { return m_MTTMode; } + void setMTTMode ( unsigned mode ) { m_MTTMode = mode; m_MTTEnabled = ( m_MTTMode != 0 ); } + + void setUseCompositeRef(bool b) { m_compositeRefEnabled = b; } + bool getUseCompositeRef() const { return m_compositeRefEnabled; } + + void setUseMHIntra ( bool b ) { m_MHIntra = b; } + bool getUseMHIntra () const { return m_MHIntra; } + void setUseTriangle ( bool b ) { m_Triangle = b; } + bool getUseTriangle () const { return m_Triangle; } +#if !JVET_M0483_IBC + void setIBCMode (unsigned IBCMode) { m_IBCMode = IBCMode; } + unsigned getIBCMode () const { return m_IBCMode; } +#endif + // KJS: END former SPSNext parameters }; @@ -2288,7 +2261,7 @@ public: PreCalcValues( const SPS& sps, const PPS& pps, bool _isEncoder ) : chrFormat ( sps.getChromaFormatIdc() ) , multiBlock422 ( false ) - , noMotComp ( sps.getSpsNext().getDisableMotCompress() ) + , noMotComp ( sps.getDisableMotCompress() ) , maxCUWidth ( sps.getMaxCUWidth() ) , maxCUHeight ( sps.getMaxCUHeight() ) , maxCUWidthMask ( maxCUWidth - 1 ) diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index 24487fb9a05bea975c171e8c038ce243fe7465d2..44ed81e06ca1d2ef668e3ea296060cecbf6328a4 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -293,13 +293,13 @@ void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf & void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTypeHor, int &trTypeVer ) { #if JVET_M0464_UNI_MTS - bool mtsActivated = CU::isIntra( *tu.cu ) ? tu.cs->sps->getSpsNext().getUseIntraMTS() : tu.cs->sps->getSpsNext().getUseInterMTS(); + bool mtsActivated = CU::isIntra( *tu.cu ) ? tu.cs->sps->getUseIntraMTS() : tu.cs->sps->getUseInterMTS(); #else - bool emtActivated = CU::isIntra( *tu.cu ) ? tu.cs->sps->getSpsNext().getUseIntraEMT() : tu.cs->sps->getSpsNext().getUseInterEMT(); + bool emtActivated = CU::isIntra( *tu.cu ) ? tu.cs->sps->getUseIntraEMT() : tu.cs->sps->getUseInterEMT(); #endif #if JVET_M0303_IMPLICIT_MTS - bool mtsImplicit = CU::isIntra( *tu.cu ) && tu.cs->sps->getSpsNext().getUseImplicitMTS() && compID == COMPONENT_Y; + bool mtsImplicit = CU::isIntra( *tu.cu ) && tu.cs->sps->getUseImplicitMTS() && compID == COMPONENT_Y; #endif trTypeHor = DCT2; diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp index 9482d41885e875db134a5676581ced37d256ebb1..5f79f8d2eaaed6c8e91581f09a32ce3be4ffd47a 100644 --- a/source/Lib/CommonLib/UnitPartitioner.cpp +++ b/source/Lib/CommonLib/UnitPartitioner.cpp @@ -249,7 +249,7 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur break; case CU_TRIH_SPLIT: case CU_TRIV_SPLIT: - CHECK( ( cs.sps->getSpsNext().getMTTMode() & 1 ) != 1, "Triple splits are not allowed" ); + CHECK( ( cs.sps->getMTTMode() & 1 ) != 1, "Triple splits are not allowed" ); m_partStack.push_back( PartLevel( split, PartitionerImpl::getCUSubPartitions( currArea(), cs, split ) ) ); break; case TU_MAX_TR_SPLIT: @@ -359,13 +359,13 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca if( canBtt && ( area.width <= minBtSize && area.height <= minBtSize ) && ( ( area.width <= minTtSize && area.height <= minTtSize ) - || cs.sps->getSpsNext().getMTTMode() == 0 ) ) + || cs.sps->getMTTMode() == 0 ) ) { canBtt = false; } if( canBtt && ( area.width > maxBtSize || area.height > maxBtSize ) && ( ( area.width > maxTtSize || area.height > maxTtSize ) - || cs.sps->getSpsNext().getMTTMode() == 0 ) ) + || cs.sps->getMTTMode() == 0 ) ) { canBtt = false; } @@ -384,12 +384,12 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca if( area.width <= minBtSize || area.width > maxBtSize ) canBv = false; if( area.width <= MAX_TU_SIZE_FOR_PROFILE && area.height > MAX_TU_SIZE_FOR_PROFILE ) canBv = false; - if( ( cs.sps->getSpsNext().getMTTMode() & 1 ) != 1 ) canTh = false; + if( ( cs.sps->getMTTMode() & 1 ) != 1 ) canTh = false; if( area.height <= 2 * minTtSize || area.height > maxTtSize || area.width > maxTtSize ) canTh = false; if( area.width > MAX_TU_SIZE_FOR_PROFILE || area.height > MAX_TU_SIZE_FOR_PROFILE ) canTh = false; - if( ( cs.sps->getSpsNext().getMTTMode() & 1 ) != 1 ) canTv = false; + if( ( cs.sps->getMTTMode() & 1 ) != 1 ) canTv = false; if( area.width <= 2 * minTtSize || area.width > maxTtSize || area.height > maxTtSize ) canTv = false; if( area.width > MAX_TU_SIZE_FOR_PROFILE || area.height > MAX_TU_SIZE_FOR_PROFILE ) canTv = false; @@ -515,9 +515,9 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs { if( currMtDepth >= maxBTD ) return false; if( ( area.width <= minBtSize && area.height <= minBtSize ) - && ( ( area.width <= minTtSize && area.height <= minTtSize ) || cs.sps->getSpsNext().getMTTMode() == 0 ) ) return false; + && ( ( area.width <= minTtSize && area.height <= minTtSize ) || cs.sps->getMTTMode() == 0 ) ) return false; if( ( area.width > maxBtSize || area.height > maxBtSize ) - && ( ( area.width > maxTtSize || area.height > maxTtSize ) || cs.sps->getSpsNext().getMTTMode() == 0 ) ) return false; + && ( ( area.width > maxTtSize || area.height > maxTtSize ) || cs.sps->getMTTMode() == 0 ) ) return false; if (CS::isDualITree(cs) && (area.width > 64 || area.height > 64)) { return false; @@ -543,12 +543,12 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs if( area.width <= MAX_TU_SIZE_FOR_PROFILE && area.height > MAX_TU_SIZE_FOR_PROFILE ) return false; break; case CU_TRIH_SPLIT: - if( ( cs.sps->getSpsNext().getMTTMode() & 1 ) != 1 ) return false; + if( ( cs.sps->getMTTMode() & 1 ) != 1 ) return false; if( area.height <= 2 * minTtSize || area.height > maxTtSize || area.width > maxTtSize) return false; if( area.width > MAX_TU_SIZE_FOR_PROFILE || area.height > MAX_TU_SIZE_FOR_PROFILE ) return false; break; case CU_TRIV_SPLIT: - if( ( cs.sps->getSpsNext().getMTTMode() & 1 ) != 1 ) return false; + if( ( cs.sps->getMTTMode() & 1 ) != 1 ) return false; if( area.width <= 2 * minTtSize || area.width > maxTtSize || area.height > maxTtSize) return false; if( area.width > MAX_TU_SIZE_FOR_PROFILE || area.height > MAX_TU_SIZE_FOR_PROFILE ) return false; break; @@ -1208,4 +1208,4 @@ Partitioning PartitionerImpl::getSbtTuTiling( const UnitArea& cuArea, const Codi return ret; } -#endif \ No newline at end of file +#endif diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index b8db822263aee84936cd6b3b53d048659e96ad91..aa9a7d9abbfb11db0d123ec90313b0182dfdf99b 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -190,7 +190,7 @@ int CU::predictQP( const CodingUnit& cu, const int prevQP ) const CodingStructure &cs = *cu.cs; #if ENABLE_WPP_PARALLELISM - if( cs.sps->getSpsNext().getUseNextDQP() ) + if( cs.sps->getUseNextDQP() ) { // Inter-CTU 2D "planar" c(orner) a(bove) // predictor arrangement: b(efore) p(rediction) @@ -799,7 +799,7 @@ bool PU::isLMCMode(unsigned mode) } bool PU::isLMCModeEnabled(const PredictionUnit &pu, unsigned mode) { - if ( pu.cs->sps->getSpsNext().getUseLMChroma() ) + if ( pu.cs->sps->getUseLMChroma() ) { return true; } @@ -1915,7 +1915,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, if (cnt > 1 && cnt < maxNumMergeCand) #else // skip when only 1 candidate is added so far or one is BV and one is MV - if( cnt > 1 && cnt < maxNumMergeCand && !(mrgCtx.mrgTypeNeighbours[0] != mrgCtx.mrgTypeNeighbours[1] && pu.cs->sps->getSpsNext().getIBCMode())) + if( cnt > 1 && cnt < maxNumMergeCand && !(mrgCtx.mrgTypeNeighbours[0] != mrgCtx.mrgTypeNeighbours[1] && pu.cs->sps->getIBCMode())) #endif #else for( int idx = 0; idx < end && cnt != maxNumMergeCand; idx++ ) @@ -1934,7 +1934,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #if !JVET_M0193_PAIR_AVG_REDUCTION && JVET_M0483_IBC==0 // skip when one is BV and one is MV - if (mrgCtx.mrgTypeNeighbours[i] != mrgCtx.mrgTypeNeighbours[j] && pu.cs->sps->getSpsNext().getIBCMode()) + if (mrgCtx.mrgTypeNeighbours[i] != mrgCtx.mrgTypeNeighbours[j] && pu.cs->sps->getIBCMode()) { continue; } @@ -1979,9 +1979,9 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #if JVET_M0483_IBC==0 #if JVET_M0193_PAIR_AVG_REDUCTION - if (mrgCtx.mrgTypeNeighbours[0] == MRG_TYPE_IBC && mrgCtx.mrgTypeNeighbours[1] == MRG_TYPE_IBC && pu.cs->sps->getSpsNext().getIBCMode()) + if (mrgCtx.mrgTypeNeighbours[0] == MRG_TYPE_IBC && mrgCtx.mrgTypeNeighbours[1] == MRG_TYPE_IBC && pu.cs->sps->getIBCMode()) #else - if (mrgCtx.mrgTypeNeighbours[i] == MRG_TYPE_IBC && mrgCtx.mrgTypeNeighbours[j] == MRG_TYPE_IBC && pu.cs->sps->getSpsNext().getIBCMode()) + if (mrgCtx.mrgTypeNeighbours[i] == MRG_TYPE_IBC && mrgCtx.mrgTypeNeighbours[j] == MRG_TYPE_IBC && pu.cs->sps->getIBCMode()) #endif { mrgCtx.mrgTypeNeighbours[cnt] = MRG_TYPE_IBC; @@ -4003,7 +4003,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx } } - if ( slice.getSPS()->getSpsNext().getUseAffine() ) + if ( slice.getSPS()->getUseAffine() ) { ///> Start: inherited affine candidates const PredictionUnit* npu[5]; @@ -4189,7 +4189,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx }; int verNum[6] = { 3, 3, 3, 3, 2, 2 }; - int startIdx = pu.cs->sps->getSpsNext().getUseAffineType() ? 0 : 4; + int startIdx = pu.cs->sps->getUseAffineType() ? 0 : 4; for ( int idx = startIdx; idx < modelNum; idx++ ) { int modelIdx = order[idx]; @@ -4422,7 +4422,7 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b ) { #if !JVET_M0409_ATMVP_FIX && JVET_M0483_IBC==0 - if (count == countIBC && pu.cs->slice->getSPS()->getSpsNext().getIBCMode()) + if (count == countIBC && pu.cs->slice->getSPS()->getIBCMode()) return false; #endif const Slice &slice = *pu.cs->slice; @@ -4547,7 +4547,7 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b mi.isIBCmot = false; if (colMi.isInter && colMi.isIBCmot == false) #else - if (colMi.isInter && !((colMi.interDir == 1 || colMi.interDir == 3) && (pColPic->cs->slice->getRefPOC(REF_PIC_LIST_0, colMi.refIdx[0]) == pColPic->cs->slice->getPOC()) && pu.cs->sps->getSpsNext().getIBCMode())) + if (colMi.isInter && !((colMi.interDir == 1 || colMi.interDir == 3) && (pColPic->cs->slice->getRefPOC(REF_PIC_LIST_0, colMi.refIdx[0]) == pColPic->cs->slice->getPOC()) && pu.cs->sps->getIBCMode())) #endif { for (unsigned currRefListId = 0; currRefListId < (bBSlice ? 2 : 1); currRefListId++) @@ -5619,7 +5619,7 @@ bool CU::isSameSbtSize( const uint8_t sbtInfo1, const uint8_t sbtInfo2 ) bool CU::isGBiIdxCoded( const CodingUnit &cu ) { - if( cu.cs->sps->getSpsNext().getUseGBi() == false ) + if( cu.cs->sps->getUseGBi() == false ) { CHECK(cu.GBiIdx != GBI_DEFAULT, "Error: cu.GBiIdx != GBI_DEFAULT"); return false; @@ -5776,7 +5776,7 @@ bool TU::isMTSAllowed(const TransformUnit &tu, const ComponentID compID) bool mtsAllowed = compID == COMPONENT_Y; const int maxSize = CU::isIntra( *tu.cu ) ? MTS_INTRA_MAX_CU_SIZE : MTS_INTER_MAX_CU_SIZE; - mtsAllowed &= CU::isIntra( *tu.cu ) ? tu.cs->sps->getSpsNext().getUseIntraMTS() : tu.cs->sps->getSpsNext().getUseInterMTS(); + mtsAllowed &= CU::isIntra( *tu.cu ) ? tu.cs->sps->getUseIntraMTS() : tu.cs->sps->getUseInterMTS(); mtsAllowed &= ( tu.lwidth() <= maxSize && tu.lheight() <= maxSize ); #if JVET_M0102_INTRA_SUBPARTITIONS mtsAllowed &= !tu.cu->ispMode; diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index a5b02932e319c652e9a153bf7b8cbf51aa180ad9..314bc79fcbe2476bf1ec003174d14e8bc679186b 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -446,7 +446,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } #if !JVET_M0464_UNI_MTS - if (!(!((cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getSpsNext().getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) + if (!(!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::EMTFlag), cu.emtFlag); } @@ -469,7 +469,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) } #if !JVET_M0464_UNI_MTS - if (!(!((cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getSpsNext().getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) + if (!(!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::EMTFlag_Chroma), cu.emtFlag); } @@ -863,13 +863,13 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::MMVDMergeIdx), pu.mmvdMergeIdx); } - if (!cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 + if (!cu.cs->slice->isIntra() && cu.cs->sps->getUseAffine() && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 && !pu.mmvdMergeFlag && !cu.mmvdSkip ) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::AffineFlag), pu.cu->affine); } - if (pu.cs->sps->getSpsNext().getUseMHIntra() && !pu.cu->skip && !pu.cu->affine && !(pu.cu->lwidth() * pu.cu->lheight() < 64 || pu.cu->lwidth() >= MAX_CU_SIZE || pu.cu->lheight() >= MAX_CU_SIZE) + if (pu.cs->sps->getUseMHIntra() && !pu.cu->skip && !pu.cu->affine && !(pu.cu->lwidth() * pu.cu->lheight() < 64 || pu.cu->lwidth() >= MAX_CU_SIZE || pu.cu->lheight() >= MAX_CU_SIZE) && !pu.mmvdMergeFlag ) { @@ -883,7 +883,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) } } } - if (cu.cs->slice->getSPS()->getSpsNext().getUseTriangle() && cu.cs->slice->isInterB() && cu.lwidth() * cu.lheight() >= TRIANGLE_MIN_SIZE && !cu.affine) + if (cu.cs->slice->getSPS()->getUseTriangle() && cu.cs->slice->isInterB() && cu.lwidth() * cu.lheight() >= TRIANGLE_MIN_SIZE && !cu.affine) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::TriangleFlag), cu.triangle); @@ -895,10 +895,10 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::InterDir), pu.interDir); } - if (!cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8) + if (!cu.cs->slice->isIntra() && cu.cs->sps->getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::AffineFlag), pu.cu->affine); - if (cu.affine && !cu.firstPU->mergeFlag && cu.cs->sps->getSpsNext().getUseAffineType()) + if (cu.affine && !cu.firstPU->mergeFlag && cu.cs->sps->getUseAffineType()) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::AffineType), pu.cu->affineType); } @@ -995,7 +995,7 @@ 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 (cu.cs->sps->getSpsNext().getUseIMV() && CU::hasSubCUNonZeroMVd(cu)) + if (cu.cs->sps->getUseIMV() && CU::hasSubCUNonZeroMVd(cu)) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::IMVMode), cu.imv); } @@ -1054,7 +1054,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) } } #if !JVET_M0464_UNI_MTS - if (!(!((cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getSpsNext().getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) + if (!(!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && CU::isInter(cu))) || isChroma(cu.chType))) { if( isLuma( ChannelType( chType ) ) ) { diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index c30c7921fa319ef72cd0e1f4bfb0475a64c11105..023d97aa6e74b69be5cc7ff26eb6e5966ed5a3a7 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -1006,7 +1006,7 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__OTHER ); - if( !cu.cs->sps->getSpsNext().getUseIMV() ) + if( !cu.cs->sps->getUseIMV() ) { return; } @@ -1024,7 +1024,7 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) } #endif - const SPSNext& spsNext = cu.cs->sps->getSpsNext(); + const SPS *sps = cu.cs->sps; unsigned value = 0; unsigned ctxId = DeriveCtx::CtxIMVFlag( cu ); @@ -1038,7 +1038,7 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx ) value = m_BinDecoder.decodeBin( Ctx::ImvFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, ctxId ); - if( spsNext.getImvMode() == IMV_4PEL && value ) + if( sps->getImvMode() == IMV_4PEL && value ) { value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 3 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 3 ); @@ -1443,7 +1443,7 @@ void CABACReader::intra_chroma_pred_mode( PredictionUnit& pu ) } // LM chroma mode - if( pu.cs->sps->getSpsNext().getUseLMChroma() ) + if( pu.cs->sps->getUseLMChroma() ) { if( intra_chroma_lmc_mode( pu ) ) { @@ -1771,7 +1771,7 @@ void CABACReader::subblock_merge_flag( CodingUnit& cu ) return; } - if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getSpsNext().getUseAffine() || cu.cs->sps->getSBTMVPEnabledFlag()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) + if ( !cu.cs->slice->isIntra() && (cu.cs->sps->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 ); @@ -1783,7 +1783,7 @@ void CABACReader::subblock_merge_flag( CodingUnit& cu ) void CABACReader::affine_flag( CodingUnit& cu ) { - if ( !cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8 ) + if ( !cu.cs->slice->isIntra() && cu.cs->sps->getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8 ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG ); @@ -1791,7 +1791,7 @@ void CABACReader::affine_flag( CodingUnit& cu ) cu.affine = m_BinDecoder.decodeBin( Ctx::AffineFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "affine_flag() affine=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y ); - if ( cu.affine && cu.cs->sps->getSpsNext().getUseAffineType() ) + if ( cu.affine && cu.cs->sps->getUseAffineType() ) { ctxId = 0; cu.affineType = m_BinDecoder.decodeBin( Ctx::AffineType( ctxId ) ); @@ -2109,7 +2109,7 @@ void CABACReader::mvp_flag( PredictionUnit& pu, RefPicList eRefList ) void CABACReader::MHIntra_flag(PredictionUnit& pu) { - if (!pu.cs->sps->getSpsNext().getUseMHIntra()) + if (!pu.cs->sps->getUseMHIntra()) { pu.mhIntraFlag = false; return; @@ -2239,7 +2239,7 @@ void CABACReader::triangle_mode( CodingUnit& cu ) { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__TRIANGLE_FLAG ); - if( !cu.cs->slice->getSPS()->getSpsNext().getUseTriangle() || !cu.cs->slice->isInterB() || cu.lwidth() * cu.lheight() < TRIANGLE_MIN_SIZE || cu.affine ) + if( !cu.cs->slice->getSPS()->getUseTriangle() || !cu.cs->slice->isInterB() || cu.lwidth() * cu.lheight() < TRIANGLE_MIN_SIZE || cu.affine ) { return; } @@ -2799,7 +2799,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) int state = 0; #if !JVET_M0464_UNI_MTS - bool useEmt = ( cu.cs->sps->getSpsNext().getUseIntraEMT() && cu.predMode == MODE_INTRA ) || ( cu.cs->sps->getSpsNext().getUseInterEMT() && cu.predMode != MODE_INTRA ); + bool useEmt = ( cu.cs->sps->getUseIntraEMT() && cu.predMode == MODE_INTRA ) || ( cu.cs->sps->getUseInterEMT() && cu.predMode != MODE_INTRA ); useEmt = useEmt && isLuma(compID); #if JVET_M0102_INTRA_SUBPARTITIONS useEmt = useEmt && !cu.ispMode; @@ -2945,9 +2945,9 @@ void CABACReader::emt_cu_flag( CodingUnit& cu ) const CodingStructure &cs = *cu.cs; #if JVET_M0483_IBC - if (!((cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getSpsNext().getUseInterEMT() && !CU::isIntra(cu))) || isChroma(cu.chType)) + if (!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && !CU::isIntra(cu))) || isChroma(cu.chType)) #else - if( !( ( cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra( cu ) ) || ( cs.sps->getSpsNext().getUseInterEMT() && CU::isInter( cu ) ) ) || isChroma( cu.chType ) ) + if( !( ( cs.sps->getUseIntraEMT() && CU::isIntra( cu ) ) || ( cs.sps->getUseInterEMT() && CU::isInter( cu ) ) ) || isChroma( cu.chType ) ) #endif { return; diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 4460dc6ac748f5f4a1c1828815b71c8b0113a724..8a85f4cc748f6b1789d92f6f44eece7df1bdf674 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -217,7 +217,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) #if JVET_M0483_IBC bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); #else - bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag()) || (slice.getSliceType() == P_SLICE && slice.getSPS()->getSpsNext().getIBCMode())); + bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag()) || (slice.getSliceType() == P_SLICE && slice.getSPS()->getIBCMode())); #endif if (flag && slice.getReshapeInfo().getSliceReshapeChromaAdj() && (compID != COMPONENT_Y)) { @@ -280,7 +280,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) #if JVET_M0483_IBC if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) #else - if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra() || (slice.getSliceType() == P_SLICE && slice.getSPS()->getSpsNext().getIBCMode())) && compID == COMPONENT_Y) + if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra() || (slice.getSliceType() == P_SLICE && slice.getSPS()->getIBCMode())) && compID == COMPONENT_Y) #endif { #if REUSE_CU_RESULTS @@ -303,7 +303,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) #if JVET_M0483_IBC if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra()) && compID == COMPONENT_Y) #else - if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra() || (slice.getSliceType() == P_SLICE && slice.getSPS()->getSpsNext().getIBCMode())) && compID == COMPONENT_Y) + if (slice.getReshapeInfo().getUseSliceReshaper() && (m_pcReshape->getCTUFlag() || slice.isIntra() || (slice.getSliceType() == P_SLICE && slice.getSPS()->getIBCMode())) && compID == COMPONENT_Y) #endif { #if REUSE_CU_RESULTS diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index bf11480a35980cd9a366cbb259af6ef7166b0878..6190cfb5b474d53e4570dcd60527186eca241b33 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1302,7 +1302,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl #if JVET_M0483_IBC if (pcSlice->getSPS()->getIBCFlag() && pcSlice->getEnableTMVPFlag()) #else - if (pcSlice->getSPS()->getSpsNext().getIBCMode() && pcSlice->getEnableTMVPFlag()) + if (pcSlice->getSPS()->getIBCMode() && pcSlice->getEnableTMVPFlag()) #endif { CHECK(pcSlice->getRefPic(RefPicList(pcSlice->isInterB() ? 1 - pcSlice->getColFromL0Flag() : 0), pcSlice->getColRefIdx())->getPOC() == pcSlice->getPOC(), "curr ref picture cannot be collocated picture"); @@ -1323,7 +1323,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl #if JVET_M0483_IBC if ((pcSlice->getSliceType() == I_SLICE) && m_cReshaper.getSliceReshaperInfo().getUseSliceReshaper()) #else - if ((pcSlice->getSliceType() == I_SLICE || (pcSlice->getSliceType() == P_SLICE && pcSlice->getSPS()->getSpsNext().getIBCMode())) && m_cReshaper.getSliceReshaperInfo().getUseSliceReshaper()) + if ((pcSlice->getSliceType() == I_SLICE || (pcSlice->getSliceType() == P_SLICE && pcSlice->getSPS()->getIBCMode())) && m_cReshaper.getSliceReshaperInfo().getUseSliceReshaper()) #endif { m_cReshaper.setCTUFlag(false); @@ -1359,7 +1359,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_bFirstSliceInPicture = false; #if JVET_M0483_IBC==0 - if (pcSlice->getSPS()->getSpsNext().getIBCMode()) + if (pcSlice->getSPS()->getIBCMode()) { pcSlice->getPic()->longTerm = false; } diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index b6c4618d4e575b76a2516ee6d8d93ed530167f70..25192a92f8b4b5fbf6af555b3bc622e61e0e2f59 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -782,89 +782,6 @@ void HLSyntaxReader::parseHrdParameters(HRD *hrd, bool commonInfPresentFlag, uin } } - -void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) -{ - unsigned symbol = 0; - - // tool enabling flags - READ_FLAG( symbol, "large_ctu_flag" ); spsNext.setUseLargeCTU ( symbol != 0 ); - READ_FLAG( symbol, "imv_enable_flag" ); spsNext.setUseIMV ( 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_M0142_CCLM_COLLOCATED_CHROMA - if ( spsNext.getUseLMChroma() && spsNext.getSPS().getChromaFormatIdc() == CHROMA_420 ) - { - READ_FLAG( symbol, "sps_cclm_collocated_chroma_flag" ); spsNext.setCclmCollocatedChromaFlag( symbol != 0 ); - } -#endif - -#if JVET_M0303_IMPLICIT_MTS - READ_FLAG( symbol, "mts_enabled_flag" ); spsNext.setUseMTS ( symbol != 0 ); - if ( spsNext.getUseMTS() ) - { -#endif -#if JVET_M0464_UNI_MTS - READ_FLAG( symbol, "mts_intra_enabled_flag" ); spsNext.setUseIntraMTS ( symbol != 0 ); - READ_FLAG( symbol, "mts_inter_enabled_flag" ); spsNext.setUseInterMTS ( symbol != 0 ); -#else - READ_FLAG( symbol, "emt_intra_enabled_flag" ); spsNext.setUseIntraEMT ( symbol != 0 ); - READ_FLAG( symbol, "emt_inter_enabled_flag" ); spsNext.setUseInterEMT ( symbol != 0 ); -#endif -#if JVET_M0303_IMPLICIT_MTS - } -#endif - - READ_FLAG( symbol, "affine_flag" ); spsNext.setUseAffine ( symbol != 0 ); - if ( spsNext.getUseAffine() ) - { - READ_FLAG( symbol, "affine_type_flag" ); spsNext.setUseAffineType ( symbol != 0 ); - } - READ_FLAG( symbol, "gbi_flag" ); spsNext.setUseGBi ( symbol != 0 ); -#if JVET_M0483_IBC==0 - READ_FLAG( symbol, "ibc_flag"); spsNext.setIBCMode ( symbol != 0 ); -#endif - for( int k = 0; k < SPSNext::NumReservedFlags; k++ ) - { - READ_FLAG( symbol, "reserved_flag" ); if( symbol != 0 ) EXIT("Incompatible version: SPSNext reserved flag not equal to zero (bitstream was probably created with newer software version)" ); - } - READ_FLAG( symbol, "mtt_enabled_flag" ); spsNext.setMTTMode ( symbol ); - READ_FLAG( symbol, "mhintra_flag" ); spsNext.setUseMHIntra ( symbol != 0 ); - READ_FLAG( symbol, "triangle_flag" ); spsNext.setUseTriangle ( symbol != 0 ); -#if ENABLE_WPP_PARALLELISM - READ_FLAG( symbol, "next_dqp_enabled_flag" ); spsNext.setUseNextDQP ( symbol != 0 ); -#else - READ_FLAG( symbol, "reserved_flag" ); CHECK( symbol, "reserved flag not 0!" ); -#endif - - if( spsNext.getUseIMV() ) - { - READ_UVLC( symbol, "imv_mode_minus1" ); spsNext.setImvMode( ImvMode( symbol + 1 ) ); - } - if( spsNext.getMTTEnabled() ) - { - READ_UVLC( symbol, "mtt_mode_minus1" ); spsNext.setMTTMode( symbol + 1 ); - } - - -#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET - READ_FLAG( symbol, "sps_ladf_enabled_flag" ); spsNext.setLadfEnabled( symbol != 0 ); - if ( spsNext.getLadfEnabled() ) - { - int signedSymbol = 0; - READ_CODE( 2, symbol, "sps_num_ladf_intervals_minus2"); spsNext.setLadfNumIntervals( symbol + 2 ); - READ_SVLC(signedSymbol, "sps_ladf_lowest_interval_qp_offset" ); spsNext.setLadfQpOffset( signedSymbol, 0 ); - for ( int k = 1; k < spsNext.getLadfNumIntervals(); k++ ) - { - READ_SVLC(signedSymbol, "sps_ladf_qp_offset" ); spsNext.setLadfQpOffset( signedSymbol, k ); - READ_UVLC( symbol, "sps_ladf_delta_threshold_minus1"); - spsNext.setLadfIntervalLowerBound(symbol + spsNext.getLadfIntervalLowerBound(k - 1) + 1, k); - } - } -#endif - // ADD_NEW_TOOL : (sps extension parser) read tool enabling flags and associated parameters here -} - #if JVET_M0427_INLOOP_RESHAPER void HLSyntaxReader::parseReshaper(SliceReshapeInfo& info, const SPS* pcSPS, const bool isIntra) { @@ -905,11 +822,17 @@ void HLSyntaxReader::parseReshaper(SliceReshapeInfo& info, const SPS* pcSPS, con #endif void HLSyntaxReader::parseSPS(SPS* pcSPS) { + uint32_t uiCode; + #if ENABLE_TRACING xTraceSPSHeader (); #endif +#if HEVC_VPS + READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); +#endif + READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); + CHECK(uiCode > 15, "Invalid SPS id signalled"); - uint32_t uiCode; READ_FLAG(uiCode, "intra_only_constraint_flag"); pcSPS->setIntraOnlyConstraintFlag(uiCode > 0 ? true : false); READ_CODE(4, uiCode, "max_bitdepth_constraint_idc"); pcSPS->setMaxBitDepthConstraintIdc(uiCode); READ_CODE(2, uiCode, "max_chroma_format_constraint_idc"); pcSPS->setMaxChromaFormatConstraintIdc(uiCode); @@ -927,28 +850,22 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG(uiCode, "no_ladf_constraint_flag"); pcSPS->setNoLadfConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_dep_quant_constraint_flag"); pcSPS->setNoDepQuantConstraintFlag(uiCode > 0 ? true : false); READ_FLAG(uiCode, "no_sign_data_hiding_constraint_flag"); pcSPS->setNoSignDataHidingConstraintFlag(uiCode > 0 ? true : false); -#if JVET_M0483_IBC - READ_FLAG(uiCode, "ibc_flag"); pcSPS->setIBCFlag(uiCode); -#endif -#if HEVC_VPS - READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); -#endif + + // KJS: Marakech decision: sub-layers added back READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); CHECK(uiCode > 6, "Invalid maximum number of T-layer signalled"); - READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); if ( pcSPS->getMaxTLayers() == 1 ) { // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 CHECK( uiCode != 1, "Invalid maximum number of T-layers" ); } - parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); - READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); - CHECK(uiCode > 15, "Invalid SPS id signalled"); READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) ); CHECK(uiCode > 3, "Invalid chroma format signalled"); + + // KJS: ENABLE_CHROMA_422 does not exist anymore o.O if( pcSPS->getChromaFormatIdc() == CHROMA_422 ) { EXIT( "Error: 4:2:2 chroma sampling format not supported with current compiler setting." @@ -962,6 +879,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); + + // KJS: not removing yet READ_FLAG( uiCode, "conformance_window_flag"); if (uiCode != 0) { @@ -986,6 +905,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); CHECK(uiCode > 12, "Invalid code"); + // KJS: Marakech decision: sub-layers added back uint32_t subLayerOrderingInfoPresentFlag; READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); @@ -1015,8 +935,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) unsigned maxBTSize[3] = { 0, 0, 0 }; unsigned maxTTSize[3] = { 0, 0, 0 }; - READ_FLAG(uiCode, "qtbt_dual_intra_tree"); pcSPS->setUseDualITree(uiCode); - READ_UVLC(uiCode, "log2_CTU_size_minus2"); pcSPS->setCTUSize(1 << (uiCode + 2)); + READ_FLAG(uiCode, "qtbtt_dual_tree_intra_flag"); pcSPS->setUseDualITree(uiCode); + READ_UVLC(uiCode, "log2_ctu_size_minus2"); pcSPS->setCTUSize(1 << (uiCode + 2)); pcSPS->setMaxCodingDepth(uiCode); pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); pcSPS->setMaxCUWidth(pcSPS->getCTUSize()); @@ -1025,33 +945,33 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_UVLC(uiCode, "log2_min_luma_coding_block_size_minus2"); int log2MinCUSize = uiCode + 2; pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); - READ_FLAG(uiCode, "sps_override_partition_constraints_enable_flag"); pcSPS->setSplitConsOverrideEnabledFlag(uiCode); - READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_slice"); minQT[0] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize()); - READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_inter_slice"); minQT[1] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize()); - READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_inter_slices"); maxBTD[1] = uiCode; - READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_slices"); maxBTD[0] = uiCode; + READ_FLAG(uiCode, "partition_constraints_override_enabled_flag"); pcSPS->setSplitConsOverrideEnabledFlag(uiCode); + READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_tile_group_luma"); minQT[0] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize()); + READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_inter_tile_group"); minQT[1] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize()); + READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_inter_tile_group"); maxBTD[1] = uiCode; + READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_tile_group_luma"); maxBTD[0] = uiCode; maxTTSize[0] = maxBTSize[0] = minQT[0]; if (maxBTD[0] != 0) { - READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_slice"); maxBTSize[0] <<= uiCode; - READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_slice"); maxTTSize[0] <<= uiCode; + READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_tile_group_luma"); maxBTSize[0] <<= uiCode; + READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_tile_group_luma"); maxTTSize[0] <<= uiCode; } maxTTSize[1] = maxBTSize[1] = minQT[1]; if (maxBTD[1] != 0) { - READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_inter_slice"); maxBTSize[1] <<= uiCode; - READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_inter_slice"); maxTTSize[1] <<= uiCode; + READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_inter_tile_group"); maxBTSize[1] <<= uiCode; + READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_inter_tile_group"); maxTTSize[1] <<= uiCode; } if (pcSPS->getUseDualITree()) { - READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_slice_chroma"); minQT[2] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize()); - READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_slices_chroma"); maxBTD[2] = uiCode; + READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_tile_group_chroma"); minQT[2] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize()); + READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_tile_group_chroma"); maxBTD[2] = uiCode; maxTTSize[2] = maxBTSize[2] = minQT[2]; if (maxBTD[2] != 0) { - READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_slice_chroma"); maxBTSize[2] <<= uiCode; - READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_slice_chroma"); maxTTSize[2] <<= uiCode; + READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_tile_group_chroma"); maxBTSize[2] <<= uiCode; + READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_tile_group_chroma"); maxTTSize[2] <<= uiCode; } } @@ -1064,15 +984,16 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) { CHECK(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() < 5, "Invalid code"); } - READ_UVLC( uiCode, "log2_min_luma_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); + // KJS: does not exist anymore -> remove! + READ_UVLC( uiCode, "log2_min_luma_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 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_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 ); + READ_FLAG( uiCode, "sps_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 ); @@ -1099,27 +1020,65 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setSBTMVPEnabledFlag(false); } - READ_FLAG( uiCode, "sps_bdof_enable_flag" ); pcSPS->setBDOFEnabledFlag ( uiCode != 0 ); -#if JVET_M0255_FRACMMVD_SWITCH - READ_FLAG( uiCode, "sps_fracmmvd_disabled_flag" ); pcSPS->setDisFracMmvdEnabledFlag ( uiCode != 0 ); -#endif + // KJS: sps_amvr_enabled_flag + READ_FLAG( uiCode, "imv_enable_flag" ); pcSPS->setUseIMV ( uiCode != 0 ); + + READ_FLAG( uiCode, "sps_bdof_enabled_flag" ); pcSPS->setBDOFEnabledFlag ( uiCode != 0 ); + #if JVET_M0246_AFFINE_AMVR READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 ); #endif + #if JVET_M0147_DMVR - READ_FLAG(uiCode, "dmvr_enable_flag"); pcSPS->setUseDMVR(uiCode != 0); + READ_FLAG(uiCode, "sps_dmvr_enable_flag"); pcSPS->setUseDMVR(uiCode != 0); #endif -#if HEVC_USE_SCALING_LISTS - READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); - if(pcSPS->getScalingListFlag()) + + // KJS: sps_cclm_enabled_flag + READ_FLAG( uiCode, "lm_chroma_enabled_flag" ); pcSPS->setUseLMChroma ( uiCode != 0 ); +#if JVET_M0142_CCLM_COLLOCATED_CHROMA + if ( pcSPS->getUseLMChroma() && pcSPS->getChromaFormatIdc() == CHROMA_420 ) { - READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); - if(pcSPS->getScalingListPresentFlag ()) - { - parseScalingList( &(pcSPS->getScalingList()) ); - } + READ_FLAG( uiCode, "sps_cclm_collocated_chroma_flag" ); pcSPS->setCclmCollocatedChromaFlag( uiCode != 0 ); + } +#endif + +#if JVET_M0303_IMPLICIT_MTS + READ_FLAG( uiCode, "mts_enabled_flag" ); pcSPS->setUseMTS ( uiCode != 0 ); + if ( pcSPS->getUseMTS() ) + { +#endif +#if JVET_M0464_UNI_MTS + READ_FLAG( uiCode, "mts_intra_enabled_flag" ); pcSPS->setUseIntraMTS ( uiCode != 0 ); + READ_FLAG( uiCode, "mts_inter_enabled_flag" ); pcSPS->setUseInterMTS ( uiCode != 0 ); +#else + READ_FLAG( uiCode, "emt_intra_enabled_flag" ); pcSPS->setUseIntraEMT ( uiCode != 0 ); + READ_FLAG( uiCode, "emt_inter_enabled_flag" ); pcSPS->setUseInterEMT ( uiCode != 0 ); +#endif +#if JVET_M0303_IMPLICIT_MTS } #endif + // KJS: sps_affine_enabled_flag + READ_FLAG( uiCode, "affine_flag" ); pcSPS->setUseAffine ( uiCode != 0 ); + if ( pcSPS->getUseAffine() ) + { + READ_FLAG( uiCode, "affine_type_flag" ); pcSPS->setUseAffineType ( uiCode != 0 ); + } + READ_FLAG( uiCode, "gbi_flag" ); pcSPS->setUseGBi ( uiCode != 0 ); +#if JVET_M0483_IBC + READ_FLAG(uiCode, "ibc_flag"); pcSPS->setIBCFlag(uiCode); +#else + READ_FLAG( uiCode, "ibc_flag"); pcSPS->setIBCMode ( uiCode != 0 ); +#endif + // KJS: sps_ciip_enabled_flag + READ_FLAG( uiCode, "mhintra_flag" ); pcSPS->setUseMHIntra ( uiCode != 0 ); + + READ_FLAG( uiCode, "triangle_flag" ); pcSPS->setUseTriangle ( uiCode != 0 ); + + // KJS: not in draft yet +#if JVET_M0255_FRACMMVD_SWITCH + READ_FLAG( uiCode, "sps_fracmmvd_disabled_flag" ); pcSPS->setDisFracMmvdEnabledFlag ( uiCode != 0 ); +#endif + // KJS: not in draft yet #if JVET_M0140_SBT READ_FLAG(uiCode, "sbt_enable_flag"); pcSPS->setUseSBT(uiCode != 0); if( pcSPS->getUseSBT() ) @@ -1127,7 +1086,48 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG(uiCode, "max_sbt_size_64_flag"); pcSPS->setMaxSbtSize(uiCode != 0 ? 64 : 32); } #endif + // KJS: not in draft yet +#if JVET_M0427_INLOOP_RESHAPER + READ_FLAG(uiCode, "sps_reshaper_enable_flag"); pcSPS->setUseReshaper(uiCode == 1); +#endif + +#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET + READ_FLAG( uiCode, "sps_ladf_enabled_flag" ); pcSPS->setLadfEnabled( uiCode != 0 ); + if ( pcSPS->getLadfEnabled() ) + { + int signedSymbol = 0; + READ_CODE( 2, uiCode, "sps_num_ladf_intervals_minus2"); pcSPS->setLadfNumIntervals( uiCode + 2 ); + READ_SVLC(signedSymbol, "sps_ladf_lowest_interval_qp_offset" ); pcSPS->setLadfQpOffset( signedSymbol, 0 ); + for ( int k = 1; k < pcSPS->getLadfNumIntervals(); k++ ) + { + READ_SVLC(signedSymbol, "sps_ladf_qp_offset" ); pcSPS->setLadfQpOffset( signedSymbol, k ); + READ_UVLC( uiCode, "sps_ladf_delta_threshold_minus1"); + pcSPS->setLadfIntervalLowerBound(uiCode + pcSPS->getLadfIntervalLowerBound(k - 1) + 1, k); + } + } +#endif + + // KJS: BEGIN former SPSNext parameters + READ_FLAG( uiCode, "large_ctu_flag" ); pcSPS->setUseLargeCTU ( uiCode != 0 ); + READ_FLAG( uiCode, "disable_motion_compression_flag" ); pcSPS->setDisableMotCompress ( uiCode != 0 ); + + READ_FLAG( uiCode, "mtt_enabled_flag" ); pcSPS->setMTTMode ( uiCode ); + +#if ENABLE_WPP_PARALLELISM + READ_FLAG( uiCode, "next_dqp_enabled_flag" ); pcSPS->setUseNextDQP ( uiCode != 0 ); +#endif + + if( pcSPS->getUseIMV() ) + { + READ_UVLC( uiCode, "imv_mode_minus1" ); pcSPS->setImvMode( ImvMode( uiCode + 1 ) ); + } + if( pcSPS->getMTTEnabled() ) + { + READ_UVLC( uiCode, "mtt_mode_minus1" ); pcSPS->setMTTMode( uiCode + 1 ); + } + // KJS: END former SPSNext parameters + // KJS: referece picture sets to be replaced READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); CHECK(uiCode > 64, "Invalid code"); pcSPS->createRPSList(uiCode); @@ -1153,10 +1153,26 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0); } } + + // KJS: not found in draft -> does not exist #if HEVC_USE_INTRA_SMOOTHING_T32 || HEVC_USE_INTRA_SMOOTHING_T64 READ_FLAG( uiCode, "strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); +#endif + // KJS: remove scaling lists? +#if HEVC_USE_SCALING_LISTS + READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); + if(pcSPS->getScalingListFlag()) + { + READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); + if(pcSPS->getScalingListPresentFlag ()) + { + parseScalingList( &(pcSPS->getScalingList()) ); + } + } #endif + + // KJS: no VUI defined yet READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); if (pcSPS->getVuiParametersPresentFlag()) @@ -1164,7 +1180,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) parseVUI(pcSPS->getVuiParameters(), pcSPS); } - + // KJS: no SPS extensions defined yet READ_FLAG( uiCode, "sps_extension_present_flag"); if (uiCode) @@ -1187,11 +1203,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) sps_extension_flags[i] = uiCode!=0; } - if( pcSPS->getPTL()->getGeneralPTL()->getProfileIdc() == Profile::NEXT ) - { - pcSPS->getSpsNext().setNextToolsEnabled( true ); - } - bool bSkipTrailingExtensionBits=false; for(int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum. { @@ -1214,12 +1225,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag"); spsRangeExtension.setCabacBypassAlignmentEnabledFlag (uiCode != 0); } break; - case SPS_EXT__NEXT: - { - CHECK( !pcSPS->getSpsNext().nextToolsEnabled(), "Got SPS Next extension in non NEXT profile" ); - parseSPSNext( pcSPS->getSpsNext(), pcSPS->getPCMEnabledFlag() ); - break; - } default: bSkipTrailingExtensionBits=true; break; @@ -1234,9 +1239,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } } } -#if JVET_M0427_INLOOP_RESHAPER - READ_FLAG(uiCode, "sps_reshaper_enable_flag"); pcSPS->setUseReshaper(uiCode == 1); -#endif xReadRbspTrailingBits(); } @@ -1834,16 +1836,16 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); #endif - if ( sps->getSBTMVPEnabledFlag() && !sps->getSpsNext().getUseAffine() ) // ATMVP only + if ( sps->getSBTMVPEnabledFlag() && !sps->getUseAffine() ) // ATMVP only { pcSlice->setMaxNumAffineMergeCand( 1 ); } - else if ( !sps->getSBTMVPEnabledFlag() && !sps->getSpsNext().getUseAffine() ) // both off + else if ( !sps->getSBTMVPEnabledFlag() && !sps->getUseAffine() ) // both off { pcSlice->setMaxNumAffineMergeCand( 0 ); } else - if ( sps->getSpsNext().getUseAffine() ) + if ( sps->getUseAffine() ) { READ_UVLC( uiCode, "five_minus_max_num_affine_merge_cand" ); pcSlice->setMaxNumAffineMergeCand( AFFINE_MRG_MAX_NUM_CANDS - uiCode ); diff --git a/source/Lib/DecoderLib/VLCReader.h b/source/Lib/DecoderLib/VLCReader.h index 90dfd8a97f6e2c2ed501254bfc850e8af98b20d8..b8fa2d66a90a105247e1f3e3cc17bfe53e499de4 100644 --- a/source/Lib/DecoderLib/VLCReader.h +++ b/source/Lib/DecoderLib/VLCReader.h @@ -147,7 +147,6 @@ public: #if HEVC_VPS void parseVPS ( VPS* pcVPS ); #endif - void parseSPSNext ( SPSNext& spsNext, const bool usePCM ); void parseSPS ( SPS* pcSPS ); void parsePPS ( PPS* pcPPS ); void parseVUI ( VUI* pcVUI, SPS* pcSPS ); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 99cc5c6e625b69bed1d0632c597c2fdfdb23f09d..011bfd73548b24a9f104484126e769d73a8614ae 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -1279,7 +1279,7 @@ void CABACWriter::intra_chroma_pred_mode( const PredictionUnit& pu ) } // LM chroma mode - if( pu.cs->sps->getSpsNext().getUseLMChroma() ) + if( pu.cs->sps->getUseLMChroma() ) { intra_chroma_lmc_mode( pu ); if ( PU::isLMCMode( intraDir ) ) @@ -1612,7 +1612,7 @@ void CABACWriter::subblock_merge_flag( const CodingUnit& cu ) return; } - if ( !cu.cs->slice->isIntra() && (cu.cs->sps->getSpsNext().getUseAffine() || cu.cs->sps->getSBTMVPEnabledFlag()) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 ) + if ( !cu.cs->slice->isIntra() && (cu.cs->sps->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 ) ); @@ -1622,13 +1622,13 @@ void CABACWriter::subblock_merge_flag( const CodingUnit& cu ) void CABACWriter::affine_flag( const CodingUnit& cu ) { - if ( !cu.cs->slice->isIntra() && cu.cs->sps->getSpsNext().getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8 ) + if ( !cu.cs->slice->isIntra() && cu.cs->sps->getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8 ) { unsigned ctxId = DeriveCtx::CtxAffineFlag( cu ); m_BinEncoder.encodeBin( cu.affine, Ctx::AffineFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "affine_flag() affine=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y ); - if ( cu.affine && cu.cs->sps->getSpsNext().getUseAffineType() ) + if ( cu.affine && cu.cs->sps->getUseAffineType() ) { unsigned ctxId = 0; m_BinEncoder.encodeBin( cu.affineType, Ctx::AffineType( ctxId ) ); @@ -1659,9 +1659,9 @@ void CABACWriter::merge_flag( const PredictionUnit& pu ) void CABACWriter::imv_mode( const CodingUnit& cu ) { - const SPSNext& spsNext = cu.cs->sps->getSpsNext(); + const SPS *sps = cu.cs->sps; - if( !spsNext.getUseIMV() ) + if( !sps->getUseIMV() ) { return; } @@ -1687,7 +1687,7 @@ void CABACWriter::imv_mode( const CodingUnit& cu ) m_BinEncoder.encodeBin( ( cu.imv > 0 ), Ctx::ImvFlag( ctxId ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", (cu.imv > 0), ctxId ); - if( spsNext.getImvMode() == IMV_4PEL && cu.imv > 0 ) + if( sps->getImvMode() == IMV_4PEL && cu.imv > 0 ) { m_BinEncoder.encodeBin( ( cu.imv > 1 ), Ctx::ImvFlag( 3 ) ); DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", ( cu.imv > 1 ), 3 ); @@ -1985,7 +1985,7 @@ void CABACWriter::mvp_flag( const PredictionUnit& pu, RefPicList eRefList ) void CABACWriter::MHIntra_flag(const PredictionUnit& pu) { - if (!pu.cs->sps->getSpsNext().getUseMHIntra()) + if (!pu.cs->sps->getUseMHIntra()) { CHECK(pu.mhIntraFlag == true, "invalid MHIntra SPS"); return; @@ -2076,7 +2076,7 @@ void CABACWriter::MHIntra_luma_pred_modes(const CodingUnit& cu) void CABACWriter::triangle_mode( const CodingUnit& cu ) { - if( !cu.cs->slice->getSPS()->getSpsNext().getUseTriangle() || !cu.cs->slice->isInterB() || cu.lwidth() * cu.lheight() < TRIANGLE_MIN_SIZE || cu.affine ) + if( !cu.cs->slice->getSPS()->getUseTriangle() || !cu.cs->slice->isInterB() || cu.lwidth() * cu.lheight() < TRIANGLE_MIN_SIZE || cu.affine ) { return; } @@ -2647,7 +2647,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) const int stateTab = ( tu.cs->slice->getDepQuantEnabledFlag() ? 32040 : 0 ); int state = 0; #if !JVET_M0464_UNI_MTS - bool useEmt = ( cu.cs->sps->getSpsNext().getUseIntraEMT() && cu.predMode == MODE_INTRA ) || ( cu.cs->sps->getSpsNext().getUseInterEMT() && cu.predMode != MODE_INTRA ); + bool useEmt = ( cu.cs->sps->getUseIntraEMT() && cu.predMode == MODE_INTRA ) || ( cu.cs->sps->getUseInterEMT() && cu.predMode != MODE_INTRA ); useEmt = useEmt && isLuma(compID); #if JVET_M0102_INTRA_SUBPARTITIONS useEmt = useEmt && !cu.ispMode; @@ -2783,9 +2783,9 @@ void CABACWriter::emt_cu_flag( const CodingUnit& cu ) const CodingStructure& cs = *cu.cs; #if JVET_M0483_IBC - if (!((cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getSpsNext().getUseInterEMT() && !CU::isIntra(cu))) || isChroma(cu.chType)) + if (!((cs.sps->getUseIntraEMT() && CU::isIntra(cu)) || (cs.sps->getUseInterEMT() && !CU::isIntra(cu))) || isChroma(cu.chType)) #else - if( !( ( cs.sps->getSpsNext().getUseIntraEMT() && CU::isIntra( cu ) ) || ( cs.sps->getSpsNext().getUseInterEMT() && CU::isInter( cu ) ) ) || isChroma( cu.chType ) ) + if( !( ( cs.sps->getUseIntraEMT() && CU::isIntra( cu ) ) || ( cs.sps->getUseInterEMT() && CU::isInter( cu ) ) ) || isChroma( cu.chType ) ) #endif { return; diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 17314f06b8e5d36e07b13f69221f17bcf3b33672..21436c906dc9c9ad88a48ec43d52f875e81ebb3f 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -364,7 +364,7 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsigned ctuRsAddr, const int prevQP[], const int currQP[] ) { #if !JVET_M0255_FRACMMVD_SWITCH - if (m_pcEncCfg->getIBCHashSearch() && ctuRsAddr == 0 && cs.slice->getSPS()->getSpsNext().getIBCMode()) + if (m_pcEncCfg->getIBCHashSearch() && ctuRsAddr == 0 && cs.slice->getSPS()->getIBCMode()) { #if JVET_M0427_INLOOP_RESHAPER if (cs.slice->getSPS()->getUseReshaper() && m_pcReshape->getCTUFlag()) @@ -714,7 +714,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par bestCS->chType = partitioner.chType; m_modeCtrl->initCULevel( partitioner, *tempCS ); #if JVET_M0140_SBT - if( partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() && ( sps.getUseSBT() || sps.getSpsNext().getUseInterMTS() ) ) + if( partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() && ( sps.getUseSBT() || sps.getUseInterMTS() ) ) { auto slsSbt = dynamic_cast<SaveLoadEncInfoSbt*>( m_modeCtrl ); int maxSLSize = sps.getUseSBT() ? tempCS->slice->getSPS()->getMaxSbtSize() : MTS_INTER_MAX_CU_SIZE; @@ -1514,7 +1514,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC #if !JVET_M0464_UNI_MTS const CodingUnit *bestCU = bestCS->getCU( partitioner.chType ); const int maxSizeEMT = EMT_INTRA_MAX_CU_WITH_QTBT; - uint8_t considerEmtSecondPass = ( sps.getSpsNext().getUseIntraEMT() && isLuma( partitioner.chType ) && partitioner.currArea().lwidth() <= maxSizeEMT && partitioner.currArea().lheight() <= maxSizeEMT ) ? 1 : 0; + uint8_t considerEmtSecondPass = ( sps.getUseIntraEMT() && isLuma( partitioner.chType ) && partitioner.currArea().lwidth() <= maxSizeEMT && partitioner.currArea().lheight() <= maxSizeEMT ) ? 1 : 0; #endif #if JVET_M0102_INTRA_SUBPARTITIONS @@ -2033,7 +2033,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& static_vector<unsigned, MRG_MAX_NUM_CANDS + MMVD_ADD_NUM> RdModeList2; // store the Intra mode for Intrainter RdModeList2.clear(); - bool isIntrainterEnabled = sps.getSpsNext().getUseMHIntra(); + bool isIntrainterEnabled = sps.getUseMHIntra(); if (bestCS->area.lwidth() * bestCS->area.lheight() < 64 || bestCS->area.lwidth() >= MAX_CU_SIZE || bestCS->area.lheight() >= MAX_CU_SIZE) { isIntrainterEnabled = false; @@ -2057,7 +2057,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #if JVET_M0483_IBC if (slice.getSPS()->getIBCFlag()) #else - if (slice.getSPS()->getSpsNext().getIBCMode()) + if (slice.getSPS()->getIBCMode()) #endif { ComprCUCtx cuECtx = m_modeCtrl->getComprCUCtx(); @@ -3782,7 +3782,7 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC m_pcInterSearch->resetBufferedUniMotions(); int gbiLoopNum = (tempCS->slice->isInterB() ? GBI_NUM : 1); - gbiLoopNum = (tempCS->sps->getSpsNext().getUseGBi() ? gbiLoopNum : 1); + gbiLoopNum = (tempCS->sps->getUseGBi() ? gbiLoopNum : 1); if( tempCS->area.lwidth() * tempCS->area.lheight() < GBI_SIZE_CONSTRAINT ) { @@ -3920,7 +3920,7 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be m_pcInterSearch->resetBufferedUniMotions(); int gbiLoopNum = (tempCS->slice->isInterB() ? GBI_NUM : 1); gbiLoopNum = (pcCUInfo2Reuse != NULL ? 1 : gbiLoopNum); - gbiLoopNum = (tempCS->slice->getSPS()->getSpsNext().getUseGBi() ? gbiLoopNum : 1); + gbiLoopNum = (tempCS->slice->getSPS()->getUseGBi() ? gbiLoopNum : 1); if( tempCS->area.lwidth() * tempCS->area.lheight() < GBI_SIZE_CONSTRAINT ) { @@ -4198,7 +4198,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be bool swapped = false; // avoid unwanted data copy bool reloadCU = false; #if !JVET_M0464_UNI_MTS - const bool considerEmtSecondPass = emtMode && sps.getSpsNext().getUseInterEMT() && partitioner.currArea().lwidth() <= maxSizeEMT && partitioner.currArea().lheight() <= maxSizeEMT; + const bool considerEmtSecondPass = emtMode && sps.getUseInterEMT() && partitioner.currArea().lwidth() <= maxSizeEMT && partitioner.currArea().lheight() <= maxSizeEMT; int minEMTMode = 0; int maxEMTMode = (considerEmtSecondPass?1:0); @@ -4232,7 +4232,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be } } #if JVET_M0140_SBT - const bool mtsAllowed = tempCS->sps->getSpsNext().getUseInterMTS() && partitioner.currArea().lwidth() <= MTS_INTER_MAX_CU_SIZE && partitioner.currArea().lheight() <= MTS_INTER_MAX_CU_SIZE; + const bool mtsAllowed = tempCS->sps->getUseInterMTS() && partitioner.currArea().lwidth() <= MTS_INTER_MAX_CU_SIZE && partitioner.currArea().lheight() <= MTS_INTER_MAX_CU_SIZE; uint8_t sbtAllowed = cu->checkAllowedSbt(); uint8_t numRDOTried = 0; Distortion sbtOffDist = 0; diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 78c21c8c0973353432bfa6889bdc47f588f58233..02fa3258d76d21fb0d62741f8a664b80572e49c5 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -1497,7 +1497,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setSliceType(I_SLICE); } #if JVET_M0483_IBC ==0 - if (pcSlice->getSliceType() == I_SLICE && pcSlice->getSPS()->getSpsNext().getIBCMode()) + if (pcSlice->getSliceType() == I_SLICE && pcSlice->getSPS()->getIBCMode()) { pcSlice->setSliceType(P_SLICE); } @@ -1546,7 +1546,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, setNewestBgPOC(pocCurr); setLastLTRefPoc(pocCurr); } - else if (pcPic->cs->sps->getSpsNext().getUseCompositeRef() && getLastLTRefPoc() >= 0 && getEncodedLTRef()==false && !getPicBg()->getSpliceFull() && (pocCurr - getLastLTRefPoc()) > (m_pcCfg->getFrameRate() * 2)) + else if (pcPic->cs->sps->getUseCompositeRef() && getLastLTRefPoc() >= 0 && getEncodedLTRef()==false && !getPicBg()->getSpliceFull() && (pocCurr - getLastLTRefPoc()) > (m_pcCfg->getFrameRate() * 2)) { setUseLTRef(false); setPrepareLTRef(false); @@ -1555,7 +1555,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, setLastLTRefPoc(-1); } - if (pcPic->cs->sps->getSpsNext().getUseCompositeRef() && m_picBg->getSpliceFull() && getUseLTRef()) + if (pcPic->cs->sps->getUseCompositeRef() && m_picBg->getSpliceFull() && getUseLTRef()) { m_pcEncLib->selectReferencePictureSet(pcSlice, pocCurr, iGOPid, m_bgPOC); } @@ -1669,11 +1669,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setNumRefIdx(REF_PIC_LIST_0, std::min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive, pcSlice->getRPS()->getNumberOfPictures())); pcSlice->setNumRefIdx(REF_PIC_LIST_1, std::min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive, pcSlice->getRPS()->getNumberOfPictures())); } - if (pcPic->cs->sps->getSpsNext().getUseCompositeRef() && getPrepareLTRef()) { + if (pcPic->cs->sps->getUseCompositeRef() && getPrepareLTRef()) { arrangeCompositeReference(pcSlice, rcListPic, pocCurr); } #if JVET_M0483_IBC==0 - if (pcSlice->getSPS()->getSpsNext().getIBCMode()) + if (pcSlice->getSPS()->getIBCMode()) { if (m_pcCfg->getIntraPeriod() > 0 && pcSlice->getPOC() % m_pcCfg->getIntraPeriod() == 0) { @@ -1809,7 +1809,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setSliceType ( P_SLICE ); } #if JVET_M0483_IBC==0 - if (pcSlice->getSPS()->getSpsNext().getIBCMode() && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == 1) + if (pcSlice->getSPS()->getIBCMode() && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == 1) { m_pcSliceEncoder->setEncCABACTableIdx(P_SLICE); } @@ -1903,7 +1903,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, #if JVET_M0483_IBC if (pcSlice->isIRAP() && pcSlice->getSPS()->getIBCFlag()) #else - if (pcSlice->isIRAP() && pcSlice->getSPS()->getSpsNext().getIBCMode()) + if (pcSlice->isIRAP() && pcSlice->getSPS()->getIBCMode()) #endif { pcSlice->setEnableTMVPFlag(0); @@ -1919,7 +1919,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if ( pcSlice->getSliceType() == B_SLICE) { #if JVET_M0483_IBC==0 - if (pcSlice->getSPS()->getSpsNext().getIBCMode()) + if (pcSlice->getSPS()->getIBCMode()) { if (pcSlice->getNumRefIdx(RefPicList(0)) - 1 == pcSlice->getNumRefIdx(RefPicList(1))) { @@ -2464,7 +2464,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcPic->slices[s]->setAlfSliceParam( alfSliceParam ); } } - if (pcPic->cs->sps->getSpsNext().getUseCompositeRef() && getPrepareLTRef()) + if (pcPic->cs->sps->getUseCompositeRef() && getPrepareLTRef()) { updateCompositeReference(pcSlice, rcListPic, pocCurr); } @@ -2740,7 +2740,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, #endif m_bFirst = false; m_iNumPicCoded++; - if (!(pcPic->cs->sps->getSpsNext().getUseCompositeRef() && isEncodeLtRef)) + if (!(pcPic->cs->sps->getUseCompositeRef() && isEncodeLtRef)) m_totalCoded ++; /* logging: insert a newline at end of picture period */ diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 64cc386d5788c69ee55258cc2d929b44acc78746..b1b3f24159ded1f3e1e2bd8a1e79db99acba2279 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -224,7 +224,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) omp_set_nested( true ); #endif - if (sps0.getSpsNext().getUseCompositeRef()) + if (sps0.getUseCompositeRef()) { sps0.setLongTermRefsPresent(true); } @@ -255,7 +255,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) xInitPPS(pps1, sps0); } #endif - if (sps0.getSpsNext().getUseCompositeRef()) + if (sps0.getUseCompositeRef()) { PPS &pps2 = *(m_ppsMap.allocatePS(2)); xInitPPS(pps2, sps0); @@ -365,7 +365,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) #if ENABLE_WPP_PARALLELISM m_entropyCodingSyncContextStateVec.resize( pps0.pcv->heightInCtus ); #endif - if (sps0.getSpsNext().getUseCompositeRef()) + if (sps0.getUseCompositeRef()) { Picture *picBg = new Picture; picBg->create(sps0.getChromaFormatIdc(), Size(sps0.getPicWidthInLumaSamples(), sps0.getPicHeightInLumaSamples()), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false); @@ -875,40 +875,39 @@ void EncLib::xInitSPS(SPS &sps) sps.setChromaFormatIdc ( m_chromaFormatIDC ); sps.setLog2DiffMaxMinCodingBlockSize(m_log2DiffMaxMinCodingBlockSize); - sps.getSpsNext().setNextToolsEnabled ( m_profile == Profile::NEXT ); sps.setCTUSize ( m_CTUSize ); sps.setSplitConsOverrideEnabledFlag ( m_useSplitConsOverride ); sps.setMinQTSizes ( m_uiMinQT ); - sps.getSpsNext().setUseLargeCTU ( m_LargeCTU ); + sps.setUseLargeCTU ( m_LargeCTU ); sps.setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma ); sps.setUseDualITree ( m_dualITree ); sps.setSBTMVPEnabledFlag ( m_SubPuMvpMode ); - sps.getSpsNext().setImvMode ( ImvMode(m_ImvMode) ); - sps.getSpsNext().setUseIMV ( m_ImvMode != IMV_OFF ); + sps.setImvMode ( ImvMode(m_ImvMode) ); + sps.setUseIMV ( m_ImvMode != IMV_OFF ); sps.setBDOFEnabledFlag ( m_BIO ); - sps.getSpsNext().setUseAffine ( m_Affine ); - sps.getSpsNext().setUseAffineType ( m_AffineType ); - sps.getSpsNext().setDisableMotCompress ( m_DisableMotionCompression ); - sps.getSpsNext().setMTTMode ( m_MTTMode ); - sps.getSpsNext().setUseLMChroma ( m_LMChroma ? true : false ); + sps.setUseAffine ( m_Affine ); + sps.setUseAffineType ( m_AffineType ); + sps.setDisableMotCompress ( m_DisableMotionCompression ); + sps.setMTTMode ( m_MTTMode ); + sps.setUseLMChroma ( m_LMChroma ? true : false ); #if JVET_M0142_CCLM_COLLOCATED_CHROMA - sps.getSpsNext().setCclmCollocatedChromaFlag( m_cclmCollocatedChromaFlag ); + sps.setCclmCollocatedChromaFlag( m_cclmCollocatedChromaFlag ); #endif #if ENABLE_WPP_PARALLELISM - sps.getSpsNext().setUseNextDQP ( m_AltDQPCoding ); + sps.setUseNextDQP ( m_AltDQPCoding ); #endif #if JVET_M0464_UNI_MTS #if JVET_M0303_IMPLICIT_MTS - sps.getSpsNext().setUseMTS ( m_IntraMTS || m_InterMTS || m_ImplicitMTS ); + sps.setUseMTS ( m_IntraMTS || m_InterMTS || m_ImplicitMTS ); #endif - sps.getSpsNext().setUseIntraMTS ( m_IntraMTS ); - sps.getSpsNext().setUseInterMTS ( m_InterMTS ); + sps.setUseIntraMTS ( m_IntraMTS ); + sps.setUseInterMTS ( m_InterMTS ); #else #if JVET_M0303_IMPLICIT_MTS - sps.getSpsNext().setUseMTS ( m_IntraEMT || m_InterEMT || m_ImplicitMTS ); + sps.setUseMTS ( m_IntraEMT || m_InterEMT || m_ImplicitMTS ); #endif - sps.getSpsNext().setUseIntraEMT ( m_IntraEMT ); - sps.getSpsNext().setUseInterEMT ( m_InterEMT ); + sps.setUseIntraEMT ( m_IntraEMT ); + sps.setUseInterEMT ( m_InterEMT ); #endif #if JVET_M0140_SBT sps.setUseSBT ( m_SBT ); @@ -917,24 +916,24 @@ void EncLib::xInitSPS(SPS &sps) sps.setMaxSbtSize ( m_iSourceWidth >= 1920 ? 64 : 32 ); } #endif - sps.getSpsNext().setUseCompositeRef ( m_compositeRefEnabled ); - sps.getSpsNext().setUseGBi ( m_GBi ); + sps.setUseCompositeRef ( m_compositeRefEnabled ); + sps.setUseGBi ( m_GBi ); #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET - sps.getSpsNext().setLadfEnabled ( m_LadfEnabled ); + sps.setLadfEnabled ( m_LadfEnabled ); if ( m_LadfEnabled ) { - sps.getSpsNext().setLadfNumIntervals ( m_LadfNumIntervals ); + sps.setLadfNumIntervals ( m_LadfNumIntervals ); for ( int k = 0; k < m_LadfNumIntervals; k++ ) { - sps.getSpsNext().setLadfQpOffset( m_LadfQpOffset[k], k ); - sps.getSpsNext().setLadfIntervalLowerBound( m_LadfIntervalLowerBound[k], k ); + sps.setLadfQpOffset( m_LadfQpOffset[k], k ); + sps.setLadfIntervalLowerBound( m_LadfIntervalLowerBound[k], k ); } CHECK( m_LadfIntervalLowerBound[0] != 0, "abnormal value set to LadfIntervalLowerBound[0]" ); } #endif - sps.getSpsNext().setUseMHIntra ( m_MHIntra ); - sps.getSpsNext().setUseTriangle ( m_Triangle ); + sps.setUseMHIntra ( m_MHIntra ); + sps.setUseTriangle ( m_Triangle ); #if JVET_M0255_FRACMMVD_SWITCH sps.setDisFracMmvdEnabledFlag ( m_allowDisFracMMVD ); #endif @@ -948,7 +947,7 @@ void EncLib::xInitSPS(SPS &sps) #if JVET_M0483_IBC sps.setIBCFlag ( m_IBCMode); #else - sps.getSpsNext().setIBCMode (m_IBCMode); + sps.setIBCMode (m_IBCMode); #endif sps.setWrapAroundEnabledFlag ( m_wrapAround ); sps.setWrapAroundOffset ( m_wrapAroundOffset ); @@ -1454,7 +1453,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) } CHECK(!(bestPos <= 15), "Unspecified error"); #if JVET_M0483_IBC==0 - if (sps.getSpsNext().getIBCMode()) + if (sps.getIBCMode()) { pps.setNumRefIdxL0DefaultActive(bestPos + 1); } diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 748003d1f20f8456d88fd1d6f8266507bc3dc8ec..075bc81c15afb0eb3a149aa18becfc499db2a6ba 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1144,8 +1144,8 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru cuECtx.set( BEST_HORZ_SPLIT_COST, MAX_DOUBLE ); cuECtx.set( BEST_TRIH_SPLIT_COST, MAX_DOUBLE ); cuECtx.set( BEST_TRIV_SPLIT_COST, MAX_DOUBLE ); - cuECtx.set( DO_TRIH_SPLIT, cs.sps->getSpsNext().getMTTMode() & 1 ); - cuECtx.set( DO_TRIV_SPLIT, cs.sps->getSpsNext().getMTTMode() & 1 ); + cuECtx.set( DO_TRIH_SPLIT, cs.sps->getMTTMode() & 1 ); + cuECtx.set( DO_TRIV_SPLIT, cs.sps->getMTTMode() & 1 ); cuECtx.set( BEST_IMV_COST, MAX_DOUBLE * .5 ); cuECtx.set( BEST_NO_IMV_COST, MAX_DOUBLE * .5 ); cuECtx.set( QT_BEFORE_BT, qtBeforeBt ); @@ -1308,7 +1308,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru #if JVET_M0483_IBC if (cs.sps->getIBCFlag() && checkIbc) #else - if (cs.sps->getSpsNext().getIBCMode() && checkIbc ) + if (cs.sps->getIBCMode() && checkIbc ) #endif { m_ComprCUCtxList.back().testModes.push_back({ ETM_IBC, ETO_STANDARD, qp, lossless }); @@ -1346,12 +1346,12 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add inter modes if( m_pcEncCfg->getUseEarlySkipDetection() ) { - if( cs.sps->getSpsNext().getUseTriangle() && cs.slice->isInterB() ) + if( cs.sps->getUseTriangle() && cs.slice->isInterB() ) { 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->getSBTMVPEnabledFlag() ) + if ( cs.sps->getUseAffine() || cs.sps->getSBTMVPEnabledFlag() ) { m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } ); } @@ -1360,12 +1360,12 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru else { m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, ETO_STANDARD, qp, lossless } ); - if( cs.sps->getSpsNext().getUseTriangle() && cs.slice->isInterB() ) + if( cs.sps->getUseTriangle() && cs.slice->isInterB() ) { 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->getSBTMVPEnabledFlag() ) + if ( cs.sps->getUseAffine() || cs.sps->getSBTMVPEnabledFlag() ) { m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } ); } @@ -1502,7 +1502,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt #if JVET_M0483_IBC if (cs.sps->getIBCFlag() && !cuECtx.bestTU) #else - if (cs.sps->getSpsNext().getIBCMode() && !cuECtx.bestTU) + if (cs.sps->getIBCMode() && !cuECtx.bestTU) #endif return true; CHECK( !slice.isIntra() && !cuECtx.bestTU, "No possible non-intra encoding for a P- or B-slice found" ); @@ -1572,7 +1572,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt #if JVET_M0483_IBC return sps.getIBCFlag() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE; #else - return sps.getSpsNext().getIBCMode() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE; + return sps.getIBCMode() && width <= IBC_MAX_CAND_SIZE && partitioner.currArea().lumaSize().height <= IBC_MAX_CAND_SIZE; #endif } else if( isModeInter( encTestmode ) ) @@ -1954,7 +1954,7 @@ bool EncModeCtrlMTnoRQT::useModeResult( const EncTestMode& encTestmode, CodingSt cuECtx.set( MAX_QT_SUB_DEPTH, maxQtD ); } - if( ( tempCS->sps->getSpsNext().getMTTMode() & 1 ) == 1 ) + if( ( tempCS->sps->getMTTMode() & 1 ) == 1 ) { int maxMtD = tempCS->pcv->getMaxBtDepth( *tempCS->slice, partitioner.chType ) + partitioner.currImplicitBtDepth; diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index f6d8cc75cd3eba4c9bbbaa602ac65faa4174d48d..50bc5cac2bfd80d8fe3f5840fed4633edcccab51 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -275,8 +275,8 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr rpcSlice->setSliceBits(0); rpcSlice->setPic( pcPic ); rpcSlice->initSlice(); - int multipleFactor = pcPic->cs->sps->getSpsNext().getUseCompositeRef() ? 2 : 1; - if (pcPic->cs->sps->getSpsNext().getUseCompositeRef() && isEncodeLtRef) + int multipleFactor = pcPic->cs->sps->getUseCompositeRef() ? 2 : 1; + if (pcPic->cs->sps->getUseCompositeRef() && isEncodeLtRef) { rpcSlice->setPicOutputFlag(false); } @@ -1498,23 +1498,23 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons #if JVET_M0483_IBC (pcSlice->getSPS()->getIBCFlag() && m_pcCuEncoder->getEncCfg()->getIBCHashSearch())) #else - ( pcSlice->getSPS()->getSpsNext().getIBCMode() && m_pcCuEncoder->getEncCfg()->getIBCHashSearch() ) ) + ( pcSlice->getSPS()->getIBCMode() && m_pcCuEncoder->getEncCfg()->getIBCHashSearch() ) ) #endif { #if JVET_M0427_INLOOP_RESHAPER -#if !JVET_M0483_IBC - if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getSpsNext().getIBCMode()) -#else +#if JVET_M0483_IBC if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getIBCFlag()) +#else + if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getIBCMode()) #endif cs.picture->getOrigBuf(COMPONENT_Y).rspSignal(m_pcLib->getReshaper()->getFwdLUT()); #endif m_pcCuEncoder->getIbcHashMap().rebuildPicHashMap( cs.picture->getOrigBuf() ); #if JVET_M0427_INLOOP_RESHAPER -#if !JVET_M0483_IBC - if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getSpsNext().getIBCMode()) -#else +#if JVET_M0483_IBC if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getIBCFlag()) +#else + if (pcSlice->getSPS()->getUseReshaper() && m_pcLib->getReshaper()->getCTUFlag() && pcSlice->getSPS()->getIBCMode()) #endif cs.picture->getOrigBuf().copyFrom(cs.picture->getTrueOrigBuf()); #endif diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 5d4d48624b9c4f38bc3a96ec1a6312b232b4c468..da48f75e042bc2c0f523e394664399a8f6ca5c12 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -988,7 +988,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS if (validCand) { - sad = m_pcRdCost->getBvCostMultiplePreds(xPred, yPred, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL); + sad = m_pcRdCost->getBvCostMultiplePreds(xPred, yPred, pu.cs->sps->getImvMode() == IMV_4PEL); m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * yPred + xPred; sad += m_cDistParam.distFunc(m_cDistParam); @@ -1010,7 +1010,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS continue; } - sad = m_pcRdCost->getBvCostMultiplePreds(0, y, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL); + sad = m_pcRdCost->getBvCostMultiplePreds(0, y, pu.cs->sps->getImvMode() == IMV_4PEL); m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y; sad += m_cDistParam.distFunc(m_cDistParam); @@ -1035,7 +1035,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS continue; } - sad = m_pcRdCost->getBvCostMultiplePreds(x, 0, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL); + sad = m_pcRdCost->getBvCostMultiplePreds(x, 0, pu.cs->sps->getImvMode() == IMV_4PEL); m_cDistParam.cur.buf = piRefSrch + x; sad += m_cDistParam.distFunc(m_cDistParam); @@ -1056,7 +1056,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS bestX = cMVCand[0].getHor(); bestY = cMVCand[0].getVer(); sadBest = sadBestCand[0]; - if ((!bestX && !bestY) || (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL) <= 32)) + if ((!bestX && !bestY) || (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getImvMode() == IMV_4PEL) <= 32)) { //chroma refine bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); @@ -1086,7 +1086,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS continue; } - sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL); + sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getImvMode() == IMV_4PEL); m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y + x; sad += m_cDistParam.distFunc(m_cDistParam); @@ -1097,7 +1097,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS bestX = cMVCand[0].getHor(); bestY = cMVCand[0].getVer(); sadBest = sadBestCand[0]; - if (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL) <= 16) + if (sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getImvMode() == IMV_4PEL) <= 16) { //chroma refine bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); @@ -1126,7 +1126,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS continue; } - sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL); + sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getImvMode() == IMV_4PEL); m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y + x; sad += m_cDistParam.distFunc(m_cDistParam); @@ -1150,7 +1150,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS bestY = cMVCand[0].getVer(); sadBest = sadBestCand[0]; - if ((sadBest >= tempSadBest) || ((sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL)) <= 32)) + if ((sadBest >= tempSadBest) || ((sadBest - m_pcRdCost->getBvCostMultiplePreds(bestX, bestY, pu.cs->sps->getImvMode() == IMV_4PEL)) <= 32)) { //chroma refine bestCandIdx = xIBCSearchMVChromaRefine(pu, roiWidth, roiHeight, cuPelX, cuPelY, sadBestCand, cMVCand); @@ -1183,7 +1183,7 @@ void InterSearch::xIntraPatternSearch(PredictionUnit& pu, IntTZSearchStruct& cS continue; } - sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL); + sad = m_pcRdCost->getBvCostMultiplePreds(x, y, pu.cs->sps->getImvMode() == IMV_4PEL); m_cDistParam.cur.buf = piRefSrch + cStruct.iRefStride * y + x; sad += m_cDistParam.distFunc(m_cDistParam); @@ -1395,7 +1395,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const PU::fillMvpCand(pu, REF_PIC_LIST_0, pu.refIdx[REF_PIC_LIST_0], amvpInfo4Pel); #endif - pu.cu->imv = 0;// (Int)cu.cs->sps->getSpsNext().getUseIMV(); // set as IMV=0 initially + pu.cu->imv = 0;// (Int)cu.cs->sps->getUseIMV(); // set as IMV=0 initially Mv cMv, cMvPred[2]; AMVPInfo amvpInfo; #if JVET_M0483_IBC @@ -1444,7 +1444,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const bitsBVPBest = bitsBVPTemp; bvpIdxBest = bvpIdxTemp; - if (cu.cs->sps->getSpsNext().getImvMode() && cMv != cMvPred[bvpIdxTemp]) + if (cu.cs->sps->getImvMode() && cMv != cMvPred[bvpIdxTemp]) pu.cu->imv = 1; // set as full-pel else pu.cu->imv = 0; // set as fractional-pel @@ -1455,7 +1455,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const Mv mvPredQuadPel; - if ((cMv.getHor() % 4 == 0) && (cMv.getVer() % 4 == 0) && (pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL)) + if ((cMv.getHor() % 4 == 0) && (cMv.getVer() % 4 == 0) && (pu.cs->sps->getImvMode() == IMV_4PEL)) { mvPredQuadPel = amvpInfo4Pel.mvCand[bvpIdxTemp];// cMvPred[bvpIdxTemp]; @@ -1472,7 +1472,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const bitsBVPBest = bitsBVPQP; bvpIdxBest = bvpIdxTemp; - if (cu.cs->sps->getSpsNext().getImvMode()) + if (cu.cs->sps->getImvMode()) pu.cu->imv = 2; // set as quad-pel } @@ -1493,10 +1493,10 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const pu.cu->imv = 0; if (pu.cu->imv == 2) assert((cMv.getHor() % 16 == 0) && (cMv.getVer() % 16 == 0)); - if (cu.cs->sps->getSpsNext().getUseIMV()) + if (cu.cs->sps->getUseIMV()) assert(pu.cu->imv>0 || pu.mvd[REF_PIC_LIST_0] == Mv()); - if (!cu.cs->sps->getSpsNext().getUseIMV()) + if (!cu.cs->sps->getUseIMV()) pu.mvd[REF_PIC_LIST_0] >>= (2); #if JVET_M0483_IBC @@ -1558,7 +1558,7 @@ void InterSearch::xxIBCHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, } int costQuadPel = MAX_UINT; - if ((candMv.getHor() % 4 == 0) && (candMv.getVer() % 4 == 0) && (pu.cs->sps->getSpsNext().getImvMode() == IMV_4PEL)) + if ((candMv.getHor() % 4 == 0) && (candMv.getVer() % 4 == 0) && (pu.cs->sps->getImvMode() == IMV_4PEL)) { Mv mvPredQuadPel; int imvShift = 2; @@ -1716,10 +1716,10 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi RefPicList eRefPicList = (refList == 0) ? REF_PIC_LIST_0 : REF_PIC_LIST_1; int refPicNumber = pu.cu->slice->getNumRefIdx(eRefPicList); -#if !JVET_M0483_IBC - if (pu.cs->slice->getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) +#if JVET_M0483_IBC + if (pu.cs->slice->getSPS()->getIBCFlag() && eRefPicList == REF_PIC_LIST_0) #else - if (pu.cs->slice->getSPS()->getIBCFlag() && eRefPicList == REF_PIC_LIST_0) + if (pu.cs->slice->getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) #endif { refPicNumber--; @@ -1952,8 +1952,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) #if JVET_M0246_AFFINE_AMVR bool checkAffine = pu.cu->imv == 0 || pu.cu->slice->getSPS()->getAffineAmvrEnabledFlag(); - bool checkNonAffine = pu.cu->imv == 0 || ( pu.cu->slice->getSPS()->getSpsNext().getUseIMV() && - pu.cu->imv <= pu.cu->slice->getSPS()->getSpsNext().getImvMode() ); + bool checkNonAffine = pu.cu->imv == 0 || ( pu.cu->slice->getSPS()->getUseIMV() && + pu.cu->imv <= pu.cu->slice->getSPS()->getImvMode() ); CodingUnit *bestCU = pu.cu->cs->bestCS != nullptr ? pu.cu->cs->bestCS->getCU( CHANNEL_TYPE_LUMA ) : nullptr; #if JVET_M0444_SMVD bool trySmvd = ( bestCU != nullptr && pu.cu->imv == 2 && checkAffine ) ? ( !bestCU->firstPU->mergeFlag && !bestCU->affine ) : true; @@ -2021,8 +2021,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) { RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); #if JVET_M0483_IBC==0 - int refPicNumber = cs.slice->getNumRefIdx(eRefPicList); - if (cs.slice->getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) + int refPicNumber = cs.sl#ice->getNumRefIdx(eRefPicList); + if (cs.slice->getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) { refPicNumber--; } @@ -2077,7 +2077,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] ); } - if( cu.cs->sps->getSpsNext().getUseGBi() && cu.GBiIdx == GBI_DEFAULT && cu.cs->slice->isInterB() ) + if( cu.cs->sps->getUseGBi() && cu.GBiIdx == GBI_DEFAULT && cu.cs->slice->isInterB() ) { const bool checkIdentical = true; m_uniMotions.setReadMode(checkIdentical, (uint32_t)iRefList, (uint32_t)iRefIdxTemp); @@ -2113,7 +2113,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } } - if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getSpsNext().getUseAffine() + if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getUseAffine() #if JVET_M0246_AFFINE_AMVR && checkAffine #else @@ -2236,7 +2236,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) iRefStart = 0; iRefEnd = cs.slice->getNumRefIdx(eRefPicList)-1; #if JVET_M0483_IBC==0 - if (cs.slice->getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) + if (cs.slice->getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) { iRefEnd--; } @@ -2250,7 +2250,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) continue; } uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList]; - uiBitsTemp += ((cs.slice->getSPS()->getSpsNext().getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0); + uiBitsTemp += ((cs.slice->getSPS()->getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0); if ( cs.slice->getNumRefIdx(eRefPicList) > 1 ) { uiBitsTemp += iRefIdxTemp+1; @@ -2279,7 +2279,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) uiCostBi = uiCostTemp; uiMotBits[iRefList] = uiBitsTemp - uiMbBits[2] - uiMotBits[1-iRefList]; - uiMotBits[iRefList] -= ((cs.slice->getSPS()->getSpsNext().getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0); + uiMotBits[iRefList] -= ((cs.slice->getSPS()->getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0); uiBits[2] = uiBitsTemp; if(iNumIter!=1) @@ -2400,8 +2400,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } bits = uiMbBits[2]; - bits += 1; // add one bit for symmetrical MVD mode - bits += ((cs.slice->getSPS()->getSpsNext().getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0); + bits += 1; // add one bit for #symmetrical MVD mode + bits += ((cs.slice->getSPS()->getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0); symCost += m_pcRdCost->getCost(bits); cTarMvField.setMvField(cCurMvField.mv.getSymmvdMv(cMvPredSym[curRefList], cMvPredSym[tarRefList]), refIdxTar); @@ -2506,7 +2506,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) #if JVET_M0246_AFFINE_AMVR } #endif - if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getSpsNext().getUseAffine() + if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getUseAffine() #if JVET_M0246_AFFINE_AMVR && checkAffine #else @@ -2543,7 +2543,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) int refIdx4Para[2] = { -1, -1 }; xPredAffineInterSearch(pu, origBuf, puIdx, uiLastModeTemp, uiAffineCost, cMvHevcTemp, acMvAffine4Para, refIdx4Para, gbiIdx, enforceGBiPred, - ((cu.slice->getSPS()->getSpsNext().getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0)); + ((cu.slice->getSPS()->getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0)); #if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) @@ -2552,7 +2552,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } #endif - if ( cu.slice->getSPS()->getSpsNext().getUseAffineType() ) + if ( cu.slice->getSPS()->getUseAffineType() ) { if ( uiAffineCost < uiHevcCost * 1.05 ) ///< condition for 6 parameter affine ME { @@ -2585,7 +2585,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) Distortion uiAffine6Cost = std::numeric_limits<Distortion>::max(); cu.affineType = AFFINEMODEL_6PARAM; xPredAffineInterSearch(pu, origBuf, puIdx, uiLastModeTemp, uiAffine6Cost, cMvHevcTemp, acMvAffine4Para, refIdx4Para, gbiIdx, enforceGBiPred, - ((cu.slice->getSPS()->getSpsNext().getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0)); + ((cu.slice->getSPS()->getUseGBi() == true) ? getWeightIdxBits(gbiIdx) : 0)); #if JVET_M0246_AFFINE_AMVR if ( pu.cu->imv == 0 ) @@ -2945,7 +2945,7 @@ Distortion InterSearch::xGetAffineTemplateCost( PredictionUnit& pu, PelUnitBuf& void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, RefPicList eRefPicList, Mv& rcMvPred, int iRefIdxPred, Mv& rcMv, int& riMVPIdx, uint32_t& ruiBits, Distortion& ruiCost, const AMVPInfo& amvpInfo, bool bBi) { - if( pu.cu->cs->sps->getSpsNext().getUseGBi() && pu.cu->GBiIdx != GBI_DEFAULT && !bBi && xReadBufferedUniMv(pu, eRefPicList, iRefIdxPred, rcMvPred, rcMv, ruiBits, ruiCost) ) + if( pu.cu->cs->sps->getUseGBi() && pu.cu->GBiIdx != GBI_DEFAULT && !bBi && xReadBufferedUniMv(pu, eRefPicList, iRefIdxPred, rcMvPred, rcMv, ruiBits, ruiCost) ) { return; } @@ -2991,7 +2991,7 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref cStruct.inCtuSearch = false; cStruct.zeroMV = false; { - if (pu.cs->sps->getSpsNext().getUseCompositeRef() && pu.cs->slice->getRefPic(eRefPicList, iRefIdxPred)->longTerm) + if (pu.cs->sps->getUseCompositeRef() && pu.cs->slice->getRefPic(eRefPicList, iRefIdxPred)->longTerm) { cStruct.inCtuSearch = true; } @@ -3116,7 +3116,7 @@ void InterSearch::xSetSearchRange ( const PredictionUnit& pu, sr.right = mvBR.hor; sr.bottom = mvBR.ver; - if (pu.cs->sps->getSpsNext().getUseCompositeRef() && cStruct.inCtuSearch) + if (pu.cs->sps->getUseCompositeRef() && cStruct.inCtuSearch) { Position posRB = pu.Y().bottomRight(); Position posTL = pu.Y().topLeft(); @@ -3817,7 +3817,7 @@ void InterSearch::xPatternSearchFracDIF( #endif - if (cStruct.imvShift || (pu.cs->sps->getSpsNext().getUseCompositeRef() && cStruct.zeroMV)) + if (cStruct.imvShift || (pu.cs->sps->getUseCompositeRef() && cStruct.zeroMV)) { m_pcRdCost->setDistParam( m_cDistParam, *cStruct.pcPatternKey, cStruct.piRefY + iOffset, cStruct.iRefStride, m_lumaClpRng.bd, COMPONENT_Y, 0, 1, m_pcEncCfg->getUseHADME() && !bIsLosslessCoded ); ruiCost = m_cDistParam.distFunc( m_cDistParam ); @@ -4080,8 +4080,8 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); #if JVET_M0483_IBC==0 - int refPicNumber = slice.getNumRefIdx(eRefPicList); - if (slice.getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) + int refPicNumber = s#lice.getNumRefIdx(eRefPicList); + if (slice.getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) { refPicNumber--; } @@ -4173,7 +4173,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, #endif if (pu.cu->affineType == AFFINEMODEL_4PARAM && m_affMVListSize - && (!pu.cu->cs->sps->getSpsNext().getUseGBi() || gbiIdx == GBI_DEFAULT) + && (!pu.cu->cs->sps->getUseGBi() || gbiIdx == GBI_DEFAULT) ) { int shift = MAX_CU_DEPTH; @@ -4401,7 +4401,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, #endif ); } - if(pu.cu->cs->sps->getSpsNext().getUseGBi() && pu.cu->GBiIdx == GBI_DEFAULT && pu.cu->slice->isInterB()) + if(pu.cu->cs->sps->getUseGBi() && pu.cu->GBiIdx == GBI_DEFAULT && pu.cu->slice->isInterB()) { m_uniMotions.setReadModeAffine(true, (uint8_t)iRefList, (uint8_t)iRefIdxTemp, pu.cu->affineType); m_uniMotions.copyAffineMvFrom(cMvTemp[iRefList][iRefIdxTemp], uiCostTemp - m_pcRdCost->getCost(uiBitsTemp), (uint8_t)iRefList, (uint8_t)iRefIdxTemp, pu.cu->affineType @@ -4449,9 +4449,9 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { ::memcpy( mvAffine4Para, cMvTemp, sizeof( cMvTemp ) ); #if JVET_M0246_AFFINE_AMVR - if ( pu.cu->imv == 0 && ( !pu.cu->cs->sps->getSpsNext().getUseGBi() || gbiIdx == GBI_DEFAULT ) ) + if ( pu.cu->imv == 0 && ( !pu.cu->cs->sps->getUseGBi() || gbiIdx == GBI_DEFAULT ) ) #else - if (!pu.cu->cs->sps->getSpsNext().getUseGBi() || gbiIdx == GBI_DEFAULT) + if (!pu.cu->cs->sps->getUseGBi() || gbiIdx == GBI_DEFAULT) #endif { AffineMVInfo *affMVInfo = m_affMVList + m_affMVListIdx; @@ -4607,7 +4607,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, iRefStart = 0; iRefEnd = slice.getNumRefIdx(eRefPicList) - 1; #if JVET_M0483_IBC==0 - if (slice.getSPS()->getSpsNext().getIBCMode() && eRefPicList == REF_PIC_LIST_0) + if (slice.getSPS()->getIBCMode() && eRefPicList == REF_PIC_LIST_0) { iRefEnd--; } @@ -4626,7 +4626,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } // update bits uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList]; - uiBitsTemp += ((pu.cu->slice->getSPS()->getSpsNext().getUseGBi() == true) ? gbiIdxBits : 0); + uiBitsTemp += ((pu.cu->slice->getSPS()->getUseGBi() == true) ? gbiIdxBits : 0); if( slice.getNumRefIdx(eRefPicList) > 1 ) { uiBitsTemp += iRefIdxTemp+1; @@ -4657,7 +4657,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, uiCostBi = uiCostTemp; uiMotBits[iRefList] = uiBitsTemp - uiMbBits[2] - uiMotBits[1-iRefList]; - uiMotBits[iRefList] -= ((pu.cu->slice->getSPS()->getSpsNext().getUseGBi() == true) ? gbiIdxBits : 0); + uiMotBits[iRefList] -= ((pu.cu->slice->getSPS()->getUseGBi() == true) ? gbiIdxBits : 0); uiBits[2] = uiBitsTemp; if ( iNumIter != 1 ) // MC for next iter @@ -4998,7 +4998,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, #endif bool bBi) { - if( pu.cu->cs->sps->getSpsNext().getUseGBi() && pu.cu->GBiIdx != GBI_DEFAULT && !bBi && xReadBufferedAffineUniMv(pu, eRefPicList, iRefIdxPred, acMvPred, acMv, ruiBits, ruiCost + if( pu.cu->cs->sps->getUseGBi() && pu.cu->GBiIdx != GBI_DEFAULT && !bBi && xReadBufferedAffineUniMv(pu, eRefPicList, iRefIdxPred, acMvPred, acMv, ruiBits, ruiCost #if JVET_M0247_AFFINE_AMVR_ENCOPT , mvpIdx, aamvpi #endif @@ -5165,7 +5165,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, iIterTime = bBi ? 3 : 5; } - if ( !pu.cu->cs->sps->getSpsNext().getUseAffineType() ) + if ( !pu.cu->cs->sps->getUseAffineType() ) { iIterTime = bBi ? 5 : 7; } @@ -6455,7 +6455,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par #if JVET_M0464_UNI_MTS const int numTransformCandidates = nNumTransformCands; #else - const int numEmtTransformCandidates = isLuma(compID) && tu.cu->emtFlag && sps.getSpsNext().getUseInterEMT() ? 4 : 1; + const int numEmtTransformCandidates = isLuma(compID) && tu.cu->emtFlag && sps.getUseInterEMT() ? 4 : 1; const int numTransformCandidates = checkTransformSkip[compID] ? ( numEmtTransformCandidates + 1 ) : numEmtTransformCandidates; int lastTransformModeIndex = numTransformCandidates - 1; //lastTransformModeIndex is the mode for transformSkip (if transformSkip is active) #endif diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index e91b75652dd091471920fde6c09e8fe7f6586d86..63f4b272cfc7fad3aceb8ffcb784d22bb3b982a0 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -314,7 +314,7 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) // 2: EMT is being checked for current CU. Stored results of DCT2 can be utilized for speedup uint8_t emtUsageFlag = 0; const int maxSizeEMT = EMT_INTRA_MAX_CU_WITH_QTBT; - if( width <= maxSizeEMT && height <= maxSizeEMT && sps.getSpsNext().getUseIntraEMT() ) + if( width <= maxSizeEMT && height <= maxSizeEMT && sps.getUseIntraEMT() ) { emtUsageFlag = cu.emtFlag == 1 ? 2 : 1; } @@ -1810,7 +1810,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp #if JVET_M0483_IBC bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag())); #else - bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag()) || (slice.getSliceType() == P_SLICE && slice.getSPS()->getSpsNext().getIBCMode())); + bool flag = slice.getReshapeInfo().getUseSliceReshaper() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag()) || (slice.getSliceType() == P_SLICE && slice.getSPS()->getIBCMode())); #endif if (flag && slice.getReshapeInfo().getSliceReshapeChromaAdj() && isChroma(compID)) { @@ -2456,7 +2456,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT(CodingStructure &cs, Partition #endif { UnitArea currArea = partitioner.currArea(); - const bool keepResi = cs.sps->getSpsNext().getUseLMChroma() || KEEP_PRED_AND_RESI_SIGNALS; + const bool keepResi = cs.sps->getUseLMChroma() || KEEP_PRED_AND_RESI_SIGNALS; if( !currArea.Cb().valid() ) return ChromaCbfs( false ); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index d5346cf3e390f17bfed4a0d67e1ea1a91374da79..db180cded21ea5ddb8db27f91eeb32dc1f1ad548 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -524,87 +524,6 @@ void HLSWriter::codeHrdParameters( const HRD *hrd, bool commonInfPresentFlag, ui } } - -void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) -{ - // tool enabling flags - WRITE_FLAG( spsNext.getUseLargeCTU() ? 1 : 0, "large_ctu_flag" ); - WRITE_FLAG( spsNext.getUseIMV() ? 1 : 0, "imv_enable_flag" ); - WRITE_FLAG( spsNext.getDisableMotCompress() ? 1 : 0, "disable_motion_compression_flag" ); - WRITE_FLAG( spsNext.getUseLMChroma() ? 1 : 0, "lm_chroma_enabled_flag" ); -#if JVET_M0142_CCLM_COLLOCATED_CHROMA - if ( spsNext.getUseLMChroma() && spsNext.getSPS().getChromaFormatIdc() == CHROMA_420 ) - { - WRITE_FLAG( spsNext.getCclmCollocatedChromaFlag() ? 1 : 0, "sps_cclm_collocated_chroma_flag" ); - } -#endif - -#if JVET_M0303_IMPLICIT_MTS - WRITE_FLAG( spsNext.getUseMTS() ? 1 : 0, "mts_enabled_flag" ); - if ( spsNext.getUseMTS() ) - { -#endif -#if JVET_M0464_UNI_MTS - WRITE_FLAG( spsNext.getUseIntraMTS() ? 1 : 0, "mts_intra_enabled_flag" ); - WRITE_FLAG( spsNext.getUseInterMTS() ? 1 : 0, "mts_inter_enabled_flag" ); -#else - WRITE_FLAG( spsNext.getUseIntraEMT() ? 1 : 0, "emt_intra_enabled_flag" ); - WRITE_FLAG( spsNext.getUseInterEMT() ? 1 : 0, "emt_inter_enabled_flag" ); -#endif -#if JVET_M0303_IMPLICIT_MTS - } -#endif - - WRITE_FLAG( spsNext.getUseAffine() ? 1 : 0, "affine_flag" ); - if ( spsNext.getUseAffine() ) - { - WRITE_FLAG( spsNext.getUseAffineType() ? 1 : 0, "affine_type_flag" ); - } - WRITE_FLAG( spsNext.getUseGBi() ? 1 : 0, "gbi_flag" ); -#if JVET_M0483_IBC==0 - WRITE_FLAG(spsNext.getIBCMode() ? 1 : 0, "ibc_flag" ); -#endif - for( int k = 0; k < SPSNext::NumReservedFlags; k++ ) - { - WRITE_FLAG( 0, "reserved_flag" ); - } - - WRITE_FLAG( spsNext.getMTTEnabled() ? 1 : 0, "mtt_enabled_flag" ); - WRITE_FLAG( spsNext.getUseMHIntra() ? 1 : 0, "mhintra_flag" ); - WRITE_FLAG( spsNext.getUseTriangle() ? 1: 0, "triangle_flag" ); -#if ENABLE_WPP_PARALLELISM - WRITE_FLAG( spsNext.getUseNextDQP(), "next_dqp_enabled_flag" ); -#else - WRITE_FLAG( 0, "reserved_flag" ); -#endif - - // additional parameters - - if( spsNext.getUseIMV() ) - { - WRITE_UVLC( spsNext.getImvMode()-1, "imv_mode_minus1" ); - } - - if( spsNext.getMTTEnabled() ) - { - WRITE_UVLC( spsNext.getMTTMode() - 1, "mtt_mode_minus1" ); - } -#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET - WRITE_FLAG( spsNext.getLadfEnabled() ? 1 : 0, "sps_ladf_enabled_flag" ); - if ( spsNext.getLadfEnabled() ) - { - WRITE_CODE( spsNext.getLadfNumIntervals() - 2, 2, "sps_num_ladf_intervals_minus2" ); - WRITE_SVLC( spsNext.getLadfQpOffset( 0 ), "sps_ladf_lowest_interval_qp_offset"); - for ( int k = 1; k< spsNext.getLadfNumIntervals(); k++ ) - { - WRITE_SVLC( spsNext.getLadfQpOffset( k ), "sps_ladf_qp_offset" ); - WRITE_UVLC( spsNext.getLadfIntervalLowerBound( k ) - spsNext.getLadfIntervalLowerBound( k - 1 ) - 1, "sps_ladf_delta_threshold_minus1" ); - } - } -#endif - // ADD_NEW_TOOL : (sps extension writer) write tool enabling flags and associated parameters here -} - #if JVET_M0427_INLOOP_RESHAPER void HLSWriter::codeReshaper(const SliceReshapeInfo& pSliceReshaperInfo, const SPS* pcSPS, const bool isIntra) { @@ -641,9 +560,14 @@ void HLSWriter::codeReshaper(const SliceReshapeInfo& pSliceReshaperInfo, const S void HLSWriter::codeSPS( const SPS* pcSPS ) { +#if ENABLE_TRACING + xTraceSPSHeader (); +#endif +#if HEVC_VPS + WRITE_CODE( pcSPS->getVPSId (), 4, "sps_video_parameter_set_id" ); +#endif + WRITE_UVLC( pcSPS->getSPSId (), "sps_seq_parameter_set_id" ); - const ChromaFormat format = pcSPS->getChromaFormatIdc(); - const bool chromaEnabled = isChromaEnabled(format); WRITE_FLAG(pcSPS->getIntraOnlyConstraintFlag() ? 1 : 0, "intra_only_constraint_flag"); WRITE_CODE(pcSPS->getMaxBitDepthConstraintIdc(), 4, "max_bitdepth_constraint_idc"); WRITE_CODE(pcSPS->getMaxChromaFormatConstraintIdc(), 2, "max_chroma_format_constraint_idc"); @@ -661,20 +585,17 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG(pcSPS->getNoLadfConstraintFlag() ? 1 : 0, "no_ladf_constraint_flag"); WRITE_FLAG(pcSPS->getNoDepQuantConstraintFlag() ? 1 : 0, "no_dep_quant_constraint_flag"); WRITE_FLAG(pcSPS->getNoSignDataHidingConstraintFlag() ? 1 : 0, "no_sign_data_hiding_constraint_flag"); -#if JVET_M0483_IBC - WRITE_FLAG(pcSPS->getIBCFlag() ? 1 : 0, "ibc_flag"); -#endif -#if ENABLE_TRACING - xTraceSPSHeader (); -#endif -#if HEVC_VPS - WRITE_CODE( pcSPS->getVPSId (), 4, "sps_video_parameter_set_id" ); -#endif + + // KJS: Marakech decision: sub-layers added back + CHECK( pcSPS->getMaxTLayers() == 0, "Maximum number of temporal sub-layers is '0'" ); WRITE_CODE( pcSPS->getMaxTLayers() - 1, 3, "sps_max_sub_layers_minus1" ); + WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0, "sps_temporal_id_nesting_flag" ); codePTL( pcSPS->getPTL(), true, pcSPS->getMaxTLayers() - 1 ); - WRITE_UVLC( pcSPS->getSPSId (), "sps_seq_parameter_set_id" ); + WRITE_UVLC( int(pcSPS->getChromaFormatIdc ()), "chroma_format_idc" ); + + const ChromaFormat format = pcSPS->getChromaFormatIdc(); if( format == CHROMA_444 ) { WRITE_FLAG( 0, "separate_colour_plane_flag"); @@ -684,6 +605,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(), "pic_height_in_luma_samples" ); Window conf = pcSPS->getConformanceWindow(); + // KJS: not removing yet WRITE_FLAG( conf.getWindowEnabledFlag(), "conformance_window_flag" ); if (conf.getWindowEnabledFlag()) { @@ -694,11 +616,13 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } WRITE_UVLC( pcSPS->getBitDepth(CHANNEL_TYPE_LUMA) - 8, "bit_depth_luma_minus8" ); - + + const bool chromaEnabled = isChromaEnabled(format); WRITE_UVLC( chromaEnabled ? (pcSPS->getBitDepth(CHANNEL_TYPE_CHROMA) - 8):0, "bit_depth_chroma_minus8" ); WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); + // KJS: Marakech decision: sub-layers added back const bool subLayerOrderingInfoPresentFlag = 1; WRITE_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); for(uint32_t i=0; i <= pcSPS->getMaxTLayers()-1; i++) @@ -712,41 +636,43 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } CHECK( pcSPS->getMaxCUWidth() != pcSPS->getMaxCUHeight(), "Rectangular CTUs not supported" ); - WRITE_FLAG(pcSPS->getUseDualITree(), "qtbt_dual_intra_tree"); - WRITE_UVLC(g_aucLog2[pcSPS->getCTUSize()] - MIN_CU_LOG2, "log2_CTU_size_minus2"); + WRITE_FLAG(pcSPS->getUseDualITree(), "qtbtt_dual_tree_intra_flag"); + WRITE_UVLC(g_aucLog2[pcSPS->getCTUSize()] - MIN_CU_LOG2, "log2_ctu_size_minus2"); WRITE_UVLC(pcSPS->getLog2MinCodingBlockSize() - 2, "log2_min_luma_coding_block_size_minus2"); - WRITE_FLAG(pcSPS->getSplitConsOverrideEnabledFlag(), "sps_override_partition_constraints_enable_flag"); - WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice"); - WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(B_SLICE)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_inter_slice"); - WRITE_UVLC(pcSPS->getMaxBTDepth(), "sps_max_mtt_hierarchy_depth_inter_slices"); - WRITE_UVLC(pcSPS->getMaxBTDepthI(), "sps_max_mtt_hierarchy_depth_intra_slices"); + WRITE_FLAG(pcSPS->getSplitConsOverrideEnabledFlag(), "partition_constraints_override_enabled_flag"); + WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_tile_group_luma"); + WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(B_SLICE)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_inter_tile_group"); + WRITE_UVLC(pcSPS->getMaxBTDepth(), "sps_max_mtt_hierarchy_depth_inter_tile_group"); + WRITE_UVLC(pcSPS->getMaxBTDepthI(), "sps_max_mtt_hierarchy_depth_intra_tile_group_luma"); if (pcSPS->getMaxBTDepthI() != 0) { - WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSizeI()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE)], "sps_log2_diff_max_bt_min_qt_intra_slice"); - WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSizeI()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE)], "sps_log2_diff_max_tt_min_qt_intra_slice"); + WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSizeI()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE)], "sps_log2_diff_max_bt_min_qt_intra_tile_group_luma"); + WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSizeI()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE)], "sps_log2_diff_max_tt_min_qt_intra_tile_group_luma"); } if (pcSPS->getMaxBTDepth() != 0) { - WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSize()] - g_aucLog2[pcSPS->getMinQTSize(B_SLICE)], "sps_log2_diff_max_bt_min_qt_inter_slice"); - WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSize()] - g_aucLog2[pcSPS->getMinQTSize(B_SLICE)], "sps_log2_diff_max_tt_min_qt_inter_slice"); + WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSize()] - g_aucLog2[pcSPS->getMinQTSize(B_SLICE)], "sps_log2_diff_max_bt_min_qt_inter_tile_group"); + WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSize()] - g_aucLog2[pcSPS->getMinQTSize(B_SLICE)], "sps_log2_diff_max_tt_min_qt_inter_tile_group"); } if (pcSPS->getUseDualITree()) { - WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice_chroma"); - WRITE_UVLC(pcSPS->getMaxBTDepthIChroma(), "sps_max_mtt_hierarchy_depth_intra_slices_chroma"); + WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_tile_group_chroma"); + WRITE_UVLC(pcSPS->getMaxBTDepthIChroma(), "sps_max_mtt_hierarchy_depth_intra_tile_group_chroma"); if (pcSPS->getMaxBTDepthIChroma() != 0) { - WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSizeIChroma()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_bt_min_qt_intra_slice_chroma"); - WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSizeIChroma()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_tt_min_qt_intra_slice_chroma"); + WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSizeIChroma()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_bt_min_qt_intra_tile_group_chroma"); + WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSizeIChroma()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_tt_min_qt_intra_tile_group_chroma"); } } + + // KJS: does not exist anymore -> remove? 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_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_luma_transform_block_size" ); 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"); + WRITE_FLAG( pcSPS->getPCMEnabledFlag() ? 1 : 0, "sps_pcm_enabled_flag"); if( pcSPS->getPCMEnabledFlag() ) { WRITE_CODE( pcSPS->getPCMBitDepth(CHANNEL_TYPE_LUMA) - 1, 4, "pcm_sample_bit_depth_luma_minus1" ); @@ -769,27 +695,66 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getSBTMVPEnabledFlag() ? 1 : 0, "sps_sbtmvp_enabled_flag"); } + // KJS: sps_amvr_enabled_flag + WRITE_FLAG( pcSPS->getUseIMV() ? 1 : 0, "imv_enable_flag" ); + WRITE_FLAG( pcSPS->getBDOFEnabledFlag() ? 1 : 0, "sps_bdof_enabled_flag" ); -#if JVET_M0255_FRACMMVD_SWITCH - WRITE_FLAG( pcSPS->getDisFracMmvdEnabledFlag() ? 1 : 0, "sps_fracmmvd_disabled_flag" ); -#endif + #if JVET_M0246_AFFINE_AMVR WRITE_FLAG( pcSPS->getAffineAmvrEnabledFlag() ? 1 : 0, "sps_affine_amvr_enabled_flag" ); #endif + #if JVET_M0147_DMVR - WRITE_FLAG( pcSPS->getUseDMVR() ? 1 : 0, "dmvr_enable_flag" ); + WRITE_FLAG( pcSPS->getUseDMVR() ? 1 : 0, "sps_dmvr_enable_flag" ); #endif -#if HEVC_USE_SCALING_LISTS - WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0, "scaling_list_enabled_flag" ); - if(pcSPS->getScalingListFlag()) + + // KJS: sps_cclm_enabled_flag + WRITE_FLAG( pcSPS->getUseLMChroma() ? 1 : 0, "lm_chroma_enabled_flag" ); +#if JVET_M0142_CCLM_COLLOCATED_CHROMA + if ( pcSPS->getUseLMChroma() && pcSPS->getChromaFormatIdc() == CHROMA_420 ) { - WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0, "sps_scaling_list_data_present_flag" ); - if(pcSPS->getScalingListPresentFlag()) - { - codeScalingList( pcSPS->getScalingList() ); - } + WRITE_FLAG( pcSPS->getCclmCollocatedChromaFlag() ? 1 : 0, "sps_cclm_collocated_chroma_flag" ); + } +#endif + +#if JVET_M0303_IMPLICIT_MTS + WRITE_FLAG( pcSPS->getUseMTS() ? 1 : 0, "mts_enabled_flag" ); + if ( pcSPS->getUseMTS() ) + { +#endif +#if JVET_M0464_UNI_MTS + WRITE_FLAG( pcSPS->getUseIntraMTS() ? 1 : 0, "mts_intra_enabled_flag" ); + WRITE_FLAG( pcSPS->getUseInterMTS() ? 1 : 0, "mts_inter_enabled_flag" ); +#else + WRITE_FLAG( pcSPS->getUseIntraEMT() ? 1 : 0, "emt_intra_enabled_flag" ); + WRITE_FLAG( pcSPS->getUseInterEMT() ? 1 : 0, "emt_inter_enabled_flag" ); +#endif +#if JVET_M0303_IMPLICIT_MTS } #endif + // KJS: sps_affine_enabled_flag + WRITE_FLAG( pcSPS->getUseAffine() ? 1 : 0, "affine_flag" ); + if ( pcSPS->getUseAffine() ) + { + WRITE_FLAG( pcSPS->getUseAffineType() ? 1 : 0, "affine_type_flag" ); + } + WRITE_FLAG( pcSPS->getUseGBi() ? 1 : 0, "gbi_flag" ); +#if JVET_M0483_IBC + WRITE_FLAG(pcSPS->getIBCFlag() ? 1 : 0, "ibc_flag"); +#else + WRITE_FLAG(pcSPS->getIBCMode() ? 1 : 0, "ibc_flag" ); +#endif + + // KJS: sps_ciip_enabled_flag + WRITE_FLAG( pcSPS->getUseMHIntra() ? 1 : 0, "mhintra_flag" ); + + WRITE_FLAG( pcSPS->getUseTriangle() ? 1: 0, "triangle_flag" ); + + // KJS: not in draft yet +#if JVET_M0255_FRACMMVD_SWITCH + WRITE_FLAG( pcSPS->getDisFracMmvdEnabledFlag() ? 1 : 0, "sps_fracmmvd_disabled_flag" ); +#endif + // KJS: not in draft yet #if JVET_M0140_SBT WRITE_FLAG( pcSPS->getUseSBT() ? 1 : 0, "sbt_enable_flag"); if( pcSPS->getUseSBT() ) @@ -797,9 +762,52 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG(pcSPS->getMaxSbtSize() == 64 ? 1 : 0, "max_sbt_size_64_flag"); } #endif + // KJS: not in draft yet +#if JVET_M0427_INLOOP_RESHAPER + WRITE_FLAG(pcSPS->getUseReshaper() ? 1 : 0, "sps_reshaper_enable_flag"); +#endif + +#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET + WRITE_FLAG( pcSPS->getLadfEnabled() ? 1 : 0, "sps_ladf_enabled_flag" ); + if ( pcSPS->getLadfEnabled() ) + { + WRITE_CODE( pcSPS->getLadfNumIntervals() - 2, 2, "sps_num_ladf_intervals_minus2" ); + WRITE_SVLC( pcSPS->getLadfQpOffset( 0 ), "sps_ladf_lowest_interval_qp_offset"); + for ( int k = 1; k< pcSPS->getLadfNumIntervals(); k++ ) + { + WRITE_SVLC( pcSPS->getLadfQpOffset( k ), "sps_ladf_qp_offset" ); + WRITE_UVLC( pcSPS->getLadfIntervalLowerBound( k ) - pcSPS->getLadfIntervalLowerBound( k - 1 ) - 1, "sps_ladf_delta_threshold_minus1" ); + } + } +#endif + - CHECK( pcSPS->getMaxTLayers() == 0, "Maximum number of T-layers is '0'" ); + // KJS: BEGIN former SPSNext paramaters + + // tool enabling flags + WRITE_FLAG( pcSPS->getUseLargeCTU() ? 1 : 0, "large_ctu_flag" ); + WRITE_FLAG( pcSPS->getDisableMotCompress() ? 1 : 0, "disable_motion_compression_flag" ); + + WRITE_FLAG( pcSPS->getMTTEnabled() ? 1 : 0, "mtt_enabled_flag" ); + +#if ENABLE_WPP_PARALLELISM + WRITE_FLAG( pcSPS->getUseNextDQP(), "next_dqp_enabled_flag" ); +#endif + + // additional parameters + + if( pcSPS->getUseIMV() ) + { + WRITE_UVLC( pcSPS->getImvMode()-1, "imv_mode_minus1" ); + } + + if( pcSPS->getMTTEnabled() ) + { + WRITE_UVLC( pcSPS->getMTTMode() - 1, "mtt_mode_minus1" ); + } + // KJS: END former SPSNext paramaters + // KJS: referece picture sets to be replaced const RPSList* rpsList = pcSPS->getRPSList(); WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" ); @@ -823,19 +831,31 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getUseStrongIntraSmoothing(), "strong_intra_smoothing_enable_flag" ); #endif + + // KJS: remove scaling lists? +#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 + + // KJS: no VUI defined yet WRITE_FLAG( pcSPS->getVuiParametersPresentFlag(), "vui_parameters_present_flag" ); if (pcSPS->getVuiParametersPresentFlag()) { codeVUI(pcSPS->getVuiParameters(), pcSPS); } - // KTA tools - bool sps_extension_present_flag=false; bool sps_extension_flags[NUM_SPS_EXTENSION_FLAGS]={false}; sps_extension_flags[SPS_EXT__REXT] = pcSPS->getSpsRangeExtension().settingsDifferFromDefaults(); - sps_extension_flags[SPS_EXT__NEXT] = pcSPS->getSpsNext().nextToolsEnabled(); // Other SPS extension flags checked here. @@ -885,11 +905,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( (spsRangeExtension.getCabacBypassAlignmentEnabledFlag() ? 1 : 0), "cabac_bypass_alignment_enabled_flag" ); break; } - case SPS_EXT__NEXT: - { - codeSPSNext( pcSPS->getSpsNext(), pcSPS->getPCMEnabledFlag() ); - break; - } default: CHECK(sps_extension_flags[i]!=false, "Unknown PPS extension signalled"); // Should never get here with an active SPS extension flag. break; @@ -897,9 +912,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } } -#if JVET_M0427_INLOOP_RESHAPER - WRITE_FLAG(pcSPS->getUseReshaper() ? 1 : 0, "sps_reshaper_enable_flag"); -#endif xWriteRbspTrailingBits(); } @@ -1346,17 +1358,17 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) WRITE_UVLC( MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "six_minus_max_num_merge_cand" ); #endif - if ( pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getSpsNext().getUseAffine() ) // ATMVP only + if ( pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getUseAffine() ) // ATMVP only { CHECK( pcSlice->getMaxNumAffineMergeCand() != 1, "Sub-block merge can number should be 1" ); } else - if ( !pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getSpsNext().getUseAffine() ) // both off + if ( !pcSlice->getSPS()->getSBTMVPEnabledFlag() && !pcSlice->getSPS()->getUseAffine() ) // both off { CHECK( pcSlice->getMaxNumAffineMergeCand() != 0, "Sub-block merge can number should be 0" ); } else - if ( pcSlice->getSPS()->getSpsNext().getUseAffine() ) + if ( pcSlice->getSPS()->getUseAffine() ) { CHECK( pcSlice->getMaxNumAffineMergeCand() > AFFINE_MRG_MAX_NUM_CANDS, "More affine merge candidates signalled than supported" ); WRITE_UVLC( AFFINE_MRG_MAX_NUM_CANDS - pcSlice->getMaxNumAffineMergeCand(), "five_minus_max_num_affine_merge_cand" ); diff --git a/source/Lib/EncoderLib/VLCWriter.h b/source/Lib/EncoderLib/VLCWriter.h index 4c2e05170afbadf68f642cefd652450c69607196..b3866e8ab3a78c22f66574ec4eda016167dc362d 100644 --- a/source/Lib/EncoderLib/VLCWriter.h +++ b/source/Lib/EncoderLib/VLCWriter.h @@ -120,7 +120,6 @@ public: void setBitstream ( OutputBitstream* p ) { m_pcBitIf = p; } uint32_t getNumberOfWrittenBits () { return m_pcBitIf->getNumberOfWrittenBits(); } void codeVUI ( const VUI *pcVUI, const SPS* pcSPS ); - void codeSPSNext ( const SPSNext& spsNext, const bool usePCM ); void codeSPS ( const SPS* pcSPS ); void codePPS ( const PPS* pcPPS ); #if HEVC_VPS