diff --git a/cfg/encoder_intra_vtm.cfg b/cfg/encoder_intra_vtm.cfg index 0a7fae758aedf352a31db00e4b1013d08bd09e9b..18ae597ec72e771e8e3f955e962f6abbf2c3c131 100644 --- a/cfg/encoder_intra_vtm.cfg +++ b/cfg/encoder_intra_vtm.cfg @@ -9,11 +9,6 @@ Profile : next MaxCUWidth : 64 # Maximum coding unit width in pixel MaxCUHeight : 64 # Maximum coding unit height in pixel MaxPartitionDepth : 4 # Maximum coding unit depth -# obsoleted by TULog2MaxSize -#QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for -# # quadtree-based TU coding (2...6) -QuadtreeTUMaxDepthInter : 3 -QuadtreeTUMaxDepthIntra : 3 #======== Coding Structure ============= IntraPeriod : 1 # Period of I-Frame ( -1 = only first) @@ -89,7 +84,6 @@ TemporalSubsampleRatio : 8 # General CTUSize : 128 LCTUFast : 1 -QuadtreeTULog2MaxSize : 6 DualITree : 1 # separate partitioning of luma and chroma channels for I-slices MinQTLumaISlice : 8 diff --git a/cfg/encoder_lowdelay_P_vtm.cfg b/cfg/encoder_lowdelay_P_vtm.cfg index df47fe58cafcc174d8d2be9cb92a7358c69f7121..7256c3b0d19a3e706e4ce45f5d60c0da20e2493e 100644 --- a/cfg/encoder_lowdelay_P_vtm.cfg +++ b/cfg/encoder_lowdelay_P_vtm.cfg @@ -9,11 +9,6 @@ Profile : next MaxCUWidth : 64 # Maximum coding unit width in pixel MaxCUHeight : 64 # Maximum coding unit height in pixel MaxPartitionDepth : 4 # Maximum coding unit depth -# obsoleted by TULog2MaxSize -#QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for -# # quadtree-based TU coding (2...6) -QuadtreeTUMaxDepthInter : 3 -QuadtreeTUMaxDepthIntra : 3 #======== Coding Structure ============= IntraPeriod : -1 # Period of I-Frame ( -1 = only first) @@ -105,7 +100,6 @@ CrQpOffset : 1 # General CTUSize : 128 LCTUFast : 1 -QuadtreeTULog2MaxSize : 6 DualITree : 1 # separate partitioning of luma and chroma channels for I-slices MinQTLumaISlice : 8 diff --git a/cfg/encoder_lowdelay_vtm.cfg b/cfg/encoder_lowdelay_vtm.cfg index bfafca2bb650a47142e795b917ada9bab917179e..dc4902e24ef9e5d390a59f8328e4b0590481a96b 100644 --- a/cfg/encoder_lowdelay_vtm.cfg +++ b/cfg/encoder_lowdelay_vtm.cfg @@ -9,11 +9,6 @@ Profile : next MaxCUWidth : 64 # Maximum coding unit width in pixel MaxCUHeight : 64 # Maximum coding unit height in pixel MaxPartitionDepth : 4 # Maximum coding unit depth -# obsoleted by TULog2MaxSize -#QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for -# # quadtree-based TU coding (2...6) -QuadtreeTUMaxDepthInter : 3 -QuadtreeTUMaxDepthIntra : 3 #======== Coding Structure ============= IntraPeriod : -1 # Period of I-Frame ( -1 = only first) @@ -105,7 +100,6 @@ CrQpOffset : 1 # General CTUSize : 128 LCTUFast : 1 -QuadtreeTULog2MaxSize : 6 DualITree : 1 # separate partitioning of luma and chroma channels for I-slices MinQTLumaISlice : 8 diff --git a/cfg/encoder_randomaccess_vtm.cfg b/cfg/encoder_randomaccess_vtm.cfg index beb70d7ec8784ad692a42155332efd462021d387..763c0ef98d8fe0a596e57bff2be7c8ee872e1c93 100644 --- a/cfg/encoder_randomaccess_vtm.cfg +++ b/cfg/encoder_randomaccess_vtm.cfg @@ -9,11 +9,6 @@ Profile : next MaxCUWidth : 64 # Maximum coding unit width in pixel MaxCUHeight : 64 # Maximum coding unit height in pixel MaxPartitionDepth : 4 # Maximum coding unit depth -# obsoleted by TULog2MaxSize -#QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for -# # quadtree-based TU coding (2...6) -QuadtreeTUMaxDepthInter : 3 -QuadtreeTUMaxDepthIntra : 3 #======== Coding Structure ============= IntraPeriod : 32 # Period of I-Frame ( -1 = only first) @@ -119,7 +114,6 @@ CrQpOffset : 1 # General CTUSize : 128 LCTUFast : 1 -QuadtreeTULog2MaxSize : 6 DualITree : 1 # separate partitioning of luma and chroma channels for I-slices MinQTLumaISlice : 8 diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index a38a1174f8f581354335161834968ec88d28b1f2..bd3d639ffc0399cd5d3e6123764ee44efa3dbe0f 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -293,10 +293,9 @@ void EncApp::xInitLibCfg() m_cEncLib.setMaxCUHeight ( m_uiCTUSize ); m_cEncLib.setMaxCodingDepth ( m_uiMaxCodingDepth ); m_cEncLib.setLog2DiffMaxMinCodingBlockSize ( m_uiLog2DiffMaxMinCodingBlockSize ); - m_cEncLib.setQuadtreeTULog2MaxSize ( m_quadtreeTULog2MaxSize ); - m_cEncLib.setQuadtreeTULog2MinSize ( m_quadtreeTULog2MinSize ); - m_cEncLib.setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); - m_cEncLib.setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); +#if MAX_TB_SIZE_SIGNALLING + m_cEncLib.setLog2MaxTbSize ( m_log2MaxTbSize ); +#endif #if JVET_M0428_ENC_DB_OPT m_cEncLib.setUseEncDbOpt(m_encDbOpt); #endif diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 3eaa25bf685f53a75e203db198f96f73b85ff99e..b4dd2036f766a4f19e92a7bf2f808be73a1f6b40 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -913,14 +913,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") - ("QuadtreeTULog2MaxSize", m_quadtreeTULog2MaxSize, -1, "Maximum TU size in logarithm base 2") - ("QuadtreeTULog2MinSize", m_quadtreeTULog2MinSize, 2, "Minimum TU size in logarithm base 2") - - ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs") - ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs") - - - ("TULog2MaxSize", m_tuLog2MaxSize, -1, "Maximum TU size in logarithm base 2 (for use with NEXT-Profile)") +#if MAX_TB_SIZE_SIGNALLING + ("Log2MaxTbSize", m_log2MaxTbSize, 6, "Maximum transform block size in logarithm base 2 (Default: 6)") +#endif // Coding structure paramters ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") @@ -1898,7 +1893,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #else if (((int)m_fQP < 38) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && (m_iSourceWidth <= 2048) && (m_iSourceHeight <= 1280) #endif - && ((1 << (std::max (m_quadtreeTULog2MaxSize, m_tuLog2MaxSize) + 1)) == m_uiCTUSize) && (m_iSourceWidth > 512 || m_iSourceHeight > 320)) +#if MAX_TB_SIZE_SIGNALLING + && ((1 << (m_log2MaxTbSize + 1)) == m_uiCTUSize) && (m_iSourceWidth > 512 || m_iSourceHeight > 320)) +#else + && ((1 << (MAX_TB_LOG2_SIZEY + 1)) == m_uiCTUSize) && (m_iSourceWidth > 512 || m_iSourceHeight > 320)) +#endif { m_iMaxCuDQPDepth = 1; } @@ -1914,8 +1913,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) msg( WARNING, "*************************************************************************\n" ); m_uiCTUSize = m_uiMaxCUWidth; - if( ( 1u << m_quadtreeTULog2MaxSize ) > m_uiCTUSize ) m_quadtreeTULog2MaxSize--; - if( ( 1u << m_tuLog2MaxSize ) > m_uiCTUSize ) m_tuLog2MaxSize--; +#if MAX_TB_SIZE_SIGNALLING + if( ( 1u << m_log2MaxTbSize ) > m_uiCTUSize ) m_log2MaxTbSize--; +#endif } #endif #endif // ENABLE_QPA @@ -2229,12 +2229,6 @@ bool EncAppCfg::xCheckParameter() } #endif - xConfirmPara( m_quadtreeTULog2MaxSize * m_tuLog2MaxSize >= 0, "Setting of TULog2MaxSize and QuadtreeTULog2MaxSize is mutually exclusive - use only one of the parameters" ); - - if( m_quadtreeTULog2MaxSize < 0 ) m_quadtreeTULog2MaxSize = m_tuLog2MaxSize; - - xConfirmPara( m_quadtreeTULog2MaxSize < 0, "Maximal TU size is invalid" ); - if( m_SubPuMvpMode == 3 && m_maxNumMergeCand < 7 ) { msg( WARNING, "****************************************************************************\n" ); @@ -2327,26 +2321,9 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); - xConfirmPara( m_quadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater." ); - - if( m_profile == Profile::NEXT ) - { - xConfirmPara( m_quadtreeTULog2MaxSize > 7, "QuadtreeTULog2MaxSize must be 7 or smaller." ); - } - else - { - xConfirmPara( m_quadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller." ); - } - xConfirmPara( m_quadtreeTULog2MaxSize < m_quadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); - - xConfirmPara( (1<<m_quadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); - xConfirmPara( ( 1 << m_quadtreeTULog2MinSize ) >= ( m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" ); - xConfirmPara( ( 1 << m_quadtreeTULog2MinSize ) >= ( m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" ); - xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); - xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_quadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); - xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); - xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_quadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); - +#if MAX_TB_SIZE_SIGNALLING + xConfirmPara( m_log2MaxTbSize > 6, "Log2MaxTbSize must be 6 or smaller." ); +#endif xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); xConfirmPara( m_maxNumMergeCand > MRG_MAX_NUM_CANDS, "MaxNumMergeCand must be no more than MRG_MAX_NUM_CANDS." ); @@ -3060,9 +3037,9 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "Profile : %s\n", profileToString(m_profile) ); } msg( DETAILS, "CU size / depth / total-depth : %d / %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth, m_uiMaxCodingDepth ); - msg( DETAILS, "RQT trans. size (min / max) : %d / %d\n", 1 << m_quadtreeTULog2MinSize, 1 << m_quadtreeTULog2MaxSize ); - msg( DETAILS, "Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); - msg( DETAILS, "Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); +#if MAX_TB_SIZE_SIGNALLING + msg( DETAILS, "Max TB size : %d \n", 1 << m_log2MaxTbSize ); +#endif msg( DETAILS, "Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); msg( DETAILS, "Motion search range : %d\n", m_iSearchRange ); msg( DETAILS, "Intra period : %d\n", m_iIntraPeriod ); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 09f665f46e179f0121e8457ce05b1ad11d60e463..38c52dcf4237bcc08e74ddc23e2b9e72621e38ae 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -300,14 +300,9 @@ protected: int m_numWppExtraLines; bool m_ensureWppBitEqual; - // transfom unit (TU) definition - int m_quadtreeTULog2MaxSize; - int m_quadtreeTULog2MinSize; - int m_tuLog2MaxSize; - - uint32_t m_uiQuadtreeTUMaxDepthInter; - uint32_t m_uiQuadtreeTUMaxDepthIntra; - +#if MAX_TB_SIZE_SIGNALLING + int m_log2MaxTbSize; +#endif // coding tools (bit-depth) int m_inputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input file int m_outputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of output file diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 6d09dc35f650e11d42a96fe0daf219da1381a6e5..a5872c078cc50db0e7456a3607e68220e1588439 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -153,6 +153,12 @@ static const int MAX_TLAYER = 7; ///< Expl static const int ADAPT_SR_SCALE = 1; ///< division factor for adaptive search range +static const int MIN_TB_LOG2_SIZEY = 2; +static const int MAX_TB_LOG2_SIZEY = 6; + +static const int MIN_TB_SIZEY = 1 << MIN_TB_LOG2_SIZEY; +static const int MAX_TB_SIZEY = 1 << MAX_TB_LOG2_SIZEY; + static const int MAX_NUM_PICS_IN_SOP = 1024; static const int MAX_NESTING_NUM_OPS = 1024; @@ -274,12 +280,7 @@ static const int MAX_CU_DEPTH = 7; ///< log2 static const int MAX_CU_SIZE = 1<<MAX_CU_DEPTH; static const int MIN_CU_LOG2 = 2; static const int MIN_PU_SIZE = 4; -static const int MIN_TU_SIZE = 4; -static const int MAX_TU_SIZE = 128; -static const int MAX_LOG2_TU_SIZE_PLUS_ONE = 8; ///< log2(MAX_TU_SIZE) + 1 static const int MAX_NUM_PARTS_IN_CTU = ( ( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 ) ); -static const int MAX_TR_SIZE = MAX_CU_SIZE; -static const int MAX_TU_SIZE_FOR_PROFILE = 64; static const int MAX_LOG2_DIFF_CU_TR_SIZE = 2; static const int MAX_CU_TILING_PARTITIONS = 1 << ( MAX_LOG2_DIFF_CU_TR_SIZE << 1 ); diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index e318345f2149e2d9184dd63a27153fdf0e3b2226..bfca52e7174fb2b7cbf09f1139c9ca043f5c96ef 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -548,8 +548,8 @@ namespace DQIntern private: const ScanElement * m_scanId2Pos; - int32_t m_lastBitsX [ MAX_TU_SIZE ]; - int32_t m_lastBitsY [ MAX_TU_SIZE ]; + int32_t m_lastBitsX [ MAX_TB_SIZEY ]; + int32_t m_lastBitsY [ MAX_TB_SIZEY ]; BinFracBits m_sigSbbFracBits [ sm_maxNumSigSbbCtx ]; BinFracBits m_sigFracBits [ sm_numCtxSetsSig ][ sm_maxNumSigCtx ]; CoeffFracBits m_gtxFracBits [ sm_maxNumGtxCtx ]; @@ -1001,7 +1001,7 @@ namespace DQIntern SbbCtx m_allSbbCtx [8]; SbbCtx* m_currSbbCtx; SbbCtx* m_prevSbbCtx; - uint8_t m_memory[ 8 * ( MAX_TU_SIZE * MAX_TU_SIZE + MLS_GRP_NUM ) ]; + uint8_t m_memory[ 8 * ( MAX_TB_SIZEY * MAX_TB_SIZEY + MLS_GRP_NUM ) ]; }; #define RICEMAX 32 @@ -1499,7 +1499,7 @@ namespace DQIntern State* m_skipStates; State m_startState; Quantizer m_quant; - Decision m_trellis[ MAX_TU_SIZE * MAX_TU_SIZE ][ 8 ]; + Decision m_trellis[ MAX_TB_SIZEY * MAX_TB_SIZEY ][ 8 ]; }; diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index 8355c91554139ec4a6a80f1a4346c56904e50c1d..aa6265dff72f0f7aff17fabb8050b69e5ac56283 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -369,8 +369,11 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) unsigned int orthogonalLength = 1; unsigned int orthogonalIncrement = 1; #if FIX_DB_MAX_TRANSFORM_SIZE - int maxTsize = 64; - maxTsize = 1 << cu.slice->getSPS()->getQuadtreeTULog2MaxSize(); +#if MAX_TB_SIZE_SIGNALLING + const int maxTsize = cu.slice->getSPS()->getMaxTbSize(); +#else + const int maxTsize = MAX_TB_SIZEY; +#endif #endif #if JVET_M0471_LONG_DEBLOCKING_FILTERS #if FIX_DB_MAX_TRANSFORM_SIZE diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index 5829874da0427ff5d161ab7062b18d7b193aeabb..7ff6099b3ab05b775030964e5696822292d96806 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -744,7 +744,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf const TCoeff entropyCodingMaximum = (1 << maxLog2TrDynamicRange) - 1; #if HEVC_USE_SIGN_HIDING - TCoeff deltaU[MAX_TU_SIZE * MAX_TU_SIZE]; + TCoeff deltaU[MAX_TB_SIZEY * MAX_TB_SIZEY]; #endif #if HEVC_USE_SCALING_LISTS int scalingListType = getScalingListType(tu.cu->predMode, compID); diff --git a/source/Lib/CommonLib/QuantRDOQ.h b/source/Lib/CommonLib/QuantRDOQ.h index 037fab4d7d5ec44646ebca62be1b018f5bef5bb0..233c10e7f9f518a2e575f213733a287067b5c297 100644 --- a/source/Lib/CommonLib/QuantRDOQ.h +++ b/source/Lib/CommonLib/QuantRDOQ.h @@ -132,15 +132,15 @@ private: double m_errScaleNoScalingList[SCALING_LIST_SIZE_NUM][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM][SCALING_LIST_REM_NUM]; ///< array of quantization matrix coefficient 4x4 #endif // temporary buffers for RDOQ - double m_pdCostCoeff [MAX_TU_SIZE * MAX_TU_SIZE]; - double m_pdCostSig [MAX_TU_SIZE * MAX_TU_SIZE]; - double m_pdCostCoeff0 [MAX_TU_SIZE * MAX_TU_SIZE]; - double m_pdCostCoeffGroupSig[(MAX_TU_SIZE * MAX_TU_SIZE) >> MLS_CG_SIZE]; // even if CG size is 2 (if one of the sides is 2) instead of 4, there should be enough space + double m_pdCostCoeff [MAX_TB_SIZEY * MAX_TB_SIZEY]; + double m_pdCostSig [MAX_TB_SIZEY * MAX_TB_SIZEY]; + double m_pdCostCoeff0 [MAX_TB_SIZEY * MAX_TB_SIZEY]; + double m_pdCostCoeffGroupSig[(MAX_TB_SIZEY * MAX_TB_SIZEY) >> MLS_CG_SIZE]; // even if CG size is 2 (if one of the sides is 2) instead of 4, there should be enough space #if HEVC_USE_SIGN_HIDING - int m_rateIncUp [MAX_TU_SIZE * MAX_TU_SIZE]; - int m_rateIncDown [MAX_TU_SIZE * MAX_TU_SIZE]; - int m_sigRateDelta [MAX_TU_SIZE * MAX_TU_SIZE]; - TCoeff m_deltaU [MAX_TU_SIZE * MAX_TU_SIZE]; + int m_rateIncUp [MAX_TB_SIZEY * MAX_TB_SIZEY]; + int m_rateIncDown [MAX_TB_SIZEY * MAX_TB_SIZEY]; + int m_sigRateDelta [MAX_TB_SIZEY * MAX_TB_SIZEY]; + TCoeff m_deltaU [MAX_TB_SIZEY * MAX_TB_SIZEY]; #endif };// END CLASS DEFINITION QuantRDOQ diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 8494ab1b8e11a2f5d9f9378aaa9b7dac3872859b..8173b622c7b0168e0a42f44f49333e12c1d48c8c 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -732,9 +732,7 @@ ScanElement *g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_C #endif const uint32_t g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS] = { 0,1,2,3,4,6,8,12,16,24,32,48,64,96 }; -const uint32_t g_uiGroupIdx[MAX_TU_SIZE] = { 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 -,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12 -,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13 }; +const uint32_t g_uiGroupIdx[MAX_TB_SIZEY] = { 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 }; const uint32_t g_auiGoRiceParsCoeff[32] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3 diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h index 4feac253ddc756efa4f8c3031902a4aa322319fa..cbb6399104059e245526b9ff2387ff493d20e12b 100644 --- a/source/Lib/CommonLib/Rom.h +++ b/source/Lib/CommonLib/Rom.h @@ -99,7 +99,7 @@ extern const uint8_t g_aucChromaScale[NUM_CHROMA_FORMAT][chromaQPMappingTableSi // Scanning order & context mapping table // ==================================================================================================================== -extern const uint32_t g_uiGroupIdx[ MAX_TU_SIZE ]; +extern const uint32_t g_uiGroupIdx[ MAX_TB_SIZEY ]; extern const uint32_t g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ]; extern const uint32_t g_auiGoRiceParsCoeff [ 32 ]; extern const uint32_t g_auiGoRicePosCoeff0[ 3 ][ 32 ]; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 8baeacce8e337e6d675e0dc42071aaf458a639ea..7debb8476edc166a206617d96ebac1dea7747ad0 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -1951,10 +1951,6 @@ SPS::SPS() , m_uiMaxCUHeight ( 32) , m_uiMaxCodingDepth ( 3) , m_bLongTermRefsPresent (false) -, m_uiQuadtreeTULog2MaxSize ( 0) -, m_uiQuadtreeTULog2MinSize ( 0) -, m_uiQuadtreeTUMaxDepthInter ( 0) -, m_uiQuadtreeTUMaxDepthIntra ( 0) // Tool list , m_pcmEnabledFlag (false) , m_pcmLog2MaxSize ( 5) @@ -1967,7 +1963,9 @@ SPS::SPS() #endif , m_uiBitsForPOC ( 8) , m_numLongTermRefPicSPS ( 0) -, m_uiMaxTrSize ( 32) +#if MAX_TB_SIZE_SIGNALLING +, m_log2MaxTbSize ( 6) +#endif , m_saoEnabledFlag (false) , m_bTemporalIdNestingFlag (false) #if HEVC_USE_SCALING_LISTS diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index ffe92ca71fd05e343df8125d262612e6a2351c46..c6ba1c1403d9bb6fcbdada8677129f2989e8cb32 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -902,10 +902,6 @@ private: int m_numReorderPics[MAX_TLAYER]; // Tool list - uint32_t m_uiQuadtreeTULog2MaxSize; - uint32_t m_uiQuadtreeTULog2MinSize; - uint32_t m_uiQuadtreeTUMaxDepthInter; - uint32_t m_uiQuadtreeTUMaxDepthIntra; bool m_pcmEnabledFlag; uint32_t m_pcmLog2MaxSize; uint32_t m_uiPCMLog2MinSize; @@ -925,8 +921,9 @@ private: uint32_t m_numLongTermRefPicSPS; uint32_t m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS]; bool m_usedByCurrPicLtSPSFlag[MAX_NUM_LONG_TERM_REF_PICS]; - // Max physical transform size - uint32_t m_uiMaxTrSize; +#if MAX_TB_SIZE_SIGNALLING + uint32_t m_log2MaxTbSize; +#endif bool m_saoEnabledFlag; @@ -1138,14 +1135,6 @@ public: uint32_t getPCMLog2MinSize() const { return m_uiPCMLog2MinSize; } void setBitsForPOC( uint32_t u ) { m_uiBitsForPOC = u; } uint32_t getBitsForPOC() const { return m_uiBitsForPOC; } - void setQuadtreeTULog2MaxSize( uint32_t u ) { m_uiQuadtreeTULog2MaxSize = u; } - uint32_t getQuadtreeTULog2MaxSize() const { return m_uiQuadtreeTULog2MaxSize; } - void setQuadtreeTULog2MinSize( uint32_t u ) { m_uiQuadtreeTULog2MinSize = u; } - uint32_t getQuadtreeTULog2MinSize() const { return m_uiQuadtreeTULog2MinSize; } - void setQuadtreeTUMaxDepthInter( uint32_t u ) { m_uiQuadtreeTUMaxDepthInter = u; } - void setQuadtreeTUMaxDepthIntra( uint32_t u ) { m_uiQuadtreeTUMaxDepthIntra = u; } - uint32_t getQuadtreeTUMaxDepthInter() const { return m_uiQuadtreeTUMaxDepthInter; } - uint32_t getQuadtreeTUMaxDepthIntra() const { return m_uiQuadtreeTUMaxDepthIntra; } void setNumReorderPics(int i, uint32_t tlayer) { m_numReorderPics[tlayer] = i; } int getNumReorderPics(uint32_t tlayer) const { return m_numReorderPics[tlayer]; } void createRPSList( int numRPS ); @@ -1155,10 +1144,11 @@ public: void setLongTermRefsPresent(bool b) { m_bLongTermRefsPresent=b; } bool getSPSTemporalMVPEnabledFlag() const { return m_SPSTemporalMVPEnabledFlag; } void setSPSTemporalMVPEnabledFlag(bool b) { m_SPSTemporalMVPEnabledFlag=b; } - // physical transform - void setMaxTrSize( uint32_t u ) { m_uiMaxTrSize = u; } - uint32_t getMaxTrSize() const { return m_uiMaxTrSize; } - +#if MAX_TB_SIZE_SIGNALLING + void setLog2MaxTbSize( uint32_t u ) { m_log2MaxTbSize = u; } + uint32_t getLog2MaxTbSize() const { return m_log2MaxTbSize; } + uint32_t getMaxTbSize() const { return 1 << m_log2MaxTbSize; } +#endif // Bit-depth int getBitDepth(ChannelType type) const { return m_bitDepths.recon[type]; } void setBitDepth(ChannelType type, int u ) { m_bitDepths.recon[type] = u; } diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index fcf39652563aac71500d672b84562f9efd54a079..c14a3266b7e82b916500ec422242daef0061f722 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -182,8 +182,11 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel const uint32_t uiWidth = area.width; const uint32_t uiHeight = area.height; - CHECK( uiWidth > tu.cs->sps->getMaxTrSize() || uiHeight > tu.cs->sps->getMaxTrSize(), "Maximal allowed transformation size exceeded!" ); - +#if MAX_TB_SIZE_SIGNALLING + CHECK( uiWidth > tu.cs->sps->getMaxTbSize() || uiHeight > tu.cs->sps->getMaxTbSize(), "Maximal allowed transformation size exceeded!" ); +#else + CHECK( uiWidth > MAX_TB_SIZEY || uiHeight > MAX_TB_SIZEY, "Maximal allowed transformation size exceeded!" ); +#endif if (tu.cu->transQuantBypass) { // where should this logic go? @@ -439,7 +442,7 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel } #endif - ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, TCoeff block[MAX_TU_SIZE * MAX_TU_SIZE] ); + ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, TCoeff block[MAX_TB_SIZEY * MAX_TB_SIZEY] ); const Pel *resiBuf = resi.buf; const int resiStride = resi.stride; @@ -633,14 +636,17 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q #endif { CodingStructure &cs = *tu.cs; - const SPS &sps = *cs.sps; const CompArea &rect = tu.blocks[compID]; const uint32_t width = rect.width; const uint32_t height = rect.height; const CPelBuf resiBuf = cs.getResiBuf(rect); - CHECK( sps.getMaxTrSize() < width, "Unsupported transformation size" ); +#if MAX_TB_SIZE_SIGNALLING + CHECK( cs.sps->getMaxTbSize() < width, "Unsupported transformation size" ); +#else + CHECK( MAX_TB_SIZEY < width, "Unsupported transformation size" ); +#endif int pos = 0; std::vector<TrCost> trCosts; @@ -723,7 +729,6 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q #endif { CodingStructure &cs = *tu.cs; - const SPS &sps = *cs.sps; const CompArea &rect = tu.blocks[compID]; const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; @@ -773,7 +778,12 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q } else { - CHECK( sps.getMaxTrSize() < uiWidth, "Unsupported transformation size" ); +#if MAX_TB_SIZE_SIGNALLING + CHECK( cs.sps->getMaxTbSize() < uiWidth, "Unsupported transformation size" ); + +#else + CHECK( MAX_TB_SIZEY < uiWidth, "Unsupported transformation size" ); +#endif #if JVET_M0464_UNI_MTS CoeffBuf tempCoeff( loadTr ? m_mtsCoeffs[tu.mtsIdx] : m_plTempCoeff, rect ); @@ -955,7 +965,7 @@ void TrQuant::rdpcmNxN(TransformUnit &tu, const ComponentID &compID, const QpPar RDPCMMode bestMode = NUMBER_OF_RDPCM_MODES; TCoeff bestAbsSum = std::numeric_limits<TCoeff>::max(); - TCoeff bestCoefficients[MAX_TU_SIZE * MAX_TU_SIZE]; + TCoeff bestCoefficients[MAX_TB_SIZEY * MAX_TB_SIZEY]; for (uint32_t modeIndex = 0; modeIndex < NUMBER_OF_RDPCM_MODES; modeIndex++) { diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index e5d55f34e371df0ef8693d3ad37b3e2fd137df6c..3f1e7d90bfbec5345a85b59e2e24b248d821754f 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -153,6 +153,8 @@ #define FIX_PCM 1 // Fix PCM bugs in VTM3 #endif +#define MAX_TB_SIZE_SIGNALLING 0 + #if JVET_M0464_UNI_MTS typedef std::pair<int, bool> TrMode; typedef std::pair<int, int> TrCost; diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp index af9fce47a613a805cb6ec83779f7cc0f7811ab7c..849698ca27a473ccae6976b5bd5535ff430a040d 100644 --- a/source/Lib/CommonLib/UnitPartitioner.cpp +++ b/source/Lib/CommonLib/UnitPartitioner.cpp @@ -376,18 +376,18 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca // specific check for BT splits if( area.height <= minBtSize || area.height > maxBtSize ) canBh = false; - if( area.width > MAX_TU_SIZE_FOR_PROFILE && area.height <= MAX_TU_SIZE_FOR_PROFILE ) canBh = false; + if( area.width > MAX_TB_SIZEY && area.height <= MAX_TB_SIZEY ) canBh = false; 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( area.width <= MAX_TB_SIZEY && area.height > MAX_TB_SIZEY ) canBv = 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( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) canTh = 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; + if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) canTv = false; } #endif @@ -395,7 +395,11 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs { #if JVET_M0421_SPLIT_SIG const CompArea area = currArea().Y(); - const unsigned maxTrSize = cs.sps->getMaxTrSize(); +#if MAX_TB_SIZE_SIGNALLING + const unsigned maxTrSize = cs.sps->getMaxTbSize(); +#else + const unsigned maxTrSize = MAX_TB_SIZEY; +#endif bool canNo, canQt, canBh, canTh, canBv, canTv; @@ -411,7 +415,11 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs const unsigned minBtSize = cs.pcv->getMinBtSize( *cs.slice, chType ); const unsigned maxTtSize = cs.pcv->getMaxTtSize( *cs.slice, chType ); const unsigned minTtSize = cs.pcv->getMinTtSize( *cs.slice, chType ); - const unsigned maxTrSize = cs.sps->getMaxTrSize(); +#if MAX_TB_SIZE_SIGNALLING + const unsigned maxTrSize = cs.sps->getMaxTbSize(); +#else + const unsigned maxTrSize = MAX_TB_SIZEY; +#endif const PartSplit lastSplit = m_partStack.back().split; const PartSplit parlSplit = lastSplit == CU_TRIH_SPLIT ? CU_HORZ_SPLIT : CU_VERT_SPLIT; @@ -531,19 +539,19 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs { case CU_HORZ_SPLIT: if( area.height <= minBtSize || area.height > maxBtSize ) return false; - if( area.width > MAX_TU_SIZE_FOR_PROFILE && area.height <= MAX_TU_SIZE_FOR_PROFILE ) return false; + if( area.width > MAX_TB_SIZEY && area.height <= MAX_TB_SIZEY ) return false; break; case CU_VERT_SPLIT: if( area.width <= minBtSize || area.width > maxBtSize ) return false; - if( area.width <= MAX_TU_SIZE_FOR_PROFILE && area.height > MAX_TU_SIZE_FOR_PROFILE ) return false; + if( area.width <= MAX_TB_SIZEY && area.height > MAX_TB_SIZEY ) return false; break; case CU_TRIH_SPLIT: 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; + if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) return false; break; case CU_TRIV_SPLIT: 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; + if( area.width > MAX_TB_SIZEY || area.height > MAX_TB_SIZEY ) return false; break; default: break; @@ -599,7 +607,7 @@ PartSplit QTBTPartitioner::getImplicitSplit( const CodingStructure &cs ) split = CU_QUAD_SPLIT; } #if JVET_M0446_M0888_M0905_VPDU_AT_PIC_BOUNDARY - if ((!isBlInPic || !isTrInPic) && (currArea().Y().width > MAX_TU_SIZE_FOR_PROFILE || currArea().Y().height > MAX_TU_SIZE_FOR_PROFILE)) + if ((!isBlInPic || !isTrInPic) && (currArea().Y().width > MAX_TB_SIZEY || currArea().Y().height > MAX_TB_SIZEY)) { split = CU_QUAD_SPLIT; } @@ -838,7 +846,7 @@ Partitioning PartitionerImpl::getCUSubPartitions( const UnitArea &cuArea, const if( i & 1 ) blk.x += blk.width; } - CHECK( sub[i].lumaSize().height < MIN_TU_SIZE, "the split causes the block to be smaller than the minimal TU size" ); + CHECK( sub[i].lumaSize().height < MIN_TB_SIZEY, "the split causes the block to be smaller than the minimal TU size" ); } return sub; @@ -935,7 +943,7 @@ Partitioning PartitionerImpl::getCUSubPartitions( const UnitArea &cuArea, const if (i == 1) blk.y += blk.height; } - CHECK(sub[i].lumaSize().height < MIN_TU_SIZE, "the cs split causes the block to be smaller than the minimal TU size"); + CHECK(sub[i].lumaSize().height < MIN_TB_SIZEY, "the cs split causes the block to be smaller than the minimal TU size"); } return sub; @@ -954,7 +962,7 @@ Partitioning PartitionerImpl::getCUSubPartitions( const UnitArea &cuArea, const if( i == 1 ) blk.x += blk.width; } - CHECK( sub[i].lumaSize().width < MIN_TU_SIZE, "the split causes the block to be smaller than the minimal TU size" ); + CHECK( sub[i].lumaSize().width < MIN_TB_SIZEY, "the split causes the block to be smaller than the minimal TU size" ); } return sub; @@ -975,7 +983,7 @@ Partitioning PartitionerImpl::getCUSubPartitions( const UnitArea &cuArea, const if( i == 2 ) blk.y += 3 * blk.height; } - CHECK( sub[i].lumaSize().height < MIN_TU_SIZE, "the cs split causes the block to be smaller than the minimal TU size" ); + CHECK( sub[i].lumaSize().height < MIN_TB_SIZEY, "the cs split causes the block to be smaller than the minimal TU size" ); } return sub; @@ -997,7 +1005,7 @@ Partitioning PartitionerImpl::getCUSubPartitions( const UnitArea &cuArea, const if( i == 2 ) blk.x += 3 * blk.width; } - CHECK( sub[i].lumaSize().width < MIN_TU_SIZE, "the cs split causes the block to be smaller than the minimal TU size" ); + CHECK( sub[i].lumaSize().width < MIN_TB_SIZEY, "the cs split causes the block to be smaller than the minimal TU size" ); } return sub; @@ -1107,7 +1115,11 @@ Partitioning PartitionerImpl::getMaxTuTiling( const UnitArea &cuArea, const Codi static_assert( MAX_LOG2_DIFF_CU_TR_SIZE <= g_maxRtGridSize, "Z-scan tables are only provided for MAX_LOG2_DIFF_CU_TR_SIZE for up to 3 (8x8 tiling)!" ); const CompArea area = cuArea.Y().valid() ? cuArea.Y() : cuArea.Cb(); - const int maxTrSize = cs.sps->getMaxTrSize() >> ( isLuma( area.compID ) ? 0 : 1 ); +#if MAX_TB_SIZE_SIGNALLING + const int maxTrSize = cs.sps->getMaxTbSize() >> ( isLuma( area.compID ) ? 0 : 1 ); +#else + const int maxTrSize = MAX_TB_SIZEY >> ( isLuma( area.compID ) ? 0 : 1 ); +#endif const int numTilesH = std::max<int>( 1, area.width / maxTrSize ); const int numTilesV = std::max<int>( 1, area.height / maxTrSize ); const int numTiles = numTilesH * numTilesV; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index f681fbb83a8c48c2fc93bb7e95129dfdc8560414..df6d906f1e9c5a6f93b94a815aac404ccf907565 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -392,7 +392,11 @@ ISPType CU::canUseISPSplit( const CodingUnit &cu, const ComponentID compID ) { const int width = cu.blocks[compID].width; const int height = cu.blocks[compID].height; - const int maxTrSize = cu.cs->sps->getMaxTrSize(); +#if MAX_TB_SIZE_SIGNALLING + const int maxTrSize = cu.cs->sps->getMaxTbSize(); +#else + const int maxTrSize = MAX_TB_SIZEY; +#endif return CU::canUseISPSplit( width, height, maxTrSize ); } @@ -400,7 +404,7 @@ ISPType CU::canUseISPSplit( const int width, const int height, const int maxTrSi { bool widthCannotBeUsed = false, heightCannotBeUsed = false; - const uint32_t minTuSizeForISP = MIN_TU_SIZE; + const uint32_t minTuSizeForISP = MIN_TB_SIZEY; bool notEnoughSamplesToSplit = ( g_aucLog2[width] + g_aucLog2[height] <= ( g_aucLog2[minTuSizeForISP] << 1 ) ); widthCannotBeUsed = width > maxTrSize || notEnoughSamplesToSplit; heightCannotBeUsed = height > maxTrSize || notEnoughSamplesToSplit; @@ -439,7 +443,7 @@ uint32_t CU::getISPSplitDim( const int width, const int height, const PartSplit nonSplitDimensionSize = height; } - const int minNumberOfSamplesPerCu = 1 << ( ( g_aucLog2[MIN_TU_SIZE] << 1 ) ); + const int minNumberOfSamplesPerCu = 1 << ( ( g_aucLog2[MIN_TB_SIZEY] << 1 ) ); const int factorToMinSamples = nonSplitDimensionSize < minNumberOfSamplesPerCu ? minNumberOfSamplesPerCu >> g_aucLog2[nonSplitDimensionSize] : 1; partitionSize = ( splitDimensionSize >> divShift ) < factorToMinSamples ? factorToMinSamples : ( splitDimensionSize >> divShift ); diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index b49f8b758672f21d4c397ba1506802bf21e3ea1b..f285e393b6c9d3c89395d6d67b8f4881189b2032 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -99,7 +99,7 @@ namespace CU bool isISPLast ( const CodingUnit &cu, const CompArea &tuArea, const ComponentID compID ); bool isISPFirst ( const CodingUnit &cu, const CompArea &tuArea, const ComponentID compID ); ISPType canUseISPSplit ( const CodingUnit &cu, const ComponentID compID ); - ISPType canUseISPSplit ( const int width, const int height, const int maxTrSize = MAX_TU_SIZE ); + ISPType canUseISPSplit ( const int width, const int height, const int maxTrSize = MAX_TB_SIZEY ); uint32_t getISPSplitDim ( const int width, const int height, const PartSplit ispType ); #endif diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index c45864f6290260c7637df32b15d28df860fa76e8..33807a2f32dd00f6cd895878c101cd593767a39f 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -840,7 +840,11 @@ void DecLib::xActivateParameterSets() m_cCuDecoder.initDecCuReshaper(&m_cReshaper, sps->getChromaFormatIdc()); } #endif - m_cTrQuant.init( nullptr, sps->getMaxTrSize(), false, false, false, false, false ); +#if MAX_TB_SIZE_SIGNALLING + m_cTrQuant.init( nullptr, sps->getMaxTbSize(), false, false, false, false, false ); +#else + m_cTrQuant.init( nullptr, MAX_TB_SIZEY, false, false, false, false, false ); +#endif // RdCost m_cRdCost.setCostMode ( COST_STANDARD_LOSSY ); // not used in decoder side RdCost stuff -> set to default diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 56c467b818093085bd982fec12afd724fb325baf..0ed49bc7d611363291203acb896278d786c636f0 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1000,11 +1000,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) CHECK(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() < 5, "Invalid code"); } - // 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()) ); - +#if MAX_TB_SIZE_SIGNALLING + // KJS: Not in syntax + READ_UVLC( uiCode, "log2_max_luma_transform_block_size_minus2" ); pcSPS->setLog2MaxTbSize( uiCode + 2 ); +#endif READ_FLAG( uiCode, "sps_sao_enabled_flag" ); pcSPS->setSAOEnabledFlag ( uiCode ? true : false ); READ_FLAG( uiCode, "sps_alf_enabled_flag" ); pcSPS->setALFEnabledFlag ( uiCode ? true : false ); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 64db89dfbe06b25a5fc26ea45f2bb655e14b1c19..6e25a19a182ac140a02b6586b1dd3afbf9a316ca 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -299,11 +299,9 @@ protected: bool m_e0023FastEnc; bool m_contentBasedFastQtbt; - //======= Transform ============= - uint32_t m_uiQuadtreeTULog2MaxSize; - uint32_t m_uiQuadtreeTULog2MinSize; - uint32_t m_uiQuadtreeTUMaxDepthInter; - uint32_t m_uiQuadtreeTUMaxDepthIntra; +#if MAX_TB_SIZE_SIGNALLING + uint32_t m_log2MaxTbSize; +#endif //====== Loop/Deblock Filter ======== bool m_bLoopFilterDisable; @@ -899,11 +897,9 @@ public: void setUseContentBasedFastQtbt ( bool b ) { m_contentBasedFastQtbt = b; } bool getUseContentBasedFastQtbt () const { return m_contentBasedFastQtbt; } - //======== Transform ============= - void setQuadtreeTULog2MaxSize ( uint32_t u ) { m_uiQuadtreeTULog2MaxSize = u; } - void setQuadtreeTULog2MinSize ( uint32_t u ) { m_uiQuadtreeTULog2MinSize = u; } - void setQuadtreeTUMaxDepthInter ( uint32_t u ) { m_uiQuadtreeTUMaxDepthInter = u; } - void setQuadtreeTUMaxDepthIntra ( uint32_t u ) { m_uiQuadtreeTUMaxDepthIntra = u; } +#if MAX_TB_SIZE_SIGNALLING + void setLog2MaxTbSize ( uint32_t u ) { m_log2MaxTbSize = u; } +#endif //====== Loop/Deblock Filter ======== void setLoopFilterDisable ( bool b ) { m_bLoopFilterDisable = b; } @@ -1012,12 +1008,6 @@ public: bool getAccessUnitDelimiter() const { return m_AccessUnitDelimiter; } void setAccessUnitDelimiter(bool val){ m_AccessUnitDelimiter = val; } - //======== Transform ============= - uint32_t getQuadtreeTULog2MaxSize () const { return m_uiQuadtreeTULog2MaxSize; } - uint32_t getQuadtreeTULog2MinSize () const { return m_uiQuadtreeTULog2MinSize; } - uint32_t getQuadtreeTUMaxDepthInter () const { return m_uiQuadtreeTUMaxDepthInter; } - uint32_t getQuadtreeTUMaxDepthIntra () const { return m_uiQuadtreeTUMaxDepthIntra; } - //==== Loop/Deblock Filter ======== bool getLoopFilterDisable () { return m_bLoopFilterDisable; } bool getLoopFilterOffsetInPPS () { return m_loopFilterOffsetInPPS; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 58beb9272dec5b314d8ac4329da8230acf07e065..b7c5c77ec2c622597292d5fdfdaf67016c7a03a7 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -4897,7 +4897,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be } } #endif - if( cu->lwidth() <= MAX_TU_SIZE_FOR_PROFILE && cu->lheight() <= MAX_TU_SIZE_FOR_PROFILE ) + if( cu->lwidth() <= MAX_TB_SIZEY && cu->lheight() <= MAX_TB_SIZEY ) { CHECK( tempCS->tus.size() != 1, "tu must be only one" ); } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 1b65607633369ca81e8084292c9cb754496b5962..ca313995e1f63b8c4474f1cd1bfecef584eb6f0a 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -2184,7 +2184,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (pcSlice->getPPS()->getUseDQP() && pcSlice->getPPS()->getMaxCuDQPDepth() > 0) { const PreCalcValues &pcv = *pcPic->cs->pcv; - const unsigned mtsLog2 = (unsigned)g_aucLog2[std::min (pcPic->cs->sps->getMaxTrSize(), pcv.maxCUWidth)]; +#if MAX_TB_SIZE_SIGNALLING + const unsigned mtsLog2 = (unsigned)g_aucLog2[std::min (pcPic->cs->sps->getMaxTbSize(), pcv.maxCUWidth)]; +#else + const unsigned mtsLog2 = (unsigned)g_aucLog2[std::min<uint32_t> (MAX_TB_SIZEY, pcv.maxCUWidth)]; +#endif pcPic->m_subCtuQP.resize ((pcv.maxCUWidth >> mtsLog2) * (pcv.maxCUHeight >> mtsLog2)); } #endif @@ -4049,8 +4053,12 @@ void EncGOP::applyDeblockingFilterMetric( Picture* pcPic, uint32_t uiNumSlices ) Pel* tempRec = Rec; const Slice* pcSlice = pcPic->slices[0]; - uint32_t log2maxTB = pcSlice->getSPS()->getQuadtreeTULog2MaxSize(); - uint32_t maxTBsize = (1<<log2maxTB); +#if MAX_TB_SIZE_SIGNALLING + const uint32_t log2maxTB = pcSlice->getSPS()->getLog2MaxTbSize(); +#else + const uint32_t log2maxTB = MAX_TB_LOG2_SIZEY; +#endif + const uint32_t maxTBsize = (1<<log2maxTB); const uint32_t minBlockArtSize = 8; const uint32_t noCol = (picWidth>>log2maxTB); const uint32_t noRows = (picHeight>>log2maxTB); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index c975d68d8e9c510d259ed15273a0adfaa4dcb8b6..29361fbba5a1b74f74d45d3140136ed64df0e1d1 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -284,7 +284,12 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) // initialize transform & quantization class m_cTrQuant[jId].init( jId == 0 ? nullptr : m_cTrQuant[0].getQuant(), - 1 << m_uiQuadtreeTULog2MaxSize, +#if MAX_TB_SIZE_SIGNALLING + 1 << m_log2MaxTbSize, + +#else + MAX_TB_SIZEY, +#endif m_useRDOQ, m_useRDOQTS, #if T0196_SELECTIVE_RDOQ @@ -316,7 +321,11 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) // initialize transform & quantization class m_cTrQuant.init( nullptr, - 1 << m_uiQuadtreeTULog2MaxSize, +#if MAX_TB_SIZE_SIGNALLING + 1 << m_log2MaxTbSize, +#else + MAX_TB_SIZEY, +#endif m_useRDOQ, m_useRDOQTS, #if T0196_SELECTIVE_RDOQ @@ -982,14 +991,11 @@ void EncLib::xInitSPS(SPS &sps) sps.setPCMEnabledFlag ( m_usePCM ); sps.setPCMLog2MaxSize( m_pcmLog2MaxSize ); - sps.setQuadtreeTULog2MaxSize( m_uiQuadtreeTULog2MaxSize ); - sps.setQuadtreeTULog2MinSize( m_uiQuadtreeTULog2MinSize ); - sps.setQuadtreeTUMaxDepthInter( m_uiQuadtreeTUMaxDepthInter ); - sps.setQuadtreeTUMaxDepthIntra( m_uiQuadtreeTUMaxDepthIntra ); - sps.setSPSTemporalMVPEnabledFlag((getTMVPModeId() == 2 || getTMVPModeId() == 1)); - sps.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); +#if MAX_TB_SIZE_SIGNALLING + sps.setLog2MaxTbSize ( m_log2MaxTbSize ); +#endif for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) { diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 074a647708a29c50434c9987ab5233560cf8b70d..4608571dedfed4a4bc135adcd28aca6fbfc31678 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1167,7 +1167,11 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru if ((partitioner.currArea().lwidth() < pcv.maxCUWidth) && (partitioner.currArea().lheight() < pcv.maxCUHeight) && cs.picture) { const Position &pos = getMaxLumaDQPDepthPos (cs, partitioner); - const unsigned mtsLog2 = (unsigned)g_aucLog2[std::min (cs.sps->getMaxTrSize(), pcv.maxCUWidth)]; +#if MAX_TB_SIZE_SIGNALLING + const unsigned mtsLog2 = (unsigned)g_aucLog2[std::min (cs.sps->getMaxTbSize(), pcv.maxCUWidth)]; +#else + const unsigned mtsLog2 = (unsigned)g_aucLog2[std::min<uint32_t> (MAX_TB_SIZEY, pcv.maxCUWidth)]; +#endif const unsigned stride = pcv.maxCUWidth >> mtsLog2; baseQP = cs.picture->m_subCtuQP[((pos.x & pcv.maxCUWidthMask) >> mtsLog2) + stride * ((pos.y & pcv.maxCUHeightMask) >> mtsLog2)]; @@ -1754,7 +1758,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt #if JVET_M0483_IBC if (bestCU && ((bestCU->btDepth == 0 && maxBTD >= ((slice.isIntra() && !slice.getSPS()->getIBCFlag()) ? 3 : 2)) || (bestCU->btDepth == 1 && cuBR && cuBR->btDepth == 1 && maxBTD >= ((slice.isIntra() && !slice.getSPS()->getIBCFlag()) ? 4 : 3))) - && (width <= MAX_TU_SIZE_FOR_PROFILE && height <= MAX_TU_SIZE_FOR_PROFILE) + && (width <= MAX_TB_SIZEY && height <= MAX_TB_SIZEY) && cuECtx.get<bool>(DID_HORZ_SPLIT) && cuECtx.get<bool>(DID_VERT_SPLIT)) { return false; @@ -1762,7 +1766,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt #else if( bestCU && ( ( bestCU->btDepth == 0 && maxBTD >= ( slice.isIntra() ? 3 : 2 ) ) || ( bestCU->btDepth == 1 && cuBR && cuBR->btDepth == 1 && maxBTD >= ( slice.isIntra() ? 4 : 3 ) ) ) - && ( width <= MAX_TU_SIZE_FOR_PROFILE && height <= MAX_TU_SIZE_FOR_PROFILE ) + && ( width <= MAX_TB_SIZEY && height <= MAX_TB_SIZEY ) && cuECtx.get<bool>( DID_HORZ_SPLIT ) && cuECtx.get<bool>( DID_VERT_SPLIT ) ) { return false; diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index 25c9a7b8e48ac08a8a69e42b480184aec235d28e..3f220a4cce27bde51ffdeced1fd5a19e5eecb000 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -1099,7 +1099,11 @@ static int applyQPAdaptationSubCtu (CodingStructure &cs, const UnitArea ctuArea, #if SHARP_LUMA_DELTA_QP const int lumaCtuDQP = useSharpLumaDQP ? lumaDQPOffset ((uint32_t)pcPic->m_uEnerHpCtu[ctuAddr], bitDepth) : 0; #endif - const unsigned mts = std::min (cs.sps->getMaxTrSize(), pcv.maxCUWidth); +#if MAX_TB_SIZE_SIGNALLING + const unsigned mts = std::min (cs.sps->getMaxTbSize(), pcv.maxCUWidth); +#else + const unsigned mts = std::min<uint32_t> (MAX_TB_SIZEY, pcv.maxCUWidth); +#endif const unsigned mtsLog2 = (unsigned)g_aucLog2[mts]; const unsigned stride = pcv.maxCUWidth >> mtsLog2; unsigned numAct = 0; // number of block activities diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 5df78cec9e57444067f36142f18dd0d884649c7c..2d11fecc58fd1c1d2238f06a4f52166b7bb484bf 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -339,7 +339,11 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) int ispOptions[NUM_INTRA_SUBPARTITIONS_MODES] = { 0 }; if( nOptionsForISP > 1 ) { - auto splitsThatCanBeUsedForISP = CU::canUseISPSplit( width, height, cu.cs->sps->getMaxTrSize() ); +#if MAX_TB_SIZE_SIGNALLING + auto splitsThatCanBeUsedForISP = CU::canUseISPSplit( width, height, cu.cs->sps->getMaxTbSize() ); +#else + auto splitsThatCanBeUsedForISP = CU::canUseISPSplit( width, height, MAX_TB_SIZEY ); +#endif if( splitsThatCanBeUsedForISP == CAN_USE_VER_AND_HORL_SPLITS ) { const CodingUnit* cuLeft = cu.ispMode != NOT_INTRA_SUBPARTITIONS ? cs.getCU( cs.area.blocks[partitioner.chType].pos().offset( -1, 0 ), partitioner.chType ) : nullptr; diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index e28d975da3553ebe0de3d39031ab4750dc348b75..9b94251dfa2f724c4d71ebfda9beb330f8d0d598 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -680,10 +680,10 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) } } - // 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" ); - +#if MAX_TB_SIZE_SIGNALLING + // KJS: Not in syntax + WRITE_UVLC( pcSPS->getLog2MaxTbSize() - 2, "log2_max_luma_transform_block_size_minus2" ); +#endif WRITE_FLAG( pcSPS->getSAOEnabledFlag(), "sps_sao_enabled_flag"); WRITE_FLAG( pcSPS->getALFEnabledFlag(), "sps_alf_enabled_flag" );