From f8007289e86b0ed5d828f51aad303cce36ffcd72 Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Fri, 15 Jan 2021 11:11:01 -0500
Subject: [PATCH] remove macro JVET_T0091_LMCS_ENC_OVERFLOW_FIX

---
 source/Lib/CommonLib/TypeDef.h       |  1 -
 source/Lib/EncoderLib/EncReshape.cpp | 33 ----------------------------
 2 files changed, 34 deletions(-)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 4fb6b87ae..25d3c6a67 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -56,7 +56,6 @@
 
 #define FIX_TICKET_1442_PTL_IN_VPS                        1 // Fix PTL signalling in VPS such that also the sublayer with the second highest TemporalID is signalled
 #define JVET_S0078_NOOUTPUTPRIORPICFLAG                   0 // JVET-S0078: Handling of NoOutputOfPriorPicsFlag in output process
-#define JVET_T0091_LMCS_ENC_OVERFLOW_FIX                  1 // JVET-T0091: LMCS encoder overflow fix at high bit-depth for SDR
 #define JVET_S0163_ON_TARGETOLS_SUBLAYERS                 1 // JVET-S0163: On target OLS and sublayers for decoding (OPI NAL Unit)
 #define JVET_R0266_GCI                                    1 // JVET-R0266 #5: Specify that no_gdr_constraint_flag equal to 1 specifies that sps_gdr_enabled_flag shall be equal to 0
 #define JVET_S0084_S0110_RADL                             1 // When the current picture is a RADL picture, allow RASL pictures with pps_mixed_nalu_types_in_pic_flag is equal to 1 in active entries in RefPicList[ 0 ] or RefPicList[ 1 ]
diff --git a/source/Lib/EncoderLib/EncReshape.cpp b/source/Lib/EncoderLib/EncReshape.cpp
index 1a4291cd1..a4de78ad2 100644
--- a/source/Lib/EncoderLib/EncReshape.cpp
+++ b/source/Lib/EncoderLib/EncReshape.cpp
@@ -228,11 +228,7 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats)
         {
           for (bx = x1; bx <= x2; bx++)
           {
-#if JVET_T0091_LMCS_ENC_OVERFLOW_FIX
             tempSq = (int64_t)pWinY[bx] * (int64_t)pWinY[bx];
-#else
-            tempSq = pWinY[bx] * pWinY[bx];
-#endif
             leftSum += pWinY[bx];
             leftSumSq += tempSq;
             leftColSum[bx] += pWinY[bx];
@@ -259,11 +255,7 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats)
           for (bx = x1; bx <= x2; bx++)
           {
             topRowSum[y + winLens] += pWinY[bx];
-#if JVET_T0091_LMCS_ENC_OVERFLOW_FIX
             topRowSumSq[y + winLens] += (int64_t)pWinY[bx] * (int64_t)pWinY[bx];
-#else
-            topRowSumSq[y + winLens] += pWinY[bx] * pWinY[bx];
-#endif
           }
           topSum += topRowSum[y + winLens];
           topSumSq += topRowSumSq[y + winLens];
@@ -282,11 +274,7 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats)
           for (bx = x1; bx <= x2; bx++)
           {
             leftColSum[bx] += pWinY[bx];
-#if JVET_T0091_LMCS_ENC_OVERFLOW_FIX
             leftColSumSq[bx] += (int64_t)pWinY[bx] * (int64_t)pWinY[bx];
-#else
-            leftColSumSq[bx] += pWinY[bx] * pWinY[bx];
-#endif
           }
           pWinY += stride;
         }
@@ -307,11 +295,7 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats)
             for (by = y1; by <= y2; by++)
             {
               leftColSum[x + winLens] += pWinY[x + winLens];
-#if JVET_T0091_LMCS_ENC_OVERFLOW_FIX
               leftColSumSq[x + winLens] += (int64_t)pWinY[x + winLens] * (int64_t)pWinY[x + winLens];
-#else
-              leftColSumSq[x + winLens] += pWinY[x + winLens] * pWinY[x + winLens];
-#endif
               pWinY += stride;
             }
           }
@@ -324,22 +308,14 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats)
               pWinY = &picY.buf[0];
               pWinY += winLens * stride;
               leftColSum[x + winLens] += pWinY[x + winLens];
-#if JVET_T0091_LMCS_ENC_OVERFLOW_FIX
               leftColSumSq[x + winLens] += (int64_t)pWinY[x + winLens] * (int64_t)pWinY[x + winLens];
-#else
-              leftColSumSq[x + winLens] += pWinY[x + winLens] * pWinY[x + winLens];
-#endif
             }
             if (y > winLens)
             {
               pWinY = &picY.buf[0];
               pWinY -= (winLens + 1) * stride;
               leftColSum[x + winLens] -= pWinY[x + winLens];
-#if JVET_T0091_LMCS_ENC_OVERFLOW_FIX
               leftColSumSq[x + winLens] -= (int64_t)pWinY[x + winLens] * (int64_t)pWinY[x + winLens];
-#else
-              leftColSumSq[x + winLens] -= pWinY[x + winLens] * pWinY[x + winLens];
-#endif
             }
           }
           topColSum[x + winLens] = leftColSum[x + winLens];
@@ -423,11 +399,7 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats)
     for (int x = 0; x < width; x++)
     {
       avgY += picY.buf[x];
-#if JVET_T0091_LMCS_ENC_OVERFLOW_FIX
       varY += (double)picY.buf[x] * (double)picY.buf[x];
-#else
-      varY += picY.buf[x] * picY.buf[x];
-#endif
     }
     picY.buf += stride;
   }
@@ -449,13 +421,8 @@ void EncReshape::calcSeqStats(Picture *pcPic, SeqInfo &stats)
       {
         avgU += picU.buf[x];
         avgV += picV.buf[x];
-#if JVET_T0091_LMCS_ENC_OVERFLOW_FIX
         varU += (int64_t)picU.buf[x] * (int64_t)picU.buf[x];
         varV += (int64_t)picV.buf[x] * (int64_t)picV.buf[x];
-#else
-        varU += picU.buf[x] * picU.buf[x];
-        varV += picV.buf[x] * picV.buf[x];
-#endif
       }
       picU.buf += strideC;
       picV.buf += strideC;
-- 
GitLab