From 705c478b7631640da96e4520c08e36df5e134418 Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Fri, 17 Jan 2020 15:29:47 +0100
Subject: [PATCH] remove macro JVET_P0170_ZERO_POS_SIMPLIFICATION

---
 source/Lib/CommonLib/DepQuant.cpp     | 10 ----------
 source/Lib/CommonLib/QuantRDOQ.cpp    |  4 ----
 source/Lib/CommonLib/Rom.cpp          |  8 --------
 source/Lib/CommonLib/Rom.h            |  4 ----
 source/Lib/CommonLib/TypeDef.h        |  1 -
 source/Lib/DecoderLib/CABACReader.cpp |  4 ----
 source/Lib/EncoderLib/CABACWriter.cpp |  4 ----
 7 files changed, 35 deletions(-)

diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp
index 051a30fcd..b6f0d97c6 100644
--- a/source/Lib/CommonLib/DepQuant.cpp
+++ b/source/Lib/CommonLib/DepQuant.cpp
@@ -1024,9 +1024,6 @@ namespace DQIntern
     const int8_t              m_stateId;
     const BinFracBits*const   m_sigFracBitsArray;
     const CoeffFracBits*const m_gtxFracBitsArray;
-#if !JVET_P0170_ZERO_POS_SIMPLIFICATION
-    const uint32_t*const      m_goRiceZeroArray;
-#endif
     CommonCtx&                m_commonCtx;
   public:
     unsigned                  effWidth;
@@ -1039,9 +1036,6 @@ namespace DQIntern
     , m_stateId         ( stateId )
     , m_sigFracBitsArray( rateEst.sigFlagBits(stateId) )
     , m_gtxFracBitsArray( rateEst.gtxFracBits(stateId) )
-#if !JVET_P0170_ZERO_POS_SIMPLIFICATION
-    , m_goRiceZeroArray ( g_auiGoRicePosCoeff0[std::max(0,stateId-1)] )
-#endif
     , m_commonCtx       ( commonCtx )
   {
   }
@@ -1192,11 +1186,7 @@ namespace DQIntern
 #undef UPDATE
         sumAbs = std::min<TCoeff>(31, sumAbs);
         m_goRicePar = g_auiGoRiceParsCoeff[sumAbs];
-#if JVET_P0170_ZERO_POS_SIMPLIFICATION
         m_goRiceZero = g_auiGoRicePosCoeff0(m_stateId, m_goRicePar);
-#else
-        m_goRiceZero = m_goRiceZeroArray[sumAbs];
-#endif
       }
     }
   }
diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp
index d111d442f..19ad8238f 100644
--- a/source/Lib/CommonLib/QuantRDOQ.cpp
+++ b/source/Lib/CommonLib/QuantRDOQ.cpp
@@ -763,11 +763,7 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID,
         {
           unsigned  sumAbs = cctx.templateAbsSum( iScanPos, piDstCoeff, 0 );
           goRiceParam             = g_auiGoRiceParsCoeff   [ sumAbs ];
-#if JVET_P0170_ZERO_POS_SIMPLIFICATION
           goRiceZero              = g_auiGoRicePosCoeff0(0, goRiceParam);
-#else
-          goRiceZero              = g_auiGoRicePosCoeff0[0][ sumAbs ];
-#endif
         }
 
         const BinFracBits fracBitsPar = fracBits.getFracBitsArray( uiParCtx );
diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp
index 5e6d86207..25a490a27 100644
--- a/source/Lib/CommonLib/Rom.cpp
+++ b/source/Lib/CommonLib/Rom.cpp
@@ -578,14 +578,6 @@ const uint32_t g_auiGoRiceParsCoeff[32] =
 {
   0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3
 };
-#if !JVET_P0170_ZERO_POS_SIMPLIFICATION
-const uint32_t g_auiGoRicePosCoeff0[3][32] =
-{
-  {0, 0, 0, 0, 0, 1, 2,    2, 2, 2, 2, 2, 4, 4,    4, 4, 4, 4,  4,  4,  4,  4,  4,  8,  8,  8,  8,  8,     8,  8,  8,  8},
-  {1, 1, 1, 1, 2, 3, 4,    4, 4, 6, 6, 6, 8, 8,    8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16,    16, 16, 16, 16},
-  {1, 1, 2, 2, 2, 3, 4,    4, 4, 6, 6, 6, 8, 8,    8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16,    16, 16, 16, 16}
-};
-#endif
 const char *MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM] =
 {
   {
diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h
index 8e03ba32d..929a75547 100644
--- a/source/Lib/CommonLib/Rom.h
+++ b/source/Lib/CommonLib/Rom.h
@@ -87,14 +87,10 @@ static const int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = {  6,
 extern const uint32_t   g_uiGroupIdx[ MAX_TB_SIZEY ];
 extern const uint32_t   g_uiMinInGroup[ LAST_SIGNIFICANT_GROUPS ];
 extern const uint32_t   g_auiGoRiceParsCoeff     [ 32 ];
-#if JVET_P0170_ZERO_POS_SIMPLIFICATION
 inline uint32_t g_auiGoRicePosCoeff0(int st, uint32_t ricePar)
 {
   return (st < 2 ? 1 : 2) << ricePar;
 }
-#else
-extern const uint32_t   g_auiGoRicePosCoeff0[ 3 ][ 32 ];
-#endif
 
 // ====================================================================================================================
 // Intra prediction table
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 71dea930a..689b059ca 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -121,7 +121,6 @@
 
 
 
-#define JVET_P0170_ZERO_POS_SIMPLIFICATION                1 // JVET-P0170: Simplification of deriving ZeroPos
 
 #define JVET_P0058_CHROMA_TS                              1 // JVET-P0058: Enable Transform skip for chroma
 #if JVET_AHG14_LOSSLESS && !JVET_P0058_CHROMA_TS
diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index eb24b163f..4f37f7eec 100644
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -3593,11 +3593,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
   {
     int       sumAll = cctx.templateAbsSum(scanPos, coeff, 0);
     int       rice      = g_auiGoRiceParsCoeff                        [sumAll];
-#if JVET_P0170_ZERO_POS_SIMPLIFICATION
     int       pos0      = g_auiGoRicePosCoeff0(state, rice);
-#else
-    int       pos0      = g_auiGoRicePosCoeff0[std::max(0, state - 1)][sumAll];
-#endif
     RExt__DECODER_DEBUG_BIT_STATISTICS_SET(ctype_escs);
     int       rem       = m_BinDecoder.decodeRemAbsEP( rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange() );
     DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, rice );
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index 4d995ae74..b4e013681 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -3318,11 +3318,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
     unsigned  absLevel  = abs( Coeff );
     int       sumAll = cctx.templateAbsSum(scanPos, coeff, 0);
     int       rice      = g_auiGoRiceParsCoeff                        [sumAll];
-#if JVET_P0170_ZERO_POS_SIMPLIFICATION
     int       pos0      = g_auiGoRicePosCoeff0(state, rice);
-#else
-    int       pos0      = g_auiGoRicePosCoeff0[std::max(0, state - 1)][sumAll];
-#endif
     unsigned  rem       = ( absLevel == 0 ? pos0 : absLevel <= pos0 ? absLevel-1 : absLevel );
     m_BinEncoder.encodeRemAbsEP( rem, rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange() );
     DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, rice );
-- 
GitLab