From dde0e902c96c896ebf5d6eaddb43c380151e4bc5 Mon Sep 17 00:00:00 2001
From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de>
Date: Mon, 6 Jul 2020 15:12:53 +0200
Subject: [PATCH] remove macro JVET_Q0764_WRAP_AROUND_WITH_RPR

---
 source/Lib/CommonLib/InterPrediction.cpp | 36 ------------------
 source/Lib/CommonLib/Mv.cpp              |  8 ----
 source/Lib/CommonLib/Picture.cpp         | 48 ------------------------
 source/Lib/CommonLib/Picture.h           |  8 ----
 source/Lib/CommonLib/Slice.cpp           | 17 ---------
 source/Lib/CommonLib/Slice.h             | 11 ------
 source/Lib/CommonLib/TypeDef.h           |  1 -
 source/Lib/DecoderLib/DecLib.cpp         |  4 --
 source/Lib/DecoderLib/VLCReader.cpp      | 11 ------
 source/Lib/EncoderLib/EncGOP.cpp         | 16 --------
 source/Lib/EncoderLib/EncLib.cpp         |  7 ----
 source/Lib/EncoderLib/InterSearch.cpp    | 18 ---------
 source/Lib/EncoderLib/VLCWriter.cpp      |  8 ----
 13 files changed, 193 deletions(-)

diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp
index ce9c6c1d5..f18315056 100644
--- a/source/Lib/CommonLib/InterPrediction.cpp
+++ b/source/Lib/CommonLib/InterPrediction.cpp
@@ -369,11 +369,7 @@ void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const R
       int filtersize = (compID == (COMPONENT_Y)) ? NTAPS_LUMA : NTAPS_CHROMA;
       cMv += Mv(-(((filtersize >> 1) - 1) << mvshiftTemp), -(((filtersize >> 1) - 1) << mvshiftTemp));
       bool wrapRef = false;
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
       if ( pu.cu->slice->getRefPic(refId, pu.refIdx[refId])->isWrapAroundEnabled( pu.cs->pps ) )
-#else
-      if (pu.cs->sps->getWrapAroundEnabledFlag())
-#endif
       {
         wrapRef = wrapClipMv(cMv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps, pu.cs->pps);
       }
@@ -478,11 +474,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
   {
     if( !isIBC && pu.cu->slice->getRefPic( eRefPicList, iRefIdx )->isRefScaled( pu.cs->pps ) == false )
     {
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
       if( !pu.cs->pps->getWrapAroundEnabledFlag() )
-#else
-      if( !sps.getWrapAroundEnabledFlag() )
-#endif
       {
         clipMv( mv[0], pu.cu->lumaPos(), pu.cu->lumaSize(), sps, *pu.cs->pps );
       }
@@ -685,11 +677,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio
 
   bool  wrapRef = false;
   Mv    mv(_mv);
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   if( !isIBC && refPic->isWrapAroundEnabled( pu.cs->pps ) )
-#else
-  if( !isIBC && pu.cs->sps->getWrapAroundEnabledFlag() )
-#endif
   {
     wrapRef = wrapClipMv( mv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps, pu.cs->pps );
   }
@@ -1083,11 +1071,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction
         iMvScaleTmpVer = tmpMv.getVer();
 
         // clip and scale
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
         if ( refPic->isWrapAroundEnabled( pu.cs->pps ) )
-#else
-        if (sps.getWrapAroundEnabledFlag())
-#endif
         {
           m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(iMvScaleTmpHor, iMvScaleTmpVer);
           Mv tmpMv(iMvScaleTmpHor, iMvScaleTmpVer);
@@ -1112,11 +1096,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction
         Mv curMv = m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE) * MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE)] +
           m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + iScaleY)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + iScaleX)];
         roundAffineMv(curMv.hor, curMv.ver, 1);
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
         if ( refPic->isWrapAroundEnabled( pu.cs->pps ) )
-#else
-        if (sps.getWrapAroundEnabledFlag())
-#endif
         {
           wrapRef = wrapClipMv( curMv, Position( pu.Y().x + ( w << iScaleX ), pu.Y().y + ( h << iScaleY ) ), Size( blockWidth << iScaleX, blockHeight << iScaleY ), &sps, pu.cs->pps );
         }
@@ -1709,11 +1689,7 @@ void InterPrediction::xPrefetch(PredictionUnit& pu, PelUnitBuf &pcPad, RefPicLis
     cMv += Mv(-(((filtersize >> 1) - 1) << mvshiftTempHor),
       -(((filtersize >> 1) - 1) << mvshiftTempVer));
     bool wrapRef = false;
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
     if( refPic->isWrapAroundEnabled( pu.cs->pps ) )
-#else
-    if( pu.cs->sps->getWrapAroundEnabledFlag() )
-#endif
     {
       wrapRef = wrapClipMv( cMv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps, pu.cs->pps );
     }
@@ -1885,11 +1861,7 @@ void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYu
     m_iRefListIdx = refId;
     const Picture* refPic = pu.cu->slice->getRefPic( refId, pu.refIdx[refId] )->unscaledPic;
     Mv cMvClipped = cMv;
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
     if( !pu.cs->pps->getWrapAroundEnabledFlag() )
-#else
-    if( !pu.cs->sps->getWrapAroundEnabledFlag() )
-#endif
     {
       clipMv( cMvClipped, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps );
     }
@@ -1983,11 +1955,7 @@ void InterPrediction::xinitMC(PredictionUnit& pu, const ClpRngs &clpRngs)
   Mv mergeMVL1(pu.mv[REF_PIC_LIST_1]);
 
   /*Clip the starting MVs*/
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   if( !pu.cs->pps->getWrapAroundEnabledFlag() )
-#else
-  if( !pu.cs->sps->getWrapAroundEnabledFlag() )
-#endif
   {
     clipMv( mergeMVL0, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps );
     clipMv( mergeMVL1, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps );
@@ -2059,11 +2027,7 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con
       int filtersize = (compID == (COMPONENT_Y)) ? NTAPS_LUMA : NTAPS_CHROMA;
       cMv += Mv(-(((filtersize >> 1) - 1) << mvshiftTemp), -(((filtersize >> 1) - 1) << mvshiftTemp));
       bool wrapRef = false;
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
       if ( pu.cs->pps->getWrapAroundEnabledFlag() )
-#else
-      if (pu.cs->sps->getWrapAroundEnabledFlag())
-#endif
       {
         wrapRef = wrapClipMv(cMv, pu.blocks[0].pos(), pu.blocks[0].size(), pu.cs->sps, pu.cs->pps);
       }
diff --git a/source/Lib/CommonLib/Mv.cpp b/source/Lib/CommonLib/Mv.cpp
index 4e4d69b16..105886297 100644
--- a/source/Lib/CommonLib/Mv.cpp
+++ b/source/Lib/CommonLib/Mv.cpp
@@ -122,21 +122,13 @@ bool wrapClipMv( Mv& rcMv, const Position& pos, const struct Size& size, const S
 
   if(mvX > iHorMax)
   {
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
     mvX -= ( pps->getWrapAroundOffset() << iMvShift );
-#else
-    mvX -= ( sps->getWrapAroundOffset() << iMvShift );
-#endif
     mvX = std::min( iHorMax, std::max( iHorMin, mvX ) );
     wrapRef = false;
   }
   if(mvX < iHorMin)
   {
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
     mvX += ( pps->getWrapAroundOffset() << iMvShift );
-#else
-    mvX += ( sps->getWrapAroundOffset() << iMvShift );
-#endif
     mvX = std::min( iHorMax, std::max( iHorMin, mvX ) );
     wrapRef = false;
   }
diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp
index 7d9339e39..275b4b054 100644
--- a/source/Lib/CommonLib/Picture.cpp
+++ b/source/Lib/CommonLib/Picture.cpp
@@ -175,10 +175,8 @@ Picture::Picture()
   cs                   = nullptr;
   m_isSubPicBorderSaved = false;
   m_bIsBorderExtended  = false;
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   m_wrapAroundValid    = false;
   m_wrapAroundOffset   = 0;
-#endif
   usedByCurr           = false;
   longTerm             = false;
   reconstructed        = false;
@@ -1051,20 +1049,14 @@ void Picture::restoreSubPicBorder(int POC, int subPicX0, int subPicY0, int subPi
   m_bufWrapSubPicBelow.destroy();
 }
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
 void Picture::extendPicBorder( const PPS *pps )
-#else
-void Picture::extendPicBorder()
-#endif
 {
   if ( m_bIsBorderExtended )
   {
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
     if( isWrapAroundEnabled( pps ) && ( !m_wrapAroundValid || m_wrapAroundOffset != pps->getWrapAroundOffset() ) )
     {
       extendWrapBorder( pps );
     }
-#endif
     return;
   }
 
@@ -1105,7 +1097,6 @@ void Picture::extendPicBorder()
     }
 
     // reference picture with horizontal wrapped boundary
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
     if ( isWrapAroundEnabled( pps ) )
     {
       extendWrapBorder( pps );
@@ -1115,49 +1106,11 @@ void Picture::extendPicBorder()
       m_wrapAroundValid = false;
       m_wrapAroundOffset = 0;
     }
-#else
-    if (cs->sps->getWrapAroundEnabledFlag())
-    {
-      p = M_BUFS( 0, PIC_RECON_WRAP ).get( compID );
-      p.copyFrom(M_BUFS( 0, PIC_RECONSTRUCTION ).get( compID ));
-      piTxt = p.bufAt(0,0);
-      pi = piTxt;
-      int xoffset = cs->sps->getWrapAroundOffset() >> getComponentScaleX( compID, cs->area.chromaFormat );
-      for (int y = 0; y < p.height; y++)
-      {
-        for (int x = 0; x < xmargin; x++ )
-        {
-          if( x < xoffset )
-          {
-            pi[ -x - 1 ] = pi[ -x - 1 + xoffset ];
-            pi[  p.width + x ] = pi[ p.width + x - xoffset ];
-          }
-          else
-          {
-            pi[ -x - 1 ] = pi[ 0 ];
-            pi[  p.width + x ] = pi[ p.width - 1 ];
-          }
-        }
-        pi += p.stride;
-      }
-      pi -= (p.stride + xmargin);
-      for (int y = 0; y < ymargin; y++ )
-      {
-        ::memcpy( pi + (y+1)*p.stride, pi, sizeof(Pel)*(p.width + (xmargin << 1)));
-      }
-      pi -= ((p.height-1) * p.stride);
-      for (int y = 0; y < ymargin; y++ )
-      {
-        ::memcpy( pi - (y+1)*p.stride, pi, sizeof(Pel)*(p.width + (xmargin<<1)) );
-      }
-    }
-#endif
   }
 
   m_bIsBorderExtended = true;
 }
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
 void Picture::extendWrapBorder( const PPS *pps )
 {
   for(int comp=0; comp<getNumberValidComponents( cs->area.chromaFormat ); comp++)
@@ -1202,7 +1155,6 @@ void Picture::extendWrapBorder( const PPS *pps )
   m_wrapAroundOffset = pps->getWrapAroundOffset();
 }
 
-#endif
 PelBuf Picture::getBuf( const ComponentID compID, const PictureType &type )
 {
   return M_BUFS( ( type == PIC_ORIGINAL || type == PIC_TRUE_ORIGINAL || type == PIC_ORIGINAL_INPUT || type == PIC_TRUE_ORIGINAL_INPUT ) ? 0 : scheduler.getSplitPicId(), type ).getBuf( compID );
diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h
index e6c132d2f..8bafaaf13 100644
--- a/source/Lib/CommonLib/Picture.h
+++ b/source/Lib/CommonLib/Picture.h
@@ -144,12 +144,8 @@ struct Picture : public UnitArea
          PelUnitBuf getBuf(const UnitArea &unit,     const PictureType &type);
   const CPelUnitBuf getBuf(const UnitArea &unit,     const PictureType &type) const;
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
   void extendPicBorder( const PPS *pps );
   void extendWrapBorder( const PPS *pps );
-#else
-  void extendPicBorder();
-#endif
   void finalInit( const VPS* vps, const SPS& sps, const PPS& pps, PicHeader *picHeader, APS** alfApss, APS* lmcsAps, APS* scalingListAps );
 
   int  getPOC()                               const { return poc; }
@@ -207,10 +203,8 @@ public:
   bool getSubPicSaved()          { return m_isSubPicBorderSaved; }
   void setSubPicSaved(bool bVal) { m_isSubPicBorderSaved = bVal; }
   bool m_bIsBorderExtended;
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   bool m_wrapAroundValid;
   unsigned m_wrapAroundOffset;
-#endif
   bool referenced;
   bool reconstructed;
   bool neededForOutput;
@@ -274,9 +268,7 @@ public:
                                                                                                getScalingWindow().getWindowRightOffset()  != pps->getScalingWindow().getWindowRightOffset() ||
                                                                                                getScalingWindow().getWindowTopOffset()    != pps->getScalingWindow().getWindowTopOffset()   ||
                                                                                                getScalingWindow().getWindowBottomOffset() != pps->getScalingWindow().getWindowBottomOffset(); }
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   bool               isWrapAroundEnabled( const PPS* pps ) const                     { return  pps->getWrapAroundEnabledFlag() && !isRefScaled( pps ); }
-#endif
 
   void         allocateNewSlice();
   Slice        *swapSliceObject(Slice * p, uint32_t i);
diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index b74e89118..0d989a477 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -508,11 +508,7 @@ void Slice::constructRefPicList(PicList& rcListPic)
       pcRefPic = xGetLongTermRefPic( rcListPic, ltrpPoc, m_localRPL0.getDeltaPocMSBPresentFlag( ii ), m_pcPic->layerId );
       pcRefPic->longTerm = true;
     }
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
     pcRefPic->extendPicBorder( getPPS() );
-#else
-    pcRefPic->extendPicBorder();
-#endif
     m_apcRefPicList[REF_PIC_LIST_0][ii] = pcRefPic;
     m_bIsUsedAsLongTerm[REF_PIC_LIST_0][ii] = pcRefPic->longTerm;
   }
@@ -548,11 +544,7 @@ void Slice::constructRefPicList(PicList& rcListPic)
       pcRefPic = xGetLongTermRefPic( rcListPic, ltrpPoc, m_localRPL1.getDeltaPocMSBPresentFlag( ii ), m_pcPic->layerId );
       pcRefPic->longTerm = true;
     }
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
     pcRefPic->extendPicBorder( getPPS() );
-#else
-    pcRefPic->extendPicBorder();
-#endif
     m_apcRefPicList[REF_PIC_LIST_1][ii] = pcRefPic;
     m_bIsUsedAsLongTerm[REF_PIC_LIST_1][ii] = pcRefPic->longTerm;
   }
@@ -2815,9 +2807,6 @@ SPS::SPS()
 , m_vuiParametersPresentFlag  (false)
 , m_vuiParameters             ()
 , m_wrapAroundEnabledFlag     (false)
-#if !JVET_Q0764_WRAP_AROUND_WITH_RPR
-, m_wrapAroundOffset          (  0)
-#endif
 , m_IBCFlag                   (  0)
 , m_PLTMode                   (  0)
 , m_lmcsEnabled               (false)
@@ -3052,11 +3041,9 @@ PPS::PPS()
 , m_conformanceWindowFlag            (false)
 , m_picWidthInLumaSamples(352)
 , m_picHeightInLumaSamples( 288 )
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
 , m_wrapAroundEnabledFlag            (false)
 , m_picWidthMinusWrapAroundOffset    (0)
 , m_wrapAroundOffset                 (0)
-#endif
 , pcv                                (NULL)
 {
   m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CbOffset = 0; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0. This is initialised here and never subsequently changed.
@@ -4301,12 +4288,8 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS
                                    scaledRefPic[j]->getRecoBuf(), pps->getScalingWindow(),
                                    sps->getChromaFormatIdc(), sps->getBitDepths(), true, downsampling,
                                    sps->getHorCollocatedChromaFlag(), sps->getVerCollocatedChromaFlag() );
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
           scaledRefPic[j]->unscaledPic = m_apcRefPicList[refList][rIdx];
           scaledRefPic[j]->extendPicBorder( getPPS() );
-#else
-          scaledRefPic[j]->extendPicBorder();
-#endif
 
           m_scaledRefPicList[refList][rIdx] = scaledRefPic[j];
         }
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index 356d017a8..35b054209 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1451,9 +1451,6 @@ private:
   bool              m_alfEnabledFlag;
   bool              m_ccalfEnabledFlag;
   bool              m_wrapAroundEnabledFlag;
-#if !JVET_Q0764_WRAP_AROUND_WITH_RPR
-  unsigned          m_wrapAroundOffset;
-#endif
   unsigned          m_IBCFlag;
   bool              m_useColorTrans;
   unsigned          m_PLTMode;
@@ -1802,10 +1799,6 @@ void                    setCCALFEnabledFlag( bool b )
 
   void                    setWrapAroundEnabledFlag(bool b)                                                { m_wrapAroundEnabledFlag = b;                                         }
   bool                    getWrapAroundEnabledFlag() const                                                { return m_wrapAroundEnabledFlag;                                      }
-#if !JVET_Q0764_WRAP_AROUND_WITH_RPR
-  void                    setWrapAroundOffset(unsigned offset)                                            { m_wrapAroundOffset = offset;                                         }
-  unsigned                getWrapAroundOffset() const                                                     { return m_wrapAroundOffset;                                           }
-#endif
   void                    setUseLmcs(bool b)                                                              { m_lmcsEnabled = b;                                                   }
   bool                    getUseLmcs() const                                                              { return m_lmcsEnabled;                                                }
   void                    setIBCFlag(unsigned IBCFlag)                                                    { m_IBCFlag = IBCFlag; }
@@ -1998,11 +1991,9 @@ private:
   Window           m_conformanceWindow;
   Window           m_scalingWindow;
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   bool             m_wrapAroundEnabledFlag;               //< reference wrap around enabled or not
   unsigned         m_picWidthMinusWrapAroundOffset;          // <pic_width_in_minCbSizeY - wraparound_offset_in_minCbSizeY
   unsigned         m_wrapAroundOffset;                    //< reference wrap around offset in luma samples
-#endif
 
 public:
   PreCalcValues   *pcv;
@@ -2094,14 +2085,12 @@ public:
   void                   setUseWP( bool b )                                               { m_bUseWeightPred = b;                         }
   void                   setWPBiPred( bool b )                                            { m_useWeightedBiPred = b;                      }
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   void                   setWrapAroundEnabledFlag(bool b)                                 { m_wrapAroundEnabledFlag = b;                  }
   bool                   getWrapAroundEnabledFlag() const                                 { return m_wrapAroundEnabledFlag;               }  
   void                   setPicWidthMinusWrapAroundOffset(unsigned offset)                { m_picWidthMinusWrapAroundOffset = offset;     }
   unsigned               getPicWidthMinusWrapAroundOffset() const                         { return m_picWidthMinusWrapAroundOffset;       }
   void                   setWrapAroundOffset(unsigned offset)                             { m_wrapAroundOffset = offset;                  }
   unsigned               getWrapAroundOffset() const                                      { return m_wrapAroundOffset;                    }
-#endif
   void                   setOutputFlagPresentFlag( bool b )                               { m_OutputFlagPresentFlag = b;                  }
   bool                   getOutputFlagPresentFlag() const                                 { return m_OutputFlagPresentFlag;               }
   void                   setNumSubPics(uint32_t u )                                       { CHECK( u >= MAX_NUM_SUB_PICS, "Maximum number of subpictures exceeded" );
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 129356e18..9f6b7ca4e 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -82,7 +82,6 @@
 
 
 
-#define JVET_Q0764_WRAP_AROUND_WITH_RPR                   1 // JVET-Q0764: Combination of wrap around offset and RPR
 
 #define JVET_R0055_HANDLING_NON_EXISTENT_QM               1 // JVET-R0055: infer chroma scaling lists to be all 16 in 4:0:0 by copy mode flag
 
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index 65482d091..92820889a 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -1683,11 +1683,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId)
 
   if( sps->getCTUSize() + 2 * ( 1 << sps->getLog2MinCodingBlockSize() ) > pps->getPicWidthInLumaSamples() )
   {
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
     CHECK( pps->getWrapAroundEnabledFlag(), "Wraparound shall be disabled when the value of ( CtbSizeY / MinCbSizeY + 1) is greater than or equal to ( pic_width_in_luma_samples / MinCbSizeY - 1 )" );
-#else
-    CHECK( sps->getWrapAroundEnabledFlag(), "Wraparound shall be disabled when the value of ( CtbSizeY / MinCbSizeY + 1) is less than or equal to ( pic_width_in_luma_samples / MinCbSizeY - 1 )" );
-#endif
   }
 
   if( vps != nullptr && vps->m_numOutputLayersInOls[vps->m_targetOlsIdx] > 1 )
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 7982425a8..a6a28658d 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -920,7 +920,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
   READ_FLAG(uiCode, "qp_delta_info_in_ph_flag");               pcPPS->setQpDeltaInfoInPhFlag(uiCode ? true : false);
 #endif
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   READ_FLAG(uiCode, "pps_ref_wraparound_enabled_flag");           pcPPS->setWrapAroundEnabledFlag( uiCode ? true : false );
   if (pcPPS->getWrapAroundEnabledFlag())
   {
@@ -931,7 +930,6 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
   {
     pcPPS->setPicWidthMinusWrapAroundOffset(0);
   }
-#endif
 
   READ_FLAG( uiCode, "picture_header_extension_present_flag");
   pcPPS->setPictureHeaderExtensionPresentFlag(uiCode);
@@ -1803,13 +1801,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   
 
   READ_FLAG(uiCode, "sps_ref_wraparound_enabled_flag");                  pcSPS->setWrapAroundEnabledFlag( uiCode ? true : false );
-#if !JVET_Q0764_WRAP_AROUND_WITH_RPR
-
-  if (pcSPS->getWrapAroundEnabledFlag())
-  {
-    READ_UVLC(uiCode, "sps_ref_wraparound_offset");               pcSPS->setWrapAroundOffset((uiCode + 2 + pcSPS->getCTUSize() / (1 << pcSPS->getLog2MinCodingBlockSize()))*(1 << pcSPS->getLog2MinCodingBlockSize()));
-  }
-#endif
 
   if (pcSPS->getWrapAroundEnabledFlag())
   {
@@ -2867,7 +2858,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
 
   pps->initSubPic(*sps);
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   // set wraparound offset from PPS and SPS info
   int minCbSizeY = (1 << sps->getLog2MinCodingBlockSize());
   CHECK( !sps->getWrapAroundEnabledFlag() && pps->getWrapAroundEnabledFlag(), "When sps_ref_wraparound_enabled_flag is equal to 0, the value of pps_ref_wraparound_enabled_flag shall be equal to 0.");
@@ -2881,7 +2871,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
   {
     pps->setWrapAroundOffset( 0 );
   }
-#endif
 
   // virtual boundaries
   if( sps->getVirtualBoundariesEnabledFlag() && !sps->getVirtualBoundariesPresentFlag() )
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index 396a8eb1c..e996dc906 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -4917,11 +4917,7 @@ void EncGOP::updateCompositeReference(Slice* pcSlice, PicList& rcListPic, int po
   // Update background reference
   if (pcSlice->isIRAP())//(pocCurr == 0)
   {
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
     curPic->extendPicBorder( pcSlice->getPPS() );
-#else
-    curPic->extendPicBorder();
-#endif
     curPic->setBorderExtension(true);
 
     m_picBg->getRecoBuf().copyFrom(curPic->getRecoBuf());
@@ -4960,27 +4956,15 @@ void EncGOP::updateCompositeReference(Slice* pcSlice, PicList& rcListPic, int po
       }
     }
     m_picBg->setBorderExtension(false);
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
     m_picBg->extendPicBorder( pcSlice->getPPS() );
-#else
-    m_picBg->extendPicBorder();
-#endif
     m_picBg->setBorderExtension(true);
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
     curPic->extendPicBorder( pcSlice->getPPS() );
-#else
-    curPic->extendPicBorder();
-#endif
     curPic->setBorderExtension(true);
     m_picOrig->getOrigBuf().copyFrom(curPic->getOrigBuf());
 
     m_picBg->setBorderExtension(false);
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
     m_picBg->extendPicBorder( pcSlice->getPPS() );
-#else
-    m_picBg->extendPicBorder();
-#endif
     m_picBg->setBorderExtension(true);
   }
 }
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 88fc18657..7e0ba9d89 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -316,7 +316,6 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
 
     xInitPPS( pps, sps0 ); // will allocate memory for and initialize pps.pcv inside
     
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR  
     if( pps.getWrapAroundEnabledFlag() )
     {
       int minCbSizeY = (1 << sps0.getLog2MinCodingBlockSize());
@@ -329,7 +328,6 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
       pps.setPicWidthMinusWrapAroundOffset      (0);
       pps.setWrapAroundOffset                   ( 0 );       
     }
-#endif
   }
 
 #if ER_CHROMA_QP_WCG_PPS
@@ -1257,9 +1255,6 @@ void EncLib::xInitSPS( SPS& sps )
   sps.setPLTMode                            ( m_PLTMode);
   sps.setIBCFlag                            ( m_IBCMode);
   sps.setWrapAroundEnabledFlag                      ( m_wrapAround );
-#if !JVET_Q0764_WRAP_AROUND_WITH_RPR
-  sps.setWrapAroundOffset                   ( m_wrapAroundOffset );
-#endif
   // ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here
   sps.setUseISP                             ( m_ISP );
   sps.setUseLmcs                            ( m_lmcsEnabled );
@@ -1628,7 +1623,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
     pps.setSliceChromaQpFlag(m_chromaCbQpOffsetDualTree != 0 || m_chromaCrQpOffsetDualTree != 0 || m_chromaCbCrQpOffsetDualTree != 0);
   }
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   int minCbSizeY = (1 << sps.getLog2MinCodingBlockSize());
   pps.setWrapAroundEnabledFlag                ( m_wrapAround );
   if( m_wrapAround )
@@ -1643,7 +1637,6 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
   }
   CHECK( !sps.getWrapAroundEnabledFlag() && pps.getWrapAroundEnabledFlag(), "When sps_ref_wraparound_enabled_flag is equal to 0, the value of pps_ref_wraparound_enabled_flag shall be equal to 0.");
   CHECK( (((sps.getCTUSize() / minCbSizeY) + 1) > ((pps.getPicWidthInLumaSamples() / minCbSizeY) - 1)) && pps.getWrapAroundEnabledFlag(), "When the value of CtbSizeY / MinCbSizeY + 1 is greater than pic_width_in_luma_samples / MinCbSizeY - 1, the value of pps_ref_wraparound_enabled_flag shall be equal to 0.");
-#endif
 
   pps.setNoPicPartitionFlag( m_noPicPartitionFlag );
   if( m_noPicPartitionFlag == false )
diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp
index ccbe3776d..86ae8694b 100644
--- a/source/Lib/EncoderLib/InterSearch.cpp
+++ b/source/Lib/EncoderLib/InterSearch.cpp
@@ -1884,14 +1884,9 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR
           currAMVPInfo4Pel.mvCand[mvpIdxTemp].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
         }
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
         bool wrap = pu.cu->slice->getRefPic(eRefPicList, refIdx)->isWrapAroundEnabled( pu.cs->pps );
         const Pel* refBufStart = pu.cu->slice->getRefPic(eRefPicList, refIdx)->getRecoBuf(wrap).get(COMPONENT_Y).buf;
         const int refStride = pu.cu->slice->getRefPic(eRefPicList, refIdx)->getRecoBuf(wrap).get(COMPONENT_Y).stride;
-#else
-        const Pel* refBufStart = pu.cu->slice->getRefPic(eRefPicList, refIdx)->getRecoBuf(pu.cs->sps->getWrapAroundEnabledFlag()).get(COMPONENT_Y).buf;
-        const int refStride = pu.cu->slice->getRefPic(eRefPicList, refIdx)->getRecoBuf(pu.cs->sps->getWrapAroundEnabledFlag()).get(COMPONENT_Y).stride;
-#endif
         m_cDistParam.cur.stride = refStride;
 
         m_pcRdCost->selectMotionLambda( );
@@ -2088,14 +2083,9 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi
           currAMVPInfo4Pel.mvCand[mvpIdxTemp].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
         }
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
         bool wrap = pu.cu->slice->getRefPic(eRefPicList, refIdx)->isWrapAroundEnabled( pu.cs->pps );
         const Pel* refBufStart = pu.cu->slice->getRefPic(eRefPicList, refIdx)->getRecoBuf(wrap).get(COMPONENT_Y).buf;
         const int refStride = pu.cu->slice->getRefPic(eRefPicList, refIdx)->getRecoBuf(wrap).get(COMPONENT_Y).stride;
-#else
-        const Pel* refBufStart = pu.cu->slice->getRefPic(eRefPicList, refIdx)->getRecoBuf(pu.cs->sps->getWrapAroundEnabledFlag()).get(COMPONENT_Y).buf;
-        const int refStride = pu.cu->slice->getRefPic(eRefPicList, refIdx)->getRecoBuf(pu.cs->sps->getWrapAroundEnabledFlag()).get(COMPONENT_Y).stride;
-#endif
 
         m_cDistParam.cur.stride = refStride;
 
@@ -3344,12 +3334,8 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref
 
   m_lumaClpRng = pu.cs->slice->clpRng( COMPONENT_Y );
 
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   bool wrap =  pu.cu->slice->getRefPic(eRefPicList, iRefIdxPred)->isWrapAroundEnabled( pu.cs->pps );
   CPelBuf buf = pu.cu->slice->getRefPic(eRefPicList, iRefIdxPred)->getRecoBuf(pu.blocks[COMPONENT_Y], wrap);
-#else
-  CPelBuf buf = pu.cu->slice->getRefPic(eRefPicList, iRefIdxPred)->getRecoBuf(pu.blocks[COMPONENT_Y], pu.cs->sps->getWrapAroundEnabledFlag());
-#endif
 
   IntTZSearchStruct cStruct;
   cStruct.pcPatternKey  = pcPatternKey;
@@ -7796,11 +7782,7 @@ void InterSearch::xClipMv( Mv& rcMv, const Position& pos, const struct Size& siz
     verMax = ((curSubPic.getSubPicBottom() + 1) + offset -  (int)pos.y - 1) << mvShift;
     verMin = (-(int)sps.getMaxCUHeight() - offset - ((int)pos.y - curSubPic.getSubPicTop()) + 1) << mvShift;
   }
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   if( pps.getWrapAroundEnabledFlag() )
-#else
-  if( sps.getWrapAroundEnabledFlag() )
-#endif
   {
     int horMax = ( pps.getPicWidthInLumaSamples() + sps.getMaxCUWidth() - size.width + offset - (int)pos.x - 1 ) << mvShift;
     int horMin = ( -( int ) sps.getMaxCUWidth()                                      - offset - ( int ) pos.x + 1 ) << mvShift;
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 9c05810a1..ef90f51eb 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -521,13 +521,11 @@ void HLSWriter::codePPS( const PPS* pcPPS )
   }
   WRITE_FLAG(pcPPS->getQpDeltaInfoInPhFlag() ? 1 : 0, "qp_delta_info_in_ph_flag");
 #endif
-#if JVET_Q0764_WRAP_AROUND_WITH_RPR
   WRITE_FLAG( pcPPS->getWrapAroundEnabledFlag() ? 1 : 0, "pps_ref_wraparound_enabled_flag" );
   if( pcPPS->getWrapAroundEnabledFlag() )
   {
     WRITE_UVLC(pcPPS->getPicWidthMinusWrapAroundOffset(), "pps_pic_width_minus_wraparound_offset");
   }
-#endif
 
   WRITE_FLAG( pcPPS->getPictureHeaderExtensionPresentFlag() ? 1 : 0, "picture_header_extension_present_flag");
   WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_header_extension_present_flag");
@@ -1091,12 +1089,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   }
 
   WRITE_FLAG( pcSPS->getWrapAroundEnabledFlag() ? 1 : 0,                              "sps_ref_wraparound_enabled_flag" );
-#if !JVET_Q0764_WRAP_AROUND_WITH_RPR
-  if( pcSPS->getWrapAroundEnabledFlag() )
-  {
-    WRITE_UVLC((pcSPS->getWrapAroundOffset() / (1 << pcSPS->getLog2MinCodingBlockSize())) - 2 - pcSPS->getCTUSize()/(1<<pcSPS->getLog2MinCodingBlockSize()), "sps_ref_wraparound_offset");
-  }
-#endif
 
   WRITE_FLAG( pcSPS->getSPSTemporalMVPEnabledFlag()  ? 1 : 0,                        "sps_temporal_mvp_enabled_flag" );
 
-- 
GitLab