From a0ee58c04acaf5cc775db49e97b02d4e34563ad5 Mon Sep 17 00:00:00 2001
From: Seungwook Hong <seungwook.hong@nokia.com>
Date: Wed, 27 Jan 2021 18:05:20 -0800
Subject: [PATCH] JVET-U0097: Addressed comments from 01/27/2021

---
 source/App/DecoderApp/DecApp.cpp         |   2 +-
 source/App/DecoderApp/DecAppCfg.cpp      |   2 +-
 source/App/DecoderApp/DecAppCfg.h        |   2 +-
 source/App/EncoderApp/EncApp.cpp         |   2 +-
 source/App/EncoderApp/EncAppCfg.cpp      |  10 +-
 source/App/EncoderApp/EncAppCfg.h        |   2 +-
 source/Lib/CommonLib/CodingStructure.cpp | 133 +++++++++++++++++++++--
 source/Lib/CommonLib/CodingStructure.h   |   5 -
 source/Lib/CommonLib/Common.h            |  12 +-
 source/Lib/CommonLib/MotionInfo.h        |   4 +-
 source/Lib/CommonLib/Slice.cpp           |   4 +-
 source/Lib/CommonLib/Slice.h             |   8 +-
 source/Lib/CommonLib/UnitTools.cpp       |  32 +++---
 source/Lib/CommonLib/UnitTools.h         |   2 +-
 source/Lib/DecoderLib/DecLib.cpp         |   2 +-
 source/Lib/DecoderLib/DecLib.h           |   2 +-
 source/Lib/DecoderLib/VLCReader.cpp      |   2 +-
 source/Lib/DecoderLib/VLCReader.h        |   6 +-
 source/Lib/EncoderLib/EncCfg.h           |   6 +-
 source/Lib/EncoderLib/EncCu.cpp          |   2 +
 source/Lib/EncoderLib/EncGOP.cpp         |   2 +-
 source/Lib/EncoderLib/EncGOP.h           |   6 +-
 source/Lib/EncoderLib/EncSlice.cpp       |   2 +
 23 files changed, 178 insertions(+), 72 deletions(-)

diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp
index 1ce77c7d8..b72f03f2b 100644
--- a/source/App/DecoderApp/DecApp.cpp
+++ b/source/App/DecoderApp/DecApp.cpp
@@ -605,7 +605,7 @@ void DecApp::xCreateDecLib()
   m_cDecLib.m_targetSubPicIdx = this->m_targetSubPicIdx;
   m_cDecLib.initScalingList();
 #if GDR_LEAK_TEST
-  m_cDecLib.m_POC_RandomAccess = this->m_POC_RandomAccess;
+  m_cDecLib.m_gdrPocRandomAccess = this->m_gdrPocRandomAccess;
 #endif // GDR_LEAK_TEST
 }
 
diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp
index 5e9b41709..0a126cb13 100644
--- a/source/App/DecoderApp/DecAppCfg.cpp
+++ b/source/App/DecoderApp/DecAppCfg.cpp
@@ -122,7 +122,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] )
   ("targetSubPicIdx",          m_targetSubPicIdx,                     0,           "Specify which subpicture shall be written to output, using subpic index, 0: disabled, subpicIdx=m_targetSubPicIdx-1 \n" )
   ( "UpscaledOutput",          m_upscaledOutput,                          0,       "Upscaled output for RPR" )
 #if GDR_LEAK_TEST
-  ("RandomAccessPos",          m_POC_RandomAccess,                    0,           "POC of Random access picture\n" )
+  ("RandomAccessPos",          m_gdrPocRandomAccess,                    0,         "POC of GDR Random access picture\n" )
 #endif // GDR_LEAK_TEST
   ;
 
diff --git a/source/App/DecoderApp/DecAppCfg.h b/source/App/DecoderApp/DecAppCfg.h
index 0b245acf6..bdf0db7a9 100644
--- a/source/App/DecoderApp/DecAppCfg.h
+++ b/source/App/DecoderApp/DecAppCfg.h
@@ -89,7 +89,7 @@ protected:
   int          m_upscaledOutput;                     ////< Output upscaled (2), decoded but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR.
   int           m_targetSubPicIdx;                    ///< Specify which subpicture shall be write to output, using subpicture index
 #if GDR_LEAK_TEST
-  int           m_POC_RandomAccess;                   ///<
+  int           m_gdrPocRandomAccess;                   ///<
 #endif // GDR_LEAK_TEST
 public:
   DecAppCfg();
diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index 72e15cc49..c517bfcc4 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -523,7 +523,7 @@ void EncApp::xInitLibCfg()
   m_cEncLib.setIntraPeriod                                       ( m_iIntraPeriod );
 #if GDR_ENABLED  
   m_cEncLib.setGdrPeriod                                         ( m_iGdrPeriod );
-  m_cEncLib.setGdrPocStart                                       ( m_iGdrPocStart );
+  m_cEncLib.setGdrPocStart                                       ( m_gdrPocStart );
   m_cEncLib.setGdrFrequency                                      ( m_iGdrFrequency);
   m_cEncLib.setStartWithGdr                                      ( m_bStartWithGdr );
   m_cEncLib.setNoHashForGdr                                      ( m_bNoHashForGdr );
diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp
index 00d3cfdf2..5b5c09d7a 100644
--- a/source/App/EncoderApp/EncAppCfg.cpp
+++ b/source/App/EncoderApp/EncAppCfg.cpp
@@ -1007,7 +1007,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
   // Coding structure paramters
   ("IntraPeriod,-ip",                                 m_iIntraPeriod,                                      -1, "Intra period in frames, (-1: only first frame)")
 #if GDR_ENABLED
-  ("GdrPocStart",                                     m_iGdrPocStart,                                      -1, "GDR poc start")
+  ("GdrPocStart",                                     m_gdrPocStart,                                      -1, "GDR poc start")
   ("GdrPeriod",                                       m_iGdrPeriod,                                        -1, "GDR period")
   ("GdrFrequency",                                    m_iGdrFrequency,                                     -1, "GDR freqency")
   ("StartWithGDR",                                    m_bStartWithGdr,                                  false, "Start bitstream with GDR")
@@ -1612,12 +1612,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
     if (m_iGdrFrequency < 0)
       m_iGdrFrequency = 2;
 
-    if (m_iGdrPocStart < 0) 
+    if (m_gdrPocStart < 0) 
     {
       if (m_iIntraPeriod > 0)
-        m_iGdrPocStart = m_iIntraPeriod;
+        m_gdrPocStart = m_iIntraPeriod;
       else
-        m_iGdrPocStart = m_iFrameRate * m_iGdrFrequency;
+        m_gdrPocStart = m_iFrameRate * m_iGdrFrequency;
     }
 
     if (m_iGdrPeriod < 0) 
@@ -1628,7 +1628,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
     if (m_iIntraPeriod == -1) 
     {
       m_iFrameRate = (m_iFrameRate == 0) ? 30 : m_iFrameRate;
-      if (m_iGdrPocStart % m_iFrameRate != 0)
+      if (m_gdrPocStart % m_iFrameRate != 0)
         m_iIntraPeriod = -1;
       else
         m_iIntraPeriod = m_iFrameRate * m_iGdrFrequency;
diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h
index 13c034981..b199d69e3 100644
--- a/source/App/EncoderApp/EncAppCfg.h
+++ b/source/App/EncoderApp/EncAppCfg.h
@@ -219,7 +219,7 @@ protected:
   // coding structure
   int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
 #if GDR_ENABLED 
-  int       m_iGdrPocStart;
+  int       m_gdrPocStart;
   int       m_iGdrPeriod;
   int       m_iGdrFrequency;
   bool      m_bStartWithGdr;
diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp
index 4fcae23e1..a8c6e7671 100644
--- a/source/Lib/CommonLib/CodingStructure.cpp
+++ b/source/Lib/CommonLib/CodingStructure.cpp
@@ -159,13 +159,17 @@ void CodingStructure::releaseIntermediateData()
 bool CodingStructure::containRefresh(int begX, int endX) const
 { 
   if (begX == endX)
+  {
     return false;
+  }
 
   const Area csArea      = area.Y();
   const Area refreshArea = Area(begX, area.ly(), endX - begX, std::min(slice->getPPS()->getPicHeightInLumaSamples(), area.lheight()));
 
   if (csArea.contains(refreshArea))
+  {
     return true;
+  }
   
   return false;
 }
@@ -173,13 +177,17 @@ bool CodingStructure::containRefresh(int begX, int endX) const
 bool CodingStructure::overlapRefresh(int begX, int endX) const
 {
   if (begX == endX)
+  {
     return false;
+  }
 
   const Area csArea = area.Y();
   const Area refreshArea = Area(begX, area.ly(), endX - begX, area.lheight());
 
   if (csArea.overlap(refreshArea))
+  {
     return true;
+  }
 
   return false;
 }
@@ -197,13 +205,17 @@ bool CodingStructure::overlapRefresh() const
 bool CodingStructure::withinRefresh(int begX, int endX) const
 {  
   if (begX == endX)
+  {
     return false;
+  }
 
   const Area csArea = area.Y();
   const Area refreshArea = Area(begX, area.ly(), endX - begX, area.lheight());
 
   if (refreshArea.contains(csArea))
+  {
     return true;
+  }
 
   return false;
 }
@@ -228,7 +240,9 @@ bool CodingStructure::refreshCrossTTV(int begX, int endX) const
   int sum = (overlap0 ? 1 : 0) + (overlap1 ? 1 : 0) + (overlap2 ? 1 : 0);
 
   if (0 < sum)
+  {
     return true;
+  }
 
   return false;
 }
@@ -251,7 +265,9 @@ bool CodingStructure::refreshCrossBTV(int begX, int endX) const
   int sum = (overlap0 ? 1 : 0) + (overlap1 ? 1 : 0);
 
   if (0 < sum)
+  {
     return true;
+  }
 
   return false;
 }
@@ -265,7 +281,9 @@ bool CodingStructure::overlapDirty() const
   bool insideRight = isClean(topRight, CHANNEL_TYPE_LUMA);
 
   if (insideLeft != insideRight)
+  {
     return true;
+  }
 
   return false;
 }
@@ -287,8 +305,10 @@ bool CodingStructure::dirtyCrossTTV() const
 
   bool allclean = clean0 && clean1 && clean2;
   
-  if (allclean) 
+  if (allclean)
+  {
     return false;
+  }
 
   return true;
 }
@@ -309,7 +329,9 @@ bool CodingStructure::dirtyCrossBTV() const
   bool allclean = clean0 && clean1;
 
   if (allclean)
+  {
     return false;
+  }
 
   return true;
 }
@@ -329,7 +351,9 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv) const
   const Picture* const curPic = slice->getPic();
 
   if (!curPic)
+  {
     return false;
+  }
 
   PicHeader     *curPh = curPic->cs->picHeader;
   bool isCurGdrPicture = curPh->getInGdrPeriod();
@@ -356,9 +380,13 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv) const
     const int lastPelPos = std::max(lastLumaPos, lastChromaPos);
 
     if (lastPelPos < scaledEndX)
+    {
       return true;
+    }
     else
+    {
       return false;
+    }
   }
   
   return true;
@@ -372,11 +400,21 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, const Picture*
          pos in clean area -> true
          pos in dirty area -> false
   */  
-  if (!refPic) return false;
-  if (!refPic->cs) return false;
+  if (!refPic)
+  {
+    return false;
+  }
+
+  if (!refPic->cs)
+  {
+    return false;
+  }
 
   PicHeader *refPh = refPic->cs->picHeader;
-  if (!refPh) return false;
+  if (!refPh)
+  {
+    return false;
+  }
 
   bool isRefGdrPicture = refPh->getInGdrPeriod();
 
@@ -401,9 +439,13 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, const Picture*
     const int lastPelPos = std::max(lastLumaPos, lastChromaPos);
 
     if (lastPelPos < scaledEndX)
+    {
       return true;
+    }
     else
+    {
       return false;
+    }
   }
   else 
   {
@@ -411,9 +453,13 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, const Picture*
     bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0);
 
     if (isCurGdrPicture)
+    {
       return false;
+    }
     else
+    {
       return true;
+    }
   }  
 }
 
@@ -426,16 +472,30 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i
          pos in clean area -> true
          pos in dirty area -> false
   */  
-  if (refIdx < 0) return false;
+  if (refIdx < 0)
+  {
+    return false;
+  }
 
   const Picture* const refPic = slice->getRefPic(e, refIdx);
   const bool isExceedNumRef = (refIdx < slice->getNumRefIdx(e)) ? false : true;
-  if (!refPic || isExceedNumRef) return false;
-  if (!refPic->cs) return false;
+
+  if (!refPic || isExceedNumRef)
+  {
+    return false;
+  }
+
+  if (!refPic->cs)
+  {
+    return false;
+  }
 
   PicHeader *refPh = refPic->cs->picHeader;
 
-  if (!refPh) return false;
+  if (!refPh)
+  {
+    return false;
+  }
     
   bool isRefGdrPicture = refPh->getInGdrPeriod();
 
@@ -461,9 +521,13 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i
     const int lastPelPos    = std::max(lastLumaPos, lastChromaPos);
     
     if (lastPelPos < scaledEndX)
+    {
       return true;
+    }
     else
+    {
       return false;
+    }
   }
   else 
   {
@@ -471,9 +535,13 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i
     bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0);
 
     if (isCurGdrPicture)
+    {
       return false;
+    }
     else
+    {
       return true;
+    }
   }
 }
 
@@ -491,11 +559,18 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i
   PicHeader *refPh;
 
   if (refIdx == MAX_NUM_REF)
+  {
     refPic = slice->getPic();
+  }
   else
+  {
     refPic = slice->getRefPic(e, refIdx);
+  }
 
-  if (!refPic) return false;
+  if (!refPic)
+  {
+    return false;
+  }
 
   if (refIdx == MAX_NUM_REF) 
   {
@@ -503,12 +578,18 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i
   }
   else
   {
-    if (refPic->cs) return false;
+    if (refPic->cs)
+    {
+      return false;
+    }
 
     refPh = refPic->cs->picHeader;
   }
 
-  if (!refPh) return false;
+  if (!refPh)
+  {
+    return false;
+  }
 
   bool isRefGdrPicture = refPh->getInGdrPeriod();
 
@@ -533,19 +614,27 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i
     const int lastPelPos = std::max(lastLumaPos, lastChromaPos);
 
     if (lastPelPos < scaledEndX)
+    {
       return true;
+    }
     else
+    {
       return false;
+    }
   }
-  else 
+  else
   {
     // refPic is normal picture
     bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0);
 
     if (isCurGdrPicture)
+    {
       return false;
+    }
     else
+    {
       return true;
+    }
   }
 }
 
@@ -561,7 +650,9 @@ bool CodingStructure::isClean(const Position &IntPos, RefPicList e, int refIdx)
   const Picture* const refPic = slice->getRefPic(e, refIdx);
 
   if (!refPic || refIdx < 0)
+  {
     return false;
+  }
 
   PicHeader     *refPh = refPic->cs->picHeader;
   bool isRefGdrPicture = refPh->getInGdrPeriod();
@@ -573,7 +664,9 @@ bool CodingStructure::isClean(const Position &IntPos, RefPicList e, int refIdx)
       return true;
     }
     else
+    {
       return false;
+    }
   }
   else 
   {
@@ -581,16 +674,22 @@ bool CodingStructure::isClean(const Position &IntPos, RefPicList e, int refIdx)
     bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0);
 
     if (isCurGdrPicture)
+    {
       return false;
+    }
     else
+    {
       return true;
+    }
   }
 }
 
 bool CodingStructure::isClean(const Position &IntPos, const Picture* const refPic) const
 {    
   if (!refPic)
+  {
     return false;
+  }
 
   PicHeader     *refPh = refPic->cs->picHeader;
   bool isRefGdrPicture = refPh->getInGdrPeriod();
@@ -602,7 +701,9 @@ bool CodingStructure::isClean(const Position &IntPos, const Picture* const refPi
       return true;
     }
     else
+    {
       return false;
+    }
   }
   else 
   {
@@ -610,9 +711,13 @@ bool CodingStructure::isClean(const Position &IntPos, const Picture* const refPi
     bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0);
 
     if (isCurGdrPicture)
+    {
       return false;
+    }
     else
+    {
       return true;
+    }
   }
 }
 
@@ -632,9 +737,13 @@ bool CodingStructure::isClean(const int Intx, const int Inty, const ChannelType
 
     virboundary_endx = virboundary_endx >> effChType;
     if (Intx < virboundary_endx)
+    {
       return true;
+    }
     else
+    {
       return false;
+    }
   }
 
   return true;
diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h
index e5a9cfcfb..f7b01f02c 100644
--- a/source/Lib/CommonLib/CodingStructure.h
+++ b/source/Lib/CommonLib/CodingStructure.h
@@ -112,11 +112,6 @@ public:
 
   bool refreshCrossTTV(int begX, int endX) const;
   bool refreshCrossBTV(int begX, int endX) const;
-  bool refreshCrossQT(int begX, int endX) const;  
-
-  bool refreshFitTTV(int begX, int endX) const;
-  bool refreshFitBTV(int begX, int endX) const;
-  bool refreshFitQT(int begX, int endX) const;
 
   bool overlapDirty() const;
   bool dirtyCrossTTV() const;  
diff --git a/source/Lib/CommonLib/Common.h b/source/Lib/CommonLib/Common.h
index 52db0a72a..6313b984a 100644
--- a/source/Lib/CommonLib/Common.h
+++ b/source/Lib/CommonLib/Common.h
@@ -108,15 +108,17 @@ struct Area : public Position, public Size
     if (_area.contains(thisArea))
       return false;
 
-    bool btopLeft  = contains(_area.topLeft());
-    bool btopRight = contains(_area.topRight());
-    bool bbotLeft  = contains(_area.bottomLeft());
-    bool bbotRight = contains(_area.bottomRight());
+    bool topLeft  = contains(_area.topLeft());
+    bool topRight = contains(_area.topRight());
+    bool botLeft  = contains(_area.bottomLeft());
+    bool botRight = contains(_area.bottomRight());
 
-    int sum = (btopLeft ? 1 : 0) + (btopRight ? 1 : 0) + (bbotLeft ? 1 : 0) + (bbotRight ? 1 : 0);
+    int sum = (topLeft ? 1 : 0) + (topRight ? 1 : 0) + (botLeft ? 1 : 0) + (botRight ? 1 : 0);
 
     if (0 < sum && sum < 4)
+    {
       return true;
+    }
 
     return false;
   }
diff --git a/source/Lib/CommonLib/MotionInfo.h b/source/Lib/CommonLib/MotionInfo.h
index 1aad0ce53..5a9d76e9f 100644
--- a/source/Lib/CommonLib/MotionInfo.h
+++ b/source/Lib/CommonLib/MotionInfo.h
@@ -160,8 +160,8 @@ struct MotionInfo
   uint8_t         BcwIdx;
   Mv      bv;
 #if GDR_ENABLED
-  bool      soClean;  // source Position is clean/dirty
-  Position  soPos;    // source Position of Mv
+  bool      sourceClean;  // source Position is clean/dirty
+  Position  sourcePos;    // source Position of Mv
 #endif
 
   MotionInfo() : isInter(false), isIBCmot(false), interDir(0), useAltHpelIf(false), sliceIdx(0), refIdx{ NOT_VALID, NOT_VALID }, BcwIdx(0) { }
diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index d0b7a0288..a00b007af 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -2742,8 +2742,8 @@ void PicHeader::initPicHeader()
 
   m_alfApsIdsLuma.resize(0);
 #if GDR_ENABLED
-  m_InGdrPeriod      = false;
-  m_LastGdrPeriodPoc = -1;
+  m_inGdrPeriod      = false;
+  m_lastGdrPeriodPoc = -1;
 #endif
 }
 
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index 4f48b87e3..2f7cd5727 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -2333,8 +2333,8 @@ private:
   bool                        m_gdrOrIrapPicFlag;                                       //!< gdr or irap picture flag
   bool                        m_gdrPicFlag;                                             //!< gradual decoding refresh picture flag
 #if GDR_ENABLED
-  bool                        m_InGdrPeriod;
-  int                         m_LastGdrPeriodPoc;
+  bool                        m_inGdrPeriod;
+  int                         m_lastGdrPeriodPoc;
 #endif
   uint32_t                    m_recoveryPocCnt;                                         //!< recovery POC count
   bool                        m_noOutputBeforeRecoveryFlag;                             //!< NoOutputBeforeRecoveryFlag
@@ -2423,8 +2423,8 @@ public:
   void                        setGdrPicFlag( bool b )                                   { m_gdrPicFlag = b;                                                                            }
   bool                        getGdrPicFlag() const                                     { return m_gdrPicFlag;                                                                         }
 #if GDR_ENABLED
-  void                        setInGdrPeriod(bool b)                                    { m_InGdrPeriod = b;                                                                            }
-  bool                        getInGdrPeriod() const                                    { return m_InGdrPeriod;                                                                         }  
+  void                        setInGdrPeriod(bool b)                                    { m_inGdrPeriod = b;                                                                            }
+  bool                        getInGdrPeriod() const                                    { return m_inGdrPeriod;                                                                         }  
 #endif
   void                        setRecoveryPocCnt( uint32_t u )                           { m_recoveryPocCnt = u;                                                                        }
   uint32_t                    getRecoveryPocCnt() const                                 { return m_recoveryPocCnt;                                                                     }
diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index 2eb260f62..44c41f5ea 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -388,8 +388,8 @@ void CU::saveMotionInHMVP( const CodingUnit& cu, const bool isToBeDone )
     MotionInfo mi = pu.getMotionInfo();
 
 #if GDR_ENABLED 
-    mi.soPos = pu.lumaPos();
-    mi.soClean = pu.cs->isClean(mi.soPos, CHANNEL_TYPE_LUMA);
+    mi.sourcePos   = pu.lumaPos();
+    mi.sourceClean = pu.cs->isClean(mi.sourcePos, CHANNEL_TYPE_LUMA);
 #endif
     mi.BcwIdx = (mi.interDir == 3) ? cu.BcwIdx : BCW_DEFAULT;
 
@@ -859,14 +859,12 @@ int PU::getWideAngle( const TransformUnit &tu, const uint32_t dirMode, const Com
 bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int &mrgCandIdx,
                           const uint32_t maxNumMergeCandMin1, int &cnt, const bool isAvailableA1,
                           const MotionInfo miLeft, const bool isAvailableB1, const MotionInfo miAbove,
-#if GDR_ENABLED
                           const bool ibcFlag, const bool isGt4x4
-  , const PredictionUnit &pu
-  , bool &allCandSolidInAbove
-)
-#else
-                          const bool ibcFlag, const bool isGt4x4)
+#if GDR_ENABLED
+                         ,const PredictionUnit &pu
+                         ,bool &allCandSolidInAbove
 #endif
+)
 {
   const Slice& slice = *cs.slice;
   MotionInfo miNeighbor;
@@ -888,10 +886,10 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int
   {
     miNeighbor = lut[num_avai_candInLUT - mrgIdx];
 #if GDR_ENABLED    
-    Position soPos = Position(0, 0);
+    Position sourcePos = Position(0, 0);
     if (isEncodeClean) 
     {
-      soPos = miNeighbor.soPos;
+      sourcePos = miNeighbor.sourcePos;
     }
 #endif
 
@@ -907,7 +905,7 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int
       if (isEncodeClean) 
       {
         // note : cannot gaurantee the order/value in the lut if any of the lut is in dirty area
-        mrgCtx.mvPos[(cnt << 1) + 0]   = soPos;
+        mrgCtx.mvPos[(cnt << 1) + 0]   = sourcePos;
         mrgCtx.mvSolid[(cnt << 1) + 0] = allCandSolidInAbove && vbOnCtuBoundary;
         mrgCtx.mvValid[(cnt << 1) + 0] = cs.isClean(pu.Y().bottomRight(), miNeighbor.mv[0], REF_PIC_LIST_0, miNeighbor.refIdx[0]);
         allCandSolidInAbove = allCandSolidInAbove && vbOnCtuBoundary;
@@ -919,7 +917,7 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int
 #if GDR_ENABLED
         if (isEncodeClean) 
         {
-          mrgCtx.mvPos[(cnt << 1) + 1]   = soPos;
+          mrgCtx.mvPos[(cnt << 1) + 1]   = sourcePos;
           mrgCtx.mvSolid[(cnt << 1) + 1] = allCandSolidInAbove && vbOnCtuBoundary;
           mrgCtx.mvValid[(cnt << 1) + 1] = cs.isClean(pu.Y().bottomRight(), miNeighbor.mv[1], REF_PIC_LIST_1, miNeighbor.refIdx[1]);
           allCandSolidInAbove = allCandSolidInAbove && vbOnCtuBoundary; 
@@ -2453,10 +2451,8 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r
 #if GDR_ENABLED
 void PU::xInheritedAffineMv(const PredictionUnit &pu, const PredictionUnit* puNeighbour, RefPicList eRefPicList, Mv rcMv[3], bool rcMvSolid[3], MvpType rcMvType[3], Position rcMvPos[3])
 {
-#if GDR_ENABLED  
   const CodingStructure &cs = *pu.cs;
   const bool isEncodeClean = cs.pcv->isEncoder && ((cs.picHeader->getInGdrPeriod() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0));
-#endif
 
   int posNeiX = puNeighbour->Y().pos().x;
   int posNeiY = puNeighbour->Y().pos().y;
@@ -3127,7 +3123,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
 #if GDR_ENABLED
         if (isEncodeClean) 
         {
-          info.mvPos[info.numCand]   = neibMi.soPos;
+          info.mvPos[info.numCand]   = neibMi.sourcePos;
           info.mvType[info.numCand]  = MVP_HMVP;
           info.mvSolid[info.numCand] = allCandSolidInAbove && vbOnCtuBoundary; //  cs.isClean(neibMi.soPos, CHANNEL_TYPE_LUMA);
           allCandSolidInAbove = allCandSolidInAbove && vbOnCtuBoundary;
@@ -3717,7 +3713,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
       };
 
 #if GDR_ENABLED     
-      bool model_solid[6] = 
+      bool modelSolid[6] = 
       {
         miSolid[0] && miSolid[1] && miSolid[2],
         miSolid[0] && miSolid[1] && miSolid[3],
@@ -3741,8 +3737,8 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
         {
           for (int i = 0; i < 3; i++)  
           {
-            affMrgCtx.mvSolid[(affinNumValidCand << 1) + 0][i] = model_solid[modelIdx];
-            affMrgCtx.mvSolid[(affinNumValidCand << 1) + 1][i] = model_solid[modelIdx];
+            affMrgCtx.mvSolid[(affinNumValidCand << 1) + 0][i] = modelSolid[modelIdx];
+            affMrgCtx.mvSolid[(affinNumValidCand << 1) + 1][i] = modelSolid[modelIdx];
           }
         }
 #endif
diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h
index 766205bd6..57f398d31 100644
--- a/source/Lib/CommonLib/UnitTools.h
+++ b/source/Lib/CommonLib/UnitTools.h
@@ -158,7 +158,7 @@ namespace PU
     , const bool isGt4x4
 #if GDR_ENABLED
     , const PredictionUnit &pu
-    , bool &addMergeHMVPCand
+    , bool &allCandSolidInAbove  
 #endif
   );
   void addAMVPHMVPCand                (const PredictionUnit &pu, const RefPicList eRefPicList, const int currRefPOC, AMVPInfo &info);
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index 930cd9e81..54a0abb81 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -2781,7 +2781,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
   }
 
 #if GDR_LEAK_TEST  
-  if (m_POC_RandomAccess == pcSlice->getPOC())
+  if (m_gdrPocRandomAccess == pcSlice->getPOC())
   {
     for (int e = 0; e < 2; e++)
     {
diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h
index 78deaba84..b87ba26d9 100644
--- a/source/Lib/DecoderLib/DecLib.h
+++ b/source/Lib/DecoderLib/DecLib.h
@@ -206,7 +206,7 @@ public:
   ParameterSetMap<APS>*   m_apsMapEnc;
 #if GDR_LEAK_TEST
 public:
-  int                     m_POC_RandomAccess;
+  int                     m_gdrPocRandomAccess;
 #endif // GDR_LEAK_TEST
 
 public:
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 8b330e07f..dc9155a43 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -281,7 +281,7 @@ void FDReader::parseFillerData(InputBitstream* bs, uint32_t &fdSize)
 HLSyntaxReader::HLSyntaxReader()
 {
 #if GDR_ENABLED
-  m_last_gdr_poc = -1;
+  m_lastGdrPoc = -1;
 #endif
 }
 
diff --git a/source/Lib/DecoderLib/VLCReader.h b/source/Lib/DecoderLib/VLCReader.h
index dcbd89ab5..a8db110a5 100644
--- a/source/Lib/DecoderLib/VLCReader.h
+++ b/source/Lib/DecoderLib/VLCReader.h
@@ -147,7 +147,7 @@ public:
 class HLSyntaxReader : public VLCReader
 {
 #if GDR_ENABLED
-  int m_last_gdr_poc;
+  int m_lastGdrPoc;
   int m_last_gdr_recovery_poc_cnt;
 #endif
 
@@ -161,8 +161,8 @@ protected:
 
 public:
 #if GDR_ENABLED
-  void setLastGdrPoc(int poc) { m_last_gdr_poc = poc;  }
-  int  getLastGdrPoc()        { return m_last_gdr_poc; }
+  void setLastGdrPoc(int poc) { m_lastGdrPoc = poc;  }
+  int  getLastGdrPoc()        { return m_lastGdrPoc; }
   void setLastGdrRecoveryPocCnt(int recovery_poc_cnt) { m_last_gdr_recovery_poc_cnt = recovery_poc_cnt; }
   int  getLastGdrRecoveryPocCnt()                     { return m_last_gdr_recovery_poc_cnt; }
 #endif
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index d45a816a8..98ad3bcc1 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -303,7 +303,7 @@ protected:
   unsigned              m_subPicIdLen;
   std::vector<uint16_t> m_subPicId;
 #if GDR_ENABLED
-  unsigned  m_GdrPeriod;
+  unsigned  m_gdrPeriod;
   unsigned  m_GdrPocStart;
   int       m_GdrFrequency;
   bool      m_bStartWithGdr;
@@ -1005,14 +1005,14 @@ public:
   void      setMaxBTSizes                   ( unsigned* maxBT)   { m_uiMaxBT[0] = maxBT[0]; m_uiMaxBT[1] = maxBT[1]; m_uiMaxBT[2] = maxBT[2]; }
   void      setMaxTTSizes                   ( unsigned* maxTT)   { m_uiMaxTT[0] = maxTT[0]; m_uiMaxTT[1] = maxTT[1]; m_uiMaxTT[2] = maxTT[2]; }
 #if GDR_ENABLED
-  void      setGdrPeriod(unsigned  u)   { m_GdrPeriod   = u; }
+  void      setGdrPeriod(unsigned  u)   { m_gdrPeriod   = u; }
   void      setGdrPocStart(unsigned  u) { m_GdrPocStart = u; }
   void      setGdrFrequency(int i)      { m_GdrFrequency = i; }
   void      setStartWithGdr(bool b)     { m_bStartWithGdr = b; }
   void      setNoHashForGdr(bool b)     { m_bNoHashForGdr = b; }  
   void      setGdrPicOutput(bool b)     { m_bGdrPicOutput = b; }
 
-  unsigned  getGdrPeriod()              { return m_GdrPeriod;   }
+  unsigned  getGdrPeriod()              { return m_gdrPeriod;   }
   unsigned  getGdrPocStart()            { return m_GdrPocStart; }
   int       getGdrFrequency()           { return m_GdrFrequency; }
   bool      getStartWithGdr()           { return m_bStartWithGdr; }
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index 472704f04..c574d15f1 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -579,7 +579,9 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par
     m2 = ((mm + 0) >> 3) << 3;
 
     if (dd > mm && m1 == m2)
+    {
       m1 = m1 + 8;
+    }
 
     n1 = (picWidth - m2 * gdrPeriod) / 8;
 
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index d68dc8fa8..bdc6c2632 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -313,7 +313,7 @@ void EncGOP::init ( EncLib* pcEncLib )
   }
 #endif
 #if GDR_ENABLED
-  m_LastGdrPeriodPoc = -1;
+  m_lastGdrPeriodPoc = -1;
 #endif
 }
 
diff --git a/source/Lib/EncoderLib/EncGOP.h b/source/Lib/EncoderLib/EncGOP.h
index 2c0599c3e..04df5eada 100644
--- a/source/Lib/EncoderLib/EncGOP.h
+++ b/source/Lib/EncoderLib/EncGOP.h
@@ -184,7 +184,7 @@ private:
 
   AUWriterIf*             m_AUWriterIf;
 #if GDR_ENABLED
-  int                     m_LastGdrPeriodPoc;  
+  int                     m_lastGdrPeriodPoc;  
 #endif
 
 #if JVET_O0756_CALCULATE_HDRMETRICS
@@ -238,8 +238,8 @@ public:
   int       getLastLTRefPoc() const { return m_lastLTRefPoc; }
 
 #if GDR_ENABLED
-  void      setLastGdrPeriodPoc(int p)  { m_LastGdrPeriodPoc = p; }
-  int       getLastGdrPeriodPoc() const { return m_LastGdrPeriodPoc; }
+  void      setLastGdrPeriodPoc(int p)  { m_lastGdrPeriodPoc = p; }
+  int       getLastGdrPeriodPoc() const { return m_lastGdrPeriodPoc; }
 #endif
 
   void  printOutSummary( uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, 
diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp
index 31a81ff8e..cfc58ce4e 100644
--- a/source/Lib/EncoderLib/EncSlice.cpp
+++ b/source/Lib/EncoderLib/EncSlice.cpp
@@ -813,7 +813,9 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr
     m2 = ((mm + 0) >> 3) << 3;
 
     if (dd > mm && m1 == m2)
+    {
       m1 = m1 + 8;
+    }
      
     n1 = (picWidth - m2 * gdrPeriod) / 8;    
 
-- 
GitLab