Commit c6b26fba authored by Xiang Li's avatar Xiang Li

Merge branch 'rm_rdpcm' into 'master'

Remove code related to RDPCM

See merge request !1818
parents e7809789 a4b64b45
Pipeline #5535 passed with stage
in 11 minutes and 43 seconds
......@@ -3279,16 +3279,6 @@ Specifies the maximum TU size for which transform-skip can be used; the minimum
\\
\Option{ImplicitResidualDPCM} &
\Default{false} &
When true, specifies the use of the implicitly signalled residual RDPCM tool (for intra). Version 1 and some Version 2 (RExt) profiles require this to be false.
\\
\Option{ExplicitResidualDPCM} &
\Default{false} &
When true, specifies the use of the explicitly signalled residual RDPCM tool (for intra-block-copy and inter). Version 1 and some Version 2 (RExt) profiles require this to be false.
\\
\Option{ResidualRotation} &
\Default{false} &
When true, specifies the use of the residual rotation tool. Version 1 and some Version 2 (RExt) profiles require this to be false.
......
......@@ -746,10 +746,6 @@ void EncApp::xInitLibCfg()
m_cEncLib.setPersistentRiceAdaptationEnabledFlag ( m_persistentRiceAdaptationEnabledFlag );
m_cEncLib.setCabacBypassAlignmentEnabledFlag ( m_cabacBypassAlignmentEnabledFlag );
m_cEncLib.setLog2MaxTransformSkipBlockSize ( m_log2MaxTransformSkipBlockSize );
for (uint32_t signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
{
m_cEncLib.setRdpcmEnabledFlag ( RDPCMSignallingMode(signallingModeIndex), m_rdpcmEnabledFlag[signallingModeIndex]);
}
m_cEncLib.setFastUDIUseMPMEnabled ( m_bFastUDIUseMPMEnabled );
m_cEncLib.setFastMEForGenBLowDelayEnabled ( m_bFastMEForGenBLowDelayEnabled );
m_cEncLib.setUseBLambdaForNonKeyLowDelayPictures ( m_bUseBLambdaForNonKeyLowDelayPictures );
......
......@@ -1118,8 +1118,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("ChromaTS", m_useChromaTS, false, "Enable encoder search of chromaTS")
("BDPCM", m_useBDPCM, false, "BDPCM (0:off, 1:luma and chroma)")
("ISPFast", m_useFastISP, false, "Fast encoder search for ISP")
("ImplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT], false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)")
("ExplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT], false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)")
("ResidualRotation", m_transformSkipRotationEnabledFlag, false, "Enable rotation of transform-skipped and transquant-bypassed TUs through 180 degrees prior to entropy coding (not valid in V1 profiles)")
("SingleSignificanceMapContext", m_transformSkipContextEnabledFlag, false, "Enable, for transform-skipped and transquant-bypassed TUs, the selection of a single significance map context variable for all coefficients (not valid in V1 profiles)")
("GolombRiceParameterAdaptation", m_persistentRiceAdaptationEnabledFlag, false, "Enable the adaptation of the Golomb-Rice parameter over the course of each slice")
......@@ -2605,8 +2603,6 @@ bool EncAppCfg::xCheckParameter()
xConfirmPara(m_log2MaxTransformSkipBlockSize>=6, "Transform Skip Log2 Max Size must be less or equal to 5 for given profile.");
xConfirmPara(m_transformSkipRotationEnabledFlag==true, "UseResidualRotation must not be enabled for given profile.");
xConfirmPara(m_transformSkipContextEnabledFlag==true, "UseSingleSignificanceMapContext must not be enabled for given profile.");
xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT]==true, "ImplicitResidualDPCM must not be enabled for given profile.");
xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT]==true, "ExplicitResidualDPCM must not be enabled for given profile.");
xConfirmPara(m_persistentRiceAdaptationEnabledFlag==true, "GolombRiceParameterAdaption must not be enabled for given profile.");
xConfirmPara(m_extendedPrecisionProcessingFlag==true, "UseExtendedPrecision must not be enabled for given profile.");
xConfirmPara(m_highPrecisionOffsetsEnabledFlag==true, "UseHighPrecisionPredictionWeighting must not be enabled for given profile.");
......@@ -3823,8 +3819,6 @@ void EncAppCfg::xPrintParameter()
msg( DETAILS, "Intra reference smoothing : %s\n", (m_enableIntraReferenceSmoothing ? "Enabled" : "Disabled") );
msg( DETAILS, "cu_chroma_qp_offset_subdiv : %d\n", m_cuChromaQpOffsetSubdiv);
msg( DETAILS, "extended_precision_processing_flag : %s\n", (m_extendedPrecisionProcessingFlag ? "Enabled" : "Disabled") );
msg( DETAILS, "implicit_rdpcm_enabled_flag : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ? "Enabled" : "Disabled") );
msg( DETAILS, "explicit_rdpcm_enabled_flag : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ? "Enabled" : "Disabled") );
msg( DETAILS, "transform_skip_rotation_enabled_flag : %s\n", (m_transformSkipRotationEnabledFlag ? "Enabled" : "Disabled") );
msg( DETAILS, "transform_skip_context_enabled_flag : %s\n", (m_transformSkipContextEnabledFlag ? "Enabled" : "Disabled") );
msg( DETAILS, "high_precision_offsets_enabled_flag : %s\n", (m_highPrecisionOffsetsEnabledFlag ? "Enabled" : "Disabled") );
......
......@@ -240,7 +240,6 @@ protected:
uint32_t m_log2MaxTransformSkipBlockSize; ///< transform-skip maximum size (minimum of 2)
bool m_transformSkipRotationEnabledFlag; ///< control flag for transform-skip/transquant-bypass residual rotation
bool m_transformSkipContextEnabledFlag; ///< control flag for transform-skip/transquant-bypass single significance map context
bool m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];///< control flags for residual DPCM
bool m_persistentRiceAdaptationEnabledFlag; ///< control flag for Golomb-Rice parameter adaptation over each slice
bool m_cabacBypassAlignmentEnabledFlag;
bool m_ISP;
......
......@@ -102,7 +102,6 @@ enum CodingStatisticsType
STATS__CABAC_FIXED_BITS,
STATS__BYTE_ALIGNMENT_BITS,
STATS__TRAILING_BITS,
STATS__EXPLICIT_RDPCM_BITS,
STATS__CABAC_EP_BIT_ALIGNMENT,
STATS__CABAC_BITS__ALIGNED_SIGN_BIT,
STATS__CABAC_BITS__ALIGNED_ESCAPE_BITS,
......@@ -197,7 +196,6 @@ static inline const char* getName(CodingStatisticsType name)
"CABAC_FIXED_BITS",
"BYTE_ALIGNMENT_BITS",
"TRAILING_BITS",
"EXPLICIT_RDPCM_BITS",
"CABAC_EP_BIT_ALIGNMENT",
"CABAC_BITS__ALIGNED_SIGN_BIT",
"CABAC_BITS__ALIGNED_ESCAPE_BITS",
......
......@@ -683,7 +683,6 @@ void CodingStructure::addEmptyTUs( Partitioner &partitioner )
{
tu.getCoeffs( ComponentID( compID ) ).fill( 0 );
tu.getPcmbuf( ComponentID( compID ) ).fill( 0 );
tu.rdpcm[compID] = RDPCM_OFF;
}
}
tu.depth = trDepth;
......
......@@ -696,22 +696,6 @@ const CtxSet ContextSetCfg::CopyRunModel = ContextSetCfg::addCtxSet
{ 0, 9, 5, },
});
const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet
({
{ CNU, CNU, },
{ CNU, CNU, },
{ CNU, CNU, },
{ DWS, DWS, },
});
const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet
({
{ CNU, CNU, },
{ CNU, CNU, },
{ CNU, CNU, },
{ DWS, DWS, },
});
const CtxSet ContextSetCfg::TransformSkipFlag = ContextSetCfg::addCtxSet
({
{ 25, 17, },
......
......@@ -249,8 +249,6 @@ public:
static const CtxSet RunTypeFlag;
static const CtxSet IdxRunModel;
static const CtxSet CopyRunModel;
static const CtxSet RdpcmFlag;
static const CtxSet RdpcmDir;
static const CtxSet SbtFlag;
static const CtxSet SbtQuadFlag;
static const CtxSet SbtHorFlag;
......
......@@ -540,7 +540,7 @@ void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeff
{
if( (tu.cu->bdpcmMode && isLuma(compID)) || (isChroma(compID) && tu.cu->bdpcmModeChroma ) )
{
forwardRDPCM( tu, compID, pSrc, uiAbsSum, cQP, ctx );
forwardBDPCM(tu, compID, pSrc, uiAbsSum, cQP, ctx);
}
else
{
......@@ -1399,7 +1399,8 @@ void QuantRDOQ::xRateDistOptQuantTS( TransformUnit &tu, const ComponentID &compI
}
}
void QuantRDOQ::forwardRDPCM( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &coeffs, TCoeff &absSum, const QpParam &qp, const Ctx &ctx )
void QuantRDOQ::forwardBDPCM(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &coeffs, TCoeff &absSum,
const QpParam &qp, const Ctx &ctx)
{
const FracBitsAccess& fracBits = ctx.getFracBitsAcess();
......
......@@ -65,7 +65,8 @@ public:
void setScalingList ( ScalingList *scalingList, const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths);
// quantization
void quant ( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx& ctx );
void forwardRDPCM ( TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx &ctx );
void forwardBDPCM(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum,
const QpParam &cQP, const Ctx &ctx);
private:
double* xGetErrScaleCoeffSL ( uint32_t list, uint32_t sizeX, uint32_t sizeY, int qp ) { return m_errScale[sizeX][sizeY][list][qp]; }; //!< get Error Scale Coefficent
......
......@@ -2845,17 +2845,12 @@ void PicHeader::resetWpScaling()
SPSRExt::SPSRExt()
: m_transformSkipRotationEnabledFlag (false)
, m_transformSkipContextEnabledFlag (false)
// m_rdpcmEnabledFlag initialized below
, m_extendedPrecisionProcessingFlag (false)
, m_intraSmoothingDisabledFlag (false)
, m_highPrecisionOffsetsEnabledFlag (false)
, m_persistentRiceAdaptationEnabledFlag(false)
, m_cabacBypassAlignmentEnabledFlag (false)
{
for (uint32_t signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
{
m_rdpcmEnabledFlag[signallingModeIndex] = false;
}
}
......
......@@ -1341,7 +1341,6 @@ class SPSRExt // Names aligned to text specification
private:
bool m_transformSkipRotationEnabledFlag;
bool m_transformSkipContextEnabledFlag;
bool m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];
bool m_extendedPrecisionProcessingFlag;
bool m_intraSmoothingDisabledFlag;
bool m_highPrecisionOffsetsEnabledFlag;
......@@ -1355,8 +1354,6 @@ public:
{
return getTransformSkipRotationEnabledFlag()
|| getTransformSkipContextEnabledFlag()
|| getRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT)
|| getRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT)
|| getExtendedPrecisionProcessingFlag()
|| getIntraSmoothingDisabledFlag()
|| getHighPrecisionOffsetsEnabledFlag()
......@@ -1371,9 +1368,6 @@ public:
bool getTransformSkipContextEnabledFlag() const { return m_transformSkipContextEnabledFlag; }
void setTransformSkipContextEnabledFlag(const bool value) { m_transformSkipContextEnabledFlag = value; }
bool getRdpcmEnabledFlag(const RDPCMSignallingMode signallingMode) const { return m_rdpcmEnabledFlag[signallingMode]; }
void setRdpcmEnabledFlag(const RDPCMSignallingMode signallingMode, const bool value) { m_rdpcmEnabledFlag[signallingMode] = value; }
bool getExtendedPrecisionProcessingFlag() const { return m_extendedPrecisionProcessingFlag; }
void setExtendedPrecisionProcessingFlag(bool value) { m_extendedPrecisionProcessingFlag = value; }
......
......@@ -554,68 +554,8 @@ void TrQuant::invTransformNxN( TransformUnit &tu, const ComponentID &compID, Pel
//DTRACE_BLOCK_COEFF(tu.getCoeffs(compID), tu, tu.cu->predMode, compID);
DTRACE_PEL_BUF( D_RESIDUALS, pResi, tu, tu.cu->predMode, compID);
invRdpcmNxN(tu, compID, pResi);
}
void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf &pcResidual)
{
const CompArea &area = tu.blocks[compID];
if (CU::isRDPCMEnabled(*tu.cu) && (tu.mtsIdx[compID] == MTS_SKIP))
{
const uint32_t uiWidth = area.width;
const uint32_t uiHeight = area.height;
RDPCMMode rdpcmMode = RDPCM_OFF;
if (tu.cu->predMode == MODE_INTRA)
{
const ChannelType chType = toChannelType(compID);
const uint32_t uiChFinalMode = PU::getFinalIntraMode(*tu.cs->getPU(area.pos(), chType), chType);
if (uiChFinalMode == VER_IDX || uiChFinalMode == HOR_IDX)
{
rdpcmMode = (uiChFinalMode == VER_IDX) ? RDPCM_VER : RDPCM_HOR;
}
}
else // not intra case
{
rdpcmMode = RDPCMMode(tu.rdpcm[compID]);
}
const TCoeff pelMin = (TCoeff) std::numeric_limits<Pel>::min();
const TCoeff pelMax = (TCoeff) std::numeric_limits<Pel>::max();
if (rdpcmMode == RDPCM_VER)
{
for (uint32_t uiX = 0; uiX < uiWidth; uiX++)
{
TCoeff accumulator = pcResidual.at(uiX, 0); // 32-bit accumulator
for (uint32_t uiY = 1; uiY < uiHeight; uiY++)
{
accumulator += pcResidual.at(uiX, uiY);
pcResidual.at(uiX, uiY) = (Pel) Clip3<TCoeff>(pelMin, pelMax, accumulator);
}
}
}
else if (rdpcmMode == RDPCM_HOR)
{
for (uint32_t uiY = 0; uiY < uiHeight; uiY++)
{
TCoeff accumulator = pcResidual.at(0, uiY);
for (uint32_t uiX = 1; uiX < uiWidth; uiX++)
{
accumulator += pcResidual.at(uiX, uiY);
pcResidual.at(uiX, uiY) = (Pel) Clip3<TCoeff>(pelMin, pelMax, accumulator);
}
}
}
}
}
std::pair<int64_t,int64_t> TrQuant::fwdTransformICT( const TransformUnit &tu, const PelBuf &resCb, const PelBuf &resCr, PelBuf &resC1, PelBuf &resC2, int jointCbCr )
{
CHECK( Size(resCb) != Size(resCr), "resCb and resCr have different sizes" );
......@@ -1043,15 +983,11 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const
return;
}
RDPCMMode rdpcmMode = RDPCM_OFF;
rdpcmNxN(tu, compID, cQP, uiAbsSum, rdpcmMode);
if ((tu.cu->bdpcmMode && isLuma(compID)) || (!isLuma(compID) && tu.cu->bdpcmModeChroma))
{
tu.mtsIdx[compID] = MTS_SKIP;
}
if (rdpcmMode == RDPCM_OFF)
{
uiAbsSum = 0;
......@@ -1093,118 +1029,6 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const
}
void TrQuant::applyForwardRDPCM(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const RDPCMMode &mode)
{
const uint32_t uiWidth = tu.blocks[compID].width;
const uint32_t uiHeight = tu.blocks[compID].height;
const bool rotateResidual = TU::isNonTransformedResidualRotated(tu, compID);
const uint32_t uiSizeMinus1 = (uiWidth * uiHeight) - 1;
const CPelBuf pcResidual = tu.cs->getResiBuf(tu.blocks[compID]);
const CoeffBuf pcCoeff = tu.getCoeffs(compID);
uint32_t uiX = 0;
uint32_t uiY = 0;
uint32_t &majorAxis = (mode == RDPCM_VER) ? uiX : uiY;
uint32_t &minorAxis = (mode == RDPCM_VER) ? uiY : uiX;
const uint32_t majorAxisLimit = (mode == RDPCM_VER) ? uiWidth : uiHeight;
const uint32_t minorAxisLimit = (mode == RDPCM_VER) ? uiHeight : uiWidth;
const bool bUseHalfRoundingPoint = (mode != RDPCM_OFF);
uiAbsSum = 0;
for (majorAxis = 0; majorAxis < majorAxisLimit; majorAxis++)
{
TCoeff accumulatorValue = 0; // 32-bit accumulator
for (minorAxis = 0; minorAxis < minorAxisLimit; minorAxis++)
{
const uint32_t sampleIndex = (uiY * uiWidth) + uiX;
const uint32_t coefficientIndex = (rotateResidual ? (uiSizeMinus1-sampleIndex) : sampleIndex);
const Pel currentSample = pcResidual.at(uiX, uiY);
const TCoeff encoderSideDelta = TCoeff(currentSample) - accumulatorValue;
Pel reconstructedDelta;
m_quant->transformSkipQuantOneSample(tu, compID, encoderSideDelta, pcCoeff.buf[coefficientIndex], coefficientIndex, cQP, bUseHalfRoundingPoint);
m_quant->invTrSkipDeQuantOneSample (tu, compID, pcCoeff.buf[coefficientIndex], reconstructedDelta, coefficientIndex, cQP);
uiAbsSum += abs(pcCoeff.buf[coefficientIndex]);
if (mode != RDPCM_OFF)
{
accumulatorValue += reconstructedDelta;
}
}
}
}
void TrQuant::rdpcmNxN(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, RDPCMMode &rdpcmMode)
{
if (!CU::isRDPCMEnabled(*tu.cu) || (tu.mtsIdx[compID] != MTS_SKIP))
{
rdpcmMode = RDPCM_OFF;
}
else if (CU::isIntra(*tu.cu))
{
const ChannelType chType = toChannelType(compID);
const uint32_t uiChFinalMode = PU::getFinalIntraMode(*tu.cs->getPU(tu.blocks[compID].pos(), chType), chType);
if (uiChFinalMode == VER_IDX || uiChFinalMode == HOR_IDX)
{
rdpcmMode = (uiChFinalMode == VER_IDX) ? RDPCM_VER : RDPCM_HOR;
applyForwardRDPCM(tu, compID, cQP, uiAbsSum, rdpcmMode);
}
else
{
rdpcmMode = RDPCM_OFF;
}
}
else // not intra, need to select the best mode
{
const CompArea &area = tu.blocks[compID];
const uint32_t uiWidth = area.width;
const uint32_t uiHeight = area.height;
RDPCMMode bestMode = NUMBER_OF_RDPCM_MODES;
TCoeff bestAbsSum = std::numeric_limits<TCoeff>::max();
TCoeff bestCoefficients[MAX_TB_SIZEY * MAX_TB_SIZEY];
for (uint32_t modeIndex = 0; modeIndex < NUMBER_OF_RDPCM_MODES; modeIndex++)
{
const RDPCMMode mode = RDPCMMode(modeIndex);
TCoeff currAbsSum = 0;
applyForwardRDPCM(tu, compID, cQP, uiAbsSum, rdpcmMode);
if (currAbsSum < bestAbsSum)
{
bestMode = mode;
bestAbsSum = currAbsSum;
if (mode != RDPCM_OFF)
{
CoeffBuf(bestCoefficients, uiWidth, uiHeight).copyFrom(tu.getCoeffs(compID));
}
}
}
rdpcmMode = bestMode;
uiAbsSum = bestAbsSum;
if (rdpcmMode != RDPCM_OFF) //the TU is re-transformed and quantized if DPCM_OFF is returned, so there is no need to preserve it here
{
tu.getCoeffs(compID).copyFrom(CoeffBuf(bestCoefficients, uiWidth, uiHeight));
}
}
tu.rdpcm[compID] = rdpcmMode;
}
void TrQuant::xTransformSkip(const TransformUnit &tu, const ComponentID &compID, const CPelBuf &resi, TCoeff* psCoeff)
{
const CompArea &rect = tu.blocks[compID];
......
......@@ -100,8 +100,6 @@ public:
void invTransformNxN (TransformUnit &tu, const ComponentID &compID, PelBuf &pResi, const QpParam &cQPs);
void transformNxN ( TransformUnit& tu, const ComponentID& compID, const QpParam& cQP, std::vector<TrMode>* trModes, const int maxCand );
void transformNxN ( TransformUnit& tu, const ComponentID& compID, const QpParam& cQP, TCoeff& uiAbsSum, const Ctx& ctx, const bool loadTr = false );
void rdpcmNxN (TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, RDPCMMode &rdpcmMode);
void applyForwardRDPCM(TransformUnit &tu, const ComponentID &compID, const QpParam &cQP, TCoeff &uiAbsSum, const RDPCMMode &rdpcmMode);
void transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &compID, const TCoeff &resiDiff, TCoeff &coeff, const uint32_t &uiPos, const QpParam &cQP, const bool bUseHalfRoundingPoint);
void invTrSkipDeQuantOneSample (TransformUnit &tu, const ComponentID &compID, const TCoeff &pcCoeff, Pel &reconSample, const uint32_t &uiPos, const QpParam &cQP);
......@@ -110,7 +108,6 @@ public:
std::pair<int64_t,int64_t> fwdTransformICT ( const TransformUnit &tu, const PelBuf &resCb, const PelBuf &resCr, PelBuf& resC1, PelBuf& resC2, int jointCbCr = -1 );
std::vector<int> selectICTCandidates ( const TransformUnit &tu, CompStorage* resCb, CompStorage* resCr );
void invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf &pcResidual);
#if RDOQ_CHROMA_LAMBDA
void setLambdas ( const double lambdas[MAX_NUM_COMPONENT] ) { m_quant->setLambdas( lambdas ); }
void selectLambda( const ComponentID compIdx ) { m_quant->selectLambda( compIdx ); }
......
......@@ -449,21 +449,6 @@ enum SbtMode
NUMBER_SBT_MODE
};
enum RDPCMMode
{
RDPCM_OFF = 0,
RDPCM_HOR = 1,
RDPCM_VER = 2,
NUMBER_OF_RDPCM_MODES = 3
};
enum RDPCMSignallingMode
{
RDPCM_SIGNAL_IMPLICIT = 0,
RDPCM_SIGNAL_EXPLICIT = 1,
NUMBER_OF_RDPCM_SIGNALLING_MODES = 2
};
/// supported slice type
enum SliceType
{
......
......@@ -736,7 +736,6 @@ void TransformUnit::initData()
for( unsigned i = 0; i < MAX_NUM_TBLOCKS; i++ )
{
cbf[i] = 0;
rdpcm[i] = NUMBER_OF_RDPCM_MODES;
mtsIdx[i] = MTS_DCT2_DCT2;
}
depth = 0;
......@@ -779,7 +778,6 @@ TransformUnit& TransformUnit::operator=(const TransformUnit& other)
if (m_runType[i] && other.m_runType[i] && m_runType[i] != other.m_runType[i] ) memcpy(m_runType[i], other.m_runType[i], sizeof(bool) * area);
}
cbf[i] = other.cbf[i];
rdpcm[i] = other.rdpcm[i];
mtsIdx[i] = other.mtsIdx[i];
}
depth = other.depth;
......@@ -804,7 +802,6 @@ void TransformUnit::copyComponentFrom(const TransformUnit& other, const Componen
}
cbf[i] = other.cbf[i];
rdpcm[i] = other.rdpcm[i];
depth = other.depth;
mtsIdx[i] = other.mtsIdx[i];
noResidual = other.noResidual;
......
......@@ -458,7 +458,6 @@ struct TransformUnit : public UnitArea
bool noResidual;
uint8_t jointCbCr;
uint8_t cbf [ MAX_NUM_TBLOCKS ];
RDPCMMode rdpcm [ MAX_NUM_TBLOCKS ];
TransformUnit() : chType( CH_L ) { }
TransformUnit(const UnitArea& unit);
......
......@@ -283,12 +283,6 @@ bool CU::isPLT(const CodingUnit &cu)
return cu.predMode == MODE_PLT;
}
bool CU::isRDPCMEnabled(const CodingUnit& cu)
{
return cu.cs->sps->getSpsRangeExtension().getRdpcmEnabledFlag(cu.predMode == MODE_INTRA ? RDPCM_SIGNAL_IMPLICIT : RDPCM_SIGNAL_EXPLICIT);
}
bool CU::isSameSlice(const CodingUnit& cu, const CodingUnit& cu2)
{
return cu.slice->getIndependentSliceIdx() == cu2.slice->getIndependentSliceIdx();
......
......@@ -60,7 +60,6 @@ namespace CU
bool isInter (const CodingUnit &cu);
bool isIBC (const CodingUnit &cu);
bool isPLT (const CodingUnit &cu);
bool isRDPCMEnabled (const CodingUnit &cu);
bool isSameCtu (const CodingUnit &cu, const CodingUnit &cu2);
bool isSameSlice (const CodingUnit &cu, const CodingUnit &cu2);
......
......@@ -72,9 +72,6 @@ enum class BlockStatistic {
IndependentSliceIdx,
LFNSTIdx,
JointCbCr,
RDPCM_Y,
RDPCM_Cb,
RDPCM_Cr,
// intra
Luma_IntraMode,
......@@ -167,9 +164,6 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType
{ BlockStatistic::IndependentSliceIdx, std::tuple<std::string, BlockStatisticType, std::string>{"IndependentSliceIdx", BlockStatisticType::Integer, ""}},
{ BlockStatistic::LFNSTIdx, std::tuple<std::string, BlockStatisticType, std::string>{"LFNSTIdx", BlockStatisticType::Integer, "[0, 3]"}},
{ BlockStatistic::JointCbCr, std::tuple<std::string, BlockStatisticType, std::string>{"JointCbCr", BlockStatisticType::Flag, ""}},
{ BlockStatistic::RDPCM_Y, std::tuple<std::string, BlockStatisticType, std::string>{"RDPCM_Y", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}},
{ BlockStatistic::RDPCM_Cb, std::tuple<std::string, BlockStatisticType, std::string>{"RDPCM_Cb", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}},
{ BlockStatistic::RDPCM_Cr, std::tuple<std::string, BlockStatisticType, std::string>{"RDPCM_Cr", BlockStatisticType::Integer, "[0, " + std::to_string(NUMBER_OF_RDPCM_MODES) + "]"}},
{ BlockStatistic::MIPFlag, std::tuple<std::string, BlockStatisticType, std::string>{"MIPFlag", BlockStatisticType::Flag, ""}},
{ BlockStatistic::ISPMode, std::tuple<std::string, BlockStatisticType, std::string>{"ISPMode", BlockStatisticType::Integer, "[0, " + std::to_string(NUM_INTRA_SUBPARTITIONS_MODES) + "]"}},
......
......@@ -2864,7 +2864,6 @@ void CABACReader::cu_chroma_qp_offset( CodingUnit& cu )
//--------------------------------------------------------------------------------
// void residual_coding ( tu, compID )
// bool transform_skip_flag ( tu, compID )
// RDPCMMode explicit_rdpcm_mode ( tu, compID )
// int last_sig_coeff ( coeffCtx )
// void residual_coding_subblock( coeffCtx )
//================================================================================
......@@ -2891,9 +2890,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx&
if( compID == COMPONENT_Cr && tu.jointCbCr == 3 )
return;
// parse transform skip and explicit rdpcm mode
ts_flag ( tu, compID );
explicit_rdpcm_mode( tu, compID );
if( tu.mtsIdx[compID] == MTS_SKIP && !tu.cs->slice->getTSResidualCodingDisabledFlag() )
{
......@@ -2902,16 +2899,7 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx&
}
// determine sign hiding
bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && tu.rdpcm[compID] == RDPCM_OFF );
if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx[compID] == MTS_SKIP )
{
const ChannelType chType = toChannelType( compID );
const unsigned intraMode = PU::getFinalIntraMode( *cu.cs->getPU( tu.blocks[compID].pos(), chType ), chType );
if( intraMode == HOR_IDX || intraMode == VER_IDX )
{
signHiding = false;
}
}
bool signHiding = cu.cs->slice->getSignDataHidingEnabledFlag();
// init coeff coding context
CoeffCodingContext cctx ( tu, compID, signHiding );
......@@ -3032,31 +3020,6 @@ void CABACReader::isp_mode( CodingUnit& cu )
DTRACE( g_trace_ctx, D_SYNTAX, "intra_subPartitions() etype=%d pos=(%d,%d) ispIdx=%d\n", cu.chType, cu.blocks[cu.chType].x, cu.blocks[cu.chType].y, (int)cu.ispMode );
}
void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID )
{
const CodingUnit& cu = *tu.cu;
tu.rdpcm[compID] = RDPCM_OFF;
if (!CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && ( tu.mtsIdx[compID] == MTS_SKIP))
{
RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE( STATS__EXPLICIT_RDPCM_BITS, tu.blocks[tu.chType].lumaSize() );
ChannelType chType = toChannelType( compID );
if( m_BinDecoder.decodeBin( Ctx::RdpcmFlag( chType ) ) )
{
if( m_BinDecoder.decodeBin( Ctx::RdpcmDir( chType ) ) )
{
tu.rdpcm[compID] = RDPCM_VER;
}
else
{
tu.rdpcm[compID] = RDPCM_HOR;
}
}
}
}
void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx )
{
int chIdx = cu.isSepTree() && cu.chType == CHANNEL_TYPE_CHROMA ? 1 : 0;
......
......@@ -135,7 +135,6 @@ public:
void mts_idx ( CodingUnit& cu, CUCtx& cuCtx );
void residual_lfnst_mode ( CodingUnit& cu, CUCtx& cuCtx );
void isp_mode ( CodingUnit& cu );
void explicit_rdpcm_mode ( TransformUnit& tu, ComponentID compID );
int last_sig_coeff ( CoeffCodingContext& cctx, TransformUnit& tu, ComponentID compID );
void residual_coding_subblock ( CoeffCodingContext& cctx, TCoeff* coeff, const int stateTransTable, int& state );
void residual_codingTS ( TransformUnit& tu, ComponentID compID );
......
......@@ -2282,8 +2282,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
SPSRExt &spsRangeExtension = pcSPS->getSpsRangeExtension();
READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag"); spsRangeExtension.setTransformSkipRotationEnabledFlag(uiCode != 0);
READ_FLAG( uiCode, "transform_skip_context_enabled_flag"); spsRangeExtension.setTransformSkipContextEnabledFlag (uiCode != 0);
READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0));
READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0));
READ_FLAG( uiCode, "extended_precision_processing_flag"); spsRangeExtension.setExtendedPrecisionProcessingFlag (uiCode != 0);
READ_FLAG( uiCode, "intra_smoothing_disabled_flag"); spsRangeExtension.setIntraSmoothingDisabledFlag (uiCode != 0);
READ_FLAG( uiCode, "high_precision_offsets_enabled_flag"); spsRangeExtension.setHighPrecisionOffsetsEnabledFlag (uiCode != 0);
......
......@@ -2603,7 +2603,6 @@ void CABACWriter::cu_chroma_qp_offset( const CodingUnit& cu )
//--------------------------------------------------------------------------------
// void residual_coding ( tu, compID )
// void transform_skip_flag ( tu, compID )
// void explicit_rdpcm_mode ( tu, compID )
// void last_sig_coeff ( coeffCtx )
// void residual_coding_subblock( coeffCtx )
//================================================================================
......@@ -2630,9 +2629,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID,
if( compID == COMPONENT_Cr && tu.jointCbCr == 3 )
return;
// code transform skip and explicit rdpcm mode
ts_flag ( tu, compID );
explicit_rdpcm_mode( tu, compID );
if( tu.mtsIdx[compID] == MTS_SKIP && !tu.cs->slice->getTSResidualCodingDisabledFlag() )
{
......@@ -2641,16 +2638,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID,
}
// determine sign hiding
bool signHiding = ( cu.cs->slice->getSignDataHidingEnabledFlag() && tu.rdpcm[compID] == RDPCM_OFF );
if( signHiding && CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && tu.mtsIdx[compID] == MTS_SKIP)
{
const ChannelType chType = toChannelType( compID );
const unsigned intraMode = PU::getFinalIntraMode( *cu.cs->getPU( tu.blocks[compID].pos(), chType ), chType );
if( intraMode == HOR_IDX || intraMode == VER_IDX )
{
signHiding = false;
}
}
bool signHiding = cu.cs->slice->getSignDataHidingEnabledFlag();
// init coeff coding context
CoeffCodingContext cctx ( tu, compID, signHiding );
......@@ -2780,28 +2768,6 @@ void CABACWriter::isp_mode( const CodingUnit& cu )
DTRACE( g_trace_ctx, D_SYNTAX, "intra_subPartitions() etype=%d pos=(%d,%d) ispIdx=%d\n", cu.chType, cu.blocks[cu.chType