From 1b42cd273cb80a5eecb07b2cf264f6b742edbedb Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Fri, 31 Jul 2020 13:22:42 -0400
Subject: [PATCH] Fix formatting: braces, spaces, indentation

---
 source/Lib/CommonLib/RdCost.cpp      | 34 ++++++++++++----------------
 source/Lib/CommonLib/Rom.cpp         | 25 ++++++++++++++++----
 source/Lib/CommonLib/TrQuant_EMT.cpp | 14 ------------
 3 files changed, 35 insertions(+), 38 deletions(-)

diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp
index 6e86a9d86..ea57ae867 100644
--- a/source/Lib/CommonLib/RdCost.cpp
+++ b/source/Lib/CommonLib/RdCost.cpp
@@ -1918,7 +1918,6 @@ Distortion RdCost::xGetSSE16( const DistParam &rcDtParam )
 
   for( ; iRows != 0; iRows-- )
   {
-
     iTemp = piOrg[ 0] - piCur[ 0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
     iTemp = piOrg[ 1] - piCur[ 1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
     iTemp = piOrg[ 2] - piCur[ 2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
@@ -1965,7 +1964,6 @@ Distortion RdCost::xGetSSE16N( const DistParam &rcDtParam )
   {
     for (int n = 0; n < iCols; n+=16 )
     {
-
       iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
       iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
       iTemp = piOrg[n+ 2] - piCur[n+ 2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
@@ -1982,7 +1980,6 @@ Distortion RdCost::xGetSSE16N( const DistParam &rcDtParam )
       iTemp = piOrg[n+13] - piCur[n+13]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
       iTemp = piOrg[n+14] - piCur[n+14]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
       iTemp = piOrg[n+15] - piCur[n+15]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
-
     }
     piOrg += iStrideOrg;
     piCur += iStrideCur;
@@ -2012,7 +2009,6 @@ Distortion RdCost::xGetSSE32( const DistParam &rcDtParam )
 
   for( ; iRows != 0; iRows-- )
   {
-
     iTemp = piOrg[ 0] - piCur[ 0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
     iTemp = piOrg[ 1] - piCur[ 1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
     iTemp = piOrg[ 2] - piCur[ 2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift);
@@ -2962,24 +2958,14 @@ void RdCost::saveUnadjustedLambda()
 
 void RdCost::initLumaLevelToWeightTable()
 {
-  for (int i = 0; i < LUMA_LEVEL_TO_DQP_LUT_MAXSIZE; i++) {
+  for (int i = 0; i < LUMA_LEVEL_TO_DQP_LUT_MAXSIZE; i++)
+  {
     double x = i;
     double y;
 
-/*
-    //always false
-    if (isSDR)  // set SDR weight table
-    {
-      y = 0.03*x - 3.0;        // this is the Equation used to derive the luma qp LUT for SDR in ST-2084
-      y = y<0 ? 0 : (y>12 ? 12 : y);
-
-    }
-    else
-*/
-    { // set SDR weight table
-      y = 0.015*x - 1.5 - 6;   // this is the Equation used to derive the luma qp LUT for HDR in MPEG HDR anchor3.2 (JCTCX-X1020)
-      y = y<-3 ? -3 : (y>6 ? 6 : y);
-    }
+    y = 0.015 * x - 1.5
+        - 6;   // this is the Equation used to derive the luma qp LUT for HDR in MPEG HDR anchor3.2 (JCTCX-X1020)
+    y = y < -3 ? -3 : (y > 6 ? 6 : y);
 
     m_lumaLevelToWeightPLUT[i] = pow(2.0, y / 3.0);      // or power(10, dQp/10)      they are almost equal
   }
@@ -2989,9 +2975,13 @@ void RdCost::initLumaLevelToWeightTableReshape()
 {
   int lutSize = 1 << m_lumaBD;
   if (m_reshapeLumaLevelToWeightPLUT.empty())
+  {
     m_reshapeLumaLevelToWeightPLUT.resize(lutSize, 1.0);
+  }
   if (m_lumaLevelToWeightPLUT.empty())
+  {
     m_lumaLevelToWeightPLUT.resize(lutSize, 1.0);
+  }
   if (m_signalType == RESHAPE_SIGNAL_PQ)
   {
     for (int i = 0; i < (1 << m_lumaBD); i++)
@@ -3035,11 +3025,15 @@ void RdCost::updateReshapeLumaLevelToWeightTable(SliceReshapeInfo &sliceReshape,
       for (int i = 0; i < PIC_CODE_CW_BINS; i++)
       {
         if ((i < sliceReshape.reshaperModelMinBinIdx) || (i > sliceReshape.reshaperModelMaxBinIdx))
+        {
           weight = 1.0;
+        }
         else
         {
           if (sliceReshape.reshaperModelBinCWDelta[i] == 1 || (sliceReshape.reshaperModelBinCWDelta[i] == -1 * histLens))
+          {
             weight = wBin;
+          }
           else
           {
             weight = (double)wtTable[i] / (double)histLens;
@@ -3073,7 +3067,7 @@ Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, con
 
   if (compIdx == COMPONENT_Y)
   {
-     CHECK(org!=orgLuma, "");
+    CHECK(org != orgLuma, "");
   }
   // use luma to get weight
   double weight = 1.0;
diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp
index 4c6f2ef71..914b908f4 100644
--- a/source/Lib/CommonLib/Rom.cpp
+++ b/source/Lib/CommonLib/Rom.cpp
@@ -141,7 +141,10 @@ public:
             m_line++;
             m_column = m_blockWidth - 1;
           }
-          else m_column++;
+          else
+          {
+            m_column++;
+          }
         }
         else
         {
@@ -150,7 +153,10 @@ public:
             m_line++;
             m_column = 0;
           }
-          else m_column--;
+          else
+          {
+            m_column--;
+          }
         }
         break;
 
@@ -162,7 +168,10 @@ public:
             m_column++;
             m_line = m_blockHeight - 1;
           }
-          else m_line++;
+          else
+          {
+            m_line++;
+          }
         }
         else
         {
@@ -171,7 +180,10 @@ public:
             m_column++;
             m_line = 0;
           }
-          else m_line--;
+          else
+          {
+            m_line--;
+          }
         }
         break;
       //------------------------------------------------
@@ -709,7 +721,9 @@ void initGeoTemplate()
       if( (distanceIdx == 0 && angleIdx >= 16)
         || ((distanceIdx == 2 || distanceIdx == 0) && (g_angle2mask[angleIdx] == 0 || g_angle2mask[angleIdx] == 5))
         || g_angle2mask[angleIdx] == -1 )
+      {
         continue;
+      }
       g_GeoParams[modeIdx]    = new int16_t[2];
       g_GeoParams[modeIdx][0] = (int16_t)angleIdx;
       g_GeoParams[modeIdx][1] = (int16_t)distanceIdx;
@@ -719,7 +733,9 @@ void initGeoTemplate()
   for (int angleIdx = 0; angleIdx < (GEO_NUM_ANGLES >> 2) + 1; angleIdx++)
   {
     if (g_angle2mask[angleIdx] == -1)
+    {
       continue;
+    }
     g_globalGeoWeights[g_angle2mask[angleIdx]] = new int16_t[GEO_WEIGHT_MASK_SIZE * GEO_WEIGHT_MASK_SIZE];
 #if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
     g_globalGeoEncSADmask[g_angle2mask[angleIdx]] = new Pel[GEO_WEIGHT_MASK_SIZE * GEO_WEIGHT_MASK_SIZE];
@@ -775,6 +791,7 @@ void initGeoTemplate()
     }
   }
 }
+
 int16_t** g_GeoParams;
 int16_t*  g_globalGeoWeights   [GEO_NUM_PRESTORED_MASK];
 #if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
diff --git a/source/Lib/CommonLib/TrQuant_EMT.cpp b/source/Lib/CommonLib/TrQuant_EMT.cpp
index 34918f6b2..b2afb83b2 100644
--- a/source/Lib/CommonLib/TrQuant_EMT.cpp
+++ b/source/Lib/CommonLib/TrQuant_EMT.cpp
@@ -126,18 +126,6 @@ void fastInverseDCT2_B2(const TCoeff *src, TCoeff *dst, int shift, int line, int
   {
     memset(dst, 0, (iSkipLine << 1) * sizeof(TCoeff));
   }
-
-  /*TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0;
-
-  #define T(a,b)    ( (TCoeff)( g_aiT2[ TRANSFORM_INVERSE ][ a ][ b ] ) * src[ a * line ] )
-
-  for (int j = 0; j < line; j++, src++, dst += 2)
-  {
-  dst[0] = Clip3(outputMinimum, outputMaximum, (T(0, 0) + T(1, 0) + add) >> shift);
-  dst[1] = Clip3(outputMinimum, outputMaximum, (T(0, 1) + T(1, 1) + add) >> shift);
-  }
-
-  #undef  T*/
 }
 
 /** 4x4 forward transform implemented using partial butterfly structure (1D)
@@ -609,8 +597,6 @@ void fastInverseDCT2_B16( const TCoeff *src, TCoeff *dst, int shift, int line, i
   }
 }
 
-
-
 /** 32x32 forward transform implemented using partial butterfly structure (1D)
 *  \param src   input data (residual)
 *  \param dst   output data (transform coefficients)
-- 
GitLab