From abb755364c5e0cf3e30ba194471bdb1f8664c8c0 Mon Sep 17 00:00:00 2001 From: Frank Bossen <fbossen@gmail.com> Date: Fri, 17 Jan 2020 15:29:48 +0100 Subject: [PATCH] remove macro JVET_P0058_CHROMA_TS --- source/App/EncoderApp/EncApp.cpp | 2 - source/App/EncoderApp/EncAppCfg.cpp | 4 - source/App/EncoderApp/EncAppCfg.h | 2 - source/Lib/CommonLib/ContextModelling.cpp | 4 - source/Lib/CommonLib/Contexts.cpp | 14 --- source/Lib/CommonLib/DepQuant.cpp | 80 ---------------- source/Lib/CommonLib/Quant.cpp | 39 -------- source/Lib/CommonLib/QuantRDOQ.cpp | 40 -------- source/Lib/CommonLib/TrQuant.cpp | 79 +--------------- source/Lib/CommonLib/TypeDef.h | 6 -- source/Lib/CommonLib/Unit.cpp | 14 --- source/Lib/CommonLib/Unit.h | 4 - source/Lib/CommonLib/UnitTools.cpp | 24 ----- .../Lib/CommonLib/dtrace_blockstatistics.cpp | 29 ------ source/Lib/CommonLib/dtrace_blockstatistics.h | 8 -- source/Lib/DecoderLib/CABACReader.cpp | 45 --------- source/Lib/EncoderLib/CABACWriter.cpp | 37 -------- source/Lib/EncoderLib/EncCfg.h | 4 - source/Lib/EncoderLib/EncCu.cpp | 13 --- source/Lib/EncoderLib/InterSearch.cpp | 26 ----- source/Lib/EncoderLib/IntraSearch.cpp | 94 ------------------- 21 files changed, 1 insertion(+), 567 deletions(-) diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index ddcb001d9..062ab4bb8 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -498,9 +498,7 @@ void EncApp::xInitLibCfg() m_cEncLib.setLog2SaoOffsetScale ( CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] ); m_cEncLib.setUseTransformSkip ( m_useTransformSkip ); m_cEncLib.setUseTransformSkipFast ( m_useTransformSkipFast ); -#if JVET_P0058_CHROMA_TS m_cEncLib.setUseChromaTS ( m_useChromaTS && m_useTransformSkip); -#endif m_cEncLib.setUseBDPCM ( m_useBDPCM ); m_cEncLib.setTransformSkipRotationEnabledFlag ( m_transformSkipRotationEnabledFlag ); m_cEncLib.setTransformSkipContextEnabledFlag ( m_transformSkipContextEnabledFlag ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index c0cb4bbf1..c8214f5c7 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1288,9 +1288,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") ("TransformSkipFast", m_useTransformSkipFast, false, "Fast encoder search for transform skipping, winner takes it all mode.") ("TransformSkipLog2MaxSize", m_log2MaxTransformSkipBlockSize, 5U, "Specify transform-skip maximum size. Minimum 2, Maximum 5. (not valid in V1 profiles)") -#if JVET_P0058_CHROMA_TS ("ChromaTS", m_useChromaTS, false, "Enable encoder search of chromaTS") -#endif #if JVET_P0059_CHROMA_BDPCM ("BDPCM", m_useBDPCM, 0, "BDPCM (0:off, 1:lumaonly, 2:lumachroma") #else @@ -4239,9 +4237,7 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "TransformSkip:%d ", m_useTransformSkip ); msg( VERBOSE, "TransformSkipFast:%d ", m_useTransformSkipFast ); msg( VERBOSE, "TransformSkipLog2MaxSize:%d ", m_log2MaxTransformSkipBlockSize); -#if JVET_P0058_CHROMA_TS msg(VERBOSE, "ChromaTS:%d ", m_useChromaTS); -#endif msg( VERBOSE, "BDPCM:%d ", m_useBDPCM ); msg( VERBOSE, "Tiles: %dx%d ", m_numTileCols, m_numTileRows ); msg( VERBOSE, "Slices: %d ", m_numSlicesInPic); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 886e55241..6b94de4b7 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -329,9 +329,7 @@ protected: bool m_useColorTrans; unsigned m_PLTMode; bool m_JointCbCrMode; -#if JVET_P0058_CHROMA_TS bool m_useChromaTS; -#endif unsigned m_IBCMode; unsigned m_IBCLocalSearchRangeX; unsigned m_IBCLocalSearchRangeY; diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index 17399f3c5..dac605f0c 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -68,11 +68,7 @@ CoeffCodingContext::CoeffCodingContext( const TransformUnit& tu, ComponentID com , m_lastOffsetY (0) , m_lastShiftX (0) , m_lastShiftY (0) -#if JVET_P0058_CHROMA_TS , m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.mtsIdx[m_compID] == MTS_SKIP)) -#else - , m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.mtsIdx==MTS_SKIP)) -#endif , m_scanPosLast (-1) , m_subSetId (-1) , m_subSetPos (-1) diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index b4457949e..10c33fadf 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -739,17 +739,10 @@ const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet const CtxSet ContextSetCfg::TransformSkipFlag = ContextSetCfg::addCtxSet ({ -#if JVET_P0058_CHROMA_TS { 25, 17, }, { 25, 17, }, { 25, 1, }, { 1, 1, }, -#else - { 25, }, - { 25, }, - { 25, }, - { 1, }, -#endif }); const CtxSet ContextSetCfg::MTSIdx = ContextSetCfg::addCtxSet @@ -1495,17 +1488,10 @@ const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet const CtxSet ContextSetCfg::TransformSkipFlag = ContextSetCfg::addCtxSet ({ -#if JVET_P0058_CHROMA_TS { 33, CNU }, { 18, CNU }, { 33, CNU }, { 1, 1 }, -#else - { 33, }, - { 18, }, - { 33, }, - { 1, }, -#endif }); const CtxSet ContextSetCfg::MTSIdx = ContextSetCfg::addCtxSet diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index b6f0d97c6..af4a5757a 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -667,16 +667,7 @@ namespace DQIntern { CHECKD( lambda <= 0.0, "Lambda must be greater than 0" ); -#if JVET_P0058_CHROMA_TS const int qpDQ = cQP.Qp(tu.mtsIdx[compID] == MTS_SKIP) + 1; -#else -#if JVET_P0059_CHROMA_BDPCM - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID) ); - const int qpDQ = cQP.Qp(isTransformSkip) + 1; -#else - const int qpDQ = cQP.Qp(tu.mtsIdx==MTS_SKIP && isLuma(compID)) + 1; -#endif -#endif const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; const SPS& sps = *tu.cs->sps; @@ -685,11 +676,7 @@ namespace DQIntern const int channelBitDepth = sps.getBitDepth( chType ); const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange( chType ); const int nomTransformShift = getTransformShift( channelBitDepth, area.size(), maxLog2TrDynamicRange ); -#if JVET_P0058_CHROMA_TS const bool clipTransformShift = ( tu.mtsIdx[compID] == MTS_SKIP && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag()); -#else - const bool clipTransformShift = ( tu.mtsIdx==MTS_SKIP && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ); -#endif const bool needsSqrt2ScaleAdjustment = TU::needsSqrt2Scale(tu, compID); const int transformShift = ( clipTransformShift ? std::max<int>( 0, nomTransformShift ) : nomTransformShift ) + (needsSqrt2ScaleAdjustment?-1:0); // quant parameters @@ -745,16 +732,7 @@ namespace DQIntern } //----- set dequant parameters ----- -#if JVET_P0058_CHROMA_TS const int qpDQ = cQP.Qp(tu.mtsIdx[compID] == MTS_SKIP) + 1; -#else -#if JVET_P0059_CHROMA_BDPCM - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID)); - const int qpDQ = cQP.Qp(isTransformSkip) + 1; -#else - const int qpDQ = cQP.Qp(tu.mtsIdx==MTS_SKIP && isLuma(compID)) + 1; -#endif -#endif const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; const SPS& sps = *tu.cs->sps; @@ -764,11 +742,7 @@ namespace DQIntern const TCoeff minTCoeff = -( 1 << maxLog2TrDynamicRange ); const TCoeff maxTCoeff = ( 1 << maxLog2TrDynamicRange ) - 1; const int nomTransformShift = getTransformShift( channelBitDepth, area.size(), maxLog2TrDynamicRange ); -#if JVET_P0058_CHROMA_TS const bool clipTransformShift = ( tu.mtsIdx[compID] == MTS_SKIP && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag()); -#else - const bool clipTransformShift = ( tu.mtsIdx==MTS_SKIP && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() ); -#endif const bool needsSqrt2ScaleAdjustment = TU::needsSqrt2Scale(tu, compID); const int transformShift = ( clipTransformShift ? std::max<int>( 0, nomTransformShift ) : nomTransformShift ) + (needsSqrt2ScaleAdjustment?-1:0); Intermediate_Int shift = IQUANT_SHIFT + 1 - qpPer - transformShift + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); @@ -1485,11 +1459,7 @@ namespace DQIntern bool zeroOut = false; bool zeroOutforThres = false; int effWidth = tuPars.m_width, effHeight = tuPars.m_height; -#if JVET_P0058_CHROMA_TS if( ( tu.mtsIdx[compID] > MTS_SKIP || (tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32)) && compID == COMPONENT_Y) -#else - if( ( tu.mtsIdx > MTS_SKIP || ( tu.cs->sps->getUseMTS() && tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && compID == COMPONENT_Y ) -#endif { effHeight = (tuPars.m_height == 32) ? 16 : tuPars.m_height; effWidth = (tuPars.m_width == 32) ? 16 : tuPars.m_width; @@ -1498,11 +1468,7 @@ namespace DQIntern zeroOutforThres = zeroOut || (32 < tuPars.m_height || 32 < tuPars.m_width); //===== find first test position ===== int firstTestPos = numCoeff - 1; -#if JVET_P0058_CHROMA_TS if (lfnstIdx > 0 && tu.mtsIdx[compID] != MTS_SKIP && width >= 4 && height >= 4) -#else - if( lfnstIdx > 0 && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 ) -#endif { firstTestPos = ( ( width == 4 && height == 4 ) || ( width == 8 && height == 8 ) ) ? 7 : 15 ; } @@ -1607,28 +1573,10 @@ DepQuant::~DepQuant() void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx& ctx ) { -#if JVET_P0058_CHROMA_TS if ( tu.cs->picHeader->getDepQuantEnabledFlag() && (tu.mtsIdx[compID] != MTS_SKIP) ) -#else -#if JVET_P0059_CHROMA_BDPCM - if ((tu.cs->slice->getDepQuantEnabledFlag() && (tu.mtsIdx != MTS_SKIP || !isLuma(compID))) && - !((tu.cu->bdpcmMode && isLuma(compID)) || (tu.cu->bdpcmModeChroma && !isLuma(compID))) ) -#else - if ( tu.cs->slice->getDepQuantEnabledFlag() && (tu.mtsIdx != MTS_SKIP || !isLuma(compID)) ) -#endif -#endif { //===== scaling matrix ==== -#if JVET_P0058_CHROMA_TS const int qpDQ = cQP.Qp(tu.mtsIdx[compID] == MTS_SKIP) + 1; -#else -#if JVET_P0059_CHROMA_BDPCM - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID) ); - const int qpDQ = cQP.Qp(isTransformSkip) + 1; -#else - const int qpDQ = cQP.Qp(tu.mtsIdx==MTS_SKIP && isLuma(compID)) + 1; -#endif -#endif const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; const CompArea &rect = tu.blocks[compID]; @@ -1638,13 +1586,8 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const uint32_t log2TrWidth = floorLog2(width); const uint32_t log2TrHeight = floorLog2(height); -#if JVET_P0058_CHROMA_TS const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), tu.cu->lfnstIdx > 0, disableSMForLFNST); -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; - const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP && isLuma(compID)), tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif static_cast<DQIntern::DepQuant*>(p)->quant( tu, pSrc, compID, cQP, Quant::m_dLambda, ctx, uiAbsSum, enableScalingLists, Quant::getQuantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) ); } else @@ -1655,27 +1598,9 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const ComponentID &compID, const QpParam &cQP ) { -#if JVET_P0058_CHROMA_TS if( tu.cs->picHeader->getDepQuantEnabledFlag() && (tu.mtsIdx[compID] != MTS_SKIP)) -#else -#if JVET_P0059_CHROMA_BDPCM - if ((tu.cs->slice->getDepQuantEnabledFlag() && (tu.mtsIdx != MTS_SKIP || !isLuma(compID))) && - !((tu.cu->bdpcmMode && isLuma(compID)) || (tu.cu->bdpcmModeChroma && !isLuma(compID))) ) -#else - if( tu.cs->slice->getDepQuantEnabledFlag() && (tu.mtsIdx != MTS_SKIP || !isLuma(compID)) ) -#endif -#endif { -#if JVET_P0058_CHROMA_TS const int qpDQ = cQP.Qp(tu.mtsIdx[compID] == MTS_SKIP) + 1; -#else -#if JVET_P0059_CHROMA_BDPCM - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID) ); - const int qpDQ = cQP.Qp(isTransformSkip) + 1; -#else - const int qpDQ = cQP.Qp(tu.mtsIdx==MTS_SKIP && isLuma(compID)) + 1; -#endif -#endif const int qpPer = qpDQ / 6; const int qpRem = qpDQ - 6 * qpPer; const CompArea &rect = tu.blocks[compID]; @@ -1685,13 +1610,8 @@ void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const Compo CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const uint32_t log2TrWidth = floorLog2(width); const uint32_t log2TrHeight = floorLog2(height); -#if JVET_P0058_CHROMA_TS const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), tu.cu->lfnstIdx > 0, disableSMForLFNST); -#else - const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; - const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP && isLuma(compID)), tu.cu->lfnstIdx > 0, disableSMForLFNST); -#endif static_cast<DQIntern::DepQuant*>(p)->dequant( tu, dstCoeff, compID, cQP, enableScalingLists, Quant::getDequantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) ); } else diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index b6df0a534..3dd392525 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -370,11 +370,7 @@ void Quant::dequant(const TransformUnit &tu, const int maxLog2TrDynamicRange = sps->getMaxLog2TrDynamicRange(toChannelType(compID)); const TCoeff transformMinimum = -(1 << maxLog2TrDynamicRange); const TCoeff transformMaximum = (1 << maxLog2TrDynamicRange) - 1; -#if JVET_P0058_CHROMA_TS const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else - const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); -#endif const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, tu.cu->lfnstIdx > 0, disableSMForLFNST); @@ -400,11 +396,7 @@ void Quant::dequant(const TransformUnit &tu, CHECK(uiWidth > m_uiMaxTrSize, "Unsupported transformation size"); // Represents scaling through forward transform -#if JVET_P0058_CHROMA_TS const bool bClipTransformShiftTo0 = tu.mtsIdx[compID] != MTS_SKIP && sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag(); -#else - const bool bClipTransformShiftTo0 = tu.mtsIdx!=MTS_SKIP && sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag(); -#endif const int originalTransformShift = getTransformShift(channelBitDepth, area.size(), maxLog2TrDynamicRange); const bool needSqrtAdjustment = TU::needsBlockSizeTrafoScale( tu, compID ); const int iTransformShift = (bClipTransformShiftTo0 ? std::max<int>(0, originalTransformShift) : originalTransformShift) + (needSqrtAdjustment?-1:0); @@ -970,15 +962,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf const CCoeffBuf &piCoef = pSrc; CoeffBuf piQCoef = tu.getCoeffs(compID); -#if JVET_P0058_CHROMA_TS const bool useTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else -#if JVET_P0059_CHROMA_BDPCM - const bool useTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID) ); -#else - const bool useTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); -#endif -#endif const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); { @@ -1062,11 +1046,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff const CCoeffBuf piCoef = pSrc; -#if JVET_P0058_CHROMA_TS const bool useTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else - const bool useTransformSkip = tu.mtsIdx == MTS_SKIP && isLuma(compID); -#endif const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); int scalingListType = getScalingListType(tu.cu->predMode, compID); @@ -1128,11 +1108,7 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co const int scalingListType = getScalingListType(tu.cu->predMode, compID); const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, tu.cu->lfnstIdx > 0, disableSMForLFNST); -#if JVET_P0058_CHROMA_TS const bool useTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else - const bool useTransformSkip = tu.mtsIdx == MTS_SKIP && isLuma(compID); -#endif const int defaultQuantisationCoefficient = g_quantScales[0][cQP.rem(useTransformSkip)]; CHECK( scalingListType >= SCALING_LIST_NUM, "Invalid scaling list" ); @@ -1183,19 +1159,8 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp const CompArea &rect = tu.blocks[compID]; const uint32_t uiWidth = rect.width; const uint32_t uiHeight = rect.height; -#if JVET_P0058_CHROMA_TS const int QP_per = cQP.per(tu.mtsIdx[compID] == MTS_SKIP); const int QP_rem = cQP.rem(tu.mtsIdx[compID] == MTS_SKIP); -#else -#if JVET_P0059_CHROMA_BDPCM - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID)); - const int QP_per = cQP.per(isTransformSkip); - const int QP_rem = cQP.rem(isTransformSkip); -#else - const int QP_per = cQP.per(tu.mtsIdx==MTS_SKIP && isLuma(compID)); - const int QP_rem = cQP.rem(tu.mtsIdx==MTS_SKIP && isLuma(compID)); -#endif -#endif const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID)); const int channelBitDepth = sps.getBitDepth(toChannelType(compID)); const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); @@ -1205,11 +1170,7 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); -#if JVET_P0058_CHROMA_TS const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)); -#endif const int rightShift = (IQUANT_SHIFT - ((isTransformSkip ? 0 : iTransformShift) + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0); const TCoeff transformMinimum = -(1 << maxLog2TrDynamicRange); diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index 19ad8238f..08dc0a04e 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -519,11 +519,7 @@ void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeff const CCoeffBuf &piCoef = pSrc; CoeffBuf piQCoef = tu.getCoeffs(compID); -#if JVET_P0058_CHROMA_TS const bool useTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else - const bool useTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); -#endif bool useRDOQ = useTransformSkip ? m_useRDOQTS : m_useRDOQ; @@ -539,15 +535,7 @@ void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeff if (!m_useSelectiveRDOQ || xNeedRDOQ(tu, compID, piCoef, cQP)) { #endif -#if JVET_P0058_CHROMA_TS if( useTransformSkip ) -#else -#if JVET_P0059_CHROMA_BDPCM - if((isLuma(compID) && useTransformSkip) || (isChroma(compID) && tu.cu->bdpcmModeChroma)) -#else - if( isLuma( compID ) && useTransformSkip ) -#endif -#endif { #if JVET_P0059_CHROMA_BDPCM if( (tu.cu->bdpcmMode && isLuma(compID)) || (isChroma(compID) && tu.cu->bdpcmModeChroma ) ) @@ -607,11 +595,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, // Represents scaling through forward transform int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange); -#if JVET_P0058_CHROMA_TS if (tu.mtsIdx[compID] == MTS_SKIP && extendedPrecision) -#else - if (tu.mtsIdx==MTS_SKIP && extendedPrecision) -#endif { iTransformShift = std::max<int>(0, iTransformShift); } @@ -648,15 +632,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID ); -#if JVET_P0058_CHROMA_TS const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else -#if JVET_P0059_CHROMA_BDPCM - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID)); -#else - const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); -#endif -#endif const double *const pdErrScale = xGetErrScaleCoeffSL(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, cQP.rem(isTransformSkip)); const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem(isTransformSkip), uiLog2BlockWidth, uiLog2BlockHeight); const bool disableSMForLFNST = tu.cs->picHeader->getScalingListPresentFlag() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; @@ -1244,15 +1220,7 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI m_bdpcm = 0; const bool needsSqrt2Scale = TU::needsSqrt2Scale( tu, compID ); // should always be false - transform-skipped blocks don't require sqrt(2) compensation. -#if JVET_P0058_CHROMA_TS const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else -#if JVET_P0059_CHROMA_BDPCM - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || ( tu.cu->bdpcmModeChroma && isChroma(compID) ); -#else - const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); -#endif -#endif const int qBits = QUANT_SHIFT + qp.per(isTransformSkip) + (isTransformSkip ? 0 : transformShift) + (needsSqrt2Scale ? -1 : 0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits const int quantisationCoefficient = g_quantScales[needsSqrt2Scale?1:0][qp.rem(isTransformSkip)]; const double errorScale = xGetErrScaleCoeff( TU::needsSqrt2Scale(tu, compID), width, height, qp.rem(isTransformSkip), maxLog2TrDynamicRange, channelBitDepth, isTransformSkip); @@ -1491,15 +1459,7 @@ void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, cons m_bdpcm = dirMode; const bool needsSqrt2Scale = TU::needsSqrt2Scale(tu, compID); // should always be false - transform-skipped blocks don't require sqrt(2) compensation. -#if JVET_P0058_CHROMA_TS const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else -#if JVET_P0059_CHROMA_BDPCM - const bool isTransformSkip = (tu.mtsIdx == MTS_SKIP && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID) ); -#else - const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); -#endif -#endif const int qBits = QUANT_SHIFT + qp.per(isTransformSkip) + (isTransformSkip? 0 : transformShift) + ( needsSqrt2Scale ? -1 : 0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits const int quantisationCoefficient = g_quantScales[needsSqrt2Scale ? 1 : 0][qp.rem(isTransformSkip)]; const double errorScale = xGetErrScaleCoeff(TU::needsSqrt2Scale(tu, compID), width, height, qp.rem(isTransformSkip), maxLog2TrDynamicRange, channelBitDepth, isTransformSkip); diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index c5084ef13..c666375df 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -314,11 +314,7 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID ) const uint32_t height = area.height; const uint32_t lfnstIdx = tu.cu->lfnstIdx; -#if JVET_P0058_CHROMA_TS if (lfnstIdx && tu.mtsIdx[compID] != MTS_SKIP && width >= 4 && height >= 4) -#else - if( lfnstIdx && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 ) -#endif { const bool whge3 = width >= 8 && height >= 8; const ScanElement * scan = whge3 ? g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( width ) ] : g_scanOrder[ SCAN_GROUPED_4x4 ][ SCAN_DIAG ][ gp_sizeIdxInfo->idxFrom( width ) ][ gp_sizeIdxInfo->idxFrom( height ) ]; @@ -410,11 +406,7 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons const uint32_t height = area.height; const uint32_t lfnstIdx = tu.cu->lfnstIdx; -#if JVET_P0058_CHROMA_TS if( lfnstIdx && tu.mtsIdx[compID] != MTS_SKIP && width >= 4 && height >= 4) -#else - if( lfnstIdx && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 ) -#endif { const bool whge3 = width >= 8 && height >= 8; const ScanElement * scan = whge3 ? g_coefTopLeftDiagScan8x8[ gp_sizeIdxInfo->idxFrom( width ) ] : g_scanOrder[ SCAN_GROUPED_4x4 ][ SCAN_DIAG ][ gp_sizeIdxInfo->idxFrom( width ) ][ gp_sizeIdxInfo->idxFrom( height ) ]; @@ -440,11 +432,7 @@ void TrQuant::xFwdLfnst( const TransformUnit &tu, const ComponentID compID, cons bool tu8x8Flag = ( width == 8 && height == 8 ); TCoeff* lfnstTemp; TCoeff* coeffTemp; -#if JVET_P0058_CHROMA_TS TCoeff * tempCoeff = loadTr ? m_mtsCoeffs[tu.mtsIdx[compID]] : m_tempCoeff; -#else - TCoeff * tempCoeff = loadTr ? m_mtsCoeffs[tu.mtsIdx] : m_tempCoeff; -#endif int y; lfnstTemp = m_tempInMatrix; // forward low frequency non-separable transform @@ -522,15 +510,7 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel xInvLfnst( tu, compID ); } -#if JVET_P0058_CHROMA_TS if( tu.mtsIdx[compID] == MTS_SKIP ) -#else -#if JVET_P0059_CHROMA_BDPCM - if( (isLuma(compID) && tu.mtsIdx == MTS_SKIP) || (isChroma(compID) && tu.cu->bdpcmModeChroma)) -#else - if( isLuma(compID) && tu.mtsIdx == MTS_SKIP ) -#endif -#endif { xITransformSkip( tempCoeff, pResi, tu, compID ); } @@ -548,11 +528,7 @@ void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf & { const CompArea &area = tu.blocks[compID]; -#if JVET_P0058_CHROMA_TS if (CU::isRDPCMEnabled(*tu.cu) && (tu.mtsIdx[compID] == MTS_SKIP)) -#else - if (CU::isRDPCMEnabled(*tu.cu) && (tu.mtsIdx==MTS_SKIP)) -#endif { const uint32_t uiWidth = area.width; const uint32_t uiHeight = area.height; @@ -752,19 +728,10 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int & if (isExplicitMTS) { -#if JVET_P0058_CHROMA_TS if (tu.mtsIdx[compID] > MTS_SKIP) -#else - if (tu.mtsIdx > MTS_SKIP) -#endif { -#if JVET_P0058_CHROMA_TS int indHor = (tu.mtsIdx[compID] - MTS_DST7_DST7) & 1; int indVer = (tu.mtsIdx[compID] - MTS_DST7_DST7) >> 1; -#else - int indHor = (tu.mtsIdx - MTS_DST7_DST7) & 1; - int indVer = (tu.mtsIdx - MTS_DST7_DST7) >> 1; -#endif trTypeHor = indHor ? DCT8 : DST7; trTypeVer = indVer ? DCT8 : DST7; } @@ -964,16 +931,8 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const const double facBB[] = { 1.2, 1.3, 1.3, 1.4, 1.5 }; while( it != trModes->end() ) { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[compID] = it->first; -#else - tu.mtsIdx = it->first; -#endif -#if JVET_P0058_CHROMA_TS CoeffBuf tempCoeff( m_mtsCoeffs[tu.mtsIdx[compID]], rect); -#else - CoeffBuf tempCoeff( m_mtsCoeffs[tu.mtsIdx], rect ); -#endif if( tu.noResidual ) { int sumAbs = 0; @@ -982,15 +941,7 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const continue; } -#if JVET_P0058_CHROMA_TS if ( tu.mtsIdx[compID] == MTS_SKIP ) -#else -#if JVET_P0059_CHROMA_BDPCM - if ((isLuma(compID) && tu.mtsIdx == MTS_SKIP) || (isChroma(compID) && tu.cu->bdpcmModeChroma)) -#else - if( isLuma(compID) && tu.mtsIdx == MTS_SKIP ) -#endif -#endif { xTransformSkip( tu, compID, resiBuf, tempCoeff.buf ); } @@ -1006,19 +957,11 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const } double scaleSAD=1.0; -#if JVET_P0058_CHROMA_TS if ( tu.mtsIdx[compID] == MTS_SKIP && ((floorLog2(width) + floorLog2(height)) & 1) == 1) -#else - if (isLuma(compID) && tu.mtsIdx==MTS_SKIP && ((floorLog2(width) + floorLog2(height)) & 1) == 1 ) -#endif { scaleSAD=1.0/1.414213562; // compensate for not scaling transform skip coefficients by 1/sqrt(2) } -#if JVET_P0058_CHROMA_TS if (tu.mtsIdx[compID] == MTS_SKIP) -#else - if (isLuma(compID) && tu.mtsIdx == MTS_SKIP) -#endif { int trShift = getTransformShift(tu.cu->slice->getSPS()->getBitDepth(toChannelType(compID)), rect.size(), tu.cu->slice->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID))); scaleSAD *= pow(2, trShift); @@ -1030,11 +973,7 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const int numTests = 0; std::vector<TrCost>::iterator itC = trCosts.begin(); -#if JVET_P0058_CHROMA_TS const double fac = facBB[std::max(0, floorLog2(std::max(width, height)) - 2)]; -#else - const double fac = facBB[floorLog2(std::max(width, height))-2]; -#endif const double thr = fac * trCosts.begin()->first; const double thrTS = trCosts.begin()->first; while( itC != trCosts.end() ) @@ -1066,17 +1005,13 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const RDPCMMode rdpcmMode = RDPCM_OFF; rdpcmNxN(tu, compID, cQP, uiAbsSum, rdpcmMode); -#if JVET_P0058_CHROMA_TS && JVET_P0059_CHROMA_BDPCM +#if JVET_P0059_CHROMA_BDPCM if ((tu.cu->bdpcmMode && isLuma(compID)) || (!isLuma(compID) && tu.cu->bdpcmModeChroma)) #else if( tu.cu->bdpcmMode && isLuma(compID) ) #endif { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[compID] = MTS_SKIP; -#else - tu.mtsIdx = MTS_SKIP; -#endif } if (rdpcmMode == RDPCM_OFF) @@ -1087,21 +1022,13 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const CHECK( cs.sps->getMaxTbSize() < uiWidth, "Unsupported transformation size" ); -#if JVET_P0058_CHROMA_TS CoeffBuf tempCoeff(loadTr ? m_mtsCoeffs[tu.mtsIdx[compID]] : m_tempCoeff, rect); -#else - CoeffBuf tempCoeff(loadTr ? m_mtsCoeffs[tu.mtsIdx] : m_tempCoeff, rect); -#endif DTRACE_PEL_BUF( D_RESIDUALS, resiBuf, tu, tu.cu->predMode, compID ); if( !loadTr ) { -#if JVET_P0058_CHROMA_TS if ( tu.mtsIdx[compID] == MTS_SKIP ) -#else - if( isLuma(compID) && tu.mtsIdx == MTS_SKIP ) -#endif { xTransformSkip( tu, compID, resiBuf, tempCoeff.buf ); } @@ -1179,11 +1106,7 @@ void TrQuant::applyForwardRDPCM(TransformUnit &tu, const ComponentID &compID, co void TrQuant::rdpcmNxN(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, RDPCMMode &rdpcmMode) { -#if JVET_P0058_CHROMA_TS if (!CU::isRDPCMEnabled(*tu.cu) || (tu.mtsIdx[compID] != MTS_SKIP)) -#else - if (!CU::isRDPCMEnabled(*tu.cu) || (tu.mtsIdx!=MTS_SKIP)) -#endif { rdpcmMode = RDPCM_OFF; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 689b059ca..d31dda084 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -122,13 +122,7 @@ -#define JVET_P0058_CHROMA_TS 1 // JVET-P0058: Enable Transform skip for chroma -#if JVET_AHG14_LOSSLESS && !JVET_P0058_CHROMA_TS -#define JVET_P0058_CHROMA_TS 1 -#endif -#if JVET_P0058_CHROMA_TS #define JVET_P0058_CHROMA_TS_ENCODER_INTRA_SAD_MOD 1 // Modified cost criterion for chroma intra encoder search -#endif #define JVET_P0436_CQP_OFFSET_SIGNALLING 1 // JVET_P0436: CU chroma QP offset signalling consistent with VPDU and bugfix diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 8193c5c98..9e5f414dc 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -747,14 +747,9 @@ void TransformUnit::initData() cbf[i] = 0; rdpcm[i] = NUMBER_OF_RDPCM_MODES; compAlpha[i] = 0; -#if JVET_P0058_CHROMA_TS mtsIdx[i] = MTS_DCT2_DCT2; -#endif } depth = 0; -#if !JVET_P0058_CHROMA_TS - mtsIdx = MTS_DCT2_DCT2; -#endif noResidual = false; jointCbCr = 0; m_chromaResScaleInv = 0; @@ -805,14 +800,9 @@ TransformUnit& TransformUnit::operator=(const TransformUnit& other) cbf[i] = other.cbf[i]; rdpcm[i] = other.rdpcm[i]; compAlpha[i] = other.compAlpha[i]; -#if JVET_P0058_CHROMA_TS mtsIdx[i] = other.mtsIdx[i]; -#endif } depth = other.depth; -#if !JVET_P0058_CHROMA_TS - mtsIdx = other.mtsIdx; -#endif noResidual = other.noResidual; jointCbCr = other.jointCbCr; return *this; @@ -841,11 +831,7 @@ void TransformUnit::copyComponentFrom(const TransformUnit& other, const Componen compAlpha[i] = other.compAlpha[i]; depth = other.depth; -#if JVET_P0058_CHROMA_TS mtsIdx[i] = other.mtsIdx[i]; -#else - mtsIdx = isLuma( i ) ? other.mtsIdx : mtsIdx; -#endif noResidual = other.noResidual; jointCbCr = isChroma( i ) ? other.jointCbCr : jointCbCr; } diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 1af8640d9..82a942407 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -455,11 +455,7 @@ struct TransformUnit : public UnitArea int m_chromaResScaleInv; uint8_t depth; -#if JVET_P0058_CHROMA_TS uint8_t mtsIdx [ MAX_NUM_TBLOCKS ]; -#else - uint8_t mtsIdx; -#endif bool noResidual; uint8_t jointCbCr; uint8_t cbf [ MAX_NUM_TBLOCKS ]; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 3f03f3f92..691a2e34e 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -3682,36 +3682,16 @@ void TU::setCbfAtDepth(TransformUnit &tu, const ComponentID &compID, const unsig bool TU::isTSAllowed(const TransformUnit &tu, const ComponentID compID) { -#if !JVET_P0058_CHROMA_TS - bool tsAllowed = compID == COMPONENT_Y; -#endif const int maxSize = tu.cs->pps->getLog2MaxTransformSkipBlockSize(); -#if JVET_P0058_CHROMA_TS bool tsAllowed = tu.cs->sps->getTransformSkipEnabledFlag(); -#else - tsAllowed &= tu.cs->sps->getTransformSkipEnabledFlag(); -#endif tsAllowed &= ( !tu.cu->ispMode || !isLuma(compID) ); SizeType transformSkipMaxSize = 1 << maxSize; -#if JVET_P0058_CHROMA_TS tsAllowed &= !(tu.cu->bdpcmMode && isLuma(compID)); #if JVET_P0059_CHROMA_BDPCM tsAllowed &= !(tu.cu->bdpcmModeChroma && isChroma(compID)); #endif -#else -#if JVET_P0059_CHROMA_BDPCM - tsAllowed &= !(tu.cu->bdpcmMode && isLuma(compID) ); - tsAllowed &= !(tu.cu->bdpcmModeChroma && isChroma(compID) ); -#else - tsAllowed &= !(tu.cu->bdpcmMode && tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize); -#endif -#endif -#if JVET_P0058_CHROMA_TS tsAllowed &= tu.blocks[compID].width <= transformSkipMaxSize && tu.blocks[compID].height <= transformSkipMaxSize; -#else - tsAllowed &= tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize; -#endif tsAllowed &= !tu.cu->sbtInfo; return tsAllowed; @@ -3737,11 +3717,7 @@ bool TU::hasCrossCompPredInfo( const TransformUnit &tu, const ComponentID &compI bool TU::needsSqrt2Scale( const TransformUnit &tu, const ComponentID &compID ) { const Size &size=tu.blocks[compID]; -#if JVET_P0058_CHROMA_TS const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); -#else - const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID); -#endif return (!isTransformSkip) && (((floorLog2(size.width) + floorLog2(size.height)) & 1) == 1); } diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index a79a7aab8..bb201c3e9 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -708,34 +708,13 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) if (tu.Y().valid()) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Y), tu.cbf[COMPONENT_Y]); -#if JVET_P0058_CHROMA_TS DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::MTSIdx_Y), tu.mtsIdx[COMPONENT_Y]); -#else - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::MTSIdx), tu.mtsIdx); -#endif } if ( tu.Cb().valid() ) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::JointCbCr), tu.jointCbCr); } -#if !JVET_P0058_CHROMA_TS - if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==MTS_SKIP) ) - { - if (tu.Y().valid()) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::RDPCM_Y), tu.rdpcm[COMPONENT_Y]); - } - if (tu.Cb().valid()) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::RDPCM_Cb), tu.rdpcm[COMPONENT_Cb]); - } - if (tu.Cr().valid()) - { - DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::RDPCM_Cr), tu.rdpcm[COMPONENT_Cr]); - } - } -#endif bool lumaOnly = ( cu.chromaFormat == CHROMA_400 || !tu.blocks[COMPONENT_Cb].valid() ); if( !lumaOnly ) { @@ -753,10 +732,8 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cb), tu.cbf[COMPONENT_Cb]); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cr), tu.cbf[COMPONENT_Cr]); -#if JVET_P0058_CHROMA_TS DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::MTSIdx_Cb), tu.mtsIdx[COMPONENT_Cb]); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::MTSIdx_Cr), tu.mtsIdx[COMPONENT_Cr]); -#endif } } } @@ -1004,20 +981,14 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea) if (tu.Y().valid()) { DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Y), tu.cbf[COMPONENT_Y]); -#if JVET_P0058_CHROMA_TS DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::MTSIdx_Y), tu.mtsIdx[COMPONENT_Y]); -#else - DTRACE_BLOCK_SCALAR( g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName( BlockStatistic::MTSIdx ), tu.mtsIdx ); -#endif } if (!(cu.chromaFormat == CHROMA_400 || (cu.isSepTree() && cu.chType == CHANNEL_TYPE_LUMA))) { DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cb), tu.cbf[COMPONENT_Cb]); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::Cbf_Cr), tu.cbf[COMPONENT_Cr]); -#if JVET_P0058_CHROMA_TS DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::MTSIdx_Cb), tu.mtsIdx[COMPONENT_Cb]); DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_CODED, tu, GetBlockStatisticName(BlockStatistic::MTSIdx_Cr), tu.mtsIdx[COMPONENT_Cr]); -#endif } } } diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h index c85308475..fa58e5da0 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.h +++ b/source/Lib/CommonLib/dtrace_blockstatistics.h @@ -63,13 +63,9 @@ enum class BlockStatistic { ChromaQPAdj, QP, SplitSeries, -#if JVET_P0058_CHROMA_TS MTSIdx_Y, MTSIdx_Cb, MTSIdx_Cr, -#else - MTSIdx, -#endif BDPCM, #if JVET_P0059_CHROMA_BDPCM BDPCMChroma, @@ -166,13 +162,9 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType { BlockStatistic::Luma_IntraMode, std::tuple<std::string, BlockStatisticType, std::string>{"Luma_IntraMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_MODE) + "]"}}, { BlockStatistic::Chroma_IntraMode, std::tuple<std::string, BlockStatisticType, std::string>{"Chroma_IntraMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_MODE) + "]"}}, { BlockStatistic::SkipFlag, std::tuple<std::string, BlockStatisticType, std::string>{"SkipFlag", BlockStatisticType::Flag, ""}}, -#if JVET_P0058_CHROMA_TS { BlockStatistic::MTSIdx_Y, std::tuple<std::string, BlockStatisticType, std::string> {"MTS_Y", BlockStatisticType::Integer, ""} }, { BlockStatistic::MTSIdx_Cb, std::tuple<std::string, BlockStatisticType, std::string>{"MTS_Cb", BlockStatisticType::Integer, ""} }, { BlockStatistic::MTSIdx_Cr, std::tuple<std::string, BlockStatisticType, std::string>{"MTS_Cr", BlockStatisticType::Integer, ""} }, -#else - { BlockStatistic::MTSIdx, std::tuple<std::string, BlockStatisticType, std::string>{"TransformSkipFlag_Y", BlockStatisticType::Integer, ""}}, -#endif { BlockStatistic::BDPCM, std::tuple<std::string, BlockStatisticType, std::string>{"BDPCM", BlockStatisticType::Flag, ""}}, // called bdpcmMode, but used like a flag in the software? related to intra, but signalled always? #if JVET_P0059_CHROMA_BDPCM { BlockStatistic::BDPCMChroma, std::tuple<std::string, BlockStatisticType, std::string>{"BDPCMChroma", BlockStatisticType::Flag, ""}}, diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 4f37f7eec..ecc6d03f1 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -3151,18 +3151,10 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& ts_flag ( tu, compID ); explicit_rdpcm_mode( tu, compID ); -#if JVET_P0058_CHROMA_TS #if JVET_P0059_CHROMA_BDPCM if (tu.mtsIdx[compID] == MTS_SKIP) #else if( tu.mtsIdx[compID] == MTS_SKIP || (tu.cu->bdpcmMode && isLuma(compID) ) ) -#endif -#else -#if JVET_P0059_CHROMA_BDPCM - if( (isLuma(compID) && (tu.mtsIdx == MTS_SKIP || tu.cu->bdpcmMode)) || (isChroma(compID) && (tu.cu->bdpcmModeChroma))) -#else - if( isLuma( compID ) && ( tu.mtsIdx == MTS_SKIP || tu.cu->bdpcmMode ) ) -#endif #endif { residual_codingTS( tu, compID ); @@ -3171,11 +3163,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& // determine sign hiding bool signHiding = ( cu.cs->picHeader->getSignDataHidingEnabledFlag() && tu.rdpcm[compID] == RDPCM_OFF ); -#if JVET_P0058_CHROMA_TS if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx[compID] == MTS_SKIP ) -#else - if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==MTS_SKIP ) -#endif { const ChannelType chType = toChannelType( compID ); const unsigned intraMode = PU::getFinalIntraMode( *cu.cs->getPU( tu.blocks[compID].pos(), chType ), chType ); @@ -3191,20 +3179,12 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& // parse last coeff position cctx.setScanPosLast( last_sig_coeff( cctx, tu, compID ) ); -#if JVET_P0058_CHROMA_TS if (tu.mtsIdx[compID] != MTS_SKIP && tu.blocks[compID].height >= 4 && tu.blocks[compID].width >= 4 ) -#else - if( tu.mtsIdx != MTS_SKIP && tu.blocks[ compID ].height >= 4 && tu.blocks[ compID ].width >= 4 ) -#endif { const int maxLfnstPos = ((tu.blocks[compID].height == 4 && tu.blocks[compID].width == 4) || (tu.blocks[compID].height == 8 && tu.blocks[compID].width == 8)) ? 7 : 15; cuCtx.violatesLfnstConstrained[ toChannelType(compID) ] |= cctx.scanPosLast() > maxLfnstPos; } -#if JVET_P0058_CHROMA_TS if( tu.mtsIdx[compID] != MTS_SKIP && tu.blocks[compID].height >= 4 && tu.blocks[compID].width >= 4 ) -#else - if( tu.mtsIdx != MTS_SKIP && tu.blocks[ compID ].height >= 4 && tu.blocks[ compID ].width >= 4 ) -#endif { const int lfnstLastScanPosTh = isLuma( compID ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA; cuCtx.lfnstLastScanPos |= cctx.scanPosLast() >= lfnstLastScanPosTh; @@ -3239,17 +3219,12 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx& void CABACReader::ts_flag( TransformUnit& tu, ComponentID compID ) { -#if JVET_P0058_CHROMA_TS #if JVET_P0059_CHROMA_BDPCM int tsFlag = ( (tu.cu->bdpcmMode && isLuma(compID)) || (tu.cu->bdpcmModeChroma && isChroma(compID)) ) ? 1 : tu.mtsIdx[compID] == MTS_SKIP ? 1 : 0; #else int tsFlag = tu.cu->bdpcmMode && isLuma(compID) ? 1 : tu.mtsIdx[compID] == MTS_SKIP ? 1 : 0; #endif int ctxIdx = isLuma(compID) ? 0 : 1; -#else - int tsFlag = tu.cu->bdpcmMode ? 1 : tu.mtsIdx == MTS_SKIP ? 1 : 0; - int ctxIdx = 0; -#endif if( TU::isTSAllowed ( tu, compID ) ) { @@ -3257,11 +3232,7 @@ void CABACReader::ts_flag( TransformUnit& tu, ComponentID compID ) tsFlag = m_BinDecoder.decodeBin( Ctx::TransformSkipFlag( ctxIdx ) ); } -#if JVET_P0058_CHROMA_TS tu.mtsIdx[compID] = tsFlag ? MTS_SKIP : MTS_DCT2_DCT2; -#else - tu.mtsIdx = tsFlag ? MTS_SKIP : MTS_DCT2_DCT2; -#endif DTRACE(g_trace_ctx, D_SYNTAX, "ts_flag() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), tsFlag); } @@ -3269,11 +3240,7 @@ void CABACReader::ts_flag( TransformUnit& tu, ComponentID compID ) void CABACReader::mts_idx( CodingUnit& cu, CUCtx& cuCtx ) { TransformUnit &tu = *cu.firstTU; -#if JVET_P0058_CHROMA_TS int mtsIdx = tu.mtsIdx[COMPONENT_Y]; // Transform skip flag has already been decoded -#else - int mtsIdx = tu.mtsIdx; // Transform skip flag has already been decoded -#endif if( CU::isMTSAllowed( cu, COMPONENT_Y ) && !cuCtx.violatesMtsCoeffConstraint && cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) ) @@ -3299,11 +3266,7 @@ void CABACReader::mts_idx( CodingUnit& cu, CUCtx& cuCtx ) } } -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = mtsIdx; -#else - tu.mtsIdx = mtsIdx; -#endif DTRACE(g_trace_ctx, D_SYNTAX, "mts_idx() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), mtsIdx); } @@ -3334,11 +3297,7 @@ void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID ) tu.rdpcm[compID] = RDPCM_OFF; -#if JVET_P0058_CHROMA_TS if (!CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx[compID] == MTS_SKIP)) -#else - if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==MTS_SKIP ) ) -#endif { RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE( STATS__EXPLICIT_RDPCM_BITS, tu.blocks[tu.chType].lumaSize() ); @@ -3376,11 +3335,7 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx ) const bool lumaFlag = cu.isSepTree() ? ( isLuma( cu.chType ) ? true : false ) : true; const bool chromaFlag = cu.isSepTree() ? ( isChroma( cu.chType ) ? true : false ) : true; bool nonZeroCoeffNonTsCorner8x8 = ( lumaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_LUMA] ) || (chromaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] ); -#if JVET_P0058_CHROMA_TS const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx[COMPONENT_Y] == MTS_SKIP; -#else - const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx == MTS_SKIP; -#endif if ((!cuCtx.lfnstLastScanPos && !cu.ispMode) || nonZeroCoeffNonTsCorner8x8 || isTrSkip) { cu.lfnstIdx = 0; diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index b4e013681..a139aca45 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -2902,18 +2902,10 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, ts_flag ( tu, compID ); explicit_rdpcm_mode( tu, compID ); -#if JVET_P0058_CHROMA_TS #if JVET_P0059_CHROMA_BDPCM if (tu.mtsIdx[compID] == MTS_SKIP) #else if (tu.mtsIdx[compID] == MTS_SKIP || (tu.cu->bdpcmMode && isLuma(compID))) -#endif -#else -#if JVET_P0059_CHROMA_BDPCM - if ((isLuma(compID) && (tu.mtsIdx == MTS_SKIP || tu.cu->bdpcmMode)) || (isChroma(compID) && tu.cu->bdpcmModeChroma) ) -#else - if( isLuma( compID ) && ( tu.mtsIdx == MTS_SKIP || tu.cu->bdpcmMode ) ) -#endif #endif { residual_codingTS( tu, compID ); @@ -2922,11 +2914,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, // determine sign hiding bool signHiding = ( cu.cs->picHeader->getSignDataHidingEnabledFlag() && tu.rdpcm[compID] == RDPCM_OFF ); -#if JVET_P0058_CHROMA_TS if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx[compID] == MTS_SKIP) -#else - if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==MTS_SKIP ) -#endif { const ChannelType chType = toChannelType( compID ); const unsigned intraMode = PU::getFinalIntraMode( *cu.cs->getPU( tu.blocks[compID].pos(), chType ), chType ); @@ -2955,20 +2943,12 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, CHECK( scanPosLast < 0, "Coefficient coding called for empty TU" ); cctx.setScanPosLast(scanPosLast); -#if JVET_P0058_CHROMA_TS if (cuCtx && tu.mtsIdx[compID] != MTS_SKIP && tu.blocks[compID].height >= 4 && tu.blocks[compID].width >= 4) -#else - if( cuCtx && tu.mtsIdx != MTS_SKIP && tu.blocks[ compID ].height >= 4 && tu.blocks[ compID ].width >= 4 ) -#endif { const int maxLfnstPos = ((tu.blocks[compID].height == 4 && tu.blocks[compID].width == 4) || (tu.blocks[compID].height == 8 && tu.blocks[compID].width == 8)) ? 7 : 15; cuCtx->violatesLfnstConstrained[ toChannelType(compID) ] |= cctx.scanPosLast() > maxLfnstPos; } -#if JVET_P0058_CHROMA_TS if (cuCtx && tu.mtsIdx[compID] != MTS_SKIP && tu.blocks[compID].height >= 4 && tu.blocks[compID].width >= 4) -#else - if( cuCtx && tu.mtsIdx != MTS_SKIP && tu.blocks[ compID ].height >= 4 && tu.blocks[ compID ].width >= 4 ) -#endif { const int lfnstLastScanPosTh = isLuma( compID ) ? LFNST_LAST_SIG_LUMA : LFNST_LAST_SIG_CHROMA; cuCtx->lfnstLastScanPos |= cctx.scanPosLast() >= lfnstLastScanPosTh; @@ -3006,13 +2986,8 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID, void CABACWriter::ts_flag( const TransformUnit& tu, ComponentID compID ) { -#if JVET_P0058_CHROMA_TS int tsFlag = tu.mtsIdx[compID] == MTS_SKIP ? 1 : 0; int ctxIdx = isLuma(compID) ? 0 : 1; -#else - int tsFlag = tu.mtsIdx == MTS_SKIP ? 1 : 0; - int ctxIdx = 0; -#endif if( TU::isTSAllowed ( tu, compID ) ) { @@ -3024,11 +2999,7 @@ void CABACWriter::ts_flag( const TransformUnit& tu, ComponentID compID ) void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx* cuCtx ) { TransformUnit &tu = *cu.firstTU; -#if JVET_P0058_CHROMA_TS int mtsIdx = tu.mtsIdx[COMPONENT_Y]; -#else - int mtsIdx = tu.mtsIdx; -#endif if( CU::isMTSAllowed( cu, COMPONENT_Y ) && cuCtx && !cuCtx->violatesMtsCoeffConstraint && cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) ) @@ -3078,11 +3049,7 @@ void CABACWriter::isp_mode( const CodingUnit& cu ) void CABACWriter::explicit_rdpcm_mode( const TransformUnit& tu, ComponentID compID ) { const CodingUnit& cu = *tu.cu; -#if JVET_P0058_CHROMA_TS if (!CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && (tu.mtsIdx[compID] == MTS_SKIP)) -#else - if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==MTS_SKIP ) ) -#endif { ChannelType chType = toChannelType( compID ); switch( tu.rdpcm[compID] ) @@ -3119,11 +3086,7 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) const bool chromaFlag = cu.isSepTree() ? ( isChroma( cu.chType ) ? true : false ) : true; bool nonZeroCoeffNonTsCorner8x8 = ( lumaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_LUMA] ) || (chromaFlag && cuCtx.violatesLfnstConstrained[CHANNEL_TYPE_CHROMA] ); -#if JVET_P0058_CHROMA_TS const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx[COMPONENT_Y] == MTS_SKIP; -#else - const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx == MTS_SKIP; -#endif if( (!cuCtx.lfnstLastScanPos && !cu.ispMode) || nonZeroCoeffNonTsCorner8x8 || isTrSkip ) { return; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 06f7a7d7c..2c176418f 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -437,9 +437,7 @@ protected: uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; bool m_useTransformSkip; bool m_useTransformSkipFast; -#if JVET_P0058_CHROMA_TS bool m_useChromaTS; -#endif #if JVET_P0059_CHROMA_BDPCM int m_useBDPCM; #else @@ -1370,10 +1368,8 @@ public: void setTransformSkipRotationEnabledFlag (const bool value) { m_transformSkipRotationEnabledFlag = value; } bool getTransformSkipContextEnabledFlag () const { return m_transformSkipContextEnabledFlag; } void setTransformSkipContextEnabledFlag (const bool value) { m_transformSkipContextEnabledFlag = value; } -#if JVET_P0058_CHROMA_TS bool getUseChromaTS () { return m_useChromaTS; } void setUseChromaTS (bool b) { m_useChromaTS = b; } -#endif #if JVET_P0059_CHROMA_BDPCM int getUseBDPCM () { return m_useBDPCM; } void setUseBDPCM ( int b ) { m_useBDPCM = b; } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index ee2099a1e..0f37a7ff5 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -1870,11 +1870,7 @@ bool EncCu::xCheckRDCostIntra(CodingStructure *&tempCS, CodingStructure *&bestCS if( bestCS->cus.size() == 1 ) { CodingUnit &cu = *bestCS->cus.front(); -#if JVET_P0058_CHROMA_TS if (cu.firstTU->mtsIdx[COMPONENT_Y] == MTS_SKIP) -#else - if( cu.firstTU->mtsIdx == MTS_SKIP ) -#endif { if( ( floorLog2( cu.firstTU->blocks[ COMPONENT_Y ].width ) + floorLog2( cu.firstTU->blocks[ COMPONENT_Y ].height ) ) >= 6 ) { @@ -4277,13 +4273,8 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS sbtOffCost = tempCS->cost; sbtOffDist = tempCS->dist; sbtOffRootCbf = cu->rootCbf; -#if JVET_P0058_CHROMA_TS currBestSbt = CU::getSbtInfo(cu->firstTU->mtsIdx[COMPONENT_Y] > MTS_SKIP ? SBT_OFF_MTS : SBT_OFF_DCT, 0); currBestTrs = cu->firstTU->mtsIdx[COMPONENT_Y]; -#else - currBestSbt = CU::getSbtInfo( cu->firstTU->mtsIdx > MTS_SKIP ? SBT_OFF_MTS : SBT_OFF_DCT, 0 ); - currBestTrs = cu->firstTU->mtsIdx; -#endif #if WCG_EXT DTRACE_MODE_COST( *tempCS, m_pcRdCost->getLambda( true ) ); @@ -4419,11 +4410,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS if( tempCS->cost < currBestCost ) { currBestSbt = cu->sbtInfo; -#if JVET_P0058_CHROMA_TS currBestTrs = tempCS->tus[cu->sbtInfo ? cu->getSbtPos() : 0]->mtsIdx[COMPONENT_Y]; -#else - currBestTrs = tempCS->tus[cu->sbtInfo ? cu->getSbtPos() : 0]->mtsIdx; -#endif assert( currBestTrs == 0 || currBestTrs == 1 ); currBestCost = tempCS->cost; } diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 45351e87c..2a0f143d8 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -6484,11 +6484,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par { TransformUnit &tu = csFull->addTU(CS::getArea(cs, currArea, partitioner.chType), partitioner.chType); tu.depth = currDepth; -#if JVET_P0058_CHROMA_TS for (int i = 0; i<MAX_NUM_TBLOCKS; i++) tu.mtsIdx[i] = MTS_DCT2_DCT2; -#else - tu.mtsIdx = MTS_DCT2_DCT2; -#endif tu.checkTuNoResidual( partitioner.currPartIdx() ); Position tuPos = tu.Y(); tuPos.relativeTo(cu.Y()); @@ -6547,11 +6543,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par preCalcAlpha = xCalcCrossComponentPredictionAlpha( tu, compID, m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate() ); } -#if JVET_P0058_CHROMA_TS const bool tsAllowed = TU::isTSAllowed(tu, compID) && (isLuma(compID) || (isChroma(compID) && m_pcEncCfg->getUseChromaTS())); -#else - const bool tsAllowed = TU::isTSAllowed ( tu, compID ); -#endif const bool mtsAllowed = CU::isMTSAllowed( *tu.cu, compID ); uint8_t nNumTransformCands = 1 + ( tsAllowed ? 1 : 0 ) + ( mtsAllowed ? 4 : 0 ); // DCT + TS + 4 MTS = 6 tests @@ -6612,20 +6604,12 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par m_CABACEstimator->getCtx() = ctxStart; m_CABACEstimator->resetBits(); -#if JVET_P0058_CHROMA_TS -#else - if( isLuma( compID ) ) -#endif { #if JVET_AHG14_LOSSLESS if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING ) ) { #endif -#if JVET_P0058_CHROMA_TS if (bestTU.mtsIdx[compID] == MTS_SKIP && m_pcEncCfg->getUseTransformSkipFast()) -#else - if( bestTU.mtsIdx == MTS_SKIP && m_pcEncCfg->getUseTransformSkipFast() ) -#endif { continue; } @@ -6636,11 +6620,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par #if JVET_AHG14_LOSSLESS } #endif -#if JVET_P0058_CHROMA_TS tu.mtsIdx[compID] = trModes[transformMode].first; -#else - tu.mtsIdx = trModes[transformMode].first; -#endif } tu.compAlpha[compID] = bUseCrossCPrediction ? preCalcAlpha : 0; @@ -6691,11 +6671,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par if( transformMode == 0 ) { m_pcTrQuant->transformNxN( tu, compID, cQP, &trModes, m_pcEncCfg->getMTSInterMaxCand() ); -#if JVET_P0058_CHROMA_TS tu.mtsIdx[compID] = trModes[0].first; -#else - tu.mtsIdx = trModes[0].first; -#endif } #if JVET_AHG14_LOSSLESS if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0 ) ) @@ -6944,10 +6920,8 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par tu.jointCbCr = (uint8_t) cbfMask; tu.compAlpha[COMPONENT_Cb] = tu.compAlpha[COMPONENT_Cr] = 0; -#if JVET_P0058_CHROMA_TS // encoder bugfix: initialize mtsIdx for chroma under JointCbCrMode. tu.mtsIdx[COMPONENT_Cb] = tu.mtsIdx[COMPONENT_Cr] = MTS_DCT2_DCT2; -#endif int codedCbfMask = 0; ComponentID codeCompId = (tu.jointCbCr >> 1 ? COMPONENT_Cb : COMPONENT_Cr); ComponentID otherCompId = (codeCompId == COMPONENT_Cr ? COMPONENT_Cb : COMPONENT_Cr); diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 7b9421b29..a5502f5d3 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -3212,11 +3212,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp if (trModes) { m_pcTrQuant->transformNxN(tu, compID, cQP, trModes, m_pcEncCfg->getMTSIntraMaxCand()); -#if JVET_P0058_CHROMA_TS tu.mtsIdx[compID] = trModes->at(0).first; -#else - tu.mtsIdx = trModes->at(0).first; -#endif } #if JVET_AHG14_LOSSLESS if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING && tu.mtsIdx[compID] == 0 ) || tu.cu->bdpcmMode != 0 ) @@ -3271,14 +3267,11 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp PelBuf& codeResi = ( codeCompId == COMPONENT_Cr ? crResi : piResi ); uiAbsSum = 0; -#if JVET_P0058_CHROMA_TS if (trModes) { m_pcTrQuant->transformNxN(tu, compID, qpCbCr, trModes, m_pcEncCfg->getMTSIntraMaxCand()); tu.mtsIdx[compID] = trModes->at(0).first; } -#endif -#if JVET_P0058_CHROMA_TS // encoder bugfix: Set loadTr to aovid redundant transform process #if JVET_AHG14_LOSSLESS #if JVET_P0059_CHROMA_BDPCM @@ -3292,9 +3285,6 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp #else m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); #endif -#else - m_pcTrQuant->transformNxN(tu, codeCompId, qpCbCr, uiAbsSum, m_CABACEstimator->getCtx()); -#endif #if JVET_AHG14_LOSSLESS #if JVET_P0059_CHROMA_BDPCM @@ -3475,11 +3465,7 @@ void IntraSearch::xIntraCodingACTTUBlock(TransformUnit &tu, const ComponentID &c if (trModes) { m_pcTrQuant->transformNxN(tu, compID, cQP, trModes, m_pcEncCfg->getMTSIntraMaxCand()); -#if JVET_P0058_CHROMA_TS tu.mtsIdx[compID] = trModes->at(0).first; -#else - tu.mtsIdx = trModes->at(0).first; -#endif } m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr); @@ -3817,11 +3803,7 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING ) ) { #endif -#if JVET_P0058_CHROMA_TS if( !cbfDCT2 || ( m_pcEncCfg->getUseTransformSkipFast() && bestModeId[ COMPONENT_Y ] == MTS_SKIP)) -#else - if( !cbfDCT2 || ( m_pcEncCfg->getUseTransformSkipFast() && bestModeId[ COMPONENT_Y ] == 1 ) ) -#endif { break; } @@ -3830,22 +3812,14 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par continue; } //we compare the DCT-II cost against the best ISP cost so far (except for TS) -#if JVET_P0058_CHROMA_TS if (m_pcEncCfg->getUseFastISP() && !cu.ispMode && ispIsCurrentWinner && trModes[modeId].first != MTS_DCT2_DCT2 && (trModes[modeId].first != MTS_SKIP || !tsAllowed) && bestDCT2cost > bestCostSoFar * threshold) -#else - if( m_pcEncCfg->getUseFastISP() && !cu.ispMode && ispIsCurrentWinner && trModes[ modeId ].first != 0 && ( trModes[ modeId ].first != 1 || !tsAllowed ) && bestDCT2cost > bestCostSoFar * threshold ) -#endif { continue; } #if JVET_AHG14_LOSSLESS } #endif -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = trModes[modeId].first; -#else - tu.mtsIdx = trModes[ modeId ].first; -#endif } @@ -3889,45 +3863,25 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par if( transformIndex == 1 ) { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = (uiIntraMode < 34) ? MTS_DST7_DCT8 : MTS_DCT8_DST7; -#else - tu.mtsIdx = ( uiIntraMode < 34 ) ? MTS_DST7_DCT8 : MTS_DCT8_DST7; -#endif } else if( transformIndex == 2 ) { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = (uiIntraMode < 34) ? MTS_DCT8_DST7 : MTS_DST7_DCT8; -#else - tu.mtsIdx = ( uiIntraMode < 34 ) ? MTS_DCT8_DST7 : MTS_DST7_DCT8; -#endif } else { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = MTS_DST7_DST7 + transformIndex; -#else - tu.mtsIdx = MTS_DST7_DST7 + transformIndex; -#endif } } else { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = MTS_DST7_DST7 + transformIndex; -#else - tu.mtsIdx = MTS_DST7_DST7 + transformIndex; -#endif } } else { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = transformIndex; -#else - tu.mtsIdx = transformIndex; -#endif } if( !cu.mtsFlag && checkTransformSkip ) @@ -4381,11 +4335,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti #if JVET_AHG14_LOSSLESS } #endif -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = trModes[modeId].first; -#else - tu.mtsIdx = trModes[modeId].first; -#endif } singleDistTmpLuma = 0; @@ -4399,45 +4349,25 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti if (transformIndex == 1) { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = (uiIntraMode < 34) ? MTS_DST7_DCT8 : MTS_DCT8_DST7; -#else - tu.mtsIdx = (uiIntraMode < 34) ? MTS_DST7_DCT8 : MTS_DCT8_DST7; -#endif } else if (transformIndex == 2) { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = (uiIntraMode < 34) ? MTS_DCT8_DST7 : MTS_DST7_DCT8; -#else - tu.mtsIdx = (uiIntraMode < 34) ? MTS_DCT8_DST7 : MTS_DST7_DCT8; -#endif } else { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = MTS_DST7_DST7 + transformIndex; -#else - tu.mtsIdx = MTS_DST7_DST7 + transformIndex; -#endif } } else { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = MTS_DST7_DST7 + transformIndex; -#else - tu.mtsIdx = MTS_DST7_DST7 + transformIndex; -#endif } } else { -#if JVET_P0058_CHROMA_TS tu.mtsIdx[COMPONENT_Y] = transformIndex; -#else - tu.mtsIdx = transformIndex; -#endif } if (!cu.mtsFlag && checkTransformSkip) @@ -4979,7 +4909,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio Distortion singleDistCTmp = 0; double singleCostTmp = 0; const int crossCPredictionModesToTest = checkCrossComponentPrediction ? 2 : 1; -#if JVET_P0058_CHROMA_TS const bool tsAllowed = TU::isTSAllowed(currTU, compID) && (m_pcEncCfg->getUseChromaTS()); uint8_t nNumTransformCands = 1 + (tsAllowed ? 1 : 0); // DCT + TS = 2 tests std::vector<TrMode> trModes; @@ -4990,14 +4919,9 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio trModes.push_back(TrMode(1, true));//TS } CHECK(!currTU.Cb().valid(), "Invalid TU"); -#endif -#if JVET_P0058_CHROMA_TS const int totalModesToTest = crossCPredictionModesToTest * nNumTransformCands; bool cbfDCT2 = true; -#else - const int totalModesToTest = crossCPredictionModesToTest; -#endif const bool isOneMode = false; maxModesTested = totalModesToTest > maxModesTested ? totalModesToTest : maxModesTested; @@ -5010,9 +4934,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio ctxStart = m_CABACEstimator->getCtx(); } -#if JVET_P0058_CHROMA_TS for (int modeId = 0; modeId < nNumTransformCands; modeId++) -#endif { for (int crossCPredictionModeId = 0; crossCPredictionModeId < crossCPredictionModesToTest; crossCPredictionModeId++) { @@ -5021,12 +4943,10 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio currTU.compAlpha [compID] = ( crossCPredictionModeId ? compAlpha[compID] : 0 ); -#if JVET_P0058_CHROMA_TS #if JVET_P0059_CHROMA_BDPCM currTU.mtsIdx[compID] = currTU.cu->bdpcmModeChroma ? MTS_SKIP : trModes[modeId].first; #else currTU.mtsIdx[compID] = trModes[modeId].first; -#endif #endif currModeId++; @@ -5038,7 +4958,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio if( !( m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING ) ) { #endif -#if JVET_P0058_CHROMA_TS //if DCT2's cbf==0, skip ts search if (!cbfDCT2 && trModes[modeId].first == MTS_SKIP) { @@ -5048,7 +4967,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio { continue; } -#endif #if JVET_AHG14_LOSSLESS } #endif @@ -5060,7 +4978,6 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio singleDistCTmp = 0; -#if JVET_P0058_CHROMA_TS if (nNumTransformCands > 1) { xIntraCodingTUBlock(currTU, compID, crossCPredictionModeId != 0, singleDistCTmp, default0Save1Load2, nullptr, modeId == 0 ? &trModes : nullptr, true); @@ -5069,18 +4986,11 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio { xIntraCodingTUBlock(currTU, compID, crossCPredictionModeId != 0, singleDistCTmp, default0Save1Load2); } -#else - xIntraCodingTUBlock( currTU, compID, crossCPredictionModeId != 0, singleDistCTmp, default0Save1Load2 ); -#endif -#if JVET_P0058_CHROMA_TS #if JVET_P0059_CHROMA_BDPCM if (((crossCPredictionModeId == 1) && (currTU.compAlpha[compID] == 0)) || ((currTU.mtsIdx[compID] == MTS_SKIP && !currTU.cu->bdpcmModeChroma) && !TU::getCbf(currTU, compID))) //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. #else if (((crossCPredictionModeId == 1) && (currTU.compAlpha[compID] == 0)) || ((currTU.mtsIdx[compID] == MTS_SKIP) && !TU::getCbf(currTU, compID))) //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. -#endif -#else - if( ( ( crossCPredictionModeId == 1 ) && ( currTU.compAlpha[compID] == 0 ) ) ) //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. #endif { singleCostTmp = MAX_DOUBLE; @@ -5116,12 +5026,10 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio bestDistCr = singleDistCTmp; } -#if JVET_P0058_CHROMA_TS if (currTU.mtsIdx[compID] == MTS_DCT2_DCT2) { cbfDCT2 = TU::getCbfAtDepth(currTU, compID, currDepth); } -#endif if( !isLastMode ) { @@ -5182,10 +5090,8 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio currTU.jointCbCr = (uint8_t)cbfMask; currTU.compAlpha[COMPONENT_Cb] = 0; currTU.compAlpha[COMPONENT_Cr] = 0; -#if JVET_P0058_CHROMA_TS // encoder bugfix: initialize mtsIdx for chroma under JointCbCrMode. currTU.mtsIdx[COMPONENT_Cb] = currTU.mtsIdx[COMPONENT_Cr] = MTS_DCT2_DCT2; -#endif m_CABACEstimator->getCtx() = ctxStartTU; resiCb.copyFrom( orgResiCb[cbfMask] ); -- GitLab