Commit 63ee5564 authored by Xiang Li's avatar Xiang Li

Merge branch 'namedMtsIdx' into 'master'

Define named values for mtsIdx and use them

See merge request jvet/VVCSoftware_VTM!520
parents 8e85cb31 b2d88278
Pipeline #1470 passed with stage
......@@ -92,7 +92,7 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_lastOffsetY (0)
, m_lastShiftX (0)
, m_lastShiftY (0)
, m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.cu->transQuantBypass || tu.mtsIdx==1))
, m_TrafoBypass (tu.cs->sps->getSpsRangeExtension().getTransformSkipContextEnabledFlag() && (tu.cu->transQuantBypass || tu.mtsIdx==MTS_SKIP))
, m_scanPosLast (-1)
, m_subSetId (-1)
, m_subSetPos (-1)
......@@ -615,4 +615,4 @@ unsigned DeriveCtx::CtxMipFlag( const CodingUnit& cu )
return ctxId;
}
#endif
\ No newline at end of file
#endif
......@@ -756,7 +756,7 @@ namespace DQIntern
const int channelBitDepth = sps.getBitDepth( chType );
const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange( chType );
const int nomTransformShift = getTransformShift( channelBitDepth, area.size(), maxLog2TrDynamicRange );
const bool clipTransformShift = ( tu.mtsIdx==1 && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() );
const bool clipTransformShift = ( tu.mtsIdx==MTS_SKIP && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() );
#if JVET_N0246_MODIFIED_QUANTSCALES
const bool needsSqrt2ScaleAdjustment = TU::needsSqrt2Scale(tu, compID);
const int transformShift = ( clipTransformShift ? std::max<int>( 0, nomTransformShift ) : nomTransformShift ) + (needsSqrt2ScaleAdjustment?-1:0);
......@@ -859,7 +859,7 @@ namespace DQIntern
const TCoeff minTCoeff = -( 1 << maxLog2TrDynamicRange );
const TCoeff maxTCoeff = ( 1 << maxLog2TrDynamicRange ) - 1;
const int nomTransformShift = getTransformShift( channelBitDepth, area.size(), maxLog2TrDynamicRange );
const bool clipTransformShift = ( tu.mtsIdx==1 && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() );
const bool clipTransformShift = ( tu.mtsIdx==MTS_SKIP && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() );
#if JVET_N0246_MODIFIED_QUANTSCALES
const bool needsSqrt2ScaleAdjustment = TU::needsSqrt2Scale(tu, compID);
const int transformShift = ( clipTransformShift ? std::max<int>( 0, nomTransformShift ) : nomTransformShift ) + (needsSqrt2ScaleAdjustment?-1:0);
......@@ -1678,7 +1678,7 @@ namespace DQIntern
//===== find first test position =====
int firstTestPos = numCoeff - 1;
#if JVET_N0193_LFNST
if( lfnstIdx > 0 && tu.mtsIdx != 1 && ( ( width == 4 && height == 4 ) || ( width == 8 && height == 8 ) ) )
if( lfnstIdx > 0 && tu.mtsIdx != MTS_SKIP && ( ( width == 4 && height == 4 ) || ( width == 8 && height == 8 ) ) )
{
firstTestPos = 7;
}
......@@ -1707,7 +1707,7 @@ namespace DQIntern
int effWidth = tuPars.m_width, effHeight = tuPars.m_height;
bool zeroOut = false;
if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tuPars.m_height <= 32 && tuPars.m_width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
{
effHeight = ( tuPars.m_height == 32 ) ? 16 : tuPars.m_height;
effWidth = ( tuPars.m_width == 32 ) ? 16 : tuPars.m_width;
......@@ -1719,7 +1719,7 @@ namespace DQIntern
{
const ScanInfo& scanInfo = tuPars.m_scanInfo[ scanIdx ];
#if JVET_N0193_LFNST
bool lfnstZeroOut = lfnstIdx > 0 && tu.mtsIdx != 1 && width >= 4 && height >= 4 &&
bool lfnstZeroOut = lfnstIdx > 0 && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 &&
( ( ( ( width >= 8 && height >= 8 ) && scanIdx >= 16 ) || ( ( ( width == 4 && height == 4 ) || ( width == 8 && height == 8 ) ) && scanIdx >= 8 ) ) && scanIdx < 48 );
xDecideAndUpdate( abs( tCoeff[ scanInfo.rasterPos ] ), scanInfo, ( zeroOut && ( scanInfo.posX >= effWidth || scanInfo.posY >= effHeight ) ) || lfnstZeroOut );
#else
......@@ -1776,7 +1776,7 @@ DepQuant::~DepQuant()
void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx& ctx )
{
#if JVET_N0280_RESIDUAL_CODING_TS
if( tu.cs->slice->getDepQuantEnabledFlag() && tu.mtsIdx != 1 )
if( tu.cs->slice->getDepQuantEnabledFlag() && tu.mtsIdx != MTS_SKIP )
#else
if( tu.cs->slice->getDepQuantEnabledFlag() )
#endif
......@@ -1792,7 +1792,7 @@ 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_N0280_RESIDUAL_CODING_TS
if( tu.cs->slice->getDepQuantEnabledFlag() && tu.mtsIdx != 1 )
if( tu.cs->slice->getDepQuantEnabledFlag() && tu.mtsIdx != MTS_SKIP )
#else
if( tu.cs->slice->getDepQuantEnabledFlag() )
#endif
......
......@@ -373,7 +373,7 @@ void Quant::dequant(const TransformUnit &tu,
const TCoeff transformMinimum = -(1 << maxLog2TrDynamicRange);
const TCoeff transformMaximum = (1 << maxLog2TrDynamicRange) - 1;
#if HEVC_USE_SCALING_LISTS
const bool isTransformSkip = tu.mtsIdx==1 && isLuma(compID);
const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID);
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip);
const int scalingListType = getScalingListType(tu.cu->predMode, compID);
#endif
......@@ -398,7 +398,7 @@ void Quant::dequant(const TransformUnit &tu,
CHECK(uiWidth > m_uiMaxTrSize, "Unsupported transformation size");
// Represents scaling through forward transform
const bool bClipTransformShiftTo0 = tu.mtsIdx!=1 && sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag();
const bool bClipTransformShiftTo0 = tu.mtsIdx!=MTS_SKIP && sps->getSpsRangeExtension().getExtendedPrecisionProcessingFlag();
const int originalTransformShift = getTransformShift(channelBitDepth, area.size(), maxLog2TrDynamicRange);
#if JVET_N0246_MODIFIED_QUANTSCALES
const bool needSqrtAdjustment = TU::needsBlockSizeTrafoScale( tu, compID );
......@@ -847,7 +847,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf
const CCoeffBuf &piCoef = pSrc;
CoeffBuf piQCoef = tu.getCoeffs(compID);
const bool useTransformSkip = tu.mtsIdx==1;
const bool useTransformSkip = tu.mtsIdx==MTS_SKIP;
const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID));
{
......@@ -975,7 +975,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff
const CCoeffBuf piCoef = pSrc;
const bool useTransformSkip = tu.mtsIdx==1;
const bool useTransformSkip = tu.mtsIdx==MTS_SKIP;
const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID));
#if HEVC_USE_SCALING_LISTS
......
......@@ -560,7 +560,7 @@ void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeff
const CCoeffBuf &piCoef = pSrc;
CoeffBuf piQCoef = tu.getCoeffs(compID);
const bool useTransformSkip = tu.mtsIdx==1;
const bool useTransformSkip = tu.mtsIdx==MTS_SKIP;
bool useRDOQ = useTransformSkip ? m_useRDOQTS : m_useRDOQ;
......@@ -640,7 +640,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID,
// Represents scaling through forward transform
int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange);
if (tu.mtsIdx==1 && extendedPrecision)
if (tu.mtsIdx==MTS_SKIP && extendedPrecision)
{
iTransformShift = std::max<int>(0, iTransformShift);
}
......@@ -689,7 +689,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID,
#if HEVC_USE_SCALING_LISTS
const double *const pdErrScale = xGetErrScaleCoeff(scalingListType, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1), cQP.rem);
const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1));
const bool isTransformSkip = tu.mtsIdx==1 && isLuma(compID);
const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID);
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip);
const int defaultQuantisationCoefficient = g_quantScales[ needSqrtAdjustment ?1:0][cQP.rem];
const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1), cQP.rem);
......
......@@ -256,7 +256,7 @@ void TrQuant::xInvLfnst( const TransformUnit &tu, const ComponentID compID )
const uint32_t height = area.height;
const uint32_t lfnstIdx = tu.cu->lfnstIdx;
if( lfnstIdx && tu.mtsIdx != 1 && width >= 4 && height >= 4 )
if( lfnstIdx && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 )
{
const bool whge3 = width >= 8 && height >= 8;
#if JVET_N0103_CGSIZE_HARMONIZATION
......@@ -360,7 +360,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( lfnstIdx && tu.mtsIdx != 1 && width >= 4 && height >= 4 )
if( lfnstIdx && tu.mtsIdx != MTS_SKIP && width >= 4 && height >= 4 )
{
const bool whge3 = width >= 8 && height >= 8;
#if JVET_N0103_CGSIZE_HARMONIZATION
......@@ -498,7 +498,7 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel
}
#endif
if( isLuma(compID) && tu.mtsIdx == 1 )
if( isLuma(compID) && tu.mtsIdx == MTS_SKIP )
{
xITransformSkip( tempCoeff, pResi, tu, compID );
}
......@@ -517,7 +517,7 @@ void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf &
{
const CompArea &area = tu.blocks[compID];
if (CU::isRDPCMEnabled(*tu.cu) && (tu.mtsIdx==1 || tu.cu->transQuantBypass))
if (CU::isRDPCMEnabled(*tu.cu) && (tu.mtsIdx==MTS_SKIP || tu.cu->transQuantBypass))
{
const uint32_t uiWidth = area.width;
const uint32_t uiHeight = area.height;
......@@ -659,10 +659,10 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy
#if JVET_N0866_UNIF_TRFM_SEL_IMPL_MTS_ISP
if (isExplicitMTS)
{
if (tu.mtsIdx > 1)
if (tu.mtsIdx > MTS_SKIP)
{
int indHor = (tu.mtsIdx - 2) & 1;
int indVer = (tu.mtsIdx - 2) >> 1;
int indHor = (tu.mtsIdx - MTS_DST7_DST7) & 1;
int indVer = (tu.mtsIdx - MTS_DST7_DST7) >> 1;
trTypeHor = indHor ? DCT8 : DST7;
trTypeVer = indVer ? DCT8 : DST7;
......@@ -673,10 +673,10 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy
{
if( compID == COMPONENT_Y )
{
if ( tu.mtsIdx > 1 )
if ( tu.mtsIdx > MTS_SKIP )
{
int indHor = ( tu.mtsIdx - 2 ) & 1;
int indVer = ( tu.mtsIdx - 2 ) >> 1;
int indHor = ( tu.mtsIdx - MTS_DST7_DST7 ) & 1;
int indVer = ( tu.mtsIdx - MTS_DST7_DST7 ) >> 1;
trTypeHor = indHor ? DCT8 : DST7;
trTypeVer = indVer ? DCT8 : DST7;
......@@ -911,7 +911,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const
continue;
}
if( isLuma(compID) && tu.mtsIdx == 1 )
if( isLuma(compID) && tu.mtsIdx == MTS_SKIP )
{
xTransformSkip( tu, compID, resiBuf, tempCoeff.buf );
}
......@@ -927,7 +927,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const
}
double scaleSAD=1.0;
if (isLuma(compID) && tu.mtsIdx==1 && ((g_aucLog2[width] + g_aucLog2[height]) & 1) == 1 )
if (isLuma(compID) && tu.mtsIdx==MTS_SKIP && ((g_aucLog2[width] + g_aucLog2[height]) & 1) == 1 )
{
scaleSAD=1.0/1.414213562; // compensate for not scaling transform skip coefficients by 1/sqrt(2)
}
......@@ -978,7 +978,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const
#if JVET_N0413_RDPCM
if( tu.cu->bdpcmMode && isLuma(compID) )
{
tu.mtsIdx = 1;
tu.mtsIdx = MTS_SKIP;
}
#endif
......@@ -1025,7 +1025,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const
if( !loadTr )
{
if( isLuma(compID) && tu.mtsIdx == 1 )
if( isLuma(compID) && tu.mtsIdx == MTS_SKIP )
{
xTransformSkip( tu, compID, resiBuf, tempCoeff.buf );
}
......@@ -1037,7 +1037,7 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const
//we do this only with the DCT-II coefficients
if( isLuma(compID) &&
!loadTr && tu.mtsIdx == 0
!loadTr && tu.mtsIdx == MTS_DCT2_DCT2
)
{
//it gets the distribution of the coefficients energy, which will be useful to discard ISP tests
......@@ -1160,7 +1160,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 (!CU::isRDPCMEnabled(*tu.cu) || (tu.mtsIdx!=1 && !tu.cu->transQuantBypass))
if (!CU::isRDPCMEnabled(*tu.cu) || (tu.mtsIdx!=MTS_SKIP && !tu.cu->transQuantBypass))
{
rdpcmMode = RDPCM_OFF;
}
......
......@@ -452,6 +452,16 @@ enum TransType
DCT2_EMT = 4
};
enum MTSIdx
{
MTS_DCT2_DCT2 = 0,
MTS_SKIP = 1,
MTS_DST7_DST7 = 2,
MTS_DCT8_DST7 = 3,
MTS_DST7_DCT8 = 4,
MTS_DCT8_DCT8 = 5
};
enum ISPType
{
NOT_INTRA_SUBPARTITIONS = 0,
......
......@@ -638,7 +638,7 @@ void TransformUnit::initData()
compAlpha[i] = 0;
}
depth = 0;
mtsIdx = 0;
mtsIdx = MTS_DCT2_DCT2;
noResidual = false;
#if JVET_N0054_JOINT_CHROMA
jointCbCr = 0;
......
......@@ -245,7 +245,7 @@ bool CU::hasNonTsCodedBlock( const CodingUnit& cu )
{
for( uint32_t i = 0; i < ::getNumberValidTBlocks( *cu.cs->pcv ); i++ )
{
hasAnyNonTSCoded |= ( currTU.blocks[i].valid() && ( isLuma(ComponentID(i)) ? currTU.mtsIdx != 1 : true ) && TU::getCbf( currTU, ComponentID( i ) ) );
hasAnyNonTSCoded |= ( currTU.blocks[i].valid() && ( isLuma(ComponentID(i)) ? currTU.mtsIdx != MTS_SKIP : true ) && TU::getCbf( currTU, ComponentID( i ) ) );
}
}
......@@ -5793,7 +5793,7 @@ bool TU::isMTSAllowed(const TransformUnit &tu, const ComponentID compID)
uint32_t TU::getGolombRiceStatisticsIndex(const TransformUnit &tu, const ComponentID &compID)
{
const bool transformSkip = tu.mtsIdx==1;
const bool transformSkip = tu.mtsIdx==MTS_SKIP;
const bool transquantBypass = tu.cu->transQuantBypass;
//--------
......@@ -5876,9 +5876,9 @@ uint32_t TU::getNumNonZeroCoeffsNonTS( const TransformUnit& tu, const bool bLuma
for( uint32_t i = 0; i < ::getNumberValidTBlocks( *tu.cs->pcv ); i++ )
{
#if JVET_N0193_LFNST
if( tu.blocks[ i ].valid() && tu.mtsIdx != 1 && TU::getCbf( tu, ComponentID( i ) ) )
if( tu.blocks[ i ].valid() && tu.mtsIdx != MTS_SKIP && TU::getCbf( tu, ComponentID( i ) ) )
#else
if( tu.blocks[i].valid() && ( isLuma(ComponentID(i)) ? tu.mtsIdx !=1 : true ) && TU::getCbf( tu, ComponentID( i ) ) )
if( tu.blocks[i].valid() && ( isLuma(ComponentID(i)) ? tu.mtsIdx !=MTS_SKIP : true ) && TU::getCbf( tu, ComponentID( i ) ) )
#endif
{
if( isLuma ( tu.blocks[i].compID ) && !bLuma ) continue;
......@@ -5910,7 +5910,7 @@ uint32_t TU::getNumNonZeroCoeffsNonTSCorner8x8( const TransformUnit& tu, const b
uint32_t count = 0;
for( uint32_t i = 0; i < ::getNumberValidTBlocks( *tu.cs->pcv ); i++ )
{
if( tu.blocks[ i ].valid() && tu.mtsIdx != 1 && TU::getCbf( tu, ComponentID( i ) ) )
if( tu.blocks[ i ].valid() && tu.mtsIdx != MTS_SKIP && TU::getCbf( tu, ComponentID( i ) ) )
{
if( isLuma( tu.blocks[ i ].compID ) && ( !lumaFlag || !lumaCountFlag ) ) continue;
if( isChroma( tu.blocks[ i ].compID ) && ( !chromaFlag || !chromaCountFlag ) ) continue;
......@@ -5942,7 +5942,7 @@ uint32_t TU::getNumNonZeroCoeffsNonTSCorner8x8( const TransformUnit& tu, const b
bool TU::needsSqrt2Scale( const TransformUnit &tu, const ComponentID &compID )
{
const Size &size=tu.blocks[compID];
const bool isTransformSkip = tu.mtsIdx==1 && isLuma(compID);
const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID);
return (!isTransformSkip) && (((g_aucLog2[size.width] + g_aucLog2[size.height]) & 1) == 1);
}
......
......@@ -2742,9 +2742,9 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID )
#if JVET_N0280_RESIDUAL_CODING_TS
#if JVET_N0413_RDPCM
if( isLuma( compID ) && ( tu.mtsIdx == 1 || tu.cu->bdpcmMode ) )
if( isLuma( compID ) && ( tu.mtsIdx == MTS_SKIP || tu.cu->bdpcmMode ) )
#else
if( isLuma( compID ) && tu.mtsIdx == 1 )
if( isLuma( compID ) && tu.mtsIdx == MTS_SKIP )
#endif
{
residual_codingTS( tu, compID );
......@@ -2755,7 +2755,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID )
#if HEVC_USE_SIGN_HIDING
// determine sign hiding
bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF );
if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==1 )
if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==MTS_SKIP )
{
const ChannelType chType = toChannelType( compID );
const unsigned intraMode = PU::getFinalIntraMode( *cu.cs->getPU( tu.blocks[compID].pos(), chType ), chType );
......@@ -2785,7 +2785,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID )
for( int subSetId = ( cctx.scanPosLast() >> cctx.log2CGSize() ); subSetId >= 0; subSetId--)
{
cctx.initSubblock ( subSetId );
if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
{
if( ( tu.blocks[ compID ].height == 32 && cctx.cgPosY() >= ( 16 >> cctx.log2CGHeight() ) ) || ( tu.blocks[ compID ].width == 32 && cctx.cgPosX() >= ( 16 >> cctx.log2CGWidth() ) ) )
{
......@@ -2804,7 +2804,7 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID )
const bool mtsAllowed = TU::isMTSAllowed( tu, compID );
#if JVET_N0413_RDPCM
if( tu.cu->bdpcmMode ) tu.mtsIdx = 1;
if( tu.cu->bdpcmMode ) tu.mtsIdx = MTS_SKIP;
#endif
if( !mtsAllowed && !tsAllowed ) return;
......@@ -2817,10 +2817,10 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID )
{
ctxIdx = 6;
symbol = m_BinDecoder.decodeBin( Ctx::MTSIndex( ctxIdx ) );
tu.mtsIdx = 1-symbol; // 1 = TS
tu.mtsIdx = symbol ? MTS_DCT2_DCT2 : MTS_SKIP;
}
if( tu.mtsIdx != 1 )
if( tu.mtsIdx != MTS_SKIP )
{
if( mtsAllowed )
{
......@@ -2830,7 +2830,7 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID )
if( symbol )
{
ctxIdx = 7;
tu.mtsIdx = 2; // mtsIdx = 2 -- 4
tu.mtsIdx = MTS_DST7_DST7; // mtsIdx = 2 -- 4
for( int i = 0; i < 3; i++, ctxIdx++ )
{
symbol = m_BinDecoder.decodeBin( Ctx::MTSIndex( ctxIdx ) );
......@@ -2903,7 +2903,7 @@ void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID )
tu.rdpcm[compID] = RDPCM_OFF;
if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==1 || cu.transQuantBypass ) )
if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==MTS_SKIP || cu.transQuantBypass ) )
{
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE( STATS__EXPLICIT_RDPCM_BITS, tu.blocks[tu.chType].lumaSize() );
......@@ -2974,7 +2974,7 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu )
#endif
unsigned cctx = 0;
if( cu.firstTU->mtsIdx < 2 && CS::isDualITree( *cu.cs ) ) cctx++;
if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && CS::isDualITree( *cu.cs ) ) cctx++;
#if JVET_N0105_LFNST_CTX_MODELLING
uint32_t idxLFNST = m_BinDecoder.decodeBin( Ctx::LFNSTIdx( cctx ) );
......@@ -3003,7 +3003,7 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, Co
unsigned maxLastPosX = cctx.maxLastPosX();
unsigned maxLastPosY = cctx.maxLastPosY();
if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
{
maxLastPosX = ( tu.blocks[ compID ].width == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosX;
maxLastPosY = ( tu.blocks[ compID ].height == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosY;
......
......@@ -2605,9 +2605,9 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID )
#if JVET_N0280_RESIDUAL_CODING_TS
#if JVET_N0413_RDPCM
if( isLuma( compID ) && ( tu.mtsIdx == 1 || tu.cu->bdpcmMode ) )
if( isLuma( compID ) && ( tu.mtsIdx == MTS_SKIP || tu.cu->bdpcmMode ) )
#else
if( isLuma( compID ) && tu.mtsIdx==1 )
if( isLuma( compID ) && tu.mtsIdx==MTS_SKIP )
#endif
{
residual_codingTS( tu, compID );
......@@ -2618,7 +2618,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID )
#if HEVC_USE_SIGN_HIDING
// determine sign hiding
bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && !cu.transQuantBypass && tu.rdpcm[compID] == RDPCM_OFF );
if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==1 )
if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx==MTS_SKIP )
{
const ChannelType chType = toChannelType( compID );
const unsigned intraMode = PU::getFinalIntraMode( *cu.cs->getPU( tu.blocks[compID].pos(), chType ), chType );
......@@ -2662,7 +2662,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID )
for( int subSetId = ( cctx.scanPosLast() >> cctx.log2CGSize() ); subSetId >= 0; subSetId--)
{
cctx.initSubblock ( subSetId, sigGroupFlags[subSetId] );
if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].height <= 32 && tu.blocks[ compID ].width <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
{
if( ( tu.blocks[ compID ].height == 32 && cctx.cgPosY() >= ( 16 >> cctx.log2CGHeight() ) )
|| ( tu.blocks[ compID ].width == 32 && cctx.cgPosX() >= ( 16 >> cctx.log2CGWidth() ) ) )
......@@ -2690,16 +2690,16 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID )
if( tsAllowed )
{
symbol = 1 - ( tu.mtsIdx == 1 ? 1 : 0 );
symbol = (tu.mtsIdx == MTS_SKIP) ? 0 : 1;
ctxIdx = 6;
m_BinEncoder.encodeBin( symbol, Ctx::MTSIndex( ctxIdx ) );
}
if( tu.mtsIdx != 1 )
if( tu.mtsIdx != MTS_SKIP )
{
if( mtsAllowed )
{
symbol = tu.mtsIdx != 0 ? 1 : 0;
symbol = tu.mtsIdx != MTS_DCT2_DCT2 ? 1 : 0;
ctxIdx = std::min( (int)cu.qtDepth, 5 );
m_BinEncoder.encodeBin( symbol, Ctx::MTSIndex( ctxIdx ) );
......@@ -2708,7 +2708,7 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID )
ctxIdx = 7;
for( int i = 0; i < 3; i++, ctxIdx++ )
{
symbol = tu.mtsIdx > i + 2 ? 1 : 0;
symbol = tu.mtsIdx > i + MTS_DST7_DST7 ? 1 : 0;
m_BinEncoder.encodeBin( symbol, Ctx::MTSIndex( ctxIdx ) );
if( !symbol )
......@@ -2764,7 +2764,7 @@ void CABACWriter::isp_mode( const CodingUnit& cu )
void CABACWriter::explicit_rdpcm_mode( const TransformUnit& tu, ComponentID compID )
{
const CodingUnit& cu = *tu.cu;
if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==1 || cu.transQuantBypass ) )
if( !CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx==MTS_SKIP || cu.transQuantBypass ) )
{
ChannelType chType = toChannelType( compID );
switch( tu.rdpcm[compID] )
......@@ -2832,7 +2832,7 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx )
#endif
unsigned cctx = 0;
if( cu.firstTU->mtsIdx < 2 && CS::isDualITree( *cu.cs ) ) cctx++;
if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && CS::isDualITree( *cu.cs ) ) cctx++;
const uint32_t idxLFNST = cu.lfnstIdx;
assert( idxLFNST < 3 );
......@@ -2879,7 +2879,7 @@ void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx, const TransformUnit&
unsigned maxLastPosX = cctx.maxLastPosX();
unsigned maxLastPosY = cctx.maxLastPosY();
if( ( tu.mtsIdx > 1 || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
if( ( tu.mtsIdx > MTS_SKIP || ( tu.cu->sbtInfo != 0 && tu.blocks[ compID ].width <= 32 && tu.blocks[ compID ].height <= 32 ) ) && !tu.cu->transQuantBypass && compID == COMPONENT_Y )
{
maxLastPosX = ( tu.blocks[compID].width == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosX;
maxLastPosY = ( tu.blocks[compID].height == 32 ) ? g_uiGroupIdx[ 15 ] : maxLastPosY;
......
......@@ -1627,7 +1627,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
if( bestCS->cus.size() == 1 )
{
CodingUnit &cu = *bestCS->cus.front();
if( cu.firstTU->mtsIdx == 1 )
if( cu.firstTU->mtsIdx == MTS_SKIP )
{
if( ( g_aucLog2[ cu.firstTU->blocks[ COMPONENT_Y ].width ] + g_aucLog2[ cu.firstTU->blocks[ COMPONENT_Y ].height ] ) >= 6 )
{
......@@ -4370,7 +4370,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS
sbtOffCost = tempCS->cost;
sbtOffDist = tempCS->dist;
sbtOffRootCbf = cu->rootCbf;
currBestSbt = CU::getSbtInfo( cu->firstTU->mtsIdx > 1 ? SBT_OFF_MTS : SBT_OFF_DCT, 0 );
currBestSbt = CU::getSbtInfo( cu->firstTU->mtsIdx > MTS_SKIP ? SBT_OFF_MTS : SBT_OFF_DCT, 0 );
currBestTrs = cu->firstTU->mtsIdx;
if( cu->lwidth() <= MAX_TB_SIZEY && cu->lheight() <= MAX_TB_SIZEY )
{
......
......@@ -6699,7 +6699,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par
{
TransformUnit &tu = csFull->addTU(CS::isDualITree(cs) ? cu : currArea, partitioner.chType);
tu.depth = currDepth;
tu.mtsIdx = 0;
tu.mtsIdx = MTS_DCT2_DCT2;
tu.checkTuNoResidual( partitioner.currPartIdx() );
const Slice &slice = *cs.slice;
......@@ -6817,7 +6817,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par
if( isLuma( compID ) )
{
if( bestTU.mtsIdx == 1 && m_pcEncCfg->getUseTransformSkipFast() )
if( bestTU.mtsIdx == MTS_SKIP && m_pcEncCfg->getUseTransformSkipFast() )
{
continue;
}
......@@ -7908,4 +7908,4 @@ uint64_t InterSearch::xCalcPuMeBits(PredictionUnit& pu)
}
return m_CABACEstimator->getEstFracBits();
}
#endif
\ No newline at end of file
#endif
......@@ -2504,9 +2504,9 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp
}
m_pcTrQuant->transformNxN( tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr, &diagRatio, &horVerRatio );
#if INCLUDE_ISP_CFG_FLAG
if ( !tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed && tu.mtsIdx == 0 && ispSplitIsAllowed )
if ( !tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed && tu.mtsIdx == MTS_DCT2_DCT2 && ispSplitIsAllowed )
#else
if ( !tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed && tu.mtsIdx == 0 )
if ( !tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed && tu.mtsIdx == MTS_DCT2_DCT2 )
#endif
{
m_intraModeDiagRatio .push_back(diagRatio);
......@@ -2882,22 +2882,21 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par
if( transformIndex == 1 )
{
tu.mtsIdx = ( uiIntraMode < 34 ) ? 2 : 1; //(DST7,DCT8) : (DCT8,DST7)
tu.mtsIdx = ( uiIntraMode < 34 ) ? MTS_DST7_DCT8 : MTS_DCT8_DST7;
}
else if( transformIndex == 2 )
{
tu.mtsIdx = ( uiIntraMode < 34 ) ? 1 : 2; //(DCT8,DST7) : (DST7,DCT8)
tu.mtsIdx = ( uiIntraMode < 34 ) ? MTS_DCT8_DST7 : MTS_DST7_DCT8;
}
else
{
tu.mtsIdx = transformIndex;
tu.mtsIdx = MTS_DST7_DST7 + transformIndex;
}
}
else
{
tu.mtsIdx = transformIndex;
tu.mtsIdx = MTS_DST7_DST7 + transformIndex;
}
tu.mtsIdx += 2;
}
else
{
......@@ -2993,7 +2992,7 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par
bestDCT2cost = singleCostTmp;
}
#if JVET_N0217_MATRIX_INTRAPRED
if (!cu.ispMode && !cu.mipFlag && tu.mtsIdx == 0 )
if (!cu.ispMode && !cu.mipFlag && tu.mtsIdx == MTS_DCT2_DCT2 )
{
m_bestCostNonMip = std::min(m_bestCostNonMip, singleCostTmp);
}
......@@ -3754,4 +3753,4 @@ void IntraSearch::reduceHadCandList(static_vector<T, N>& candModeList, static_ve
candCostList = tempCandCostList;
numModesForFullRD = int(candModeList.size());
}
#endif
\ No newline at end of file
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment