From ff977ac46635f096565b481e9009c08c85636b67 Mon Sep 17 00:00:00 2001 From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de> Date: Mon, 26 Nov 2018 20:01:21 +0100 Subject: [PATCH] Structure cleanup --- cfg/encoder_intra_vtm.cfg | 1 - cfg/encoder_lowdelay_P_vtm.cfg | 1 - cfg/encoder_lowdelay_vtm.cfg | 1 - cfg/encoder_randomaccess_vtm.cfg | 1 - source/App/EncoderApp/EncApp.cpp | 6 +- source/App/EncoderApp/EncAppCfg.cpp | 69 ++----- source/App/EncoderApp/EncAppCfg.h | 2 - source/Lib/CommonLib/CodingStructure.cpp | 7 +- source/Lib/CommonLib/CommonDef.h | 2 - source/Lib/CommonLib/ContextModelling.cpp | 38 +--- source/Lib/CommonLib/DepQuant.cpp | 8 +- source/Lib/CommonLib/IntraPrediction.cpp | 32 +-- source/Lib/CommonLib/LoopFilter.cpp | 13 +- source/Lib/CommonLib/RdCost.cpp | 13 +- source/Lib/CommonLib/RdCost.h | 4 - source/Lib/CommonLib/Slice.cpp | 1 - source/Lib/CommonLib/Slice.h | 15 +- source/Lib/CommonLib/TrQuant.cpp | 21 +- source/Lib/CommonLib/TrQuant.h | 3 +- source/Lib/CommonLib/TypeDef.h | 7 - source/Lib/CommonLib/Unit.cpp | 2 - source/Lib/CommonLib/Unit.h | 1 - source/Lib/CommonLib/UnitPartitioner.cpp | 15 +- source/Lib/CommonLib/UnitTools.cpp | 17 +- .../Lib/CommonLib/dtrace_blockstatistics.cpp | 2 +- source/Lib/CommonLib/x86/RdCostX86.h | 12 +- source/Lib/DecoderLib/CABACReader.cpp | 52 ++--- source/Lib/DecoderLib/DecCu.cpp | 65 +----- source/Lib/DecoderLib/DecLib.cpp | 3 +- source/Lib/DecoderLib/VLCReader.cpp | 177 ++++++++-------- source/Lib/EncoderLib/CABACWriter.cpp | 59 ++---- source/Lib/EncoderLib/EncCfg.h | 6 - source/Lib/EncoderLib/EncCu.cpp | 195 +++++------------- source/Lib/EncoderLib/EncCu.h | 2 +- source/Lib/EncoderLib/EncLib.cpp | 7 +- source/Lib/EncoderLib/EncModeCtrl.cpp | 49 +++-- source/Lib/EncoderLib/EncModeCtrl.h | 15 +- source/Lib/EncoderLib/InterSearch.cpp | 194 ++--------------- source/Lib/EncoderLib/InterSearch.h | 10 +- source/Lib/EncoderLib/IntraSearch.cpp | 102 +++------ source/Lib/EncoderLib/VLCWriter.cpp | 133 ++++++------ 41 files changed, 392 insertions(+), 971 deletions(-) diff --git a/cfg/encoder_intra_vtm.cfg b/cfg/encoder_intra_vtm.cfg index 100dc175b..5de7eca29 100644 --- a/cfg/encoder_intra_vtm.cfg +++ b/cfg/encoder_intra_vtm.cfg @@ -92,7 +92,6 @@ CTUSize : 128 LCTUFast : 1 QuadtreeTULog2MaxSize : 6 -QTBT : 1 # QTBT DualITree : 1 # separate partitioning of luma and chroma channels for I-slices MinQTLumaISlice : 8 MinQTChromaISlice : 4 diff --git a/cfg/encoder_lowdelay_P_vtm.cfg b/cfg/encoder_lowdelay_P_vtm.cfg index 60efe6071..16ee4e63f 100644 --- a/cfg/encoder_lowdelay_P_vtm.cfg +++ b/cfg/encoder_lowdelay_P_vtm.cfg @@ -108,7 +108,6 @@ CTUSize : 128 LCTUFast : 1 QuadtreeTULog2MaxSize : 6 -QTBT : 1 # QTBT DualITree : 1 # separate partitioning of luma and chroma channels for I-slices MinQTLumaISlice : 8 MinQTChromaISlice : 4 diff --git a/cfg/encoder_lowdelay_vtm.cfg b/cfg/encoder_lowdelay_vtm.cfg index 9612eadad..935e25973 100644 --- a/cfg/encoder_lowdelay_vtm.cfg +++ b/cfg/encoder_lowdelay_vtm.cfg @@ -108,7 +108,6 @@ CTUSize : 128 LCTUFast : 1 QuadtreeTULog2MaxSize : 6 -QTBT : 1 # QTBT DualITree : 1 # separate partitioning of luma and chroma channels for I-slices MinQTLumaISlice : 8 MinQTChromaISlice : 4 diff --git a/cfg/encoder_randomaccess_vtm.cfg b/cfg/encoder_randomaccess_vtm.cfg index 8dbf07b89..2e938d715 100644 --- a/cfg/encoder_randomaccess_vtm.cfg +++ b/cfg/encoder_randomaccess_vtm.cfg @@ -122,7 +122,6 @@ CTUSize : 128 LCTUFast : 1 QuadtreeTULog2MaxSize : 6 -QTBT : 1 # QTBT DualITree : 1 # separate partitioning of luma and chroma channels for I-slices MinQTLumaISlice : 8 MinQTChromaISlice : 4 diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 25e02c2a2..f48428987 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -211,7 +211,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseSelectiveRDOQ ( m_useSelectiveRDOQ ); #endif m_cEncLib.setRDpenalty ( m_rdPenalty ); - m_cEncLib.setQTBT ( m_QTBT ); m_cEncLib.setCTUSize ( m_uiCTUSize ); #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT m_cEncLib.setUseSplitConsOverride ( m_SplitConsOverrideEnabledFlag ); @@ -278,8 +277,8 @@ void EncApp::xInitLibCfg() // ADD_NEW_TOOL : (encoder app) add setting of tool enabling flags and associated parameters here - m_cEncLib.setMaxCUWidth ( m_QTBT ? m_uiCTUSize : m_uiMaxCUWidth ); - m_cEncLib.setMaxCUHeight ( m_QTBT ? m_uiCTUSize : m_uiMaxCUWidth ); + m_cEncLib.setMaxCUWidth ( m_uiCTUSize ); + m_cEncLib.setMaxCUHeight ( m_uiCTUSize ); m_cEncLib.setMaxCodingDepth ( m_uiMaxCodingDepth ); m_cEncLib.setLog2DiffMaxMinCodingBlockSize ( m_uiLog2DiffMaxMinCodingBlockSize ); m_cEncLib.setQuadtreeTULog2MaxSize ( m_quadtreeTULog2MaxSize ); @@ -535,7 +534,6 @@ void EncApp::xInitLibCfg() m_cEncLib.setSummaryVerboseness ( m_summaryVerboseness ); m_cEncLib.setIMV ( m_ImvMode ); m_cEncLib.setIMV4PelFast ( m_Imv4PelFast ); - m_cEncLib.setIMVMaxCand ( m_ImvMaxCand ); m_cEncLib.setDecodeBitstream ( 0, m_decodeBitstreams[0] ); m_cEncLib.setDecodeBitstream ( 1, m_decodeBitstreams[1] ); m_cEncLib.setSwitchPOC ( m_switchPOC ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index d33c3de53..89356829f 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -799,7 +799,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") - ("QTBT", m_QTBT, false, "Enable QTBT (0:off, 1:on) [default: off]") ("MTT", m_MTT, 0u, "Multi type tree type (0: off, 1:QTBT + triple split) [default: 0]") ("CTUSize", m_uiCTUSize, 128u, "CTUSize (specifies the CTU size if QTBT is on) [default: 128]") #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT @@ -836,7 +835,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) "\t1: IMV default (Full-Pel)\n" "\t2: IMV Full-Pel and 4-PEL\n") ("IMV4PelFast", m_Imv4PelFast, 1, "Fast 4-Pel Adaptive MV precision Mode 0:disabled, 1:enabled) [default: 1]") - ("IMVMaxCand", m_ImvMaxCand, 4, "max IMV cand (QTBF off only)") #if ENABLE_WPP_PARALLELISM ("AltDQPCoding", m_AltDQPCoding, false, "Improved predictive delta-QP coding (0:off, 1:on) [default: off]") #endif @@ -1870,21 +1868,18 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) if( ( 1u << m_tuLog2MaxSize ) > m_uiCTUSize ) m_tuLog2MaxSize--; } - if( m_QTBT ) + const int minCuSize = 1 << MIN_CU_LOG2; + m_uiMaxCodingDepth = 0; + while( ( m_uiCTUSize >> m_uiMaxCodingDepth ) > minCuSize ) { - int minCuSize = 1 << MIN_CU_LOG2; - m_uiMaxCodingDepth = 0; - while( ( m_uiCTUSize >> m_uiMaxCodingDepth ) > minCuSize ) - { - m_uiMaxCodingDepth++; - } - m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCodingDepth; - m_uiMaxCUWidth = m_uiMaxCUHeight = m_uiCTUSize; - m_uiMaxCUDepth = m_uiMaxCodingDepth; + m_uiMaxCodingDepth++; + } + m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCodingDepth; + m_uiMaxCUWidth = m_uiMaxCUHeight = m_uiCTUSize; + m_uiMaxCUDepth = m_uiMaxCodingDepth; #if !JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCUDepth - 1; + m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCUDepth - 1; #endif - } // check validity of input parameters if( xCheckParameter() ) @@ -1893,22 +1888,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) return false; } - if( !m_QTBT ) - { - // compute actual CU depth with respect to config depth and max transform size - uint32_t uiAddCUDepth = 0; - while( ( m_uiMaxCUWidth >> m_uiMaxCUDepth ) > ( 1 << ( m_quadtreeTULog2MinSize + uiAddCUDepth ) ) ) - { - uiAddCUDepth++; - } - - m_uiMaxCodingDepth = m_uiMaxCUDepth + uiAddCUDepth; // if minimum TU larger than 4x4, allow for additional part indices for 4:2:2 SubTUs. - m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCUDepth - 1; - - m_uiCTUSize = m_uiMaxCUWidth; - } - - // print-out parameters xPrintParameter(); @@ -1954,7 +1933,6 @@ bool EncAppCfg::xCheckParameter() #if ENABLE_WPP_PARALLELISM xConfirmPara( m_numWppThreads > 1, "WPP-style parallelization only supported with NEXT profile" ); #endif - xConfirmPara( m_QTBT, "QTBT only allowed with NEXT profile" ); xConfirmPara( m_LMChroma, "LMChroma only allowed with NEXT profile" ); xConfirmPara( m_LargeCTU, "Large CTU is only allowed with NEXT profile" ); xConfirmPara( m_SubPuMvpMode != 0, "Sub-PU motion vector prediction is only allowed with NEXT profile" ); @@ -2000,7 +1978,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_signDataHidingEnabledFlag, "SignHideFlag must be equal to 0 if dependent quantization is enabled" ); #endif } - xConfirmPara( !m_QTBT && m_MTT, "Multi type tree is an extension of QTBT, thus QTBT has to be enabled for MTT" ); #if !REMOVE_MV_ADAPT_PREC xConfirmPara(m_Affine && !m_highPrecisionMv, "Affine is not yet implemented for HighPrecMv off."); @@ -2049,13 +2026,8 @@ bool EncAppCfg::xCheckParameter() #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT xConfirmPara( m_useAMaxBT && !m_SplitConsOverrideEnabledFlag, "AMaxBt can only be used with PartitionConstriantsOverride enabled" ); #endif - xConfirmPara( m_useAMaxBT && !m_QTBT, "AMaxBT can only be used with QTBT!" ); - - - - - - + + xConfirmPara(m_bitstreamFileName.empty(), "A bitstream file name must be specified (BitstreamFile)"); const uint32_t maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]); xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value"); @@ -2251,10 +2223,6 @@ bool EncAppCfg::xCheckParameter() #if SHARP_LUMA_DELTA_QP xConfirmPara( m_lumaLevelToDeltaQPMapping.mode && m_uiDeltaQpRD > 0, "Luma-level-based Delta QP cannot be used together with slice level multiple-QP optimization\n" ); #endif - if( !m_QTBT ) - { - xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); - } xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); @@ -2297,7 +2265,7 @@ bool EncAppCfg::xCheckParameter() { xConfirmPara( m_uiMaxCUHeight > 64, "CTU bigger than 64 only allowed with large CTU." ); xConfirmPara( m_uiMaxCUWidth > 64, "CTU bigger than 64 only allowed with large CTU." ); - if( m_QTBT ) xConfirmPara( m_uiCTUSize > 64, "CTU bigger than 64 only allowed with large CTU." ); + xConfirmPara( m_uiCTUSize > 64, "CTU bigger than 64 only allowed with large CTU." ); } if( m_profile == Profile::NEXT ) @@ -3101,7 +3069,6 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "FDM:%d ", m_useFastDecisionForMerge ); msg( VERBOSE, "CFM:%d ", m_bUseCbfFastMode ); msg( VERBOSE, "ESD:%d ", m_useEarlySkipDetection ); - msg( VERBOSE, "RQT:%d ", !m_QTBT ); msg( VERBOSE, "TransformSkip:%d ", m_useTransformSkip ); msg( VERBOSE, "TransformSkipFast:%d ", m_useTransformSkipFast ); msg( VERBOSE, "TransformSkipLog2MaxSize:%d ", m_log2MaxTransformSkipBlockSize); @@ -3164,12 +3131,10 @@ void EncAppCfg::xPrintParameter() msg(VERBOSE, "SubPuMvpLog2Size:%d ", m_SubPuMvpLog2Size); } #endif - msg( VERBOSE, "QTBT:%d ", m_QTBT ); - if( m_QTBT ) msg( VERBOSE, "DualITree:%d ", m_dualTree ); + msg( VERBOSE, "DualITree:%d ", m_dualTree ); msg( VERBOSE, "LargeCTU:%d ", m_LargeCTU ); msg( VERBOSE, "IMV:%d ", m_ImvMode ); - if( !m_QTBT ) msg( VERBOSE, "IMVMaxCand:%d ", m_ImvMaxCand ); -#if !REMOVE_MV_ADAPT_PREC +#if !REMOVE_MV_ADAPT_PREC msg(VERBOSE, "HighPrecMv:%d ", m_highPrecisionMv); #endif #if JVET_L0256_BIO @@ -3211,9 +3176,9 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "PBIntraFast:%d ", m_usePbIntraFast ); if( m_ImvMode == 2 ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast ); if( m_EMT ) msg( VERBOSE, "EMTFast: %1d(intra) %1d(inter) ", ( m_FastEMT & m_EMT & 1 ), ( m_FastEMT >> 1 ) & ( m_EMT >> 1 ) & 1 ); - if( m_QTBT ) msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT ); - if( m_QTBT ) msg( VERBOSE, "E0023FastEnc:%d ", m_e0023FastEnc ); - if( m_QTBT ) msg( VERBOSE, "ContentBasedFastQtbt:%d ", m_contentBasedFastQtbt ); + msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT ); + msg( VERBOSE, "E0023FastEnc:%d ", m_e0023FastEnc ); + msg( VERBOSE, "ContentBasedFastQtbt:%d ", m_contentBasedFastQtbt ); msg( VERBOSE, "NumSplitThreads:%d ", m_numSplitThreads ); if( m_numSplitThreads > 1 ) diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index a697945e7..bd140d91d 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -196,7 +196,6 @@ protected: int m_maxTempLayer; ///< Max temporal layer // coding unit (CU) definition - bool m_QTBT; unsigned m_uiCTUSize; #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT bool m_SplitConsOverrideEnabledFlag; @@ -525,7 +524,6 @@ protected: int m_log2MaxMvLengthVertical; ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units int m_ImvMode; ///< imv mode int m_Imv4PelFast; ///< imv 4-Pel fast mode - int m_ImvMaxCand; ///< imv max num cand for test (QTBT off only) std::string m_colourRemapSEIFileRoot; std::string m_summaryOutFilename; ///< filename to use for producing summary output file. diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index fe6714d89..c8fa7d267 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -361,10 +361,7 @@ PredictionUnit& CodingStructure::addPU( const UnitArea &unit, const ChannelType #if ENABLE_SPLIT_PARALLELISM || ENABLE_WPP_PARALLELISM CHECK( pu->cacheId != pu->cu->cacheId, "Inconsintent cacheId between the PU and assigned CU" ); - if( pcv->noRQT ) - { - CHECK( pu->cu->firstPU != nullptr, "Without an RQT the firstPU should be null" ); - } + CHECK( pu->cu->firstPU != nullptr, "Without an RQT the firstPU should be null" ); #endif PredictionUnit *prevPU = m_numPUs > 0 ? pus.back() : nullptr; @@ -1340,4 +1337,4 @@ CprLumaCoverage CodingStructure::getCprLumaCoverage(const CompArea& chromaArea) return coverage; } -#endif \ No newline at end of file +#endif diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 35c3ec8a5..65802ad15 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -223,8 +223,6 @@ static const int DM_CHROMA_IDX = NUM_INTRA_MODE; ///< chro static const uint8_t INTER_MODE_IDX = 255; ///< index for inter modes -static const uint32_t EMT_INTRA_MAX_CU = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128 -static const uint32_t EMT_INTER_MAX_CU = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128 static const uint32_t EMT_INTRA_MAX_CU_WITH_QTBT = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128 static const uint32_t EMT_INTER_MAX_CU_WITH_QTBT = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128 #if JVET_L0165_6MPM diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index dd5da2486..f61b32e7d 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -110,35 +110,19 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp #endif if (m_chType == CHANNEL_TYPE_CHROMA) { - if( tu.cs->pcv->rectCUs ) - { #if HEVC_USE_MDCS - const_cast<int&>(m_lastShiftX) = Clip3( 0, 2, int( ( m_scanType == SCAN_VER ? m_height : m_width ) >> 3) ); - const_cast<int&>(m_lastShiftY) = Clip3( 0, 2, int( ( m_scanType == SCAN_VER ? m_width : m_height ) >> 3) ); + const_cast<int&>(m_lastShiftX) = Clip3( 0, 2, int( ( m_scanType == SCAN_VER ? m_height : m_width ) >> 3) ); + const_cast<int&>(m_lastShiftY) = Clip3( 0, 2, int( ( m_scanType == SCAN_VER ? m_width : m_height ) >> 3) ); #else - const_cast<int&>(m_lastShiftX) = Clip3( 0, 2, int( m_width >> 3) ); - const_cast<int&>(m_lastShiftY) = Clip3( 0, 2, int( m_height >> 3) ); + const_cast<int&>(m_lastShiftX) = Clip3( 0, 2, int( m_width >> 3) ); + const_cast<int&>(m_lastShiftY) = Clip3( 0, 2, int( m_height >> 3) ); #endif - } - else - { - const_cast<int&>(m_lastShiftX) = log2sizeX - 2; - const_cast<int&>(m_lastShiftY) = log2sizeY - 2; - } } else { - if( tu.cs->pcv->rectCUs ) - { - static const int prefix_ctx[8] = { 0, 0, 0, 3, 6, 10, 15, 21 }; - const_cast<int&>(m_lastOffsetX) = prefix_ctx[ log2sizeX ]; - const_cast<int&>(m_lastOffsetY) = prefix_ctx[ log2sizeY ];; - } - else - { - const_cast<int&>(m_lastOffsetX) = 3 * (log2sizeX - 2) + ((log2sizeX - 1) >> 2); - const_cast<int&>(m_lastOffsetY) = 3 * (log2sizeY - 2) + ((log2sizeY - 1) >> 2); - } + static const int prefix_ctx[8] = { 0, 0, 0, 3, 6, 10, 15, 21 }; + const_cast<int&>(m_lastOffsetX) = prefix_ctx[ log2sizeX ]; + const_cast<int&>(m_lastOffsetY) = prefix_ctx[ log2sizeY ];; const_cast<int&>(m_lastShiftX) = (log2sizeX + 1) >> 2; const_cast<int&>(m_lastShiftY) = (log2sizeY + 1) >> 2; } @@ -240,11 +224,7 @@ unsigned DeriveCtx::CtxInterDir( const PredictionUnit& pu ) { if( pu.cs->sps->getSpsNext().getUseLargeCTU() ) { - if( pu.cs->pcv->rectCUs ) - { - return Clip3( 0, 3, 7 - ( ( g_aucLog2[pu.lumaSize().width] + g_aucLog2[pu.lumaSize().height] + 1 ) >> 1 ) ); // VG-ASYMM DONE - } - return Clip3( 0, 3, 6 - g_aucLog2[pu.cu->lumaSize().width] ); + return Clip3( 0, 3, 7 - ( ( g_aucLog2[pu.lumaSize().width] + g_aucLog2[pu.lumaSize().height] + 1 ) >> 1 ) ); // VG-ASYMM DONE } return pu.cu->qtDepth; } @@ -610,4 +590,4 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.cu->GBiIdx = (interDirNeighbours[fPosBaseIdx] == 3) ? GBiIdx[fPosBaseIdx] : GBI_DEFAULT; #endif } -#endif \ No newline at end of file +#endif diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index b84dfa29e..cc9503f45 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -491,8 +491,8 @@ namespace DQIntern const bool useYCtx = ( xy != 0 ); #endif const CtxSet& ctxSetLast = ( useYCtx ? Ctx::LastY : Ctx::LastX )[ chType ]; - const unsigned lastShift = ( compID == COMPONENT_Y ? (log2Size+1)>>2 : ( tu.cs->pcv->rectCUs ? Clip3<unsigned>(0,2,size>>3) : log2Size-2 ) ); - const unsigned lastOffset = ( compID == COMPONENT_Y ? ( tu.cs->pcv->rectCUs ? prefixCtx[log2Size] : 3*(log2Size-2)+((log2Size-1)>>2) ) : 0 ); + const unsigned lastShift = ( compID == COMPONENT_Y ? (log2Size+1)>>2 : Clip3<unsigned>(0,2,size>>3) ); + const unsigned lastOffset = ( compID == COMPONENT_Y ? ( prefixCtx[log2Size] ) : 0 ); uint32_t sumFBits = 0; unsigned maxCtxId = g_uiGroupIdx[ size - 1 ]; for( unsigned ctxId = 0; ctxId < maxCtxId; ctxId++ ) @@ -892,8 +892,8 @@ namespace DQIntern const bool useYCtx = ( xy != 0 ); #endif const CtxSet& ctxSetLast = ( useYCtx ? Ctx::LastY : Ctx::LastX )[ m_chType ]; - const unsigned lastShift = ( m_compID == COMPONENT_Y ? (log2Size+1)>>2 : ( tu.cs->pcv->rectCUs ? Clip3<unsigned>(0,2,size>>3) : log2Size-2 ) ); - const unsigned lastOffset = ( m_compID == COMPONENT_Y ? ( tu.cs->pcv->rectCUs ? prefixCtx[log2Size] : 3*(log2Size-2)+((log2Size-1)>>2) ) : 0 ); + const unsigned lastShift = ( m_compID == COMPONENT_Y ? (log2Size+1)>>2 : Clip3<unsigned>(0,2,size>>3) ); + const unsigned lastOffset = ( m_compID == COMPONENT_Y ? prefixCtx[log2Size] : 0 ); uint32_t sumFBits = 0; unsigned maxCtxId = g_uiGroupIdx[ size - 1 ]; for( unsigned ctxId = 0; ctxId < maxCtxId; ctxId++ ) diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index 6f8c41ef4..10b310ae1 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -363,7 +363,6 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co CHECK( g_aucLog2[iWidth] < 2 && pu.cs->pcv->noChroma2x2, "Size not allowed" ); CHECK( g_aucLog2[iWidth] > 7, "Size not allowed" ); - CHECK( iWidth != iHeight && !pu.cs->pcv->rectCUs, "Rectangular block are only allowed with QTBT" ); #if JVET_L0283_MULTI_REF_LINE const int multiRefIdx = (compID == COMPONENT_Y) ? pu.multiRefIdx : 0; @@ -1852,24 +1851,16 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom int iRecStride = Src.stride; int iRecStride2 = iRecStride << 1; - CodingStructure& cs = *pu.cs; const CodingUnit& lumaCU = isChroma( pu.chType ) ? *pu.cs->picture->cs->getCU( lumaArea.pos(), CH_L ) : *pu.cu; const CodingUnit& cu = *pu.cu; const CompArea& area = isChroma( pu.chType ) ? chromaArea : lumaArea; - const SPS &sps = *cs.sps; - const uint32_t uiTuWidth = area.width; const uint32_t uiTuHeight = area.height; int iBaseUnitSize = ( 1 << MIN_CU_LOG2 ); - if( !cs.pcv->rectCUs ) - { - iBaseUnitSize = sps.getMaxCUWidth() >> sps.getMaxCodingDepth(); - } - const int iUnitWidth = iBaseUnitSize >> getComponentScaleX( area.compID, area.chromaFormat ); const int iUnitHeight = iBaseUnitSize >> getComponentScaleX( area.compID, area.chromaFormat ); const int iTUWidthInUnits = uiTuWidth / iUnitWidth; @@ -1907,15 +1898,8 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom ( bNeighborFlags + iLeftUnits - 1 ) ); #endif - if( lumaCU.cs->pcv->rectCUs ) - { - bLeftAvaillable = availlableUnit == iTUHeightInUnits; - } - else - { - bLeftAvaillable = availlableUnit == iTUWidthInUnits; - } - + bLeftAvaillable = availlableUnit == iTUHeightInUnits; + availlableUnit = isAboveAvailable( isChroma( pu.chType ) ? cu : lumaCU, toChannelType( area.compID ), area.pos(), iAboveUnits, iUnitWidth, #if JVET_L0338_MDLM ( bNeighborFlags + iLeftUnits + leftBelowUnits + 1 ) ); @@ -1923,14 +1907,8 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom ( bNeighborFlags + iLeftUnits + 1 ) ); #endif - if( lumaCU.cs->pcv->rectCUs ) - { - bAboveAvaillable = availlableUnit == iTUWidthInUnits; - } - else - { - bAboveAvaillable = availlableUnit == iTUHeightInUnits; - } + bAboveAvaillable = availlableUnit == iTUWidthInUnits; + #if JVET_L0338_MDLM if (bLeftAvaillable) // if left is not available, then the below left is not available { @@ -2477,7 +2455,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component #endif int minDim = bLeftAvaillable && bAboveAvaillable ? 1 << g_aucPrevLog2[std::min( uiCHeight, uiCWidth )] : 1 << g_aucPrevLog2[bLeftAvaillable ? uiCHeight : uiCWidth]; int minStep = 1; - int numSteps = cs.pcv->rectCUs ? minDim / minStep : minDim; + int numSteps = minDim / minStep; if( bAboveAvaillable ) { diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp index 3e2ea44ea..d9ed51017 100644 --- a/source/Lib/CommonLib/LoopFilter.cpp +++ b/source/Lib/CommonLib/LoopFilter.cpp @@ -316,10 +316,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) for( int x = 0; x < area.width; x += uiPelsInPart ) { unsigned uiBSCheck = 1; - if( !cu.cs->pcv->noRQT && uiPelsInPart == 4 ) - { - uiBSCheck = ( ( edgeDir == EDGE_VER ) && ( x % 8 == 0 ) ) || ( ( edgeDir == EDGE_HOR ) && ( y % 8 == 0 ) ); - } const Position localPos { area.x + x, area.y + y }; const unsigned rasterIdx = getRasterIdx( localPos, pcv ); @@ -330,9 +326,6 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) } } - const unsigned shiftFactor = edgeDir == EDGE_VER ? ::getComponentScaleX( COMPONENT_Cb, pcv.chrFormat ) : ::getComponentScaleY( COMPONENT_Cb, pcv.chrFormat ); - const bool bAlwaysDoChroma = pcv.chrFormat == CHROMA_444 || pcv.noRQT; - if (edgeDir == EDGE_HOR) { if (!((cu.block(COMPONENT_Y).y % 8) == 0)) @@ -382,7 +375,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir ) { xEdgeFilterLuma(cu, edgeDir, edge); } - if (cu.blocks[COMPONENT_Cb].valid() && pcv.chrFormat != CHROMA_400 && (bAlwaysDoChroma || (uiPelsInPart > DEBLOCK_SMALLEST_BLOCK) || (edge % ((DEBLOCK_SMALLEST_BLOCK << shiftFactor) / uiPelsInPart)) == 0)) + if (cu.blocks[COMPONENT_Cb].valid() && pcv.chrFormat != CHROMA_400) { xEdgeFilterChroma(cu, edgeDir, edge); } @@ -618,7 +611,7 @@ void LoopFilter::xEdgeFilterLuma(const CodingUnit& cu, const DeblockEdgeDir edge const ClpRng& clpRng( cu.cs->slice->clpRng(COMPONENT_Y) ); int iQP = 0; - unsigned uiNumParts = ( pcv.rectCUs ? ( ( edgeDir == EDGE_VER ) ? lumaArea.height / pcv.minCUHeight : lumaArea.width / pcv.minCUWidth ) : pcv.partsInCtuWidth >> cu.qtDepth ); + unsigned uiNumParts = ( ( ( edgeDir == EDGE_VER ) ? lumaArea.height / pcv.minCUHeight : lumaArea.width / pcv.minCUWidth ) ); int pelsInPart = pcv.minCUWidth; unsigned uiBsAbsIdx = 0, uiBs = 0; int iOffset, iSrcStep; @@ -792,7 +785,7 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed return; } - unsigned uiNumParts = ( pcv.rectCUs ? ( ( edgeDir == EDGE_VER ) ? lumaSize.height / pcv.minCUHeight : lumaSize.width / pcv.minCUWidth ) : pcv.partsInCtuWidth >> cu.qtDepth ); + unsigned uiNumParts = ( edgeDir == EDGE_VER ) ? lumaSize.height / pcv.minCUHeight : lumaSize.width / pcv.minCUWidth ; int uiNumPelsLuma = pcv.minCUWidth; unsigned uiBsAbsIdx; unsigned ucBs; diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index 572eacb8b..dea19abe5 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -192,7 +192,6 @@ void RdCost::copyState( const RdCost& other ) m_mvPredictor = other.m_mvPredictor; m_motionLambda = other.m_motionLambda; m_iCostScale = other.m_iCostScale; - m_useQtbt = other.m_useQtbt; memcpy( m_dLambdaMotionSAD, other.m_dLambdaMotionSAD, sizeof( m_dLambdaMotionSAD ) ); } #endif @@ -201,7 +200,6 @@ void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRef { rcDP.bitDepth = bitDepth; rcDP.compID = compID; - rcDP.isQtbt = m_useQtbt; // set Original & Curr Pointer / Stride rcDP.org = org; @@ -281,7 +279,6 @@ void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const Pel* piRef void RdCost::setDistParam( DistParam &rcDP, const CPelBuf &org, const CPelBuf &cur, int bitDepth, ComponentID compID, bool useHadamard ) { - rcDP.isQtbt = m_useQtbt; rcDP.org = org; rcDP.cur = cur; rcDP.step = 1; @@ -330,7 +327,6 @@ void RdCost::setDistParam( DistParam &rcDP, const Pel* pOrg, const Pel* piRefY, { rcDP.bitDepth = bitDepth; rcDP.compID = compID; - rcDP.isQtbt = m_useQtbt; rcDP.org.buf = pOrg; rcDP.org.stride = iOrgStride; @@ -381,7 +377,6 @@ Distortion RdCost::getDistPart( const CPelBuf &org, const CPelBuf &cur, int bitD { DistParam cDtParam; - cDtParam.isQtbt = m_useQtbt; cDtParam.org = org; cDtParam.cur = cur; cDtParam.step = 1; @@ -2770,7 +2765,7 @@ Distortion RdCost::xGetHADs( const DistParam &rcDtParam ) Distortion uiSum = 0; - if( rcDtParam.isQtbt && iCols > iRows && ( iRows & 7 ) == 0 && ( iCols & 15 ) == 0 ) + if( iCols > iRows && ( iRows & 7 ) == 0 && ( iCols & 15 ) == 0 ) { for( y = 0; y < iRows; y += 8 ) { @@ -2782,7 +2777,7 @@ Distortion RdCost::xGetHADs( const DistParam &rcDtParam ) piCur += iStrideCur * 8; } } - else if( rcDtParam.isQtbt && iCols < iRows && ( iCols & 7 ) == 0 && ( iRows & 15 ) == 0 ) + else if( iCols < iRows && ( iCols & 7 ) == 0 && ( iRows & 15 ) == 0 ) { for( y = 0; y < iRows; y += 16 ) { @@ -2794,7 +2789,7 @@ Distortion RdCost::xGetHADs( const DistParam &rcDtParam ) piCur += iStrideCur * 16; } } - else if( rcDtParam.isQtbt && iCols > iRows && ( iRows & 3 ) == 0 && ( iCols & 7 ) == 0 ) + else if( iCols > iRows && ( iRows & 3 ) == 0 && ( iCols & 7 ) == 0 ) { for( y = 0; y < iRows; y += 4 ) { @@ -2806,7 +2801,7 @@ Distortion RdCost::xGetHADs( const DistParam &rcDtParam ) piCur += iStrideCur * 4; } } - else if( rcDtParam.isQtbt && iCols < iRows && ( iCols & 3 ) == 0 && ( iRows & 7 ) == 0 ) + else if( iCols < iRows && ( iCols & 3 ) == 0 && ( iRows & 7 ) == 0 ) { for( y = 0; y < iRows; y += 8 ) { diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index 81950b777..8e9a96bb3 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -79,7 +79,6 @@ public: bool useMR; bool applyWeight; // whether weighted prediction is used or not bool isBiPred; - bool isQtbt; const WPScalingParam *wpCur; // weighted prediction scaling parameters for current ref ComponentID compID; @@ -121,7 +120,6 @@ private: double m_motionLambda; int m_iCostScale; - bool m_useQtbt; #if JVET_L0293_CPR double m_dCost; // for cpr #endif @@ -148,8 +146,6 @@ public: void setCostMode(CostMode m) { m_costMode = m; } - void setUseQtbt(bool b) { m_useQtbt = b; } - // Distortion Functions void init(); #ifdef TARGET_SIMD_X86 diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index c7f8ee256..0f77bcbfc 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -1776,7 +1776,6 @@ SPSNext::SPSNext( SPS& sps ) : m_SPS ( sps ) , m_NextEnabled ( false ) // disable all tool enabling flags by default - , m_QTBT ( false ) , m_LargeCTU ( false ) , m_SubPuMvp ( false ) , m_IMV ( false ) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 27549be29..c54d840c0 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -800,7 +800,6 @@ private: bool m_NextEnabled; //===== tool enabling flags (4 bytes - NOTE: last flag must be used for new extensions) ===== - bool m_QTBT; // 1 bool m_LargeCTU; // 5 bool m_SubPuMvp; bool m_IMV; // 9 @@ -880,8 +879,6 @@ public: void setNextToolsEnabled ( bool next ) { m_NextEnabled = next; } //===== tool enabling flags and extension bit ===== - void setUseQTBT ( bool QTBT ) { m_QTBT = QTBT; } - bool getUseQTBT () const { return m_QTBT; } void setUseLargeCTU ( bool b ) { m_LargeCTU = b; } bool getUseLargeCTU () const { return m_LargeCTU; } bool getUseSubPuMvp() const { return m_SubPuMvp; } @@ -2155,7 +2152,7 @@ class PreCalcValues public: PreCalcValues( const SPS& sps, const PPS& pps, bool _isEncoder ) : chrFormat ( sps.getChromaFormatIdc() ) - , multiBlock422 ( chrFormat == CHROMA_422 && !sps.getSpsNext().getUseQTBT() ) + , multiBlock422 ( false ) , noMotComp ( sps.getSpsNext().getDisableMotCompress() ) , maxCUWidth ( sps.getMaxCUWidth() ) , maxCUHeight ( sps.getMaxCUHeight() ) @@ -2176,12 +2173,9 @@ public: , lumaWidth ( sps.getPicWidthInLumaSamples() ) , lumaHeight ( sps.getPicHeightInLumaSamples() ) , fastDeltaQPCuMaxSize( Clip3(sps.getMaxCUHeight() >> (sps.getLog2DiffMaxMinCodingBlockSize()), sps.getMaxCUHeight(), 32u) ) - , noRQT ( sps.getSpsNext().getUseQTBT() ) - , rectCUs ( sps.getSpsNext().getUseQTBT() ) - , only2Nx2N ( sps.getSpsNext().getUseQTBT() ) - , noChroma2x2 ( !sps.getSpsNext().getUseQTBT() ) + , noChroma2x2 ( false ) , isEncoder ( _isEncoder ) - , ISingleTree ( !sps.getSpsNext().getUseQTBT() || !sps.getSpsNext().getUseDualITree() ) + , ISingleTree ( !sps.getSpsNext().getUseDualITree() ) , maxBtDepth { sps.getSpsNext().getMaxBTDepthI(), sps.getSpsNext().getMaxBTDepth(), sps.getSpsNext().getMaxBTDepthIChroma() } , minBtSize { MIN_BT_SIZE, MIN_BT_SIZE_INTER, MIN_BT_SIZE_C } , maxBtSize { sps.getSpsNext().getMaxBTSizeI(), sps.getSpsNext().getMaxBTSize(), sps.getSpsNext().getMaxBTSizeIChroma() } @@ -2217,9 +2211,6 @@ public: const unsigned lumaWidth; const unsigned lumaHeight; const unsigned fastDeltaQPCuMaxSize; - const bool noRQT; - const bool rectCUs; - const bool only2Nx2N; const bool noChroma2x2; const bool isEncoder; const bool ISingleTree; diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index e01e8bb7a..3a9ff37dd 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -132,8 +132,7 @@ void xTrMxN_EMT( const int bitDepth, const Pel *residual, size_t stride, TCoeff #else void xTrMxN_EMT( const int bitDepth, const Pel *residual, size_t stride, TCoeff *coeff, int iWidth, int iHeight, const int maxLog2TrDynamicRange, #endif - const uint8_t ucMode, const uint8_t ucTrIdx - , const bool useQTBT ) + const uint8_t ucMode, const uint8_t ucTrIdx) { const int TRANSFORM_MATRIX_SHIFT = g_transformMatrixShift[TRANSFORM_FORWARD]; const int shift_1st = ((g_aucLog2[iWidth ]) + bitDepth + TRANSFORM_MATRIX_SHIFT) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC; @@ -143,17 +142,8 @@ void xTrMxN_EMT( const int bitDepth, const Pel *residual, size_t stride, TCoeff const int iZeroOutThresh = JVET_C0024_ZERO_OUT_TH; int iSkipWidth = 0, iSkipHeight = 0; - if( useQTBT ) - { - iSkipWidth = (iWidth > iZeroOutThresh ? iWidth - iZeroOutThresh : 0); - iSkipHeight = (iHeight > iZeroOutThresh ? iHeight - iZeroOutThresh : 0); - } - else - if( ( ( ucMode == INTER_MODE_IDX || iWidth > iZeroOutThresh ) && ucTrIdx != DCT2_EMT && iWidth >= iZeroOutThresh ) || ( ucTrIdx == DCT2_EMT && iWidth > iZeroOutThresh ) ) - { - iSkipWidth = iWidth >> 1; - iSkipHeight = iHeight >> 1; - } + iSkipWidth = (iWidth > iZeroOutThresh ? iWidth - iZeroOutThresh : 0); + iSkipHeight = (iHeight > iZeroOutThresh ? iHeight - iZeroOutThresh : 0); CHECK( shift_1st < 0, "Negative shift" ); CHECK( shift_2nd < 0, "Negative shift" ); @@ -270,14 +260,12 @@ void TrQuant::init( const Quant* otherQuant, const bool useSelectiveRDOQ, #endif const bool bEnc, - const bool useTransformSkipFast, - const bool rectTUs + const bool useTransformSkipFast ) { m_uiMaxTrSize = uiMaxTrSize; m_bEnc = bEnc; m_useTransformSkipFast = useTransformSkipFast; - m_rectTUs = rectTUs; delete m_quant; m_quant = nullptr; @@ -427,7 +415,6 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel #else xTrMxN_EMT(channelBitDepth, resi.buf, resi.stride, dstCoeff.buf, iWidth, iHeight, maxLog2TrDynamicRange, ucMode, ucTrIdx #endif - , m_rectTUs ); } diff --git a/source/Lib/CommonLib/TrQuant.h b/source/Lib/CommonLib/TrQuant.h index e63083c09..a45c4958d 100644 --- a/source/Lib/CommonLib/TrQuant.h +++ b/source/Lib/CommonLib/TrQuant.h @@ -75,8 +75,7 @@ public: const bool useSelectiveRDOQ = false, #endif const bool bEnc = false, - const bool useTransformSkipFast = false, - const bool rectTUs = false + const bool useTransformSkipFast = false ); uint8_t getEmtTrIdx( TransformUnit tu, const ComponentID compID ); diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 0e33452e5..57b25b615 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -476,13 +476,6 @@ enum DeblockEdgeDir NUM_EDGE_DIR = 2 }; -/// supported partition shape -enum PartSize -{ - SIZE_2Nx2N = 0, ///< symmetric motion partition, 2Nx2N - NUMBER_OF_PART_SIZES -}; - /// supported prediction type enum PredMode { diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 273a22864..77cffb67e 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -246,7 +246,6 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) { slice = other.slice; predMode = other.predMode; - partSize = other.partSize; qtDepth = other.qtDepth; depth = other.depth; btDepth = other.btDepth; @@ -286,7 +285,6 @@ CodingUnit& CodingUnit::operator=( const CodingUnit& other ) void CodingUnit::initData() { predMode = NUMBER_OF_PREDICTION_MODES; - partSize = NUMBER_OF_PART_SIZES; qtDepth = 0; depth = 0; btDepth = 0; diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 456aadedf..3142b13b0 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -284,7 +284,6 @@ struct CodingUnit : public UnitArea ChannelType chType; PredMode predMode; - PartSize partSize; uint8_t depth; // number of all splits, applied with generalized splits uint8_t qtDepth; // number of applied quad-splits, before switching to the multi-type-tree (mtt) diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp index 8fd5da316..b07df2328 100644 --- a/source/Lib/CommonLib/UnitPartitioner.cpp +++ b/source/Lib/CommonLib/UnitPartitioner.cpp @@ -132,9 +132,7 @@ void Partitioner::copyState( const Partitioner& other ) void AdaptiveDepthPartitioner::setMaxMinDepth( unsigned& minDepth, unsigned& maxDepth, const CodingStructure& cs ) const { unsigned stdMinDepth = 0; - unsigned stdMaxDepth = ( ( cs.sps->getSpsNext().getUseQTBT() ) - ? g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), chType )] - : cs.sps->getLog2DiffMaxMinCodingBlockSize() ); + unsigned stdMaxDepth = ( g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), chType )]); const Position pos = currArea().blocks[chType].pos(); const unsigned curSliceIdx = cs.slice->getIndependentSliceIdx(); #if HEVC_TILES_WPP @@ -247,7 +245,6 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur break; case CU_HORZ_SPLIT: case CU_VERT_SPLIT: - CHECK( !cs.sps->getSpsNext().getUseQTBT(), "QTBT disabled" ); m_partStack.push_back( PartLevel( split, PartitionerImpl::getCUSubPartitions( currArea(), cs, split ) ) ); break; case CU_TRIH_SPLIT: @@ -375,7 +372,6 @@ bool QTBTPartitioner::canSplit( const PartSplit split, const CodingStructure &cs case CU_MT_SPLIT: case CU_BT_SPLIT: { - if( !cs.sps->getSpsNext().getUseQTBT() ) return false; 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; @@ -572,14 +568,7 @@ bool QTBTPartitioner::hasNextPart() Partitioner* PartitionerFactory::get( const Slice& slice ) { - if( slice.getSPS()->getSpsNext().getUseQTBT() ) - { - return new QTBTPartitioner; - } - else - { - THROW( "Unknown partitioner!" ); - } + return new QTBTPartitioner; } ////////////////////////////////////////////////////////////////////////// diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index b7c70c666..94e2ae59f 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -3210,17 +3210,12 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, #endif bool PU::isBipredRestriction(const PredictionUnit &pu) { - const SPSNext &spsNext = pu.cs->sps->getSpsNext(); #if JVET_L0104_NO_4x4BI_INTER_CU if(pu.cu->lumaSize().width == 4 && pu.cu->lumaSize().height ==4 ) { return true; } #endif - if( !pu.cs->pcv->only2Nx2N && !spsNext.getUseSubPuMvp() && pu.cu->lumaSize().width == 8 && ( pu.lumaSize().width < 8 || pu.lumaSize().height < 8 ) ) - { - return true; - } return false; } @@ -5435,16 +5430,12 @@ bool TU::hasTransformSkipFlag(const CodingStructure& cs, const CompArea& area) { uint32_t transformSkipLog2MaxSize = cs.pps->getPpsRangeExtension().getLog2MaxTransformSkipBlockSize(); - if( cs.pcv->rectCUs ) - { #if JVET_L0111 - SizeType transformSkipMaxSize = 1 << transformSkipLog2MaxSize; - return area.width <= transformSkipMaxSize && area.height <= transformSkipMaxSize; + SizeType transformSkipMaxSize = 1 << transformSkipLog2MaxSize; + return area.width <= transformSkipMaxSize && area.height <= transformSkipMaxSize; #else - return ( area.width * area.height <= (1 << ( transformSkipLog2MaxSize << 1 )) ); + return ( area.width * area.height <= (1 << ( transformSkipLog2MaxSize << 1 )) ); #endif - } - return ( area.width <= (1 << transformSkipLog2MaxSize) ); } uint32_t TU::getGolombRiceStatisticsIndex(const TransformUnit &tu, const ComponentID &compID) @@ -5561,7 +5552,7 @@ bool TU::needsBlockSizeTrafoScale( const Size& size ) #else bool TU::needsQP3Offset(const TransformUnit &tu, const ComponentID &compID) { - if( tu.cs->pcv->rectCUs && !tu.transformSkip[compID] ) + if( !tu.transformSkip[compID] ) { return ( ( ( g_aucLog2[tu.blocks[compID].width] + g_aucLog2[tu.blocks[compID].height] ) & 1 ) == 1 ); } diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index 7728bb342..49241d5b4 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -773,7 +773,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) if (CU::isInter(cu)) { const PredictionUnit &pu = *cu.firstPU; - if (!((cu.cs->pcv->noRQT || cu.partSize == SIZE_2Nx2N) && pu.mergeFlag)) + if ( !pu.mergeFlag ) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, cu, GetBlockStatisticName(BlockStatistic::RootCbf), cu.rootCbf); } diff --git a/source/Lib/CommonLib/x86/RdCostX86.h b/source/Lib/CommonLib/x86/RdCostX86.h index 4d87189ca..d17d10a80 100644 --- a/source/Lib/CommonLib/x86/RdCostX86.h +++ b/source/Lib/CommonLib/x86/RdCostX86.h @@ -2307,7 +2307,7 @@ Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) int x, y; Distortion uiSum = 0; - if( rcDtParam.isQtbt && iCols > iRows && ( iCols & 15 ) == 0 && ( iRows & 7 ) == 0 ) + if( iCols > iRows && ( iCols & 15 ) == 0 && ( iRows & 7 ) == 0 ) { for( y = 0; y < iRows; y += 8 ) { @@ -2322,7 +2322,7 @@ Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) piCur += iStrideCur * 8; } } - else if( rcDtParam.isQtbt && iCols < iRows && ( iRows & 15 ) == 0 && ( iCols & 7 ) == 0 ) + else if( iCols < iRows && ( iRows & 15 ) == 0 && ( iCols & 7 ) == 0 ) { for( y = 0; y < iRows; y += 16 ) { @@ -2337,7 +2337,7 @@ Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) piCur += iStrideCur * 16; } } - else if( rcDtParam.isQtbt && iCols > iRows && ( iCols & 7 ) == 0 && ( iRows & 3 ) == 0 ) + else if( iCols > iRows && ( iCols & 7 ) == 0 && ( iRows & 3 ) == 0 ) { for( y = 0; y < iRows; y += 4 ) { @@ -2349,7 +2349,7 @@ Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) piCur += iStrideCur * 4; } } - else if( rcDtParam.isQtbt && iCols < iRows && ( iRows & 7 ) == 0 && ( iCols & 3 ) == 0 ) + else if( iCols < iRows && ( iRows & 7 ) == 0 && ( iCols & 3 ) == 0 ) { for( y = 0; y < iRows; y += 8 ) { @@ -2361,7 +2361,7 @@ Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) piCur += iStrideCur * 8; } } - else if( vext >= AVX2 && ( ( ( iRows | iCols ) & 15 ) == 0 ) && ( iRows == iCols || !rcDtParam.isQtbt ) ) + else if( vext >= AVX2 && ( ( ( iRows | iCols ) & 15 ) == 0 ) && ( iRows == iCols ) ) { int iOffsetOrg = iStrideOrg << 4; int iOffsetCur = iStrideCur << 4; @@ -2375,7 +2375,7 @@ Distortion RdCost::xGetHADs_SIMD( const DistParam &rcDtParam ) piCur += iOffsetCur; } } - else if( ( ( ( iRows | iCols ) & 7 ) == 0 ) && ( iRows == iCols || !rcDtParam.isQtbt ) ) + else if( ( ( ( iRows | iCols ) & 7 ) == 0 ) && ( iRows == iCols ) ) { int iOffsetOrg = iStrideOrg << 3; int iOffsetCur = iStrideCur << 3; diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index fd58a5ae2..03806e695 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -633,9 +633,7 @@ PartSplit CABACReader::split_cu_mode_mt( CodingStructure& cs, Partitioner &parti bool CABACReader::split_cu_flag( CodingStructure& cs, Partitioner &partitioner ) { // TODO: make maxQTDepth a slice parameter - unsigned maxQTDepth = ( cs.sps->getSpsNext().getUseQTBT() - ? g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), partitioner.chType )] - : cs.sps->getLog2DiffMaxMinCodingBlockSize() ); + unsigned maxQTDepth = ( g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), partitioner.chType )] ); if( partitioner.currDepth == maxQTDepth ) { return false; @@ -703,7 +701,6 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& // prediction mode and partitioning data pred_mode ( cu ); - cu.partSize = SIZE_2Nx2N; // --> create PUs CU::addPUs( cu ); @@ -713,7 +710,7 @@ bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& #endif // pcm samples - if( CU::isIntra(cu) && cu.partSize == SIZE_2Nx2N ) + if( CU::isIntra(cu) ) { pcm_flag( cu ); if( cu.ipcm ) @@ -762,7 +759,6 @@ void CABACReader::cu_skip_flag( CodingUnit& cu ) cu.skip = true; cu.rootCbf = false; cu.predMode = MODE_INTER; - cu.partSize = SIZE_2Nx2N; } } @@ -1137,7 +1133,7 @@ void CABACReader::cu_residual( CodingUnit& cu, Partitioner &partitioner, CUCtx& if( CU::isInter( cu ) ) { PredictionUnit& pu = *cu.firstPU; - if( !( ( cu.cs->pcv->noRQT || cu.partSize == SIZE_2Nx2N ) && pu.mergeFlag ) ) + if( !pu.mergeFlag ) { rqt_root_cbf( cu ); } @@ -1422,8 +1418,6 @@ void CABACReader::affine_flag( CodingUnit& cu ) } #endif - CHECK( !cu.cs->pcv->rectCUs && cu.lumaSize().width != cu.lumaSize().height, "CU width and height are not equal for QTBT off." ); - RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG ); unsigned ctxId = DeriveCtx::CtxAffineFlag( cu ); @@ -1659,9 +1653,9 @@ void CABACReader::inter_pred_idc( PredictionUnit& pu ) return; } #if JVET_L0104_NO_4x4BI_INTER_CU - if( !(PU::isBipredRestriction(pu)) && ( pu.cu->partSize == SIZE_2Nx2N || pu.cs->sps->getSpsNext().getUseSubPuMvp() || pu.cu->lumaSize().width != 8 ) ) + if( !(PU::isBipredRestriction(pu)) ) #else - if( pu.cu->partSize == SIZE_2Nx2N || pu.cs->sps->getSpsNext().getUseSubPuMvp() || pu.cu->lumaSize().width != 8 ) + if( true ) #endif { unsigned ctxId = DeriveCtx::CtxInterDir(pu); @@ -1927,10 +1921,8 @@ void CABACReader::transform_tree( CodingStructure &cs, Partitioner &partitioner, // split_transform_flag bool split = false; - if( cu.cs->pcv->noRQT ) - { - split = partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); - } + + split = partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); // cbf_cb & cbf_cr if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) ) @@ -2338,17 +2330,8 @@ void CABACReader::transform_skip_flag( TransformUnit& tu, ComponentID compID ) void CABACReader::emt_tu_index( TransformUnit& tu ) { - int maxSizeEmtIntra, maxSizeEmtInter; - if( tu.cs->pcv->noRQT ) - { - maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; - maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; - } - else - { - maxSizeEmtIntra = EMT_INTRA_MAX_CU; - maxSizeEmtInter = EMT_INTER_MAX_CU; - } + int maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; + int maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; uint8_t trIdx = 0; RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__EMT_TU_INDEX ); @@ -2389,21 +2372,12 @@ void CABACReader::emt_cu_flag( CodingUnit& cu ) const unsigned cuHeight = cu.lheight(); int maxSizeEmtIntra, maxSizeEmtInter; - if( cu.cs->pcv->noRQT ) - { - if( depth >= NUM_EMT_CU_FLAG_CTX ) - { - depth = NUM_EMT_CU_FLAG_CTX - 1; - } - maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; - maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; - } - else + if( depth >= NUM_EMT_CU_FLAG_CTX ) { - maxSizeEmtIntra = EMT_INTRA_MAX_CU; - maxSizeEmtInter = EMT_INTER_MAX_CU; - CHECK( depth >= NUM_EMT_CU_FLAG_CTX, "Depth exceeds limit." ); + depth = NUM_EMT_CU_FLAG_CTX - 1; } + maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; + maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; cu.emtFlag = 0; diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index dc510242a..019da17a8 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -154,7 +154,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID ) //===== get prediction signal ===== if( compID != COMPONENT_Y && PU::isLMCMode( uiChFinalMode ) ) { - const PredictionUnit& pu = cs.pcv->noRQT && cs.pcv->only2Nx2N ? *tu.cu->firstPU : *tu.cs->getPU( tu.block( compID ), CHANNEL_TYPE_CHROMA ); + const PredictionUnit& pu = *tu.cu->firstPU; m_pcIntraPred->xGetLumaRecPixels( pu, area ); m_pcIntraPred->predIntraChromaLM( compID, piPred, pu, area, uiChFinalMode ); } @@ -493,42 +493,16 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) mrgCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize); } - if (cu.cs->pps->getLog2ParallelMergeLevelMinus2() && cu.partSize != SIZE_2Nx2N && cu.lumaSize().width <= 8) - { - if (!mrgCtx.hasMergedCandList) - { - // temporarily set size to 2Nx2N - PartSize tmpPS = SIZE_2Nx2N; - PredictionUnit tmpPU = pu; - static_cast<UnitArea&> (tmpPU) = cu; - std::swap(tmpPS, cu.partSize); #if JVET_L0054_MMVD - int fPosBaseIdx = pu.mmvdMergeIdx / MMVD_MAX_REFINE_NUM; - PU::getInterMergeCandidates(tmpPU, mrgCtx, 1, fPosBaseIdx + 1); + int fPosBaseIdx = pu.mmvdMergeIdx / MMVD_MAX_REFINE_NUM; + PU::getInterMergeCandidates(pu, mrgCtx, 1, fPosBaseIdx + 1); #else - PU::getInterMergeCandidates(tmpPU, mrgCtx, 255); + PU::getInterMergeCandidates(pu, mrgCtx, 255); #endif - PU::restrictBiPredMergeCands(pu, mrgCtx); - PU::getInterMMVDMergeCandidates(tmpPU, mrgCtx, - pu.mmvdMergeIdx - ); - std::swap(tmpPS, cu.partSize); - mrgCtx.hasMergedCandList = true; - } - } - else - { -#if JVET_L0054_MMVD - int fPosBaseIdx = pu.mmvdMergeIdx / MMVD_MAX_REFINE_NUM; - PU::getInterMergeCandidates(pu, mrgCtx, 1, fPosBaseIdx + 1); -#else - PU::getInterMergeCandidates(pu, mrgCtx, 255); -#endif - PU::restrictBiPredMergeCands(pu, mrgCtx); - PU::getInterMMVDMergeCandidates(pu, mrgCtx, - pu.mmvdMergeIdx - ); - } + PU::restrictBiPredMergeCands(pu, mrgCtx); + PU::getInterMMVDMergeCandidates(pu, mrgCtx, + pu.mmvdMergeIdx + ); mrgCtx.setMmvdMergeCandiInfo(pu, pu.mmvdMergeIdx); PU::spanMotionInfo(pu, mrgCtx); @@ -619,34 +593,13 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize ); } #endif - if( cu.cs->pps->getLog2ParallelMergeLevelMinus2() && cu.partSize != SIZE_2Nx2N && cu.lumaSize().width <= 8 ) - { - if( !mrgCtx.hasMergedCandList ) - { - // temporarily set size to 2Nx2N - PartSize tmpPS = SIZE_2Nx2N; - PredictionUnit tmpPU = pu; - static_cast<UnitArea&> ( tmpPU ) = cu; - std::swap( tmpPS, cu.partSize ); -#if JVET_L0054_MMVD - PU::getInterMergeCandidates(tmpPU, mrgCtx, 0, pu.mergeIdx); -#else - PU::getInterMergeCandidates( tmpPU, mrgCtx, pu.mergeIdx ); -#endif - PU::restrictBiPredMergeCands(pu, mrgCtx); - std::swap( tmpPS, cu.partSize ); - mrgCtx.hasMergedCandList = true; - } - } - else - { + #if JVET_L0054_MMVD PU::getInterMergeCandidates(pu, mrgCtx, 0, pu.mergeIdx); #else PU::getInterMergeCandidates( pu, mrgCtx, pu.mergeIdx ); #endif PU::restrictBiPredMergeCands(pu, mrgCtx); - } mrgCtx.setMergeInfo( pu, pu.mergeIdx ); diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 00d2f45b2..4649c6487 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -769,11 +769,10 @@ void DecLib::xActivateParameterSets() // Recursive structure m_cCuDecoder.init( &m_cTrQuant, &m_cIntraPred, &m_cInterPred ); - m_cTrQuant.init( nullptr, sps->getMaxTrSize(), false, false, false, false, false, pps->pcv->rectCUs ); + m_cTrQuant.init( nullptr, sps->getMaxTrSize(), false, false, false, false, false ); // RdCost m_cRdCost.setCostMode ( COST_STANDARD_LOSSY ); // not used in decoder side RdCost stuff -> set to default - m_cRdCost.setUseQtbt ( sps->getSpsNext().getUseQTBT() ); m_cSliceDecoder.create(); diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 7c9e0b550..a72c94c67 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -788,7 +788,6 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) unsigned symbol = 0; // tool enabling flags - READ_FLAG( symbol, "qtbt_flag" ); spsNext.setUseQTBT ( symbol != 0 ); READ_FLAG( symbol, "large_ctu_flag" ); spsNext.setUseLargeCTU ( symbol != 0 ); READ_FLAG( symbol, "subpu_tmvp_flag" ); spsNext.setSubPuMvpMode (symbol); READ_FLAG( symbol, "imv_enable_flag" ); spsNext.setUseIMV ( symbol != 0 ); @@ -831,73 +830,70 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM ) #endif // additional parameters - if( spsNext.getUseQTBT() ) - { - unsigned minQT [3] = { 0, 0, 0 }; - unsigned maxBTD[3] = { 0, 0, 0 }; + unsigned minQT [3] = { 0, 0, 0 }; + unsigned maxBTD[3] = { 0, 0, 0 }; #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - unsigned maxBTSize[3] = { 0, 0, 0 }; - unsigned maxTTSize[3] = { 0, 0, 0 }; -#endif - READ_FLAG( symbol, "qtbt_dual_intra_tree" ); spsNext.setUseDualITree( symbol ); - READ_UVLC( symbol, "log2_CTU_size_minus2" ); spsNext.setCTUSize( 1 << ( symbol + MIN_CU_LOG2 ) ); - spsNext.getSPS().setMaxCodingDepth( symbol ); // overwrite original value - spsNext.getSPS().setMaxCUWidth ( spsNext.getCTUSize() ); // overwrite original value - spsNext.getSPS().setMaxCUHeight ( spsNext.getCTUSize() ); // overwrite original value + unsigned maxBTSize[3] = { 0, 0, 0 }; + unsigned maxTTSize[3] = { 0, 0, 0 }; +#endif + READ_FLAG( symbol, "qtbt_dual_intra_tree" ); spsNext.setUseDualITree( symbol ); + READ_UVLC( symbol, "log2_CTU_size_minus2" ); spsNext.setCTUSize( 1 << ( symbol + MIN_CU_LOG2 ) ); + spsNext.getSPS().setMaxCodingDepth( symbol ); // overwrite original value + spsNext.getSPS().setMaxCUWidth ( spsNext.getCTUSize() ); // overwrite original value + spsNext.getSPS().setMaxCUHeight ( spsNext.getCTUSize() ); // overwrite original value #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - READ_FLAG( symbol, "sps_override_partition_constraints_enable_flag"); spsNext.setSplitConsOverrideEnabledFlag( symbol ); - READ_UVLC( symbol, "sps_log2_diff_min_qt_min_cb_intra_slice"); minQT[0] = 1 << (symbol + spsNext.getSPS().getLog2MinCodingBlockSize()); - READ_UVLC( symbol, "sps_log2_diff_min_qt_min_cb_inter_slice"); minQT[1] = 1 << (symbol + spsNext.getSPS().getLog2MinCodingBlockSize()); - READ_UVLC( symbol, "sps_max_mtt_hierarchy_depth_inter_slices"); maxBTD[1] = symbol; - READ_UVLC( symbol, "sps_max_mtt_hierarchy_depth_intra_slices"); maxBTD[0] = symbol; + READ_FLAG( symbol, "sps_override_partition_constraints_enable_flag"); spsNext.setSplitConsOverrideEnabledFlag( symbol ); + READ_UVLC( symbol, "sps_log2_diff_min_qt_min_cb_intra_slice"); minQT[0] = 1 << (symbol + spsNext.getSPS().getLog2MinCodingBlockSize()); + READ_UVLC( symbol, "sps_log2_diff_min_qt_min_cb_inter_slice"); minQT[1] = 1 << (symbol + spsNext.getSPS().getLog2MinCodingBlockSize()); + READ_UVLC( symbol, "sps_max_mtt_hierarchy_depth_inter_slices"); maxBTD[1] = symbol; + READ_UVLC( symbol, "sps_max_mtt_hierarchy_depth_intra_slices"); maxBTD[0] = symbol; #else - READ_UVLC( symbol, "log2_minQT_ISlice_minus2" ); minQT [0] = 1 << ( symbol + MIN_CU_LOG2 ); - READ_UVLC( symbol, "log2_minQT_PBSlice_minus2" ); minQT [1] = 1 << ( symbol + MIN_CU_LOG2 ); - READ_UVLC( symbol, "max_bt_depth" ); maxBTD[0] = symbol; - READ_UVLC( symbol, "max_bt_depth_i_slice" ); maxBTD[1] = symbol; + READ_UVLC( symbol, "log2_minQT_ISlice_minus2" ); minQT [0] = 1 << ( symbol + MIN_CU_LOG2 ); + READ_UVLC( symbol, "log2_minQT_PBSlice_minus2" ); minQT [1] = 1 << ( symbol + MIN_CU_LOG2 ); + READ_UVLC( symbol, "max_bt_depth" ); maxBTD[0] = symbol; + READ_UVLC( symbol, "max_bt_depth_i_slice" ); maxBTD[1] = symbol; #endif - + #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - maxTTSize[0] = maxBTSize[0] = minQT[0]; - if (maxBTD[0] != 0) - { - READ_UVLC(symbol, "sps_log2_diff_max_bt_min_qt_intra_slice"); maxBTSize[0] <<= symbol; - READ_UVLC(symbol, "sps_log2_diff_max_tt_min_qt_intra_slice"); maxTTSize[0] <<= symbol; - } - maxTTSize[1] = maxBTSize[1] = minQT[1]; - if (maxBTD[1] != 0) - { - READ_UVLC(symbol, "sps_log2_diff_max_bt_min_qt_inter_slice"); maxBTSize[1] <<= symbol; - READ_UVLC(symbol, "sps_log2_diff_max_tt_min_qt_inter_slice"); maxTTSize[1] <<= symbol; - } + maxTTSize[0] = maxBTSize[0] = minQT[0]; + if (maxBTD[0] != 0) + { + READ_UVLC(symbol, "sps_log2_diff_max_bt_min_qt_intra_slice"); maxBTSize[0] <<= symbol; + READ_UVLC(symbol, "sps_log2_diff_max_tt_min_qt_intra_slice"); maxTTSize[0] <<= symbol; + } + maxTTSize[1] = maxBTSize[1] = minQT[1]; + if (maxBTD[1] != 0) + { + READ_UVLC(symbol, "sps_log2_diff_max_bt_min_qt_inter_slice"); maxBTSize[1] <<= symbol; + READ_UVLC(symbol, "sps_log2_diff_max_tt_min_qt_inter_slice"); maxTTSize[1] <<= symbol; + } #endif - if( spsNext.getUseDualITree() ) - { + if( spsNext.getUseDualITree() ) + { #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - READ_UVLC( symbol, "sps_log2_diff_min_qt_min_cb_intra_slice_chroma" ); minQT [2] = 1 << ( symbol + spsNext.getSPS().getLog2MinCodingBlockSize()); - READ_UVLC( symbol, "sps_max_mtt_hierarchy_depth_intra_slices_chroma"); maxBTD[2] = symbol; - maxTTSize[2] = maxBTSize[2] = minQT[2]; - if (maxBTD[2] != 0) - { - READ_UVLC(symbol, "sps_log2_diff_max_bt_min_qt_intra_slice_chroma"); maxBTSize[2] <<= symbol; - READ_UVLC(symbol, "sps_log2_diff_max_tt_min_qt_intra_slice_chroma"); maxTTSize[2] <<= symbol; - } + READ_UVLC( symbol, "sps_log2_diff_min_qt_min_cb_intra_slice_chroma" ); minQT [2] = 1 << ( symbol + spsNext.getSPS().getLog2MinCodingBlockSize()); + READ_UVLC( symbol, "sps_max_mtt_hierarchy_depth_intra_slices_chroma"); maxBTD[2] = symbol; + maxTTSize[2] = maxBTSize[2] = minQT[2]; + if (maxBTD[2] != 0) + { + READ_UVLC(symbol, "sps_log2_diff_max_bt_min_qt_intra_slice_chroma"); maxBTSize[2] <<= symbol; + READ_UVLC(symbol, "sps_log2_diff_max_tt_min_qt_intra_slice_chroma"); maxTTSize[2] <<= symbol; + } #else - READ_UVLC( symbol, "log2_minQT_ISliceChroma_minus2" ); minQT [2] = 1 << ( symbol + MIN_CU_LOG2 ); - READ_UVLC( symbol, "max_bt_depth_i_slice_chroma" ); maxBTD[2] = symbol; + READ_UVLC( symbol, "log2_minQT_ISliceChroma_minus2" ); minQT [2] = 1 << ( symbol + MIN_CU_LOG2 ); + READ_UVLC( symbol, "max_bt_depth_i_slice_chroma" ); maxBTD[2] = symbol; #endif - } + } - spsNext.setMinQTSizes( minQT ); + spsNext.setMinQTSizes( minQT ); #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - spsNext.setMaxBTDepth( maxBTD[1], maxBTD[0], maxBTD[2] ); - spsNext.setMaxBTSize( maxBTSize[1], maxBTSize[0], maxBTSize[2] ); - spsNext.setMaxTTSize( maxTTSize[1], maxTTSize[0], maxTTSize[2] ); + spsNext.setMaxBTDepth( maxBTD[1], maxBTD[0], maxBTD[2] ); + spsNext.setMaxBTSize( maxBTSize[1], maxBTSize[0], maxBTSize[2] ); + spsNext.setMaxTTSize( maxTTSize[1], maxTTSize[0], maxTTSize[2] ); #else - spsNext.setMaxBTDepth( maxBTD[0], maxBTD[1], maxBTD[2] ); + spsNext.setMaxBTDepth( maxBTD[0], maxBTD[1], maxBTD[2] ); #endif - } if( spsNext.getUseSubPuMvp() ) { @@ -1732,56 +1728,53 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para pcSlice->setSignDataHidingEnabledFlag( uiCode != 0 ); } #endif - if( sps->getSpsNext().getUseQTBT() ) - { #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - if (sps->getSpsNext().getSplitConsOverrideEnabledFlag()) + if (sps->getSpsNext().getSplitConsOverrideEnabledFlag()) + { + READ_FLAG(uiCode, "partition_constrainst_override_flag"); pcSlice->setSplitConsOverrideFlag(uiCode ? true : false); + if (pcSlice->getSplitConsOverrideFlag()) { - READ_FLAG(uiCode, "partition_constrainst_override_flag"); pcSlice->setSplitConsOverrideFlag(uiCode ? true : false); - if (pcSlice->getSplitConsOverrideFlag()) + READ_UVLC(uiCode, "log2_diff_min_qt_min_cb"); pcSlice->setMinQTSize(1 << (uiCode + sps->getLog2MinCodingBlockSize())); + READ_UVLC(uiCode, "max_mtt_hierarchy_depth"); pcSlice->setMaxBTDepth(uiCode); + if (pcSlice->getMaxBTDepth() != 0) + { + READ_UVLC(uiCode, "log2_diff_max_bt_min_qt"); pcSlice->setMaxBTSize(pcSlice->getMinQTSize() << uiCode); + READ_UVLC(uiCode, "log2_diff_max_tt_min_qt"); pcSlice->setMaxTTSize(pcSlice->getMinQTSize() << uiCode); + } + else { - READ_UVLC(uiCode, "log2_diff_min_qt_min_cb"); pcSlice->setMinQTSize(1 << (uiCode + sps->getLog2MinCodingBlockSize())); - READ_UVLC(uiCode, "max_mtt_hierarchy_depth"); pcSlice->setMaxBTDepth(uiCode); - if (pcSlice->getMaxBTDepth() != 0) + pcSlice->setMaxBTSize(pcSlice->getMinQTSize()); + pcSlice->setMaxTTSize(pcSlice->getMinQTSize()); + } + if (pcSlice->isIntra() && sps->getSpsNext().getUseDualITree()) + { + READ_UVLC(uiCode, "log2_diff_min_qt_min_cb_chroma"); pcSlice->setMinQTSizeIChroma(1 << (uiCode + sps->getLog2MinCodingBlockSize())); + READ_UVLC(uiCode, "max_mtt_hierarchy_depth_chroma"); pcSlice->setMaxBTDepthIChroma(uiCode); + if (pcSlice->getMaxBTDepthIChroma() != 0) { - READ_UVLC(uiCode, "log2_diff_max_bt_min_qt"); pcSlice->setMaxBTSize(pcSlice->getMinQTSize() << uiCode); - READ_UVLC(uiCode, "log2_diff_max_tt_min_qt"); pcSlice->setMaxTTSize(pcSlice->getMinQTSize() << uiCode); + READ_UVLC(uiCode, "log2_diff_max_bt_min_qt_chroma"); pcSlice->setMaxBTSizeIChroma(pcSlice->getMinQTSizeIChroma() << uiCode); + READ_UVLC(uiCode, "log2_diff_max_tt_min_qt_chroma"); pcSlice->setMaxTTSizeIChroma(pcSlice->getMinQTSizeIChroma() << uiCode); } else { - pcSlice->setMaxBTSize(pcSlice->getMinQTSize()); - pcSlice->setMaxTTSize(pcSlice->getMinQTSize()); - } - if (pcSlice->isIntra() && sps->getSpsNext().getUseDualITree()) - { - READ_UVLC(uiCode, "log2_diff_min_qt_min_cb_chroma"); pcSlice->setMinQTSizeIChroma(1 << (uiCode + sps->getLog2MinCodingBlockSize())); - READ_UVLC(uiCode, "max_mtt_hierarchy_depth_chroma"); pcSlice->setMaxBTDepthIChroma(uiCode); - if (pcSlice->getMaxBTDepthIChroma() != 0) - { - READ_UVLC(uiCode, "log2_diff_max_bt_min_qt_chroma"); pcSlice->setMaxBTSizeIChroma(pcSlice->getMinQTSizeIChroma() << uiCode); - READ_UVLC(uiCode, "log2_diff_max_tt_min_qt_chroma"); pcSlice->setMaxTTSizeIChroma(pcSlice->getMinQTSizeIChroma() << uiCode); - } - else - { - pcSlice->setMaxBTSizeIChroma(pcSlice->getMinQTSizeIChroma()); - pcSlice->setMaxTTSizeIChroma(pcSlice->getMinQTSizeIChroma()); - } + pcSlice->setMaxBTSizeIChroma(pcSlice->getMinQTSizeIChroma()); + pcSlice->setMaxTTSizeIChroma(pcSlice->getMinQTSizeIChroma()); } } } + } #else - if (!pcSlice->isIntra()) - { - READ_UVLC(uiCode, "max_binary_tree_unit_size"); - uint32_t maxCU = sps->getSpsNext().getCTUSize(); - pcSlice->setMaxBTSize(maxCU >> uiCode); - } - else - { - pcSlice->setMaxBTSize(MAX_BT_SIZE); - } -#endif + if (!pcSlice->isIntra()) + { + READ_UVLC(uiCode, "max_binary_tree_unit_size"); + uint32_t maxCU = sps->getSpsNext().getCTUSize(); + pcSlice->setMaxBTSize(maxCU >> uiCode); } + else + { + pcSlice->setMaxBTSize(MAX_BT_SIZE); + } +#endif if (!pcSlice->isIntra()) { #if JVET_L0369_SUBBLOCK_MERGE diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index a733df510..18b823c72 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -529,9 +529,7 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione void CABACWriter::split_cu_flag( bool split, const CodingStructure& cs, Partitioner& partitioner ) { - unsigned maxQTDepth = ( cs.sps->getSpsNext().getUseQTBT() - ? g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), partitioner.chType )] - : cs.sps->getLog2DiffMaxMinCodingBlockSize() ); + unsigned maxQTDepth = ( g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), partitioner.chType )] ); if( partitioner.currDepth == maxQTDepth ) { return; @@ -639,7 +637,7 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C #endif // pcm samples - if( CU::isIntra(cu) && cu.partSize == SIZE_2Nx2N ) + if( CU::isIntra(cu) ) { pcm_data( cu ); if( cu.ipcm ) @@ -1151,7 +1149,7 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C if( CU::isInter( cu ) ) { PredictionUnit& pu = *cu.firstPU; - if( !( ( cu.cs->pcv->noRQT || cu.partSize == SIZE_2Nx2N ) && pu.mergeFlag ) ) + if( !pu.mergeFlag ) { rqt_root_cbf( cu ); } @@ -1182,7 +1180,7 @@ void CABACWriter::cu_emt_pertu_idx( const CodingUnit& cu ) anyNonTs |= !tu.transformSkip[0]; } - if( !cu.cs->pcv->noRQT || !isLuma( cu.chType ) || cu.nsstIdx != 0 || + if( !isLuma( cu.chType ) || cu.nsstIdx != 0 || !( cu.cs->sps->getSpsNext().getUseIntraEMT() || cu.cs->sps->getSpsNext().getUseInterEMT() ) || !anyCbf || !anyNonTs ) { return; @@ -1409,7 +1407,6 @@ void CABACWriter::affine_flag( const CodingUnit& cu ) return; } - CHECK( !cu.cs->pcv->rectCUs && cu.lumaSize().width != cu.lumaSize().height, "CU width and height are not equal for QTBT off." ); #if JVET_L0054_MMVD if (cu.firstPU->mergeFlag && (cu.firstPU->mmvdMergeFlag || cu.mmvdSkip)) { @@ -1650,9 +1647,9 @@ void CABACWriter::inter_pred_idc( const PredictionUnit& pu ) return; } #if JVET_L0104_NO_4x4BI_INTER_CU - if( !(PU::isBipredRestriction(pu)) && ( pu.cu->partSize == SIZE_2Nx2N || pu.cs->sps->getSpsNext().getUseSubPuMvp() || pu.cu->lumaSize().width != 8 ) ) + if( !(PU::isBipredRestriction(pu)) ) #else - if( pu.cu->partSize == SIZE_2Nx2N || pu.cs->sps->getSpsNext().getUseSubPuMvp() || pu.cu->lumaSize().width != 8 ) + if( true ) #endif { unsigned ctxId = DeriveCtx::CtxInterDir(pu); @@ -1871,15 +1868,12 @@ void CABACWriter::transform_tree( const CodingStructure& cs, Partitioner& partit const bool split = ( tu.depth > trDepth ); // split_transform_flag - if( cs.pcv->noRQT ) + if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { - if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) - { - CHECK( !split, "transform split implied" ); - } - else - CHECK( split, "transform split not allowed with QTBT" ); + CHECK( !split, "transform split implied" ); } + else + CHECK( split, "transform split not allowed with QTBT" ); // cbf_cb & cbf_cr if( area.chromaFormat != CHROMA_400 && area.blocks[COMPONENT_Cb].valid() && ( !CS::isDualITree( cs ) || partitioner.chType == CHANNEL_TYPE_CHROMA ) ) @@ -2279,17 +2273,9 @@ void CABACWriter::transform_skip_flag( const TransformUnit& tu, ComponentID comp void CABACWriter::emt_tu_index( const TransformUnit& tu ) { - int maxSizeEmtIntra, maxSizeEmtInter; - if( tu.cs->pcv->noRQT ) - { - maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; - maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; - } - else - { - maxSizeEmtIntra = EMT_INTRA_MAX_CU; - maxSizeEmtInter = EMT_INTER_MAX_CU; - } + int maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; + int maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; + if( CU::isIntra( *tu.cu ) && ( tu.cu->Y().width <= maxSizeEmtIntra ) && ( tu.cu->Y().height <= maxSizeEmtIntra ) ) { uint8_t trIdx = tu.emtIdx; @@ -2320,23 +2306,12 @@ void CABACWriter::emt_cu_flag( const CodingUnit& cu ) const unsigned cuWidth = cu.lwidth(); const unsigned cuHeight = cu.lheight(); - int maxSizeEmtIntra, maxSizeEmtInter; - - if( cu.cs->pcv->noRQT ) - { - if( depth >= NUM_EMT_CU_FLAG_CTX ) - { - depth = NUM_EMT_CU_FLAG_CTX - 1; - } - maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; - maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; - } - else + if( depth >= NUM_EMT_CU_FLAG_CTX ) { - maxSizeEmtIntra = EMT_INTRA_MAX_CU; - maxSizeEmtInter = EMT_INTER_MAX_CU; - CHECK( depth >= NUM_EMT_CU_FLAG_CTX, "Depth exceeds limit." ); + depth = NUM_EMT_CU_FLAG_CTX - 1; } + int maxSizeEmtIntra = EMT_INTRA_MAX_CU_WITH_QTBT; + int maxSizeEmtInter = EMT_INTER_MAX_CU_WITH_QTBT; const unsigned maxSizeEmt = CU::isIntra( cu ) ? maxSizeEmtIntra : maxSizeEmtInter; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 7e48c2557..60709f112 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -172,7 +172,6 @@ protected: int m_maxTempLayer; ///< Max temporal layer bool m_useAMP; - bool m_QTBT; unsigned m_CTUSize; #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT bool m_useSplitConsOverride; @@ -533,7 +532,6 @@ protected: uint32_t m_summaryVerboseness; ///< Specifies the level of the verboseness of the text output. int m_ImvMode; int m_Imv4PelFast; - int m_ImvMaxCand; std::string m_decodeBitstreams[2]; ///< filename for decode bitstreams. bool m_forceDecodeBitstream1; ///< guess what it means int m_switchPOC; ///< dbg poc. @@ -623,7 +621,6 @@ public: int getMaxTempLayer () { return m_maxTempLayer; } void setMaxTempLayer ( int maxTempLayer ) { m_maxTempLayer = maxTempLayer; } - void setQTBT ( bool b ) { m_QTBT = b; } void setCTUSize ( unsigned u ) { m_CTUSize = u; } void setMinQTSizes ( unsigned* minQT) { m_uiMinQT[0] = minQT[0]; m_uiMinQT[1] = minQT[1]; m_uiMinQT[2] = minQT[2]; } void setMaxBTDepth ( unsigned uiMaxBTDepth, unsigned uiMaxBTDepthI, unsigned uiMaxBTDepthIChroma ) @@ -631,7 +628,6 @@ public: unsigned getMaxBTDepth () const { return m_uiMaxBTDepth; } unsigned getMaxBTDepthI () const { return m_uiMaxBTDepthI; } unsigned getMaxBTDepthIChroma () const { return m_uiMaxBTDepthIChroma; } - bool getQTBT () const { return m_QTBT; } int getCTUSize () const { return m_CTUSize; } #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT void setUseSplitConsOverride (bool n) { m_useSplitConsOverride = n; } @@ -1374,8 +1370,6 @@ public: int getIMV() const { return m_ImvMode; } void setIMV4PelFast(int n) { m_Imv4PelFast = n; } int getIMV4PelFast() const { return m_Imv4PelFast; } - void setIMVMaxCand(int n) { m_ImvMaxCand = n; } - int getIMVMaxCand() const { return m_ImvMaxCand; } void setDecodeBitstream( int i, const std::string& s ) { m_decodeBitstreams[i] = s; } const std::string& getDecodeBitstream( int i ) const { return m_decodeBitstreams[i]; } bool getForceDecodeBitstream1() const { return m_forceDecodeBitstream1; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 7ab53e4ae..88733b4a5 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -70,11 +70,9 @@ void EncCu::create( EncCfg* encCfg ) unsigned uiMaxWidth = encCfg->getMaxCUWidth(); unsigned uiMaxHeight = encCfg->getMaxCUHeight(); ChromaFormat chromaFormat = encCfg->getChromaFormatIdc(); - bool BTnoRQT = encCfg->getQTBT(); unsigned numWidths = gp_sizeIdxInfo->numWidths(); unsigned numHeights = gp_sizeIdxInfo->numHeights(); - unsigned maxMEPart = BTnoRQT ? 1 : NUMBER_OF_PART_SIZES; m_pTempCS = new CodingStructure** [numWidths]; m_pBestCS = new CodingStructure** [numWidths]; @@ -99,7 +97,7 @@ void EncCu::create( EncCfg* encCfg ) unsigned width = gp_sizeIdxInfo->sizeFrom( w ); unsigned height = gp_sizeIdxInfo->sizeFrom( h ); - if( ( BTnoRQT || w == h ) && gp_sizeIdxInfo->isCuSize( width ) && gp_sizeIdxInfo->isCuSize( height ) ) + if( gp_sizeIdxInfo->isCuSize( width ) && gp_sizeIdxInfo->isCuSize( height ) ) { m_pTempCS[w][h] = new CodingStructure( m_unitCache.cuCache, m_unitCache.puCache, m_unitCache.tuCache ); m_pBestCS[w][h] = new CodingStructure( m_unitCache.cuCache, m_unitCache.puCache, m_unitCache.tuCache ); @@ -139,45 +137,11 @@ void EncCu::create( EncCfg* encCfg ) // WIA: only the weight==height case is relevant without QTBT m_pImvTempCS = nullptr; - if( IMV_OFF != encCfg->getIMV() && !BTnoRQT ) - { - m_pImvTempCS = new CodingStructure**[numWidths]; - - for( unsigned w = 0; w < numWidths; w++ ) - { - unsigned width = gp_sizeIdxInfo->sizeFrom( w ); - unsigned height = gp_sizeIdxInfo->sizeFrom( w ); - - m_pImvTempCS[w] = new CodingStructure*[maxMEPart]; - - for( unsigned p = 0; p < maxMEPart; p++ ) - { - if( gp_sizeIdxInfo->isCuSize( width ) ) - { - m_pImvTempCS[w][p] = new CodingStructure( m_unitCache.cuCache, m_unitCache.puCache, m_unitCache.tuCache ); - m_pImvTempCS[w][p]->create( chromaFormat, Area( 0, 0, width, height ), false ); - } - else - { - m_pImvTempCS[w][p] = nullptr; - } - } - } - } - - m_cuChromaQpOffsetIdxPlus1 = 0; unsigned maxDepth = numWidths + numHeights; - if( encCfg->getQTBT() ) - { - m_modeCtrl = new EncModeCtrlMTnoRQT(); - } - else - { - THROW( "Unknown partitioner!" ); - } + m_modeCtrl = new EncModeCtrlMTnoRQT(); #if REUSE_CU_RESULTS m_modeCtrl->create( *encCfg ); @@ -211,9 +175,6 @@ void EncCu::create( EncCfg* encCfg ) void EncCu::destroy() { - bool BTnoRQT = m_pcEncCfg->getQTBT(); - unsigned maxMEPart = BTnoRQT ? 1 : NUMBER_OF_PART_SIZES; - unsigned numWidths = gp_sizeIdxInfo->numWidths(); unsigned numHeights = gp_sizeIdxInfo->numHeights(); @@ -221,35 +182,32 @@ void EncCu::destroy() { for( unsigned h = 0; h < numHeights; h++ ) { - if( BTnoRQT || w == h ) - { - if( m_pBestCS[w][h] ) m_pBestCS[w][h]->destroy(); - if( m_pTempCS[w][h] ) m_pTempCS[w][h]->destroy(); + if( m_pBestCS[w][h] ) m_pBestCS[w][h]->destroy(); + if( m_pTempCS[w][h] ) m_pTempCS[w][h]->destroy(); - delete m_pBestCS[w][h]; - delete m_pTempCS[w][h]; + delete m_pBestCS[w][h]; + delete m_pTempCS[w][h]; #if JVET_L0266_HMVP - if (m_pTempMotLUTs[w][h]) - { - delete[] m_pTempMotLUTs[w][h]->motionCand; - m_pTempMotLUTs[w][h]->motionCand = nullptr; - delete[] m_pTempMotLUTs[w][h]; - } - if (m_pBestMotLUTs[w][h]) - { - delete[] m_pBestMotLUTs[w][h]->motionCand; - m_pBestMotLUTs[w][h]->motionCand = nullptr; - delete[] m_pBestMotLUTs[w][h]; - } + if (m_pTempMotLUTs[w][h]) + { + delete[] m_pTempMotLUTs[w][h]->motionCand; + m_pTempMotLUTs[w][h]->motionCand = nullptr; + delete[] m_pTempMotLUTs[w][h]; + } + if (m_pBestMotLUTs[w][h]) + { + delete[] m_pBestMotLUTs[w][h]->motionCand; + m_pBestMotLUTs[w][h]->motionCand = nullptr; + delete[] m_pBestMotLUTs[w][h]; + } - if (m_pSplitTempMotLUTs[w][h]) - { - delete[] m_pSplitTempMotLUTs[w][h]->motionCand; - m_pSplitTempMotLUTs[w][h]->motionCand = nullptr; - delete[] m_pSplitTempMotLUTs[w][h]; - } -#endif + if (m_pSplitTempMotLUTs[w][h]) + { + delete[] m_pSplitTempMotLUTs[w][h]->motionCand; + m_pSplitTempMotLUTs[w][h]->motionCand = nullptr; + delete[] m_pSplitTempMotLUTs[w][h]; } +#endif } delete[] m_pTempCS[w]; @@ -281,12 +239,11 @@ void EncCu::destroy() { for( unsigned w = 0; w < numWidths; w++ ) { - for( unsigned p = 0; p < maxMEPart; p++ ) + if( m_pImvTempCS[w] ) { - if( m_pImvTempCS[w][p] ) m_pImvTempCS[w][p]->destroy(); - delete m_pImvTempCS[w][p]; + m_pImvTempCS[w]->destroy(); + delete[] m_pImvTempCS[w]; } - delete[] m_pImvTempCS[w]; } delete[] m_pImvTempCS; @@ -494,7 +451,6 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign // Ensure that a coding was found // Selected mode's RD-cost must be not MAX_DOUBLE. CHECK( bestCS->cus.empty() , "No possible encoding found" ); - CHECK( bestCS->cus[0]->partSize == NUMBER_OF_PART_SIZES , "No possible encoding found" ); CHECK( bestCS->cus[0]->predMode == NUMBER_OF_PREDICTION_MODES, "No possible encoding found" ); CHECK( bestCS->cost == MAX_DOUBLE , "No possible encoding found" ); } @@ -703,11 +659,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par const UnitArea currCsArea = clipArea( CS::getArea( *bestCS, bestCS->area, partitioner.chType ), *tempCS->picture ); if( m_pImvTempCS && !slice.isIntra() ) { - const unsigned maxMEPart = tempCS->pcv->only2Nx2N ? 1 : NUMBER_OF_PART_SIZES; - for( unsigned p = 0; p < maxMEPart; p++ ) - { - tempCS->initSubStructure( *m_pImvTempCS[wIdx][p], partitioner.chType, partitioner.currArea(), false ); - } + tempCS->initSubStructure( *m_pImvTempCS[wIdx], partitioner.chType, partitioner.currArea(), false ); } #if JVET_L0293_CPR @@ -836,7 +788,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par } else { - THROW( "Don't know how to handle mode: type = " << currTestMode.type << ", size = " << currTestMode.partSize << ", options = " << currTestMode.opts ); + THROW( "Don't know how to handle mode: type = " << currTestMode.type << ", options = " << currTestMode.opts ); } } while( m_modeCtrl->nextMode( *tempCS, partitioner ) ); @@ -887,7 +839,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par // Assert if Best prediction mode is NONE // Selected mode's RD-cost must be not MAX_DOUBLE. CHECK( bestCS->cus.empty() , "No possible encoding found" ); - CHECK( bestCS->cus[0]->partSize == NUMBER_OF_PART_SIZES , "No possible encoding found" ); CHECK( bestCS->cus[0]->predMode == NUMBER_OF_PREDICTION_MODES, "No possible encoding found" ); CHECK( bestCS->cost == MAX_DOUBLE , "No possible encoding found" ); } @@ -1153,36 +1104,33 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_CABACEstimator->getCtx() = m_CurrCtx->start; - if( tempCS->sps->getSpsNext().getUseQTBT() ) - { - const TempCtx ctxStartSP( m_CtxCache, SubCtx( Ctx::SplitFlag, m_CABACEstimator->getCtx() ) ); - const TempCtx ctxStartBT( m_CtxCache, SubCtx( Ctx::BTSplitFlag, m_CABACEstimator->getCtx() ) ); + const TempCtx ctxStartSP( m_CtxCache, SubCtx( Ctx::SplitFlag, m_CABACEstimator->getCtx() ) ); + const TempCtx ctxStartBT( m_CtxCache, SubCtx( Ctx::BTSplitFlag, m_CABACEstimator->getCtx() ) ); - m_CABACEstimator->resetBits(); + m_CABACEstimator->resetBits(); - if( partitioner.getImplicitSplit( *tempCS ) != CU_QUAD_SPLIT ) + if( partitioner.getImplicitSplit( *tempCS ) != CU_QUAD_SPLIT ) + { + if( partitioner.canSplit( CU_QUAD_SPLIT, *tempCS ) ) { - if( partitioner.canSplit( CU_QUAD_SPLIT, *tempCS ) ) - { - m_CABACEstimator->split_cu_flag( split == CU_QUAD_SPLIT, *tempCS, partitioner ); - } - if( split != CU_QUAD_SPLIT ) - { - m_CABACEstimator->split_cu_mode_mt( split, *tempCS, partitioner ); - } + m_CABACEstimator->split_cu_flag( split == CU_QUAD_SPLIT, *tempCS, partitioner ); } + if( split != CU_QUAD_SPLIT ) + { + m_CABACEstimator->split_cu_mode_mt( split, *tempCS, partitioner ); + } + } - const double factor = ( tempCS->currQP[partitioner.chType] > 30 ? 1.1 : 1.075 ); - const double cost = m_pcRdCost->calcRdCost( uint64_t( m_CABACEstimator->getEstFracBits() + ( ( bestCS->fracBits ) / factor ) ), Distortion( bestCS->dist / factor ) ); + const double factor = ( tempCS->currQP[partitioner.chType] > 30 ? 1.1 : 1.075 ); + const double cost = m_pcRdCost->calcRdCost( uint64_t( m_CABACEstimator->getEstFracBits() + ( ( bestCS->fracBits ) / factor ) ), Distortion( bestCS->dist / factor ) ); - m_CABACEstimator->getCtx() = SubCtx( Ctx::SplitFlag, ctxStartSP ); - m_CABACEstimator->getCtx() = SubCtx( Ctx::BTSplitFlag, ctxStartBT ); + m_CABACEstimator->getCtx() = SubCtx( Ctx::SplitFlag, ctxStartSP ); + m_CABACEstimator->getCtx() = SubCtx( Ctx::BTSplitFlag, ctxStartBT ); - if( cost > bestCS->cost ) - { - xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); - return; - } + if( cost > bestCS->cost ) + { + xCheckBestMode( tempCS, bestCS, partitioner, encTestMode ); + return; } partitioner.splitCurrArea( split, *tempCS ); @@ -1285,7 +1233,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, #if HM_QTBT_REPRODUCE_FAST_LCTU_BUG // LARGE CTU bug - if( m_pcEncCfg->getQTBT() && m_pcEncCfg->getUseFastLCTU() ) + if( m_pcEncCfg->getUseFastLCTU() ) { unsigned minDepth = 0; unsigned maxDepth = g_aucLog2[tempCS->sps->getSpsNext().getCTUSize()] - g_aucLog2[tempCS->sps->getSpsNext().getMinQTSize( slice.getSliceType(), partitioner.chType )]; @@ -1400,12 +1348,11 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC { double bestInterCost = m_modeCtrl->getBestInterCost(); double costSize2Nx2NemtFirstPass = m_modeCtrl->getEmtSize2Nx2NFirstPassCost(); - double costSizeNxNemtFirstPass = MAX_DOUBLE; bool skipSecondEmtPass = m_modeCtrl->getSkipSecondEMTPass(); const SPS &sps = *tempCS->sps; const PPS &pps = *tempCS->pps; const CodingUnit *bestCU = bestCS->getCU( partitioner.chType ); - const int maxSizeEMT = pps.pcv->noRQT ? EMT_INTRA_MAX_CU_WITH_QTBT : EMT_INTRA_MAX_CU; + const int maxSizeEMT = EMT_INTRA_MAX_CU_WITH_QTBT; #if HM_EMT_NSST_AS_IN_JEM uint8_t considerEmtSecondPass = ( sps.getSpsNext().getUseIntraEMT() && isLuma( partitioner.chType ) && partitioner.currArea().lwidth() <= maxSizeEMT && partitioner.currArea().lheight() <= maxSizeEMT ) ? 1 : 0; #else @@ -1443,7 +1390,6 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC #if JVET_L0054_MMVD cu.mmvdSkip = false; #endif - cu.partSize = encTestMode.partSize; cu.predMode = MODE_INTRA; cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; @@ -1525,7 +1471,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC // we save the cost of the modes for the first EMT pass - if( !emtCuFlag ) static_cast< double& >( cu.partSize == SIZE_2Nx2N ? costSize2Nx2NemtFirstPass : costSizeNxNemtFirstPass ) = tempCS->cost; + if( !emtCuFlag ) static_cast< double& >( costSize2Nx2NemtFirstPass ) = tempCS->cost; #if WCG_EXT DTRACE_MODE_COST( *tempCS, m_pcRdCost->getLambda( true ) ); @@ -1536,7 +1482,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC //now we check whether the second pass of SIZE_2Nx2N and the whole Intra SIZE_NxN should be skipped or not - if( !emtCuFlag && !tempCS->slice->isIntra() && bestCU && bestCU->predMode != MODE_INTRA && cu.partSize == SIZE_2Nx2N && m_pcEncCfg->getFastInterEMT() ) + if( !emtCuFlag && !tempCS->slice->isIntra() && bestCU && bestCU->predMode != MODE_INTRA && m_pcEncCfg->getFastInterEMT() ) { const double thEmtInterFastSkipIntra = 1.4; // Skip checking Intra if "2Nx2N using DCT2" is worse than best Inter mode if( costSize2Nx2NemtFirstPass > thEmtInterFastSkipIntra * bestInterCost ) @@ -1565,7 +1511,6 @@ void EncCu::xCheckIntraPCM(CodingStructure *&tempCS, CodingStructure *&bestCS, P #if JVET_L0054_MMVD cu.mmvdSkip = false; #endif - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTRA; cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; @@ -1731,7 +1676,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& // first get merge candidates CodingUnit cu( tempCS->area ); cu.cs = tempCS; - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTER; cu.slice = tempCS->slice; #if HEVC_TILES_WPP @@ -1899,7 +1843,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #if JVET_L0124_L0208_TRIANGLE cu.triangle = false; #endif - cu.partSize = SIZE_2Nx2N; //cu.affine cu.predMode = MODE_INTER; //cu.LICFlag @@ -2359,7 +2302,6 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& #if JVET_L0124_L0208_TRIANGLE cu.triangle = false; #endif - cu.partSize = SIZE_2Nx2N; //cu.affine cu.predMode = MODE_INTER; //cu.LICFlag @@ -2574,7 +2516,6 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru { CodingUnit cu( tempCS->area ); cu.cs = tempCS; - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTER; cu.slice = tempCS->slice; cu.triangle = true; @@ -2617,7 +2558,6 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru partitioner.setCUData( cu ); cu.slice = tempCS->slice; cu.skip = false; - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTER; cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; @@ -2723,7 +2663,6 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru partitioner.setCUData(cu); cu.slice = tempCS->slice; cu.skip = false; - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTER; cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; @@ -2803,7 +2742,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct // first get merge candidates CodingUnit cu( tempCS->area ); cu.cs = tempCS; - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTER; cu.slice = tempCS->slice; #if HEVC_TILES_WPP @@ -2869,7 +2807,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap( tempCS->area.lumaPos() ); #endif cu.skip = false; - cu.partSize = SIZE_2Nx2N; cu.affine = true; cu.predMode = MODE_INTER; cu.transQuantBypass = encTestMode.lossless; @@ -2981,7 +2918,6 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap( tempCS->area.lumaPos() ); #endif cu.skip = false; - cu.partSize = SIZE_2Nx2N; cu.affine = true; cu.predMode = MODE_INTER; cu.transQuantBypass = encTestMode.lossless; @@ -3166,7 +3102,6 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct // first get merge candidates CodingUnit cu(tempCS->area); cu.cs = tempCS; - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTER; cu.cpr = true; cu.slice = tempCS->slice; @@ -3218,7 +3153,6 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap(tempCS->area.lumaPos()); #endif cu.skip = false; - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTER; cu.cpr = true; cu.transQuantBypass = encTestMode.lossless; @@ -3362,7 +3296,6 @@ void EncCu::xCheckRDCostCPRModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap(tempCS->area.lumaPos()); #endif cu.skip = false; - cu.partSize = SIZE_2Nx2N; cu.predMode = MODE_INTER; cu.cpr = true; cu.transQuantBypass = encTestMode.lossless; @@ -3440,7 +3373,6 @@ void EncCu::xCheckRDCostCPRMode(CodingStructure *&tempCS, CodingStructure *&best cu.tileIdx = tempCS->picture->tileMap->getTileIdxMap(tempCS->area.lumaPos()); #endif cu.skip = false; - cu.partSize = encTestMode.partSize; cu.predMode = MODE_INTER; cu.transQuantBypass = encTestMode.lossless; cu.chromaQpAdj = cu.transQuantBypass ? 0 : m_cuChromaQpOffsetIdxPlus1; @@ -3672,7 +3604,6 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC #if JVET_L0054_MMVD cu.mmvdSkip = false; #endif - cu.partSize = encTestMode.partSize; //cu.affine cu.predMode = MODE_INTER; cu.transQuantBypass = encTestMode.lossless; @@ -3710,7 +3641,7 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC #endif xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, 0 - , m_pImvTempCS ? m_pImvTempCS[wIdx][encTestMode.partSize] : NULL + , m_pImvTempCS ? m_pImvTempCS[wIdx] : NULL , 1 , 0 #if JVET_L0646_GBI @@ -3767,20 +3698,6 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be CodingStructure* pcCUInfo2Reuse = nullptr; - if( m_pImvTempCS && encTestMode.partSize != SIZE_2Nx2N && ( ( encTestMode.opts & ETO_FORCE_MERGE ) == 0 ) ) - { - pcCUInfo2Reuse = m_pImvTempCS[gp_sizeIdxInfo->idxFrom( tempCS->area.lwidth() )][encTestMode.partSize]; - - if( pcCUInfo2Reuse != nullptr ) - { - CHECK( tempCS->area != pcCUInfo2Reuse->area, " mismatch" ); - tempCS->copyStructure( *pcCUInfo2Reuse, partitioner.chType ); - tempCS->fracBits = 0; - tempCS->dist = 0; - tempCS->cost = MAX_DOUBLE; - } - } - #if JVET_L0646_GBI m_pcInterSearch->resetBufferedUniMotions(); int gbiLoopNum = (tempCS->slice->isInterB() ? GBI_NUM : 1); @@ -3842,7 +3759,6 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be #if JVET_L0054_MMVD cu.mmvdSkip = false; #endif - cu.partSize = encTestMode.partSize; //cu.affine cu.predMode = MODE_INTER; cu.transQuantBypass = encTestMode.lossless; @@ -3853,7 +3769,6 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be } else { - CHECK( cu.partSize != encTestMode.partSize, "Mismatch" ); CHECK( cu.skip, "Mismatch" ); CHECK( cu.qtDepth != partitioner.currQtDepth, "Mismatch" ); CHECK( cu.btDepth != partitioner.currBtDepth, "Mismatch" ); @@ -4001,7 +3916,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be double bestCostInternal = MAX_DOUBLE; double bestCost = bestCS->cost; const SPS& sps = *tempCS->sps; - const int maxSizeEMT = tempCS->pcv->noRQT ? EMT_INTER_MAX_CU_WITH_QTBT : EMT_INTER_MAX_CU; + const int maxSizeEMT = EMT_INTER_MAX_CU_WITH_QTBT; bool swapped = false; // avoid unwanted data copy bool reloadCU = false; const bool considerEmtSecondPass = emtMode && sps.getSpsNext().getUseInterEMT() && partitioner.currArea().lwidth() <= maxSizeEMT && partitioner.currArea().lheight() <= maxSizeEMT; diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index 55d9b7136..62d8bb549 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -116,7 +116,7 @@ private: #if JVET_L0293_CPR CprHashMap m_cprHashMap; #endif - CodingStructure ***m_pImvTempCS; + CodingStructure **m_pImvTempCS; EncModeCtrl *m_modeCtrl; #if JVET_L0054_MMVD PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 4917956b8..e57939ac7 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -230,11 +230,9 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) for( int jId = 0; jId < m_numCuEncStacks; jId++ ) { m_cRdCost[jId].setCostMode ( m_costMode ); - m_cRdCost[jId].setUseQtbt ( m_QTBT ); } #else m_cRdCost.setCostMode ( m_costMode ); - m_cRdCost.setUseQtbt ( m_QTBT ); #endif // initialize PPS @@ -280,7 +278,6 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) #endif true, m_useTransformSkipFast - , m_QTBT ); // initialize encoder search class @@ -313,7 +310,6 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) #endif true, m_useTransformSkipFast - , m_QTBT ); // initialize encoder search class @@ -828,7 +824,6 @@ void EncLib::xInitSPS(SPS &sps) sps.setLog2DiffMaxMinCodingBlockSize(m_log2DiffMaxMinCodingBlockSize); sps.getSpsNext().setNextToolsEnabled ( m_profile == Profile::NEXT ); - sps.getSpsNext().setUseQTBT ( m_QTBT ); sps.getSpsNext().setCTUSize ( m_CTUSize ); #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT sps.getSpsNext().setSplitConsOverrideEnabledFlag( m_useSplitConsOverride ); @@ -889,7 +884,7 @@ void EncLib::xInitSPS(SPS &sps) #endif // ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here - int minCUSize = ( /*sps.getSpsNext().getUseQTBT() ? 1 << MIN_CU_LOG2 :*/ sps.getMaxCUWidth() >> sps.getLog2DiffMaxMinCodingBlockSize() ); + int minCUSize = sps.getMaxCUWidth() >> sps.getLog2DiffMaxMinCodingBlockSize(); int log2MinCUSize = 0; while(minCUSize > 1) { diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index edb697ed3..8278d015f 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -90,7 +90,6 @@ void EncModeCtrl::xExtractFeatures( const EncTestMode encTestmode, CodingStructu cs.features[ENC_FT_RD_COST ] = double( cs.cost ); cs.features[ENC_FT_ENC_MODE_TYPE ] = double( encTestmode.type ); cs.features[ENC_FT_ENC_MODE_OPTS ] = double( encTestmode.opts ); - cs.features[ENC_FT_ENC_MODE_PART ] = double( encTestmode.partSize ); } bool EncModeCtrl::nextMode( const CodingStructure &cs, Partitioner &partitioner ) @@ -989,7 +988,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru { for( int qp = maxQP; qp >= minQP; qp-- ) { - m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_QT, SIZE_2Nx2N, ETO_STANDARD, qp, false } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_QT, ETO_STANDARD, qp, false } ); } } @@ -998,7 +997,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add split modes for( int qp = maxQP; qp >= minQP; qp-- ) { - m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_TT_V, SIZE_2Nx2N, ETO_STANDARD, qp, false } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_TT_V, ETO_STANDARD, qp, false } ); } } @@ -1007,7 +1006,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add split modes for( int qp = maxQP; qp >= minQP; qp-- ) { - m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_TT_H, SIZE_2Nx2N, ETO_STANDARD, qp, false } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_TT_H, ETO_STANDARD, qp, false } ); } } @@ -1016,7 +1015,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add split modes for( int qp = maxQP; qp >= minQP; qp-- ) { - m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_BT_V, SIZE_2Nx2N, ETO_STANDARD, qp, false } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_BT_V, ETO_STANDARD, qp, false } ); } m_ComprCUCtxList.back().set( DID_VERT_SPLIT, true ); } @@ -1030,7 +1029,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru // add split modes for( int qp = maxQP; qp >= minQP; qp-- ) { - m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_BT_H, SIZE_2Nx2N, ETO_STANDARD, qp, false } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_BT_H, ETO_STANDARD, qp, false } ); } m_ComprCUCtxList.back().set( DID_HORZ_SPLIT, true ); } @@ -1043,7 +1042,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru { for( int qp = maxQP; qp >= minQP; qp-- ) { - m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_QT, SIZE_2Nx2N, ETO_STANDARD, qp, false } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_SPLIT_QT, ETO_STANDARD, qp, false } ); } } @@ -1079,16 +1078,16 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru const int qp = std::max( qpLoop, lowestQP ); const bool lossless = useLossless && qpLoop == minQP; // add intra modes - m_ComprCUCtxList.back().testModes.push_back( { ETM_IPCM, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); - m_ComprCUCtxList.back().testModes.push_back( { ETM_INTRA, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_IPCM, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_INTRA, ETO_STANDARD, qp, lossless } ); #if JVET_L0293_CPR // add cpr mode to intra path if (cs.sps->getSpsNext().getCPRMode() && checkCpr ) { - m_ComprCUCtxList.back().testModes.push_back({ ETM_CPR, SIZE_2Nx2N, ETO_STANDARD, qp, lossless }); + m_ComprCUCtxList.back().testModes.push_back({ ETM_CPR, ETO_STANDARD, qp, lossless }); if (cs.chType == CHANNEL_TYPE_LUMA) { - m_ComprCUCtxList.back().testModes.push_back({ ETM_CPR_MERGE, SIZE_2Nx2N, ETO_STANDARD, qp, lossless }); + m_ComprCUCtxList.back().testModes.push_back({ ETM_CPR_MERGE, ETO_STANDARD, qp, lossless }); } } #endif @@ -1107,9 +1106,9 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru if( m_pcEncCfg->getIMV() == IMV_4PEL ) { int imv = m_pcEncCfg->getIMV4PelFast() ? 3 : 2; - m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, SIZE_2Nx2N, EncTestModeOpts( imv << ETO_IMV_SHIFT ), qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, EncTestModeOpts( imv << ETO_IMV_SHIFT ), qp, lossless } ); } - m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, SIZE_2Nx2N, EncTestModeOpts( 1 << ETO_IMV_SHIFT ), qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, EncTestModeOpts( 1 << ETO_IMV_SHIFT ), qp, lossless } ); } // add inter modes if( m_pcEncCfg->getUseEarlySkipDetection() ) @@ -1117,37 +1116,37 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru #if JVET_L0124_L0208_TRIANGLE if( cs.sps->getSpsNext().getUseTriangle() && cs.slice->isInterB() ) { - m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp, lossless } ); } #endif - m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp, lossless } ); #if JVET_L0369_SUBBLOCK_MERGE if ( cs.sps->getSpsNext().getUseAffine() || cs.sps->getSpsNext().getUseSubPuMvp() ) #else if( cs.sps->getSpsNext().getUseAffine() ) #endif { - m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } ); } - m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, ETO_STANDARD, qp, lossless } ); } else { - m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_INTER_ME, ETO_STANDARD, qp, lossless } ); #if JVET_L0124_L0208_TRIANGLE if( cs.sps->getSpsNext().getUseTriangle() && cs.slice->isInterB() ) { - m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_TRIANGLE, ETO_STANDARD, qp, lossless } ); } #endif - m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_MERGE_SKIP, ETO_STANDARD, qp, lossless } ); #if JVET_L0369_SUBBLOCK_MERGE if ( cs.sps->getSpsNext().getUseAffine() || cs.sps->getSpsNext().getUseSubPuMvp() ) #else if( cs.sps->getSpsNext().getUseAffine() ) #endif { - m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, SIZE_2Nx2N, ETO_STANDARD, qp, lossless } ); + m_ComprCUCtxList.back().testModes.push_back( { ETM_AFFINE, ETO_STANDARD, qp, lossless } ); } } } @@ -1170,14 +1169,12 @@ void EncModeCtrlMTnoRQT::finishCULevel( Partitioner &partitioner ) bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingStructure &cs, Partitioner& partitioner ) { - CHECK( encTestmode.partSize != SIZE_2Nx2N, "Only 2Nx2N supported with QTBT" ); - ComprCUCtx& cuECtx = m_ComprCUCtxList.back(); // Fast checks, partitioning depended // if early skip detected, skip all modes checking but the splits - if( cuECtx.earlySkip && m_pcEncCfg->getUseEarlySkipDetection() && !isModeSplit( encTestmode ) && !( isModeInter( encTestmode ) && encTestmode.partSize == SIZE_2Nx2N ) ) + if( cuECtx.earlySkip && m_pcEncCfg->getUseEarlySkipDetection() && !isModeSplit( encTestmode ) && !( isModeInter( encTestmode ) ) ) { return false; } @@ -1339,7 +1336,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt { return false; } - if( encTestmode.partSize != SIZE_2Nx2N || cs.area.lumaSize().width > cs.pcv->fastDeltaQPCuMaxSize ) + if( cs.area.lumaSize().width > cs.pcv->fastDeltaQPCuMaxSize ) { return false; // only check necessary 2Nx2N Inter in fast deltaqp mode } @@ -1643,7 +1640,7 @@ bool EncModeCtrlMTnoRQT::useModeResult( const EncTestMode& encTestmode, CodingSt { cuECtx.set( BEST_TRIV_SPLIT_COST, tempCS->cost ); } - else if( encTestmode.type == ETM_INTRA && encTestmode.partSize == SIZE_2Nx2N ) + else if( encTestmode.type == ETM_INTRA ) { const CodingUnit cu = *tempCS->getCU( partitioner.chType ); diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index 36a3950e5..bff91c3dd 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -100,17 +100,16 @@ static void getAreaIdx(const Area& area, const PreCalcValues &pcv, unsigned &idx struct EncTestMode { EncTestMode() - : type( ETM_INVALID ), opts( ETO_INVALID ), partSize( NUMBER_OF_PART_SIZES ), qp( -1 ), lossless( false ) {} + : type( ETM_INVALID ), opts( ETO_INVALID ), qp( -1 ), lossless( false ) {} EncTestMode( EncTestModeType _type ) - : type( _type ), opts( ETO_STANDARD ), partSize( SIZE_2Nx2N ), qp( -1 ), lossless( false ) {} + : type( _type ), opts( ETO_STANDARD ), qp( -1 ), lossless( false ) {} EncTestMode( EncTestModeType _type, int _qp, bool _lossless ) - : type( _type ), opts( ETO_STANDARD ), partSize( SIZE_2Nx2N ), qp( _qp ), lossless( _lossless ) {} - EncTestMode( EncTestModeType _type, PartSize _partSize, EncTestModeOpts _opts, int _qp, bool _lossless ) - : type( _type ), opts( _opts ), partSize( _partSize ), qp( _qp ), lossless( _lossless ) {} + : type( _type ), opts( ETO_STANDARD ), qp( _qp ), lossless( _lossless ) {} + EncTestMode( EncTestModeType _type, EncTestModeOpts _opts, int _qp, bool _lossless ) + : type( _type ), opts( _opts ), qp( _qp ), lossless( _lossless ) {} EncTestModeType type; EncTestModeOpts opts; - PartSize partSize; int qp; bool lossless; }; @@ -163,8 +162,8 @@ inline PartSplit getPartSplit( const EncTestMode& encTestmode ) inline EncTestMode getCSEncMode( const CodingStructure& cs ) { return EncTestMode( EncTestModeType( (unsigned)cs.features[ENC_FT_ENC_MODE_TYPE] ), - PartSize ( (unsigned)cs.features[ENC_FT_ENC_MODE_PART] ), - EncTestModeOpts( (unsigned)cs.features[ENC_FT_ENC_MODE_OPTS] ) ); + EncTestModeOpts( (unsigned)cs.features[ENC_FT_ENC_MODE_OPTS] ), + false); } diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index dfdc0687f..0ff695df8 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -703,106 +703,6 @@ Distortion InterSearch::xGetInterPredictionError( PredictionUnit& pu, PelUnitBuf return (Distortion)cDistParam.distFunc( cDistParam ); } -//! estimation of best merge coding -void InterSearch::xMergeEstimation( PredictionUnit& pu, PelUnitBuf& origBuf, int iPUIdx, uint32_t& uiMergeIdx, Distortion& ruiCost, MergeCtx &mergeCtx ) -{ - PartSize partSize = pu.cu->partSize; - - if ( pu.cs->pps->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pu.cu->lumaSize().width <= 8 ) - { - if ( iPUIdx == 0 ) - { - UnitArea unitArea = pu; - - pu.UnitArea::operator=( *pu.cu ); - pu.cu->partSize = SIZE_2Nx2N; -#if JVET_L0054_MMVD - if(pu.mmvdMergeFlag) - { - PU::getInterMergeCandidates( pu, mergeCtx -#if JVET_L0054_MMVD - , 0 -#endif - ); - PU::getInterMMVDMergeCandidates(pu, mergeCtx); - } - else - { - PU::getInterMergeCandidates(pu, mergeCtx -#if JVET_L0054_MMVD - , 0 -#endif - ); - } -#else - PU::getInterMergeCandidates( pu, mergeCtx ); -#endif - pu.UnitArea::operator=( unitArea ); - pu.cu->partSize = partSize; - } - } - else - { -#if JVET_L0054_MMVD - if(pu.mmvdMergeFlag) - { - PU::getInterMergeCandidates( pu, mergeCtx -#if JVET_L0054_MMVD - , 0 -#endif - ); - PU::getInterMMVDMergeCandidates(pu, mergeCtx); - } - else - { - PU::getInterMergeCandidates(pu, mergeCtx -#if JVET_L0054_MMVD - , 0 -#endif - ); - } -#else - PU::getInterMergeCandidates( pu, mergeCtx ); -#endif - } - - PU::restrictBiPredMergeCands( pu, mergeCtx ); - - ruiCost = std::numeric_limits<Distortion>::max(); - for( uint32_t uiMergeCand = 0; uiMergeCand < mergeCtx.numValidMergeCand; ++uiMergeCand ) - { -#if JVET_L0293_CPR - if (pu.cs->slice->getRefPic(REF_PIC_LIST_0, mergeCtx.mvFieldNeighbours[uiMergeCand << 1].refIdx)->getPOC() == pu.cs->slice->getPOC()) - { - continue; - } -#endif - mergeCtx.setMergeInfo( pu, uiMergeCand ); - - PU::spanMotionInfo( pu, mergeCtx ); - - Distortion uiCostCand = xGetInterPredictionError( pu, origBuf ); - uint32_t uiBitsCand = uiMergeCand + 1; - - if( uiMergeCand == m_pcEncCfg->getMaxNumMergeCand() - 1 ) - { - uiBitsCand--; - } - uiCostCand = uiCostCand + m_pcRdCost->getCost( uiBitsCand ); - if ( uiCostCand < ruiCost ) - { - ruiCost = uiCostCand; - uiMergeIdx = uiMergeCand; - } - } -#if JVET_L0646_GBI - if( pu.cu->GBiIdx != GBI_DEFAULT ) - { - pu.cu->GBiIdx = GBI_DEFAULT; // Reset to default for the rest modes. - } -#endif - -} #if JVET_L0293_CPR /// add cpr search functions here @@ -1677,7 +1577,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) PelUnitBuf origBuf = pu.cs->getOrgBuf( pu ); - xGetBlkBits( cu.partSize, cs.slice->isInterP(), puIdx, uiLastMode, uiMbBits ); + xGetBlkBits( cs.slice->isInterP(), puIdx, uiLastMode, uiMbBits ); m_pcRdCost->selectMotionLambda( cu.transQuantBypass ); @@ -1781,7 +1681,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } } - if (cu.Y().width > 8 && cu.Y().height > 8 && cu.partSize == SIZE_2Nx2N && cu.slice->getSPS()->getSpsNext().getUseAffine() + if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getSpsNext().getUseAffine() && cu.imv == 0 #if JVET_L0646_GBI && (gbiIdx == GBI_DEFAULT || m_affineModeSelected || !m_pcEncCfg->getUseGBiFast()) @@ -2017,8 +1917,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.mvpNum[REF_PIC_LIST_1] = NOT_VALID; - uint32_t uiMEBits = 0; - // Set Motion Field cMv [1] = mvValidList1; @@ -2054,8 +1952,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.mvpNum[REF_PIC_LIST_0] = aaiMvpNum[0][iRefIdxBi[0]]; pu.mvpNum[REF_PIC_LIST_1] = aaiMvpNum[1][iRefIdxBi[1]]; pu.interDir = 3; - - uiMEBits = uiBits[2]; } else if ( uiCost[0] <= uiCost[1] ) { @@ -2070,8 +1966,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.mvpIdx[REF_PIC_LIST_0] = aaiMvpIdx[0][iRefIdx[0]]; pu.mvpNum[REF_PIC_LIST_0] = aaiMvpNum[0][iRefIdx[0]]; pu.interDir = 1; - - uiMEBits = uiBits[0]; } else { @@ -2086,8 +1980,6 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.mvpIdx[REF_PIC_LIST_1] = aaiMvpIdx[1][iRefIdx[1]]; pu.mvpNum[REF_PIC_LIST_1] = aaiMvpNum[1][iRefIdx[1]]; pu.interDir = 2; - - uiMEBits = uiBits[1]; } #if JVET_L0646_GBI @@ -2097,39 +1989,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } #endif - if ( cu.partSize != SIZE_2Nx2N ) - { - uint32_t uiMRGIndex = 0; - - // calculate ME cost - Distortion uiMEError = xGetInterPredictionError( pu, origBuf ); - Distortion uiMECost = uiMEError + m_pcRdCost->getCost( uiMEBits ); - // save ME result. - InterPredictionData savedPU = pu; - - // find Merge result - Distortion uiMRGCost = std::numeric_limits<Distortion>::max(); - - pu.initData(); - xMergeEstimation( pu, origBuf, puIdx, uiMRGIndex, uiMRGCost, mergeCtx ); - - if( uiMRGCost < uiMECost ) - { - // set Merge result - mergeCtx.setMergeInfo( pu, uiMRGIndex ); - } - else - { - pu = savedPU; - } - uiHevcCost = ( uiMRGCost < uiMECost ) ? uiMRGCost : uiMECost; - } - if( cu.cs->pcv->only2Nx2N || cu.partSize == SIZE_2Nx2N ) - { - uiHevcCost = ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) ? uiCostBi : ( ( uiCost[0] <= uiCost[1] ) ? uiCost[0] : uiCost[1] ); - } - CHECK( !( !cu.cs->pcv->only2Nx2N || cu.partSize == SIZE_2Nx2N ), "Unexpected part size for QTBT." ); - if (cu.Y().width > 8 && cu.Y().height > 8 && cu.partSize == SIZE_2Nx2N && cu.slice->getSPS()->getSpsNext().getUseAffine() && cu.imv == 0 + uiHevcCost = ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) ? uiCostBi : ( ( uiCost[0] <= uiCost[1] ) ? uiCost[0] : uiCost[1] ); + if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getSpsNext().getUseAffine() && cu.imv == 0 #if JVET_L0646_GBI && (gbiIdx == GBI_DEFAULT || m_affineModeSelected || !m_pcEncCfg->getUseGBiFast()) #endif @@ -2378,18 +2239,11 @@ uint32_t InterSearch::xGetMvpIdxBits(int iIdx, int iNum) return uiLength; } -void InterSearch::xGetBlkBits( PartSize eCUMode, bool bPSlice, int iPartIdx, uint32_t uiLastMode, uint32_t uiBlkBit[3]) +void InterSearch::xGetBlkBits( bool bPSlice, int iPartIdx, uint32_t uiLastMode, uint32_t uiBlkBit[3]) { - if ( eCUMode == SIZE_2Nx2N ) - { - uiBlkBit[0] = (! bPSlice) ? 3 : 1; - uiBlkBit[1] = 3; - uiBlkBit[2] = 5; - } - else - { - THROW("Wrong part size!"); - } + uiBlkBit[0] = (! bPSlice) ? 3 : 1; + uiBlkBit[1] = 3; + uiBlkBit[2] = 5; } void InterSearch::xCopyAMVPInfo (AMVPInfo* pSrc, AMVPInfo* pDst) @@ -2654,16 +2508,12 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref ( m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE3 ) ? 2 : 0; rcMv = rcMvPred; const Mv *pIntegerMv2Nx2NPred = 0; - if( !pu.cs->pcv->only2Nx2N && ( pu.cu->partSize != SIZE_2Nx2N || pu.cu->qtDepth != 0 ) ) - { - pIntegerMv2Nx2NPred = &( m_integerMv2Nx2N[eRefPicList][iRefIdxPred] ); - } xPatternSearchFast( pu, cStruct, rcMv, ruiCost, pIntegerMv2Nx2NPred ); if( blkCache ) { blkCache->setMv( pu.cs->area, eRefPicList, iRefIdxPred, rcMv ); } - else if( pu.cu->partSize == SIZE_2Nx2N ) + else { m_integerMv2Nx2N[eRefPicList][iRefIdxPred] = rcMv; } @@ -3479,8 +3329,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, int iRefStart, iRefEnd; - PartSize ePartSize = pu.cu->partSize; - int bestBiPRefIdxL1 = 0; int bestBiPMvpL1 = 0; Distortion biPDistTemp = std::numeric_limits<Distortion>::max(); @@ -3506,7 +3354,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, Distortion costValidList1 = std::numeric_limits<Distortion>::max(); Mv mvHevc[3]; - xGetBlkBits( ePartSize, slice.isInterP(), puIdx, lastMode, uiMbBits); + xGetBlkBits( slice.isInterP(), puIdx, lastMode, uiMbBits); pu.cu->affine = true; pu.mergeFlag = false; @@ -5087,15 +4935,15 @@ void InterSearch::xEncodeInterResidualQT(CodingStructure &cs, Partitioner &parti if (compID == MAX_NUM_TBLOCKS) // we are not processing a channel, instead we always recurse and code the CBFs { - if( cs.pcv->noRQT ) + if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) + { + CHECK( !bSubdiv, "Not performing the implicit TU split" ); + } + else { - if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) - { - CHECK( !bSubdiv, "Not performing the implicit TU split" ); - } - else CHECK( bSubdiv, "transformsplit not supported" ); } + CHECK(CU::isIntra(cu), "Inter search provided with intra CU"); if( cu.chromaFormat != CHROMA_400 ) @@ -5175,12 +5023,8 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par #endif const unsigned currDepth = partitioner.currTrDepth; - bool bCheckSplit = false, bCheckFull = false; - if( cs.pcv->noRQT ) - { - bCheckFull = !partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); - bCheckSplit = !bCheckFull; - } + bool bCheckFull = !partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); + bool bCheckSplit = !bCheckFull; // get temporary data CodingStructure *csSplit = nullptr; @@ -5877,7 +5721,7 @@ uint64_t InterSearch::xGetSymbolFracBitsInter(CodingStructure &cs, Partitioner & m_CABACEstimator->resetBits(); - if( cu.partSize == SIZE_2Nx2N && cu.firstPU->mergeFlag && !cu.rootCbf ) + if( cu.firstPU->mergeFlag && !cu.rootCbf ) { cu.skip = true; diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index f3fa119c3..5c90bb03e 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -306,15 +306,7 @@ protected: void xCopyAMVPInfo ( AMVPInfo* pSrc, AMVPInfo* pDst ); uint32_t xGetMvpIdxBits ( int iIdx, int iNum ); - void xGetBlkBits ( PartSize eCUMode, bool bPSlice, int iPartIdx, uint32_t uiLastMode, uint32_t uiBlkBit[3]); - - void xMergeEstimation ( PredictionUnit& pu, - PelUnitBuf& origBuf, - int iPartIdx, - uint32_t& uiMergeIndex, - Distortion& ruiCost, - MergeCtx & mergeCtx - ); + void xGetBlkBits ( bool bPSlice, int iPartIdx, uint32_t uiLastMode, uint32_t uiBlkBit[3]); diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 9b48e8c05..b33510910 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -77,11 +77,8 @@ void IntraSearch::destroy() if( m_pcEncCfg ) { - bool BTnoRQT = m_pcEncCfg->getQTBT(); - - - const uint32_t uiNumLayersToAllocateSplit = BTnoRQT ? 1 : m_pcEncCfg->getQuadtreeTULog2MaxSize() - m_pcEncCfg->getQuadtreeTULog2MinSize() + 1; - const uint32_t uiNumLayersToAllocateFull = BTnoRQT ? 1 : m_pcEncCfg->getQuadtreeTULog2MaxSize() - m_pcEncCfg->getQuadtreeTULog2MinSize() + 1; + const uint32_t uiNumLayersToAllocateSplit = 1; + const uint32_t uiNumLayersToAllocateFull = 1; const int uiNumSaveLayersToAllocate = 2; for( uint32_t layer = 0; layer < uiNumSaveLayersToAllocate; layer++ ) @@ -97,7 +94,7 @@ void IntraSearch::destroy() { for( uint32_t height = 0; height < numHeights; height++ ) { - if( ( BTnoRQT || width == height ) && gp_sizeIdxInfo->isCuSize( gp_sizeIdxInfo->sizeFrom( width ) ) && gp_sizeIdxInfo->isCuSize( gp_sizeIdxInfo->sizeFrom( height ) ) ) + if( gp_sizeIdxInfo->isCuSize( gp_sizeIdxInfo->sizeFrom( width ) ) && gp_sizeIdxInfo->isCuSize( gp_sizeIdxInfo->sizeFrom( height ) ) ) { for( uint32_t layer = 0; layer < uiNumLayersToAllocateSplit; layer++ ) { @@ -192,10 +189,8 @@ void IntraSearch::init( EncCfg* pcEncCfg, uint32_t numWidths = gp_sizeIdxInfo->numWidths(); uint32_t numHeights = gp_sizeIdxInfo->numHeights(); - bool BTnoRQT = m_pcEncCfg->getQTBT(); - - const uint32_t uiNumLayersToAllocateSplit = BTnoRQT ? 1 : pcEncCfg->getQuadtreeTULog2MaxSize() - pcEncCfg->getQuadtreeTULog2MinSize() + 1; - const uint32_t uiNumLayersToAllocateFull = BTnoRQT ? 1 : pcEncCfg->getQuadtreeTULog2MaxSize() - pcEncCfg->getQuadtreeTULog2MinSize() + 1; + const uint32_t uiNumLayersToAllocateSplit = 1; + const uint32_t uiNumLayersToAllocateFull = 1; m_pBestCS = new CodingStructure**[numWidths]; m_pTempCS = new CodingStructure**[numWidths]; @@ -213,7 +208,7 @@ void IntraSearch::init( EncCfg* pcEncCfg, for( uint32_t height = 0; height < numHeights; height++ ) { - if( ( BTnoRQT || width == height ) && gp_sizeIdxInfo->isCuSize( gp_sizeIdxInfo->sizeFrom( width ) ) && gp_sizeIdxInfo->isCuSize( gp_sizeIdxInfo->sizeFrom( height ) ) ) + if( gp_sizeIdxInfo->isCuSize( gp_sizeIdxInfo->sizeFrom( width ) ) && gp_sizeIdxInfo->isCuSize( gp_sizeIdxInfo->sizeFrom( height ) ) ) { m_pBestCS[width][height] = new CodingStructure( m_unitCache.cuCache, m_unitCache.puCache, m_unitCache.tuCache ); m_pTempCS[width][height] = new CodingStructure( m_unitCache.cuCache, m_unitCache.puCache, m_unitCache.tuCache ); @@ -270,7 +265,7 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) { CodingStructure &cs = *cu.cs; const SPS &sps = *cs.sps; - const uint32_t uiWidthBit = cs.pcv->rectCUs ? g_aucLog2[partitioner.currArea().lwidth() ] : CU::getIntraSizeIdx(cu); + const uint32_t uiWidthBit = g_aucLog2[partitioner.currArea().lwidth() ]; const uint32_t uiHeightBit = g_aucLog2[partitioner.currArea().lheight()]; // Lambda calculation at equivalent Qp of 4 is recommended because at that Qp, the quantization divisor is 1. @@ -303,7 +298,7 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) // 1: EMT fast algorithm can be applied for the current CU, and the DCT2 is being checked // 2: EMT is being checked for current CU. Stored results of DCT2 can be utilized for speedup uint8_t emtUsageFlag = 0; - const int maxSizeEMT = cs.pcv->noRQT ? EMT_INTRA_MAX_CU_WITH_QTBT : EMT_INTRA_MAX_CU; + const int maxSizeEMT = EMT_INTRA_MAX_CU_WITH_QTBT; if( width <= maxSizeEMT && height <= maxSizeEMT && sps.getSpsNext().getUseIntraEMT() ) { emtUsageFlag = cu.emtFlag == 1 ? 2 : 1; @@ -311,12 +306,9 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) bool isAllIntra = m_pcEncCfg->getIntraPeriod() == 1; - if( cs.pcv->rectCUs ) + if( width * height < 64 && !isAllIntra ) { - if( width * height < 64 && !isAllIntra ) - { - emtUsageFlag = 0; //this forces the recalculation of the candidates list. Why is this necessary? (to be checked) - } + emtUsageFlag = 0; //this forces the recalculation of the candidates list. Why is this necessary? (to be checked) } static_vector<uint32_t, FAST_UDI_MAX_RDMODE_NUM> uiHadModeList; @@ -345,15 +337,7 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) static_vector< uint32_t, FAST_UDI_MAX_RDMODE_NUM > uiRdModeList; int numModesForFullRD = 3; - if( cs.pcv->rectCUs ) - { - numModesForFullRD = g_aucIntraModeNumFast_UseMPM_2D[uiWidthBit - MIN_CU_LOG2][uiHeightBit - MIN_CU_LOG2]; - } - else - { - numModesForFullRD = m_pcEncCfg->getFastUDIUseMPMEnabled() ? g_aucIntraModeNumFast_UseMPM[uiWidthBit] : g_aucIntraModeNumFast_NotUseMPM[uiWidthBit]; - numModesForFullRD -= 1; - } + numModesForFullRD = g_aucIntraModeNumFast_UseMPM_2D[uiWidthBit - MIN_CU_LOG2][uiHeightBit - MIN_CU_LOG2]; #if INTRA_FULL_SEARCH numModesForFullRD = numModesAvailable; @@ -619,22 +603,7 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) { if( isAllIntra && m_pcEncCfg->getFastIntraEMT() ) { - double thresholdSkipMode; - if( cs.pcv->noRQT ) - { - thresholdSkipMode = 1.0 + 1.4 / sqrt( ( double ) ( width*height ) ); - } - else - { - switch( width ) - { - case 4: thresholdSkipMode = 1.47; break; // Skip checking 4x4 Intra modes using the R-D cost in the DCT2-pass - case 8: thresholdSkipMode = 1.28; break; // Skip checking 8x8 Intra modes using the R-D cost in the DCT2-pass - case 16: thresholdSkipMode = 1.12; break; // Skip checking 16x16 Intra modes using the R-D cost in the DCT2-pass - case 32: thresholdSkipMode = 1.06; break; // Skip checking 32x32 Intra modes using the R-D cost in the DCT2-pass - default: thresholdSkipMode = 1.06; break; // Skip checking 32x32 Intra modes using the R-D cost in the DCT2-pass - } - } + double thresholdSkipMode = 1.0 + 1.4 / sqrt( ( double ) ( width*height ) ); numModesForFullRD = 0; @@ -671,7 +640,7 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner ) // after this point, don't use numModesForFullRD // PBINTRA fast - if( m_pcEncCfg->getUsePbIntraFast() && !cs.slice->isIntra() && cu.partSize == SIZE_2Nx2N && uiRdModeList.size() < numModesAvailable && emtUsageFlag != 2 ) + if( m_pcEncCfg->getUsePbIntraFast() && !cs.slice->isIntra() && uiRdModeList.size() < numModesAvailable && emtUsageFlag != 2 ) { if( CandHadList.size() < 3 || CandHadList[2] > cs.interHad * PBINTRA_RATIO ) { @@ -833,7 +802,7 @@ void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner) for( const auto &ptu : cs.tus ) { // for split TUs in HEVC, add the TUs without Chroma parts for correct setting of Cbfs - if( pu.contains( *ptu, CHANNEL_TYPE_CHROMA ) || ( !cs.pcv->noRQT && !ptu->Cb().valid() && !ptu->Cr().valid() ) ) + if( pu.contains( *ptu, CHANNEL_TYPE_CHROMA ) ) { saveCS.addTU( *ptu, partitioner.chType ); orgTUs.push_back( ptu ); @@ -1109,7 +1078,7 @@ void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner, #if JVET_L0283_MULTI_REF_LINE m_CABACEstimator->extend_ref_line(cu); #endif - if( CU::isIntra(cu) && cu.partSize == SIZE_2Nx2N ) + if( CU::isIntra(cu) ) { m_CABACEstimator->pcm_data( cu ); if( cu.ipcm ) @@ -1122,16 +1091,13 @@ void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner, PredictionUnit &pu = *cs.getPU(partitioner.currArea().lumaPos(), partitioner.chType); // luma prediction mode - if (cu.partSize == SIZE_2Nx2N) + if (isFirst) { - if (isFirst) - { #if JVET_L0293_CPR - if ( !cu.Y().valid()) - m_CABACEstimator->pred_mode( cu ); + if ( !cu.Y().valid()) + m_CABACEstimator->pred_mode( cu ); #endif - m_CABACEstimator->intra_luma_pred_mode( pu ); - } + m_CABACEstimator->intra_luma_pred_mode( pu ); } } @@ -1141,12 +1107,9 @@ void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner, PredictionUnit &pu = *cs.getPU( partitioner.currArea().chromaPos(), CHANNEL_TYPE_CHROMA ); - if( cu.partSize == SIZE_2Nx2N ) + if( isFirst ) { - if( isFirst ) - { - m_CABACEstimator->intra_chroma_pred_mode( pu ); - } + m_CABACEstimator->intra_chroma_pred_mode( pu ); } } } @@ -1162,14 +1125,13 @@ void IntraSearch::xEncSubdivCbfQT(CodingStructure &cs, Partitioner &partitioner, const bool subdiv = currTU.depth > currDepth; - if( cs.pcv->noRQT ) + if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { - if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) - { - CHECK( !subdiv, "TU split implied" ); - } - else - CHECK( subdiv, "No TU subdivision is allowed with QTBT" ); + CHECK( !subdiv, "TU split implied" ); + } + else + { + CHECK( subdiv, "No TU subdivision is allowed with QTBT" ); } if (bChroma) @@ -1468,15 +1430,11 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par const bool keepResi = pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() || KEEP_PRED_AND_RESI_SIGNALS; bool bCheckFull = true; bool bCheckSplit = false; - bCheckFull = cs.pcv->noRQT && !partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); - bCheckSplit = cs.pcv->noRQT && partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); + bCheckFull = !partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); + bCheckSplit = partitioner.canSplit( TU_MAX_TR_SPLIT, cs ); uint32_t numSig = 0; - if( !cs.pcv->noRQT ) - { - } - bool checkInitTrDepth = false, checkInitTrDepthTransformSkipWinner = false; double dSingleCost = MAX_DOUBLE; @@ -1693,7 +1651,7 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par bool uiSplitCbfLuma = false; bool splitIsSelected = true; - if( cs.pcv->noRQT && partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) + if( partitioner.canSplit( TU_MAX_TR_SPLIT, cs ) ) { partitioner.splitCurrArea( TU_MAX_TR_SPLIT, cs ); } diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index d67f24ed8..dbb3dd213 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -528,7 +528,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.getUseQTBT() ? 1 : 0, "qtbt_flag" ); WRITE_FLAG( spsNext.getUseLargeCTU() ? 1 : 0, "large_ctu_flag" ); WRITE_FLAG(spsNext.getUseSubPuMvp() ? 1 : 0, "subpu_tmvp_flag"); WRITE_FLAG( spsNext.getUseIMV() ? 1 : 0, "imv_enable_flag" ); @@ -572,47 +571,44 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM ) #endif // additional parameters - if( spsNext.getUseQTBT() ) - { - WRITE_FLAG( spsNext.getUseDualITree(), "qtbt_dual_intra_tree" ); - WRITE_UVLC( g_aucLog2[spsNext.getCTUSize()] - MIN_CU_LOG2, "log2_CTU_size_minus2" ); + WRITE_FLAG( spsNext.getUseDualITree(), "qtbt_dual_intra_tree" ); + WRITE_UVLC( g_aucLog2[spsNext.getCTUSize()] - MIN_CU_LOG2, "log2_CTU_size_minus2" ); #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - WRITE_FLAG (spsNext.getSplitConsOverrideEnabledFlag(), "sps_override_partition_constraints_enable_flag"); - WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize(I_SLICE)] - spsNext.getSPS().getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice"); - WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize(B_SLICE)] - spsNext.getSPS().getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_inter_slice"); - WRITE_UVLC( spsNext.getMaxBTDepth(), "sps_max_mtt_hierarchy_depth_inter_slices"); - WRITE_UVLC( spsNext.getMaxBTDepthI(), "sps_max_mtt_hierarchy_depth_intra_slices"); - if (spsNext.getMaxBTDepthI() != 0) - { - WRITE_UVLC(g_aucLog2[spsNext.getMaxBTSizeI()] - g_aucLog2[spsNext.getMinQTSize(I_SLICE)], "sps_log2_diff_max_bt_min_qt_intra_slice"); - WRITE_UVLC(g_aucLog2[spsNext.getMaxTTSizeI()] - g_aucLog2[spsNext.getMinQTSize(I_SLICE)], "sps_log2_diff_max_tt_min_qt_intra_slice"); - } - if (spsNext.getMaxBTDepth() != 0) - { - WRITE_UVLC(g_aucLog2[spsNext.getMaxBTSize()] - g_aucLog2[spsNext.getMinQTSize(B_SLICE)], "sps_log2_diff_max_bt_min_qt_inter_slice"); - WRITE_UVLC(g_aucLog2[spsNext.getMaxTTSize()] - g_aucLog2[spsNext.getMinQTSize(B_SLICE)], "sps_log2_diff_max_tt_min_qt_inter_slice"); - } + WRITE_FLAG (spsNext.getSplitConsOverrideEnabledFlag(), "sps_override_partition_constraints_enable_flag"); + WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize(I_SLICE)] - spsNext.getSPS().getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice"); + WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize(B_SLICE)] - spsNext.getSPS().getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_inter_slice"); + WRITE_UVLC( spsNext.getMaxBTDepth(), "sps_max_mtt_hierarchy_depth_inter_slices"); + WRITE_UVLC( spsNext.getMaxBTDepthI(), "sps_max_mtt_hierarchy_depth_intra_slices"); + if (spsNext.getMaxBTDepthI() != 0) + { + WRITE_UVLC(g_aucLog2[spsNext.getMaxBTSizeI()] - g_aucLog2[spsNext.getMinQTSize(I_SLICE)], "sps_log2_diff_max_bt_min_qt_intra_slice"); + WRITE_UVLC(g_aucLog2[spsNext.getMaxTTSizeI()] - g_aucLog2[spsNext.getMinQTSize(I_SLICE)], "sps_log2_diff_max_tt_min_qt_intra_slice"); + } + if (spsNext.getMaxBTDepth() != 0) + { + WRITE_UVLC(g_aucLog2[spsNext.getMaxBTSize()] - g_aucLog2[spsNext.getMinQTSize(B_SLICE)], "sps_log2_diff_max_bt_min_qt_inter_slice"); + WRITE_UVLC(g_aucLog2[spsNext.getMaxTTSize()] - g_aucLog2[spsNext.getMinQTSize(B_SLICE)], "sps_log2_diff_max_tt_min_qt_inter_slice"); + } #else - WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize( I_SLICE ) ] - MIN_CU_LOG2, "log2_minQT_ISlice_minus2" ); - WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize( B_SLICE ) ] - MIN_CU_LOG2, "log2_minQT_PBSlice_minus2" ); - WRITE_UVLC( spsNext.getMaxBTDepth(), "max_bt_depth" ); - WRITE_UVLC( spsNext.getMaxBTDepthI(), "max_bt_depth_i_slice" ); + WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize( I_SLICE ) ] - MIN_CU_LOG2, "log2_minQT_ISlice_minus2" ); + WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize( B_SLICE ) ] - MIN_CU_LOG2, "log2_minQT_PBSlice_minus2" ); + WRITE_UVLC( spsNext.getMaxBTDepth(), "max_bt_depth" ); + WRITE_UVLC( spsNext.getMaxBTDepthI(), "max_bt_depth_i_slice" ); #endif - if( spsNext.getUseDualITree() ) - { + if( spsNext.getUseDualITree() ) + { #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize( I_SLICE, CHANNEL_TYPE_CHROMA )] - spsNext.getSPS().getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice_chroma"); - WRITE_UVLC( spsNext.getMaxBTDepthIChroma(), "sps_max_mtt_hierarchy_depth_intra_slices_chroma"); - if (spsNext.getMaxBTDepthIChroma() != 0) - { - WRITE_UVLC(g_aucLog2[spsNext.getMaxBTSizeIChroma()] - g_aucLog2[spsNext.getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_bt_min_qt_intra_slice_chroma"); - WRITE_UVLC(g_aucLog2[spsNext.getMaxTTSizeIChroma()] - g_aucLog2[spsNext.getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_tt_min_qt_intra_slice_chroma"); - } + WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize( I_SLICE, CHANNEL_TYPE_CHROMA )] - spsNext.getSPS().getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice_chroma"); + WRITE_UVLC( spsNext.getMaxBTDepthIChroma(), "sps_max_mtt_hierarchy_depth_intra_slices_chroma"); + if (spsNext.getMaxBTDepthIChroma() != 0) + { + WRITE_UVLC(g_aucLog2[spsNext.getMaxBTSizeIChroma()] - g_aucLog2[spsNext.getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_bt_min_qt_intra_slice_chroma"); + WRITE_UVLC(g_aucLog2[spsNext.getMaxTTSizeIChroma()] - g_aucLog2[spsNext.getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_tt_min_qt_intra_slice_chroma"); + } #else - WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize( I_SLICE, CHANNEL_TYPE_CHROMA )] - MIN_CU_LOG2, "log2_minQT_ISliceChroma_minus2" ); - WRITE_UVLC( spsNext.getMaxBTDepthIChroma(), "max_bt_depth_i_slice_chroma" ); + WRITE_UVLC( g_aucLog2[spsNext.getMinQTSize( I_SLICE, CHANNEL_TYPE_CHROMA )] - MIN_CU_LOG2, "log2_minQT_ISliceChroma_minus2" ); + WRITE_UVLC( spsNext.getMaxBTDepthIChroma(), "max_bt_depth_i_slice_chroma" ); #endif - } } #if !JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK @@ -1235,51 +1231,48 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) CHECK( pcSlice->getSignDataHidingEnabledFlag(), "sign data hiding not supported when dependent quantization is enabled" ); } #endif - if( pcSlice->getSPS()->getSpsNext().getUseQTBT() ) - { #if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT - if (pcSlice->getSPS()->getSpsNext().getSplitConsOverrideEnabledFlag()) + if (pcSlice->getSPS()->getSpsNext().getSplitConsOverrideEnabledFlag()) + { + WRITE_FLAG(pcSlice->getSplitConsOverrideFlag() ? 1 : 0, "partition_constrainst_override_flag"); + if (pcSlice->getSplitConsOverrideFlag()) { - WRITE_FLAG(pcSlice->getSplitConsOverrideFlag() ? 1 : 0, "partition_constrainst_override_flag"); - if (pcSlice->getSplitConsOverrideFlag()) + WRITE_UVLC(g_aucLog2[pcSlice->getMinQTSize()] - pcSlice->getSPS()->getLog2MinCodingBlockSize(), "log2_diff_min_qt_min_cb"); + WRITE_UVLC(pcSlice->getMaxBTDepth(), "max_bt_depth"); + if (pcSlice->getMaxBTDepth() != 0) { - WRITE_UVLC(g_aucLog2[pcSlice->getMinQTSize()] - pcSlice->getSPS()->getLog2MinCodingBlockSize(), "log2_diff_min_qt_min_cb"); - WRITE_UVLC(pcSlice->getMaxBTDepth(), "max_bt_depth"); - if (pcSlice->getMaxBTDepth() != 0) - { - CHECK(pcSlice->getMaxBTSize() < pcSlice->getMinQTSize(), "maxBtSize is smaller than minQtSize"); - WRITE_UVLC(g_aucLog2[pcSlice->getMaxBTSize()] - g_aucLog2[pcSlice->getMinQTSize()], "log2_diff_max_bt_min_qt"); - CHECK(pcSlice->getMaxTTSize() < pcSlice->getMinQTSize(), "maxTtSize is smaller than minQtSize"); - WRITE_UVLC(g_aucLog2[pcSlice->getMaxTTSize()] - g_aucLog2[pcSlice->getMinQTSize()], "log2_diff_max_tt_min_qt"); - } - if (pcSlice->isIntra() && pcSlice->getSPS()->getSpsNext().getUseDualITree()) + CHECK(pcSlice->getMaxBTSize() < pcSlice->getMinQTSize(), "maxBtSize is smaller than minQtSize"); + WRITE_UVLC(g_aucLog2[pcSlice->getMaxBTSize()] - g_aucLog2[pcSlice->getMinQTSize()], "log2_diff_max_bt_min_qt"); + CHECK(pcSlice->getMaxTTSize() < pcSlice->getMinQTSize(), "maxTtSize is smaller than minQtSize"); + WRITE_UVLC(g_aucLog2[pcSlice->getMaxTTSize()] - g_aucLog2[pcSlice->getMinQTSize()], "log2_diff_max_tt_min_qt"); + } + if (pcSlice->isIntra() && pcSlice->getSPS()->getSpsNext().getUseDualITree()) + { + WRITE_UVLC(g_aucLog2[pcSlice->getMinQTSizeIChroma()] - pcSlice->getSPS()->getLog2MinCodingBlockSize(), "log2_diff_min_qt_min_cb_chroma"); + WRITE_UVLC(pcSlice->getMaxBTDepthIChroma(), "max_mtt_hierarchy_depth_chroma"); + if (pcSlice->getMaxBTDepthIChroma() != 0) { - WRITE_UVLC(g_aucLog2[pcSlice->getMinQTSizeIChroma()] - pcSlice->getSPS()->getLog2MinCodingBlockSize(), "log2_diff_min_qt_min_cb_chroma"); - WRITE_UVLC(pcSlice->getMaxBTDepthIChroma(), "max_mtt_hierarchy_depth_chroma"); - if (pcSlice->getMaxBTDepthIChroma() != 0) - { - CHECK(pcSlice->getMaxBTSizeIChroma() < pcSlice->getMinQTSizeIChroma(), "maxBtSizeC is smaller than minQtSizeC"); - WRITE_UVLC(g_aucLog2[pcSlice->getMaxBTSizeIChroma()] - g_aucLog2[pcSlice->getMinQTSizeIChroma()], "log2_diff_max_bt_min_qt_chroma"); - CHECK(pcSlice->getMaxTTSizeIChroma() < pcSlice->getMinQTSizeIChroma(), "maxTtSizeC is smaller than minQtSizeC"); - WRITE_UVLC(g_aucLog2[pcSlice->getMaxTTSizeIChroma()] - g_aucLog2[pcSlice->getMinQTSizeIChroma()], "log2_diff_max_tt_min_qt_chroma"); - } + CHECK(pcSlice->getMaxBTSizeIChroma() < pcSlice->getMinQTSizeIChroma(), "maxBtSizeC is smaller than minQtSizeC"); + WRITE_UVLC(g_aucLog2[pcSlice->getMaxBTSizeIChroma()] - g_aucLog2[pcSlice->getMinQTSizeIChroma()], "log2_diff_max_bt_min_qt_chroma"); + CHECK(pcSlice->getMaxTTSizeIChroma() < pcSlice->getMinQTSizeIChroma(), "maxTtSizeC is smaller than minQtSizeC"); + WRITE_UVLC(g_aucLog2[pcSlice->getMaxTTSizeIChroma()] - g_aucLog2[pcSlice->getMinQTSizeIChroma()], "log2_diff_max_tt_min_qt_chroma"); } } } + } #else - if( !pcSlice->isIntra() ) + if( !pcSlice->isIntra() ) + { + if( pcSlice->getSPS()->getSpsNext().getCTUSize() > pcSlice->getMaxBTSize() ) { - if( pcSlice->getSPS()->getSpsNext().getCTUSize() > pcSlice->getMaxBTSize() ) - { - WRITE_UVLC( g_aucLog2[pcSlice->getSPS()->getSpsNext().getCTUSize()] - g_aucLog2[pcSlice->getMaxBTSize()], "max_binary_tree_unit_size" ); - } - else - { - WRITE_UVLC( 0, "max_binary_tree_unit_size" ); - } + WRITE_UVLC( g_aucLog2[pcSlice->getSPS()->getSpsNext().getCTUSize()] - g_aucLog2[pcSlice->getMaxBTSize()], "max_binary_tree_unit_size" ); + } + else + { + WRITE_UVLC( 0, "max_binary_tree_unit_size" ); } -#endif } +#endif if( !pcSlice->isIntra() ) { #if JVET_L0369_SUBBLOCK_MERGE -- GitLab