From a4b64b45173d4d9d14ab20ee75ccf4432771affb Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Thu, 30 Jul 2020 18:40:07 -0400
Subject: [PATCH] Remove code related to RDPCM

---
 doc/software-manual.tex                       |  10 -
 source/App/EncoderApp/EncApp.cpp              |   4 -
 source/App/EncoderApp/EncAppCfg.cpp           |   6 -
 source/App/EncoderApp/EncAppCfg.h             |   1 -
 source/Lib/CommonLib/CodingStatistics.h       |   2 -
 source/Lib/CommonLib/CodingStructure.cpp      |   1 -
 source/Lib/CommonLib/Contexts.cpp             |  16 --
 source/Lib/CommonLib/Contexts.h               |   2 -
 source/Lib/CommonLib/QuantRDOQ.cpp            |   5 +-
 source/Lib/CommonLib/QuantRDOQ.h              |   3 +-
 source/Lib/CommonLib/Slice.cpp                |   5 -
 source/Lib/CommonLib/Slice.h                  |   6 -
 source/Lib/CommonLib/TrQuant.cpp              | 176 ------------------
 source/Lib/CommonLib/TrQuant.h                |   3 -
 source/Lib/CommonLib/TypeDef.h                |  15 --
 source/Lib/CommonLib/Unit.cpp                 |   3 -
 source/Lib/CommonLib/Unit.h                   |   1 -
 source/Lib/CommonLib/UnitTools.cpp            |   6 -
 source/Lib/CommonLib/UnitTools.h              |   1 -
 source/Lib/CommonLib/dtrace_blockstatistics.h |   6 -
 source/Lib/DecoderLib/CABACReader.cpp         |  39 +---
 source/Lib/DecoderLib/CABACReader.h           |   1 -
 source/Lib/DecoderLib/VLCReader.cpp           |   2 -
 source/Lib/EncoderLib/CABACWriter.cpp         |  36 +---
 source/Lib/EncoderLib/CABACWriter.h           |   1 -
 source/Lib/EncoderLib/EncCfg.h                |   3 -
 source/Lib/EncoderLib/EncLib.cpp              |   4 -
 source/Lib/EncoderLib/VLCWriter.cpp           |   2 -
 28 files changed, 7 insertions(+), 353 deletions(-)

diff --git a/doc/software-manual.tex b/doc/software-manual.tex
index e53620930..5c87a7dde 100644
--- a/doc/software-manual.tex
+++ b/doc/software-manual.tex
@@ -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.
diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index b1621268c..742401d71 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -728,10 +728,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 );
diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp
index 1e4dd2c9c..985618aeb 100644
--- a/source/App/EncoderApp/EncAppCfg.cpp
+++ b/source/App/EncoderApp/EncAppCfg.cpp
@@ -1112,8 +1112,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")
@@ -2599,8 +2597,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.");
@@ -3817,8 +3813,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") );
diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h
index f8f54ee5d..d7c625c54 100644
--- a/source/App/EncoderApp/EncAppCfg.h
+++ b/source/App/EncoderApp/EncAppCfg.h
@@ -233,7 +233,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;
diff --git a/source/Lib/CommonLib/CodingStatistics.h b/source/Lib/CommonLib/CodingStatistics.h
index 1e1f0bab0..2cbb789a9 100644
--- a/source/Lib/CommonLib/CodingStatistics.h
+++ b/source/Lib/CommonLib/CodingStatistics.h
@@ -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",
diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp
index 1a83520a5..e85bdbfdc 100644
--- a/source/Lib/CommonLib/CodingStructure.cpp
+++ b/source/Lib/CommonLib/CodingStructure.cpp
@@ -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;
diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp
index eb3b2052c..b227c2d55 100644
--- a/source/Lib/CommonLib/Contexts.cpp
+++ b/source/Lib/CommonLib/Contexts.cpp
@@ -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, },
diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h
index 7759a98fd..46ba56ed8 100644
--- a/source/Lib/CommonLib/Contexts.h
+++ b/source/Lib/CommonLib/Contexts.h
@@ -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;
diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp
index 47cfc80fe..2700b6ec3 100644
--- a/source/Lib/CommonLib/QuantRDOQ.cpp
+++ b/source/Lib/CommonLib/QuantRDOQ.cpp
@@ -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();
 
diff --git a/source/Lib/CommonLib/QuantRDOQ.h b/source/Lib/CommonLib/QuantRDOQ.h
index ec3ca1c6d..f0e8dee72 100644
--- a/source/Lib/CommonLib/QuantRDOQ.h
+++ b/source/Lib/CommonLib/QuantRDOQ.h
@@ -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
diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index d7a57d2ff..8293d705b 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -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;
-  }
 }
 
 
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index ef6a5d6f9..6ca715641 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1324,7 +1324,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;
@@ -1338,8 +1337,6 @@ public:
   {
     return getTransformSkipRotationEnabledFlag()
         || getTransformSkipContextEnabledFlag()
-        || getRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT)
-        || getRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT)
         || getExtendedPrecisionProcessingFlag()
         || getIntraSmoothingDisabledFlag()
         || getHighPrecisionOffsetsEnabledFlag()
@@ -1354,9 +1351,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;     }
 
diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp
index d0df03baa..9c206440e 100644
--- a/source/Lib/CommonLib/TrQuant.cpp
+++ b/source/Lib/CommonLib/TrQuant.cpp
@@ -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];
diff --git a/source/Lib/CommonLib/TrQuant.h b/source/Lib/CommonLib/TrQuant.h
index 619f743f9..2646aa137 100644
--- a/source/Lib/CommonLib/TrQuant.h
+++ b/source/Lib/CommonLib/TrQuant.h
@@ -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 ); }
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index f9f3f30d0..eb1d98881 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -447,21 +447,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
 {
diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp
index 39b239117..ab3fc757e 100644
--- a/source/Lib/CommonLib/Unit.cpp
+++ b/source/Lib/CommonLib/Unit.cpp
@@ -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;
diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h
index e4e562d3b..8a6858fdf 100644
--- a/source/Lib/CommonLib/Unit.h
+++ b/source/Lib/CommonLib/Unit.h
@@ -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);
diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index 24631c3c0..7824020fc 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -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();
diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h
index b73d2d5d7..c87fbdc93 100644
--- a/source/Lib/CommonLib/UnitTools.h
+++ b/source/Lib/CommonLib/UnitTools.h
@@ -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);
diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h
index 4637d8be7..1a294fdbf 100644
--- a/source/Lib/CommonLib/dtrace_blockstatistics.h
+++ b/source/Lib/CommonLib/dtrace_blockstatistics.h
@@ -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) + "]"}},
diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index 695c4c4c0..28c602f8e 100644
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -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;
diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h
index a85e9a6c1..85869f9d5 100644
--- a/source/Lib/DecoderLib/CABACReader.h
+++ b/source/Lib/DecoderLib/CABACReader.h
@@ -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 );
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 0b2a77e0c..ba5a23bda 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -2272,8 +2272,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);
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index 6a048b0d7..7c17c24f5 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -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].x, cu.blocks[cu.chType].y, (int)cu.ispMode );
 }
 
-void CABACWriter::explicit_rdpcm_mode( const TransformUnit& tu, ComponentID compID )
-{
-  const CodingUnit& cu = *tu.cu;
-  if (!CU::isIntra(cu) && CU::isRDPCMEnabled(cu) && (tu.mtsIdx[compID] == MTS_SKIP))
-  {
-    ChannelType chType = toChannelType( compID );
-    switch( tu.rdpcm[compID] )
-    {
-    case RDPCM_VER:
-      m_BinEncoder.encodeBin( 1, Ctx::RdpcmFlag(chType) );
-      m_BinEncoder.encodeBin( 1, Ctx::RdpcmDir (chType) );
-      break;
-    case RDPCM_HOR:
-      m_BinEncoder.encodeBin( 1, Ctx::RdpcmFlag(chType) );
-      m_BinEncoder.encodeBin( 0, Ctx::RdpcmDir (chType) );
-      break;
-    default: // RDPCM_OFF
-      m_BinEncoder.encodeBin( 0, Ctx::RdpcmFlag(chType) );
-    }
-  }
-}
-
 void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx )
 {
   int chIdx = cu.isSepTree() && cu.chType == CHANNEL_TYPE_CHROMA ? 1 : 0;
diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h
index 7f05fa9e8..62a39d7a6 100644
--- a/source/Lib/EncoderLib/CABACWriter.h
+++ b/source/Lib/EncoderLib/CABACWriter.h
@@ -146,7 +146,6 @@ public:
   void        mts_idx                   ( const CodingUnit&             cu,       CUCtx*            cuCtx  );
   void        residual_lfnst_mode       ( const CodingUnit&             cu,       CUCtx&            cuCtx );
   void        isp_mode                  ( const CodingUnit&             cu );
-  void        explicit_rdpcm_mode       ( const TransformUnit&          tu,       ComponentID       compID );
   void        last_sig_coeff            ( CoeffCodingContext&           cctx,     const TransformUnit& tu, ComponentID       compID );
   void        residual_coding_subblock  ( CoeffCodingContext&           cctx,     const TCoeff*     coeff, const int stateTransTable, int& state );
   void        residual_codingTS         ( const TransformUnit&          tu,       ComponentID       compID );
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index 153b6c4e8..27067a199 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -484,7 +484,6 @@ protected:
   bool      m_transformSkipContextEnabledFlag;
   bool      m_persistentRiceAdaptationEnabledFlag;
   bool      m_cabacBypassAlignmentEnabledFlag;
-  bool      m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];
 #if SHARP_LUMA_DELTA_QP
   LumaLevelToDeltaQPMapping m_lumaLevelToDeltaQPMapping; ///< mapping from luma level to delta QP.
 #endif
@@ -1424,8 +1423,6 @@ public:
   void setPersistentRiceAdaptationEnabledFlag          (const bool value)       { m_persistentRiceAdaptationEnabledFlag = value; }
   bool getCabacBypassAlignmentEnabledFlag              ()       const      { return m_cabacBypassAlignmentEnabledFlag;  }
   void setCabacBypassAlignmentEnabledFlag              (const bool value)  { m_cabacBypassAlignmentEnabledFlag = value; }
-  bool getRdpcmEnabledFlag                             (const RDPCMSignallingMode signallingMode)        const      { return m_rdpcmEnabledFlag[signallingMode];  }
-  void setRdpcmEnabledFlag                             (const RDPCMSignallingMode signallingMode, const bool value) { m_rdpcmEnabledFlag[signallingMode] = value; }
   bool getUseTransformSkipFast                         ()      { return m_useTransformSkipFast;    }
   void setUseTransformSkipFast                         ( bool b ) { m_useTransformSkipFast  = b;   }
   uint32_t getLog2MaxTransformSkipBlockSize                () const      { return m_log2MaxTransformSkipBlockSize;     }
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 2f1662b12..d2a514bf8 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1397,10 +1397,6 @@ void EncLib::xInitSPS( SPS& sps )
   // Set up SPS range extension settings
   sps.getSpsRangeExtension().setTransformSkipRotationEnabledFlag(m_transformSkipRotationEnabledFlag);
   sps.getSpsRangeExtension().setTransformSkipContextEnabledFlag(m_transformSkipContextEnabledFlag);
-  for (uint32_t signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
-  {
-    sps.getSpsRangeExtension().setRdpcmEnabledFlag(RDPCMSignallingMode(signallingModeIndex), m_rdpcmEnabledFlag[signallingModeIndex]);
-  }
   sps.getSpsRangeExtension().setExtendedPrecisionProcessingFlag(m_extendedPrecisionProcessingFlag);
   sps.getSpsRangeExtension().setIntraSmoothingDisabledFlag( m_intraSmoothingDisabledFlag );
   sps.getSpsRangeExtension().setHighPrecisionOffsetsEnabledFlag(m_highPrecisionOffsetsEnabledFlag);
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index fa8e8ba0e..05c02d525 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -1420,8 +1420,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
 
           WRITE_FLAG( (spsRangeExtension.getTransformSkipRotationEnabledFlag() ? 1 : 0),      "transform_skip_rotation_enabled_flag");
           WRITE_FLAG( (spsRangeExtension.getTransformSkipContextEnabledFlag() ? 1 : 0),       "transform_skip_context_enabled_flag");
-          WRITE_FLAG( (spsRangeExtension.getRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT) ? 1 : 0), "implicit_rdpcm_enabled_flag" );
-          WRITE_FLAG( (spsRangeExtension.getRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT) ? 1 : 0), "explicit_rdpcm_enabled_flag" );
           WRITE_FLAG( (spsRangeExtension.getExtendedPrecisionProcessingFlag() ? 1 : 0),       "extended_precision_processing_flag" );
           WRITE_FLAG( (spsRangeExtension.getIntraSmoothingDisabledFlag() ? 1 : 0),            "intra_smoothing_disabled_flag" );
           WRITE_FLAG( (spsRangeExtension.getHighPrecisionOffsetsEnabledFlag() ? 1 : 0),       "high_precision_offsets_enabled_flag" );
-- 
GitLab