diff --git a/doc/mainpage.h b/doc/mainpage.h
index 4a55ec87e5cc1595a4ecaae6d5fa5e40e18d7d0d..efe90264a414e5bca1df89df715511d12fd8c854 100644
--- a/doc/mainpage.h
+++ b/doc/mainpage.h
@@ -7,8 +7,8 @@
  *
  * \section Introduction
  *
- *  This is the doxygen generated documentation of the HEVC HM reference software. 
- *     
+ *  This is the doxygen generated documentation of the HEVC HM reference software.
+ *
  *  For detailed information see the sub-pages of this site.
  *
  *  For information on the <b>subversion repositories</b> and the <b>software manual</b> see
@@ -22,7 +22,7 @@
  * The copyright in this software is being made available under the BSD
  * License, included below. This software may be subject to other third party
  * and contributor rights, including patent rights, and no such rights are
- * granted under this license.  
+ * granted under this license.
  *
  * Copyright (c) 2010-2019, ITU/ISO/IEC
  * All rights reserved.
diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index 68de8ebb9681a777b6ecfa647535f4ae77261e14..a4eda30ba38cad7da373264a93c357443283e20c 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -260,7 +260,7 @@ void EncApp::xInitLibCfg()
       m_cEncLib.setLadfIntervalLowerBound(m_LadfIntervalLowerBound[k], k);
     }
   }
-#endif  
+#endif
   m_cEncLib.setUseMHIntra                                        ( m_MHIntra );
   m_cEncLib.setUseTriangle                                       ( m_Triangle );
 #if JVET_M0253_HASH_ME
@@ -574,7 +574,7 @@ void EncApp::xInitLibCfg()
   m_cEncLib.setReshapeSignalType                                 ( m_reshapeSignalType );
   m_cEncLib.setReshapeIntraCMD                                   ( m_intraCMD );
   m_cEncLib.setReshapeCW                                         ( m_reshapeCW );
-#endif  
+#endif
 }
 
 void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList
diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp
index ecdd366451813fd2a46fc9d7baa1e24476fa1b0f..5ca2c6bdfd3146186163a90f81799e5064041e6a 100644
--- a/source/App/EncoderApp/EncAppCfg.cpp
+++ b/source/App/EncoderApp/EncAppCfg.cpp
@@ -1338,13 +1338,13 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
   po::ErrorReporter err;
   const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv, err);
 
-  if (m_compositeRefEnabled) 
+  if (m_compositeRefEnabled)
   {
-    for (int i = 0; i < m_iGOPSize; i++) 
+    for (int i = 0; i < m_iGOPSize; i++)
     {
       m_GOPList[i].m_POC *= 2;
       m_GOPList[i].m_deltaRPS *= 2;
-      for (int j = 0; j < m_GOPList[i].m_numRefPics; j++) 
+      for (int j = 0; j < m_GOPList[i].m_numRefPics; j++)
       {
         m_GOPList[i].m_referencePics[j] *= 2;
       }
@@ -1973,7 +1973,7 @@ bool EncAppCfg::xCheckParameter()
     xConfirmPara(m_IBCMode, "IBC Mode only allowed with NEXT profile");
 #if JVET_M0253_HASH_ME
     xConfirmPara( m_HashME, "Hash motion estimation only allowed with NEXT profile" );
-#endif   
+#endif
     xConfirmPara( m_useFastLCTU, "Fast large CTU can only be applied when encoding with NEXT profile" );
 #if JVET_M0464_UNI_MTS
     xConfirmPara( m_MTS, "MTS only allowed with NEXT profile" );
@@ -2053,8 +2053,8 @@ bool EncAppCfg::xCheckParameter()
 
 
   xConfirmPara( m_useAMaxBT && !m_SplitConsOverrideEnabledFlag, "AMaxBt can only be used with PartitionConstriantsOverride enabled" );
- 
-  
+
+
   xConfirmPara(m_bitstreamFileName.empty(), "A bitstream file name must be specified (BitstreamFile)");
   const uint32_t maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
   xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value");
diff --git a/source/App/Parcat/parcat.cpp b/source/App/Parcat/parcat.cpp
index 81872abd5fb67b1bcdce84a68959119640944178..e6443eaf190ba9614243af216fa32a4572162f77 100644
--- a/source/App/Parcat/parcat.cpp
+++ b/source/App/Parcat/parcat.cpp
@@ -314,11 +314,11 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int
       int byte_offset2 = offset / 8;
       int hi_bits2 = offset % 8;
       uint16_t data2 = (nalu[byte_offset2] << 8) | nalu[byte_offset2 + 1];
-      int low_bits2 = 16 - hi_bits2 - 1;      
+      int low_bits2 = 16 - hi_bits2 - 1;
       if(((data2 >> low_bits2) % 2))
-        offset += 1; // PPSId=0 
+        offset += 1; // PPSId=0
       else
-        offset += 3; // PPSId=1 
+        offset += 3; // PPSId=1
       offset += 1; // slice_type TODO: ue(v)
       // separate_colour_plane_flag is not supported in JEM1.0
       if (nalu_type == CRA)
diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp
index 4fbd8c9dda66b96520b058067327872460cabd16..1fb61a55e0c059f468a9b2469d476042797552a0 100644
--- a/source/Lib/CommonLib/Buffer.cpp
+++ b/source/Lib/CommonLib/Buffer.cpp
@@ -393,7 +393,7 @@ void AreaBuf<Pel>::rspSignal(std::vector<Pel>& pLUT)
   if (width == 1)
   {
     THROW("Blocks of width = 1 not supported");
-  }  
+  }
   else
   {
 #endif
@@ -470,7 +470,7 @@ Pel AreaBuf <Pel> ::computeAvg() const
 #endif
     int32_t acc = 0;
 #define AVG_INC   \
-    src +=       stride; 
+    src +=       stride;
 #define AVG_OP(ADDR) acc += src[ADDR]
     SIZE_AWARE_PER_EL_OP(AVG_OP, AVG_INC);
 #undef AVG_INC
diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp
index 3f7244f93114854571c64cb89570caf3085bc686..f52f4205834c8bfafe0841b22e45451cb4462b16 100644
--- a/source/Lib/CommonLib/CodingStructure.cpp
+++ b/source/Lib/CommonLib/CodingStructure.cpp
@@ -831,7 +831,7 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C
   if( cpyResi ) picture->getResiBuf( clippedArea ).copyFrom( subResiBuf );
   if( cpyReco ) picture->getRecoBuf( clippedArea ).copyFrom( subRecoBuf );
 
-#if JVET_M0483_IBC 
+#if JVET_M0483_IBC
   if (!subStruct.m_isTuEnc && ((!slice->isIntra() || slice->getSPS()->getIBCFlag()) && subStruct.chType != CHANNEL_TYPE_CHROMA))
 #else
   if (!subStruct.m_isTuEnc && (!slice->isIntra() && subStruct.chType != CHANNEL_TYPE_CHROMA))
@@ -1015,7 +1015,7 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel
     pu = *ppu;
   }
 
-#if JVET_M0483_IBC 
+#if JVET_M0483_IBC
   if (!other.slice->isIntra() || other.slice->getSPS()->getIBCFlag())
 #else
   if( !other.slice->isIntra() )
@@ -1126,7 +1126,7 @@ void CodingStructure::clearTUs()
     memset( m_tuIdx   [i],     0, sizeof( *m_tuIdx   [0] ) * _area );
   }
 
-  numCh = getNumberValidComponents( area.chromaFormat ); 
+  numCh = getNumberValidComponents( area.chromaFormat );
   for( int i = 0; i < numCh; i++ )
   {
     m_offsets[i] = 0;
diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h
index 6e2ade64161fa45bd63ce7f49b470c93b0e9e659..de3f6beff636b7ae5ca4881dd7a2953cbd4b7a14 100644
--- a/source/Lib/CommonLib/CommonDef.h
+++ b/source/Lib/CommonLib/CommonDef.h
@@ -409,7 +409,7 @@ static const int TRIANGLE_MIN_SIZE =                            8 * 8;
 #if JVET_M0140_SBT
 static const int SBT_MAX_SIZE =                                    64; ///< maximum CU size for using SBT
 static const int SBT_NUM_SL =                                      10; ///< maximum number of historical PU decision saved for a CU
-static const int SBT_NUM_RDO =                                      2; ///< maximum number of SBT mode tried for a PU 
+static const int SBT_NUM_RDO =                                      2; ///< maximum number of SBT mode tried for a PU
 #endif
 
 static const int IBC_MAX_CAND_SIZE = 16; // max block size for ibc search
diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp
index ab3c134d37c3e995392dac2497a959a3098e2e68..2babdef1cb3d367303dd17297a3fff984266c502 100644
--- a/source/Lib/CommonLib/Contexts.cpp
+++ b/source/Lib/CommonLib/Contexts.cpp
@@ -350,7 +350,7 @@ std::vector<std::vector<uint8_t>> ContextSetCfg::sm_InitTables( NUMBER_OF_SLICE_
 const CtxSet ContextSetCfg::SplitFlag = ContextSetCfg::addCtxSet
 ({
 #if JVET_M0421_SPLIT_SIG
-  // |-------- do split ctx -------------------| 
+  // |-------- do split ctx -------------------|
   {  93, 124, 141, 123, 125, 141, 139, 126, 157, },
   { 108, 139, 156, 138, 140, 141, 139, 141, 143, },
   { 153, 154, 172, 153, 140, 156, 154, 127, 159, },
diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp
index 241cb9766411b4ec8b01d5e211321c9ef9e5f22f..47ef0df979b85e92a2b0a499fd8bdd48b3bc62ce 100644
--- a/source/Lib/CommonLib/InterPrediction.cpp
+++ b/source/Lib/CommonLib/InterPrediction.cpp
@@ -193,7 +193,7 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC )
     m_triangleBuf.create(UnitArea(chromaFormatIDC, Area(0, 0, MAX_CU_SIZE, MAX_CU_SIZE)));
 
     m_iRefListIdx = -1;
-  
+
     m_gradX0 = (Pel*)xMalloc(Pel, BIO_TEMP_BUFFER_SIZE);
     m_gradY0 = (Pel*)xMalloc(Pel, BIO_TEMP_BUFFER_SIZE);
     m_gradX1 = (Pel*)xMalloc(Pel, BIO_TEMP_BUFFER_SIZE);
@@ -204,7 +204,7 @@ void InterPrediction::init( RdCost* pcRdCost, ChromaFormat chromaFormatIDC )
   m_cYuvPredTempDMVRL0 = (Pel*)xMalloc(Pel, (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION)) * (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION)));
   m_cYuvPredTempDMVRL1 = (Pel*)xMalloc(Pel, (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION)) * (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION)));
   for (uint32_t ch = 0; ch < MAX_NUM_COMPONENT; ch++)
-  {    
+  {
     m_cRefSamplesDMVRL0[ch] = (Pel*)xMalloc(Pel, (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + NTAPS_LUMA) * (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + NTAPS_LUMA));
     m_cRefSamplesDMVRL1[ch] = (Pel*)xMalloc(Pel, (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + NTAPS_LUMA) * (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION) + NTAPS_LUMA));
   }
@@ -404,8 +404,8 @@ void InterPrediction::xChromaMC(PredictionUnit &pu, PelUnitBuf& pcYuvPred)
 }
 
 
-void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi 
-                                   , const bool& bioApplied 
+void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi
+                                   , const bool& bioApplied
                                    , const bool luma, const bool chroma
 )
 {
@@ -473,7 +473,7 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
           , isIBC
         );
       }
-#else     
+#else
       xPredInterBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx ), mv[0], pcYuvPred, bi, pu.cu->slice->clpRng( compID )
                     , bioApplied
                     , isIBC
@@ -567,14 +567,14 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
     {
       if( ( (pps.getUseWP() && slice.getSliceType() == P_SLICE) || (pps.getWPBiPred() && slice.getSliceType() == B_SLICE) ) )
       {
-        xPredInterUni ( pu, eRefPicList, pcMbBuf, true 
+        xPredInterUni ( pu, eRefPicList, pcMbBuf, true
           , bioApplied
           , true, true
         );
       }
       else
       {
-        xPredInterUni( pu, eRefPicList, pcMbBuf, pu.cu->triangle 
+        xPredInterUni( pu, eRefPicList, pcMbBuf, pu.cu->triangle
           , bioApplied
           , true, true
         );
@@ -786,7 +786,7 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio
     bioSampleExtendBilinearFilter(refBuf.buf, refBuf.stride, dstBuf.buf, dstBuf.stride, width - 2, height - 2, 1, xFrac, yFrac, rndRes, chFmt, clpRng);
 #endif
 
-    // restore data 
+    // restore data
     width = backupWidth;
     height = backupHeight;
     dstBuf.buf = backupDstBufPtr;
@@ -937,7 +937,7 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
           m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)] +
           m_storedMv[((h << iScaleY) / AFFINE_MIN_BLOCK_SIZE + 1)* MVBUFFER_SIZE + ((w << iScaleX) / AFFINE_MIN_BLOCK_SIZE + 1)] +
           Mv(2, 2));
-        curMv.set(curMv.getHor() >> 2, curMv.getVer() >> 2);   
+        curMv.set(curMv.getHor() >> 2, curMv.getVer() >> 2);
 #endif
 #endif
         if (sps.getWrapAroundEnabledFlag())
@@ -1329,7 +1329,7 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
   }
 }
 
-void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBuf, const RefPicList &eRefPicList 
+void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBuf, const RefPicList &eRefPicList
   , const bool luma, const bool chroma
 )
 {
@@ -1358,7 +1358,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
   {
     if( ( ( sliceType == P_SLICE && pps.getUseWP() ) || ( sliceType == B_SLICE && pps.getWPBiPred() ) ) )
     {
-      xPredInterUni         ( pu,          eRefPicList, predBuf, true 
+      xPredInterUni         ( pu,          eRefPicList, predBuf, true
         , false
         , true, true
       );
@@ -1366,7 +1366,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
     }
     else
     {
-      xPredInterUni( pu, eRefPicList, predBuf, false 
+      xPredInterUni( pu, eRefPicList, predBuf, false
         , false
         , true, true
       );
@@ -1380,7 +1380,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
     }
     else if( xCheckIdenticalMotion( pu ) )
     {
-      xPredInterUni( pu, REF_PIC_LIST_0, predBuf, false 
+      xPredInterUni( pu, REF_PIC_LIST_0, predBuf, false
         , false
         , true, true
       );
@@ -1393,7 +1393,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
   return;
 }
 
-void InterPrediction::motionCompensation( CodingUnit &cu, const RefPicList &eRefPicList 
+void InterPrediction::motionCompensation( CodingUnit &cu, const RefPicList &eRefPicList
   , const bool luma, const bool chroma
 )
 {
@@ -1403,7 +1403,7 @@ void InterPrediction::motionCompensation( CodingUnit &cu, const RefPicList &eRef
 #if JVET_M0147_DMVR
     pu.mvRefine = true;
 #endif
-    motionCompensation( pu, predBuf, eRefPicList 
+    motionCompensation( pu, predBuf, eRefPicList
       , luma, chroma
     );
 #if JVET_M0147_DMVR
@@ -1412,12 +1412,12 @@ void InterPrediction::motionCompensation( CodingUnit &cu, const RefPicList &eRef
   }
 }
 
-void InterPrediction::motionCompensation( PredictionUnit &pu, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/ 
+void InterPrediction::motionCompensation( PredictionUnit &pu, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/
   , const bool luma, const bool chroma
 )
 {
   PelUnitBuf predBuf = pu.cs->getPredBuf( pu );
-  motionCompensation( pu, predBuf, eRefPicList 
+  motionCompensation( pu, predBuf, eRefPicList
     , luma, chroma
   );
 }
@@ -1447,11 +1447,11 @@ void InterPrediction::motionCompensation4Triangle( CodingUnit &cu, MergeCtx &tri
     const UnitArea localUnitArea( cu.cs->area.chromaFormat, Area( 0, 0, pu.lwidth(), pu.lheight() ) );
     PelUnitBuf tmpTriangleBuf = m_triangleBuf.getBuf( localUnitArea );
     PelUnitBuf predBuf        = cu.cs->getPredBuf( pu );
-     
+
     triangleMrgCtx.setMergeInfo( pu, candIdx0 );
     PU::spanMotionInfo( pu );
     motionCompensation( pu, tmpTriangleBuf );
-   
+
     triangleMrgCtx.setMergeInfo( pu, candIdx1 );
     PU::spanMotionInfo( pu );
     motionCompensation( pu, predBuf );
@@ -1525,7 +1525,7 @@ void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint
   const int32_t offsetDefault     = (1<<(shiftDefault-1)) + IF_INTERNAL_OFFS;
   const int32_t shiftWeighted     = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)) + log2WeightBase;
   const int32_t offsetWeighted    = (1 << (shiftWeighted - 1)) + (IF_INTERNAL_OFFS << log2WeightBase);
-                                  
+
   const int32_t ratioWH           = (width > height) ? (width / height) : 1;
   const int32_t ratioHW           = (width > height) ? 1 : (height / width);
 #if JVET_M0328_KEEP_ONE_WEIGHT_GROUP
@@ -1538,7 +1538,7 @@ void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint
         int32_t weightedStartPos  = ( splitDir == 0 ) ? ( 0 - (weightedLength >> 1) * ratioWH ) : ( width - ((weightedLength + 1) >> 1) * ratioWH );
         int32_t weightedEndPos    = weightedStartPos + weightedLength * ratioWH - 1;
         int32_t weightedPosoffset =( splitDir == 0 ) ? ratioWH : -ratioWH;
-  
+
 #if JVET_M0328_KEEP_ONE_WEIGHT_GROUP
         Pel     tmpPelWeighted;
         int32_t weightIdx;
@@ -1546,7 +1546,7 @@ void InterPrediction::xWeightedTriangleBlk( const PredictionUnit &pu, const uint
   const Pel*    tmpPelWeighted;
 #endif
         int32_t x, y, tmpX, tmpY, tmpWeightedStart, tmpWeightedEnd;
-  
+
   for( y = 0; y < height; y+= ratioHW )
   {
     for( tmpY = ratioHW; tmpY > 0; tmpY-- )
@@ -1901,15 +1901,15 @@ void InterPrediction::xinitMC(PredictionUnit& pu, const ClpRngs &clpRngs)
 }
 
 void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, const ClpRngs &clpRngs, const bool bioApplied)
-{  
+{
   int iterationCount = DMVR_NUM_ITERATION;
   /*Always High Precision*/
   int mvShift = MV_FRACTIONAL_BITS_INTERNAL;
-  
+
   /*use merge MV as starting MV*/
   Mv mergeMv[] = { pu.mv[REF_PIC_LIST_0] , pu.mv[REF_PIC_LIST_1] };
-  
-  m_biLinearBufStride = (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION));  
+
+  m_biLinearBufStride = (MAX_CU_SIZE + (2 * DMVR_NUM_ITERATION));
 
   int dy = std::min<int>(pu.lumaSize().height, DMVR_SUBCU_HEIGHT);
   int dx = std::min<int>(pu.lumaSize().width,  DMVR_SUBCU_WIDTH);
@@ -1936,9 +1936,9 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con
   Pel *biLinearPredL1 = m_cYuvPredTempDMVRL1 + (iterationCount * m_biLinearBufStride) + iterationCount;
 
   Position puPos = pu.lumaPos();
-  
+
   int bd = pu.cs->slice->getClpRngs().comp[COMPONENT_Y].bd;
-  
+
   {
     int num = 0;
 
@@ -1946,7 +1946,7 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con
     for (int y = puPos.y; y < (puPos.y + pu.lumaSize().height); y = y + dy, yStart = yStart + dy)
     {
       for (int x = puPos.x, xStart = 0; x < (puPos.x + pu.lumaSize().width); x = x + dx, xStart = xStart + dx)
-      {       
+      {
         uint64_t minCost = MAX_UINT64;
         bool notZeroCost = true;
         int16_t totalDeltaMV[2] = { 0,0 };
@@ -1996,7 +1996,7 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con
         totalDeltaMV[0] = (totalDeltaMV[0] << mvShift);
         totalDeltaMV[1] = (totalDeltaMV[1] << mvShift);
         xDMVRSubPixelErrorSurface(notZeroCost, totalDeltaMV, deltaMV, pSADsArray);
-        
+
         pu.mvdL0SubPu[num] = Mv(totalDeltaMV[0], totalDeltaMV[1]);
 
         num++;
@@ -2022,7 +2022,7 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con
 
     int x = 0, y = 0;
     int xStart = 0, yStart = 0;
-    int num = 0;    
+    int num = 0;
 
     int dstStride[MAX_NUM_COMPONENT] = { pcYuvDst.bufs[COMPONENT_Y].stride, pcYuvDst.bufs[COMPONENT_Cb].stride, pcYuvDst.bufs[COMPONENT_Cr].stride };
     for (y = puPos.y; y < (puPos.y + pu.lumaSize().height); y = y + dy, yStart = yStart + dy)
diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h
index d25ef21d7539cebb5b9dd4ecfeb02b4695868863..5c0b4b9ab02652d33724e9b8ecabdcaaccd28dce 100644
--- a/source/Lib/CommonLib/InterPrediction.h
+++ b/source/Lib/CommonLib/InterPrediction.h
@@ -95,7 +95,7 @@ protected:
   PelStorage           m_triangleBuf;
   Mv*                  m_storedMv;
 #if JVET_M0147_DMVR
- /*buffers for bilinear Filter data for DMVR refinement*/  
+ /*buffers for bilinear Filter data for DMVR refinement*/
   Pel*                 m_cYuvPredTempDMVRL0;
   Pel*                 m_cYuvPredTempDMVRL1;
   int                  m_biLinearBufStride;
@@ -121,7 +121,7 @@ protected:
   Mv m_pSearchOffset[5] = { Mv(0, 1), Mv(0, -1), Mv(1, 0), Mv(-1, 0), Mv(0, 0) };
   uint64_t m_SADsArray[((2 * DMVR_NUM_ITERATION) + 1) * ((2 * DMVR_NUM_ITERATION) + 1)];
 #endif
- 
+
   Pel*                 m_gradX0;
   Pel*                 m_gradY0;
   Pel*                 m_gradX1;
@@ -134,8 +134,8 @@ protected:
 #if !JVET_M0487_INT_EXTEND
   void            bioSampleExtendBilinearFilter(Pel const* src, int srcStride, Pel *dst, int dstStride, int width, int height, int dim, int fracX, int fracY, bool isLast, const ChromaFormat fmt, const ClpRng& clpRng);
 #endif
-  void xPredInterUni            ( const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi 
-                                  , const bool& bioApplied 
+  void xPredInterUni            ( const PredictionUnit& pu, const RefPicList& eRefPicList, PelUnitBuf& pcYuvPred, const bool& bi
+                                  , const bool& bioApplied
                                   , const bool luma, const bool chroma
   );
   void xPredInterBi             ( PredictionUnit& pu, PelUnitBuf &pcYuvPred );
diff --git a/source/Lib/CommonLib/InterpolationFilter.cpp b/source/Lib/CommonLib/InterpolationFilter.cpp
index 3c16052f66e480c48286f60c4eca9fade9f73fff..845cb3dcee14f227fa9e5b0b751c675ebe011547 100644
--- a/source/Lib/CommonLib/InterpolationFilter.cpp
+++ b/source/Lib/CommonLib/InterpolationFilter.cpp
@@ -278,10 +278,10 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int
           src += srcStride;
           dst += dstStride;
         }
-      }      
+      }
     }
     else
-#endif 
+#endif
     for (row = 0; row < height; row++)
     {
       for (col = 0; col < width; col++)
@@ -301,7 +301,7 @@ void InterpolationFilter::filterCopy( const ClpRng& clpRng, const Pel *src, int
 
 #if JVET_M0147_DMVR
     if (biMCForDMVR)
-    {   
+    {
       int shift10BitOut, offset;
       if ((clpRng.bd - IF_INTERNAL_PREC_BILINEAR) > 0)
       {
@@ -512,7 +512,7 @@ void InterpolationFilter::filterHor(const ClpRng& clpRng, Pel const *src, int sr
     m_filterHor[1][1][isLast](clpRng, src, srcStride, dst, dstStride, width, height, coeff, biMCForDMVR);
 #else
     m_filterHor[1][1][isLast]( clpRng, src, srcStride, dst, dstStride, width, height, coeff );
-#endif 
+#endif
   }
   else if( N == 2 )
   {
@@ -682,7 +682,7 @@ void InterpolationFilter::filterVer( const ComponentID compID, Pel const *src, i
     if (nFilterIdx == 1)
     {
 #if JVET_M0147_DMVR
-      filterVer<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_bilinearFilterPrec4[frac], biMCForDMVR);        
+      filterVer<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_bilinearFilterPrec4[frac], biMCForDMVR);
 #else
       filterVer<NTAPS_BILINEAR>(clpRng, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_bilinearFilter[frac]);
 #endif
diff --git a/source/Lib/CommonLib/IntraPrediction.h b/source/Lib/CommonLib/IntraPrediction.h
index 8b162bb22d69931b594b1ce65bad0fd5f150c40a..281378f1c62b36f05177fe378a6ef05cf5308121 100644
--- a/source/Lib/CommonLib/IntraPrediction.h
+++ b/source/Lib/CommonLib/IntraPrediction.h
@@ -107,7 +107,7 @@ protected:
   Pel  xGetPredValDc              ( const CPelBuf &pSrc, const Size &dstSize );
 
   void xFillReferenceSamples      ( const CPelBuf &recoBuf,      Pel* refBufUnfiltered, const CompArea &area, const CodingUnit &cu );
-  void xFilterReferenceSamples    ( const Pel* refBufUnfiltered, Pel* refBufFiltered, const CompArea &area, const SPS &sps 
+  void xFilterReferenceSamples    ( const Pel* refBufUnfiltered, Pel* refBufFiltered, const CompArea &area, const SPS &sps
     , int multiRefIdx
   );
 
diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp
index fb92e137ff10f93e26be04d47a30ce2b0aba802d..32e4f6d190452d6cf7f3469c078fcd7acac3775d 100644
--- a/source/Lib/CommonLib/LoopFilter.cpp
+++ b/source/Lib/CommonLib/LoopFilter.cpp
@@ -248,7 +248,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir )
   for( auto &currTU : CU::traverseTUs( cu ) )
   {
     const Area& areaTu    = cu.Y().valid() ? currTU.block( COMPONENT_Y ) : area;
-#if  JVET_M0471_LONG_DEBLOCKING_FILTERS 
+#if  JVET_M0471_LONG_DEBLOCKING_FILTERS
     const bool xOff = currTU.blocks[cu.chType].x != cu.blocks[cu.chType].x;
     const bool yOff = currTU.blocks[cu.chType].y != cu.blocks[cu.chType].y;
     if ((yOff != 0) && (edgeDir == EDGE_HOR))
@@ -418,7 +418,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir )
 #if JVET_M0471_LONG_DEBLOCKING_FILTERS
       if (edge == 0)
       {
-#if FIX_DB_MAX_TRANSFORM_SIZE 
+#if FIX_DB_MAX_TRANSFORM_SIZE
         xEdgeFilterLuma(cu, edgeDir, edge, maxFilterLengthP, maxFilterLengthQ);
 #else
         xEdgeFilterLuma(cu, edgeDir, edge, 7, maxFilterLength);
@@ -426,19 +426,19 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir )
       }
       else
       {
-#if FIX_DB_MAX_TRANSFORM_SIZE 
+#if FIX_DB_MAX_TRANSFORM_SIZE
         if (implicitTU && ((edge % (maxTsize / 4)) == 0))
 #else
         if ( implicitTU && (edge == (64 / 4)) )
 #endif
         {
-#if FIX_DB_MAX_TRANSFORM_SIZE 
+#if FIX_DB_MAX_TRANSFORM_SIZE
           xEdgeFilterLuma(cu, edgeDir, edge, maxFilterLengthQ, maxFilterLengthQ);
 #else
           xEdgeFilterLuma(cu, edgeDir, edge, maxFilterLength, maxFilterLength);
 #endif
         }
-#if FIX_DB_MAX_TRANSFORM_SIZE 
+#if FIX_DB_MAX_TRANSFORM_SIZE
         else if ((edge == 2 || edge == (orthogonalLength - 2)) || (implicitTU && (((edge - 2) % ((maxTsize) / 4) == 0) || ((edge + 2) % ((maxTsize) / 4) == 0))))
 #else
         else if ( (edge == 2 || edge == (orthogonalLength - 2)) || (implicitTU && (edge == (56 / 4) || edge == (72 / 4))) )
@@ -1142,7 +1142,7 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
       const unsigned cuQWidth  = cuQ.block(COMPONENT_Cb).width;
       const unsigned cuQHeight = cuQ.block(COMPONENT_Cb).height;
 
-      bool largeBoundary = ((edgeDir == EDGE_VER && cuPWidth >= 8 && cuQWidth >= 8) || (edgeDir == EDGE_HOR && cuPHeight >= 8 && cuQHeight >= 8));      
+      bool largeBoundary = ((edgeDir == EDGE_VER && cuPWidth >= 8 && cuQWidth >= 8) || (edgeDir == EDGE_HOR && cuPHeight >= 8 && cuQHeight >= 8));
 
       if (edgeDir == EDGE_HOR && pos.y % cuP.slice->getSPS()->getCTUSize() == 0)
       {
@@ -1276,11 +1276,11 @@ inline void LoopFilter::xFilteringPandQ(Pel* src, int offset, int numberPSide, i
   CHECK(numberPSide <= 3 && numberQSide <= 3, "Short filtering in long filtering function");
   Pel* srcP = src-offset;
   Pel* srcQ = src;
-   
+
   int refP = 0;
   int refQ = 0;
   int refMiddle = 0;
- 
+
   const int dbCoeffs7[7] = { 59, 50, 41,32,23,14,5 };
   const int dbCoeffs3[3] = { 53, 32, 11 };
   const int dbCoeffs5[5] = { 58, 45, 32,19,6};
@@ -1514,7 +1514,7 @@ inline void LoopFilter::xPelFilterChroma( Pel* piSrc, const int iOffset, const i
     if (largeBoundary)
     {
       piSrc[-iOffset * 3] = m1; // p2
-      piSrc[-iOffset * 2] = m2; // p1 
+      piSrc[-iOffset * 2] = m2; // p1
     }
 #endif
     piSrc[-iOffset] = m3;
diff --git a/source/Lib/CommonLib/LoopFilter.h b/source/Lib/CommonLib/LoopFilter.h
index 2e251100cfe29d2a68e29dc6e9e8f400bbfe6981..5f2b0bafb0a13b0e004bed96061e9e07790e7529 100644
--- a/source/Lib/CommonLib/LoopFilter.h
+++ b/source/Lib/CommonLib/LoopFilter.h
@@ -62,7 +62,7 @@ private:
 private:
   /// CU-level deblocking function
   void xDeblockCU                 (       CodingUnit& cu, const DeblockEdgeDir edgeDir );
-  
+
   // set / get functions
   void xSetLoopfilterParam        ( const CodingUnit& cu );
 
diff --git a/source/Lib/CommonLib/Mv.h b/source/Lib/CommonLib/Mv.h
index 8204a0b92d90c6832ce0917f087f0a7c26fdd583..c703fe6cb16446c4bdf596dcb89e1ea0d6c79418 100644
--- a/source/Lib/CommonLib/Mv.h
+++ b/source/Lib/CommonLib/Mv.h
@@ -237,7 +237,7 @@ namespace std
     }
   };
 };
-void clipMv ( Mv& rcMv, const struct Position& pos, 
+void clipMv ( Mv& rcMv, const struct Position& pos,
               const struct Size& size,
               const class SPS& sps );
 
diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp
index 5ca4883b2e2c9f6a3074e91885fbe8cbad3df0a8..8bbf4b992a25e657ddc653132bee431cfeb63b42 100644
--- a/source/Lib/CommonLib/RdCost.cpp
+++ b/source/Lib/CommonLib/RdCost.cpp
@@ -152,7 +152,7 @@ void RdCost::init()
   m_afpDistortFunc[DF_SAD_FULL_NBIT32 ] = RdCost::xGetSAD_full;
   m_afpDistortFunc[DF_SAD_FULL_NBIT64 ] = RdCost::xGetSAD_full;
   m_afpDistortFunc[DF_SAD_FULL_NBIT16N] = RdCost::xGetSAD_full;
-  
+
 #if WCG_EXT
   m_afpDistortFunc[DF_SSE_WTD   ] = RdCost::xGetSSE_WTD;
   m_afpDistortFunc[DF_SSE2_WTD  ] = RdCost::xGetSSE2_WTD;
@@ -2900,11 +2900,11 @@ void RdCost::initLumaLevelToWeightTable()
     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 = 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       
+
+    m_lumaLevelToWeightPLUT[i] = pow(2.0, y / 3.0);      // or power(10, dQp/10)      they are almost equal
   }
 }
 
@@ -2918,7 +2918,7 @@ void RdCost::initLumaLevelToWeightTableReshape()
     m_lumaLevelToWeightPLUT.resize(lutSize, 1.0);
   if (m_signalType == RESHAPE_SIGNAL_PQ)
   {
-    for (int i = 0; i < (1 << m_lumaBD); i++) 
+    for (int i = 0; i < (1 << m_lumaBD); i++)
     {
       double x = m_lumaBD < 10 ? i << (10 - m_lumaBD) : m_lumaBD > 10 ? i >> (m_lumaBD - 10) : i;
       double y;
@@ -2940,7 +2940,7 @@ void RdCost::updateReshapeLumaLevelToWeightTableChromaMD(std::vector<Pel>& ILUT)
 
 void RdCost::restoreReshapeLumaLevelToWeightTable()
 {
-  for (int i = 0; i < (1 << m_lumaBD); i++) 
+  for (int i = 0; i < (1 << m_lumaBD); i++)
   {
     m_reshapeLumaLevelToWeightPLUT.at(i) = m_lumaLevelToWeightPLUT.at(i);
   }
@@ -2964,7 +2964,7 @@ void RdCost::updateReshapeLumaLevelToWeightTable(SliceReshapeInfo &sliceReshape,
         {
           if (sliceReshape.reshaperModelBinCWDelta[i] == 1 || (sliceReshape.reshaperModelBinCWDelta[i] == -1 * histLens))
             weight = wBin;
-          else 
+          else
           {
             weight = (double)wtTable[i] / (double)histLens;
             weight = weight*weight;
@@ -2990,7 +2990,7 @@ void RdCost::updateReshapeLumaLevelToWeightTable(SliceReshapeInfo &sliceReshape,
 }
 #endif
 
-Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, const uint32_t uiShift, const Pel orgLuma) 
+Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, const uint32_t uiShift, const Pel orgLuma)
 {
   Distortion distortionVal = 0;
   Intermediate_Int iTemp = org - cur;
@@ -3003,7 +3003,7 @@ Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, con
   // use luma to get weight
 #if JVET_M0427_INLOOP_RESHAPER
   double weight = 1.0;
-  if (m_signalType == RESHAPE_SIGNAL_SDR) 
+  if (m_signalType == RESHAPE_SIGNAL_SDR)
   {
     if (compIdx == COMPONENT_Y)
     {
@@ -3011,7 +3011,7 @@ Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, con
     }
     else
     {
-      weight = m_chromaWeight; 
+      weight = m_chromaWeight;
     }
   }
   else
@@ -3053,7 +3053,7 @@ Distortion RdCost::xGetSSE_WTD( const DistParam &rcDtParam )
   {
     for (int n = 0; n < iCols; n++ )
     {
-      uiSum += getWeightedMSE(rcDtParam.compID, piOrg[n  ], piCur[n  ], uiShift, piOrgLuma[n<<cShift]); 
+      uiSum += getWeightedMSE(rcDtParam.compID, piOrg[n  ], piCur[n  ], uiShift, piOrgLuma[n<<cShift]);
     }
     piOrg += iStrideOrg;
     piCur += iStrideCur;
@@ -3069,7 +3069,7 @@ Distortion RdCost::xGetSSE2_WTD( const DistParam &rcDtParam )
     CHECK( rcDtParam.org.width != 2, "" );
     return RdCostWeightPrediction::xGetSSEw( rcDtParam ); // ignore it for now
   }
-  
+
   int  iRows = rcDtParam.org.height;
   const Pel* piOrg = rcDtParam.org.buf;
   const Pel* piCur = rcDtParam.cur.buf;
@@ -3138,7 +3138,7 @@ Distortion RdCost::xGetSSE8_WTD( const DistParam &rcDtParam )
   const Pel* piOrgLuma        = rcDtParam.orgLuma.buf;
   const size_t  iStrideOrgLuma   = rcDtParam.orgLuma.stride;
   const size_t  cShift           = (rcDtParam.compID==COMPONENT_Y) ? 0 : 1; // assume 420, could use getComponentScaleX, getComponentScaleY
- 
+
   Distortion uiSum   = 0;
   uint32_t uiShift = DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth) << 1;
   for( ; iRows != 0; iRows-- )
@@ -3173,7 +3173,7 @@ Distortion RdCost::xGetSSE16_WTD( const DistParam &rcDtParam )
   const Pel* piOrgLuma        = rcDtParam.orgLuma.buf;
   const size_t  iStrideOrgLuma   = rcDtParam.orgLuma.stride;
   const size_t  cShift           = (rcDtParam.compID==COMPONENT_Y) ? 0 : 1; // assume 420, could use getComponentScaleX, getComponentScaleY
-  
+
   Distortion uiSum   = 0;
   uint32_t uiShift = DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth) << 1;
   for( ; iRows != 0; iRows-- )
@@ -3261,7 +3261,7 @@ Distortion RdCost::xGetSSE32_WTD( const DistParam &rcDtParam )
   const Pel* piOrgLuma        = rcDtParam.orgLuma.buf;
   const size_t  iStrideOrgLuma   = rcDtParam.orgLuma.stride;
   const size_t  cShift           = (rcDtParam.compID==COMPONENT_Y) ? 0 : 1; // assume 420, could use getComponentScaleX, getComponentScaleY
-  
+
   Distortion uiSum   = 0;
   uint32_t uiShift = DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth) << 1;
   for( ; iRows != 0; iRows-- )
@@ -3320,7 +3320,7 @@ Distortion RdCost::xGetSSE64_WTD( const DistParam &rcDtParam )
   const Pel* piOrgLuma        = rcDtParam.orgLuma.buf;
   const size_t iStrideOrgLuma   = rcDtParam.orgLuma.stride;
   const size_t cShift           = (rcDtParam.compID==COMPONENT_Y) ? 0 : 1; // assume 420, could use getComponentScaleX, getComponentScaleY
- 
+
   Distortion uiSum   = 0;
   uint32_t uiShift = DISTORTION_PRECISION_ADJUSTMENT((rcDtParam.bitDepth)) << 1;
   for( ; iRows != 0; iRows-- )
diff --git a/source/Lib/CommonLib/Reshape.h b/source/Lib/CommonLib/Reshape.h
index d273d39c90cccc6c5f059d89201745d7a6305001..64aa62f391ff3e385860c0809d1b125351681086 100644
--- a/source/Lib/CommonLib/Reshape.h
+++ b/source/Lib/CommonLib/Reshape.h
@@ -96,7 +96,7 @@ public:
 };// END CLASS DEFINITION Reshape
 
 //! \}
-#endif // 
+#endif //
 #endif // __RESHAPE__
 
 
diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp
index 2141368ce5e1ddd8c3aae7271a81c3c881db1fab..3865da3ff81d12b7bccc8913bf803e85036119e8 100644
--- a/source/Lib/CommonLib/Rom.cpp
+++ b/source/Lib/CommonLib/Rom.cpp
@@ -311,7 +311,7 @@ uint32_t deriveWeightIdxBits(uint8_t gbiIdx) // Note: align this with TEncSbac::
 }
 
 #if JVET_M0102_INTRA_SUBPARTITIONS // define the sbb sizes
-uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] = 
+uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] =
 {
   //===== luma =====
   {
@@ -937,7 +937,7 @@ const uint8_t g_NonMPM[257] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
 
 #if !JVET_M0328_KEEP_ONE_WEIGHT_GROUP
 const Pel g_trianglePelWeightedLuma[TRIANGLE_DIR_NUM][2][7] =
-{ 
+{
   { // TRIANGLE_DIR_135
     { 1, 2, 4, 6, 7, 0, 0 },
     { 1, 2, 3, 4, 5, 6, 7 }
@@ -980,14 +980,14 @@ const uint8_t g_triangleWeightLengthChroma[2][2] = { { 5, 7 }, { 3, 3 } };
 #if !JVET_M0883_TRIANGLE_SIGNALING
 const uint8_t g_triangleCombination[TRIANGLE_MAX_NUM_CANDS][3] =
 {
-  { 0, 1, 0 }, { 1, 0, 1 }, { 1, 0, 2 }, { 0, 0, 1 }, { 0, 2, 0 }, 
-  { 1, 0, 3 }, { 1, 0, 4 }, { 1, 1, 0 }, { 0, 3, 0 }, { 0, 4, 0 }, 
-  { 0, 0, 2 }, { 0, 1, 2 }, { 1, 1, 2 }, { 0, 0, 4 }, { 0, 0, 3 }, 
-  { 0, 1, 3 }, { 0, 1, 4 }, { 1, 1, 4 }, { 1, 1, 3 }, { 1, 2, 1 }, 
-  { 1, 2, 0 }, { 0, 2, 1 }, { 0, 4, 3 }, { 1, 3, 0 }, { 1, 3, 2 }, 
-  { 1, 3, 4 }, { 1, 4, 0 }, { 1, 3, 1 }, { 1, 2, 3 }, { 1, 4, 1 }, 
-  { 0, 4, 1 }, { 0, 2, 3 }, { 1, 4, 2 }, { 0, 3, 2 }, { 1, 4, 3 }, 
-  { 0, 3, 1 }, { 0, 2, 4 }, { 1, 2, 4 }, { 0, 4, 2 }, { 0, 3, 4 }, 
+  { 0, 1, 0 }, { 1, 0, 1 }, { 1, 0, 2 }, { 0, 0, 1 }, { 0, 2, 0 },
+  { 1, 0, 3 }, { 1, 0, 4 }, { 1, 1, 0 }, { 0, 3, 0 }, { 0, 4, 0 },
+  { 0, 0, 2 }, { 0, 1, 2 }, { 1, 1, 2 }, { 0, 0, 4 }, { 0, 0, 3 },
+  { 0, 1, 3 }, { 0, 1, 4 }, { 1, 1, 4 }, { 1, 1, 3 }, { 1, 2, 1 },
+  { 1, 2, 0 }, { 0, 2, 1 }, { 0, 4, 3 }, { 1, 3, 0 }, { 1, 3, 2 },
+  { 1, 3, 4 }, { 1, 4, 0 }, { 1, 3, 1 }, { 1, 2, 3 }, { 1, 4, 1 },
+  { 0, 4, 1 }, { 0, 2, 3 }, { 1, 4, 2 }, { 0, 3, 2 }, { 1, 4, 3 },
+  { 0, 3, 1 }, { 0, 2, 4 }, { 1, 2, 4 }, { 0, 4, 2 }, { 0, 3, 4 },
 };
 
 const uint8_t g_triangleIdxBins[TRIANGLE_MAX_NUM_CANDS] =
diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index b42f52342eda15e1c663d0b8845d521ff76c9edf..251cadbacef9d2f530d3816cf70ed34f5c186fa7 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -1953,7 +1953,7 @@ SPS::SPS()
 #endif
 #if JVET_M0140_SBT
 , m_SBT                       ( false )
-, m_MaxSbtSize                ( 32 ) 
+, m_MaxSbtSize                ( 32 )
 #endif
 #if HEVC_VPS
 , m_VPSId                     (  0)
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index 63a2bd032ab21892b74b5ca0ad7ecf8f2d28a38f..ab1a080e4e7b572d6bf3ef66a49fec52a6f77775 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1183,7 +1183,7 @@ public:
   unsigned                getMaxBTDepthIChroma()                                                    const { return m_maxBTDepth[2]; }
   void                    setMaxBTSize(unsigned    maxBTSize,
                                        unsigned    maxBTSizeI,
-                                       unsigned    maxBTSizeC) 
+                                       unsigned    maxBTSizeC)
                                                                                                           { m_maxBTSize[1] = maxBTSize; m_maxBTSize[0] = maxBTSizeI; m_maxBTSize[2] = maxBTSizeC; }
   unsigned                getMaxBTSize()                                                            const { return m_maxBTSize[1]; }
   unsigned                getMaxBTSizeI()                                                           const { return m_maxBTSize[0]; }
@@ -1252,7 +1252,7 @@ public:
 
   bool                    getSBTMVPEnabledFlag() const                                                    { return m_sbtmvpEnabledFlag; }
   void                    setSBTMVPEnabledFlag(bool b)                                                    { m_sbtmvpEnabledFlag = b; }
-  
+
   void                    setBDOFEnabledFlag(bool b)                                                      { m_bdofEnabledFlag = b; }
   bool                    getBDOFEnabledFlag() const                                                      { return m_bdofEnabledFlag; }
 
diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp
index 69451f731a2399cac02f3e9a54f76ae1fc1bb207..24487fb9a05bea975c171e8c038ce243fe7465d2 100644
--- a/source/Lib/CommonLib/TrQuant.cpp
+++ b/source/Lib/CommonLib/TrQuant.cpp
@@ -347,7 +347,7 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy
     return;
   }
 #endif
-  
+
 #if JVET_M0464_UNI_MTS
   if ( mtsActivated )
 #else
@@ -367,7 +367,7 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy
         int indHor = tu.emtIdx &  1;
         int indVer = tu.emtIdx >> 1;
 #endif
-        
+
         trTypeHor = indHor ? DCT8 : DST7;
         trTypeVer = indVer ? DCT8 : DST7;
       }
@@ -380,7 +380,7 @@ void TrQuant::getTrTypes ( TransformUnit tu, const ComponentID compID, int &trTy
     int  height      = tu.blocks[compID].height;
     bool widthDstOk  = width  >= 4 && width  <= 16;
     bool heightDstOk = height >= 4 && height <= 16;
-    
+
     if ( width < height && widthDstOk )
       trTypeHor = DST7;
     else if ( height < width && heightDstOk )
@@ -406,34 +406,34 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
   const int      skipWidth              = width  > JVET_C0024_ZERO_OUT_TH ? width  - JVET_C0024_ZERO_OUT_TH : 0;
   const int      skipHeight             = height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0;
 #endif
-  
+
 #if !JVET_M0102_INTRA_SUBPARTITIONS
   CHECK( shift_1st < 0, "Negative shift" );
   CHECK( shift_2nd < 0, "Negative shift" );
 #endif
-  
+
   int trTypeHor = DCT2;
   int trTypeVer = DCT2;
-  
+
   getTrTypes ( tu, compID, trTypeHor, trTypeVer );
 
 #if JVET_M0297_32PT_MTS_ZERO_OUT
   const int      skipWidth  = ( trTypeHor != DCT2 && width  == 32 ) ? 16 : width  > JVET_C0024_ZERO_OUT_TH ? width  - JVET_C0024_ZERO_OUT_TH : 0;
   const int      skipHeight = ( trTypeVer != DCT2 && height == 32 ) ? 16 : height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0;
 #endif
-  
+
 #if RExt__DECODER_DEBUG_TOOL_STATISTICS
   if ( trTypeHor != DCT2 )
   {
     CodingStatistics::IncrementStatisticTool( CodingStatisticsClassType{ STATS__TOOL_EMT, uint32_t( width ), uint32_t( height ), compID } );
   }
 #endif
-  
+
   ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, TCoeff block[MAX_TU_SIZE * MAX_TU_SIZE] );
-  
+
   const Pel *resiBuf    = resi.buf;
   const int  resiStride = resi.stride;
-  
+
   for( int y = 0; y < height; y++ )
   {
     for( int x = 0; x < width; x++ )
@@ -441,7 +441,7 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
       block[( y * width ) + x] = resiBuf[( y * resiStride ) + x];
     }
   }
-  
+
 #if JVET_M0102_INTRA_SUBPARTITIONS
   if( width > 1 && height > 1 ) // 2-D transform
   {
@@ -451,12 +451,12 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
     CHECK( shift_2nd < 0, "Negative shift" );
 #endif
   TCoeff *tmp = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) );
-  
+
   fastFwdTrans[trTypeHor][transformWidthIndex ](block,        tmp, shift_1st, height,        0, skipWidth);
   fastFwdTrans[trTypeVer][transformHeightIndex](tmp, dstCoeff.buf, shift_2nd, width, skipWidth, skipHeight);
 #if JVET_M0102_INTRA_SUBPARTITIONS
   }
-  else if( height == 1 ) //1-D horizontal transform 
+  else if( height == 1 ) //1-D horizontal transform
   {
     const int      shift              = ((g_aucLog2[width ]) + bitDepth + TRANSFORM_MATRIX_SHIFT) - maxLog2TrDynamicRange + COM16_C806_TRANS_PREC;
     CHECK( shift < 0, "Negative shift" );
@@ -492,7 +492,7 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo
   const int      skipWidth              = width  > JVET_C0024_ZERO_OUT_TH ? width  - JVET_C0024_ZERO_OUT_TH : 0;
   const int      skipHeight             = height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0;
 #endif
-  
+
 #if !JVET_M0102_INTRA_SUBPARTITIONS
   CHECK( shift_1st < 0, "Negative shift" );
   CHECK( shift_2nd < 0, "Negative shift" );
@@ -500,19 +500,19 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo
 
   int trTypeHor = DCT2;
   int trTypeVer = DCT2;
-  
+
   getTrTypes ( tu, compID, trTypeHor, trTypeVer );
 
 #if JVET_M0297_32PT_MTS_ZERO_OUT
   const int      skipWidth  = ( trTypeHor != DCT2 && width  == 32 ) ? 16 : width  > JVET_C0024_ZERO_OUT_TH ? width  - JVET_C0024_ZERO_OUT_TH : 0;
   const int      skipHeight = ( trTypeVer != DCT2 && height == 32 ) ? 16 : height > JVET_C0024_ZERO_OUT_TH ? height - JVET_C0024_ZERO_OUT_TH : 0;
 #endif
-  
+
 #if !JVET_M0102_INTRA_SUBPARTITIONS
   TCoeff *tmp   = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) );
 #endif
   TCoeff *block = ( TCoeff * ) alloca( width * height * sizeof( TCoeff ) );
-  
+
 #if JVET_M0102_INTRA_SUBPARTITIONS
   if( width > 1 && height > 1 ) //2-D transform
   {
@@ -541,10 +541,10 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo
     fastInvTrans[trTypeHor][transformWidthIndex]( pCoeff.buf, block, shift + 1, 1, 0, skipWidth, clipMinimum, clipMaximum );
   }
 #endif
-  
+
   Pel *resiBuf    = pResidual.buf;
   int  resiStride = pResidual.stride;
-  
+
   for( int y = 0; y < height; y++ )
   {
     for( int x = 0; x < width; x++ )
@@ -793,13 +793,13 @@ void TrQuant::transformNxN(TransformUnit &tu, const ComponentID &compID, const Q
 
 #if JVET_M0102_INTRA_SUBPARTITIONS
       //we do this only with the DCT-II coefficients
-      if( isLuma(compID) && 
+      if( isLuma(compID) &&
 #if JVET_M0464_UNI_MTS
         !loadTr && tu.mtsIdx == 0
 #else
         !tu.cu->emtFlag
 #endif
-        ) 
+        )
       {
         //it gets the distribution of the coefficients energy, which will be useful to discard ISP tests
         xGetCoeffEnergy( tu, compID, tempCoeff, diagRatio, horVerRatio );
diff --git a/source/Lib/CommonLib/TrQuant_EMT.cpp b/source/Lib/CommonLib/TrQuant_EMT.cpp
index 3ea8ce7306e663478e28f20dfac2a5251e1b70ba..d12b5c39221667729b53ddf14ff502b3ded960d9 100644
--- a/source/Lib/CommonLib/TrQuant_EMT.cpp
+++ b/source/Lib/CommonLib/TrQuant_EMT.cpp
@@ -1018,7 +1018,7 @@ void fastInverseDST7_B16(const TCoeff *src, TCoeff *dst, int shift, int line, in
 #if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT
   int j, k;
   TCoeff a[5], b[5], c[5], d[5], t;
-  
+
   TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0;
 
   const TMatrixCoeff *iT = g_trCoreDST7P16[TRANSFORM_INVERSE][0];
@@ -1208,7 +1208,7 @@ void fastInverseDST7_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in
 
     t[0] = iT[12] * src[6*line] + iT[25] * src[19*line];
     t[1] = iT[25] * src[6*line] - iT[12] * src[19*line];
-    
+
     dst[ 0] = Clip3(outputMinimum, outputMaximum, (int)( iT[0] * a[1][0] - iT[11] * a[8][0] + iT[13] * a[7][0] + iT[24] * a[4][5] - iT[1] * a[8][5] + iT[10] * a[1][5] + iT[14] * a[4][0] + iT[23] * a[7][5] + iT[2] * a[1][1] - iT[9] * a[8][1] + iT[15] * a[7][1] + iT[22] * a[4][4] - iT[3] * a[8][4] + iT[8] * a[1][4] + iT[16] * a[4][1] + iT[21] * a[7][4] + iT[4] * a[1][2] - iT[7] * a[8][2] + iT[17] * a[7][2] + iT[20] * a[4][3] - iT[5] * a[8][3] + iT[6] * a[1][3] + iT[18] * a[4][2] + iT[19] * a[7][3] + t[0] + add) >> shift);
     dst[ 1] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[4][2] - iT[11] * a[6][2] + iT[13] * a[0][3] + iT[24] * a[5][2] + iT[1] * a[2][0] + iT[10] * a[7][0] + iT[14] * a[5][5] - iT[23] * a[9][5] + iT[2] * a[7][2] + iT[9] * a[2][2] - iT[15] * a[9][3] + iT[22] * a[5][3] - iT[3] * a[6][0] - iT[8] * a[4][0] + iT[16] * a[5][0] + iT[21] * a[0][5] - iT[4] * a[4][1] - iT[7] * a[6][1] + iT[17] * a[0][4] + iT[20] * a[5][1] + iT[5] * a[2][1] + iT[6] * a[7][1] + iT[18] * a[5][4] - iT[19] * a[9][4] + t[1] + add) >> shift);
     dst[ 2] = Clip3(outputMinimum, outputMaximum, (int)(-iT[0] * a[2][4] - iT[11] * a[3][4] + iT[13] * a[0][4] + iT[24] * a[1][4] + iT[1] * a[4][3] + iT[10] * a[7][2] + iT[14] * a[1][2] - iT[23] * a[8][2] + iT[2] * a[3][0] - iT[9] * a[6][5] - iT[15] * a[8][0] + iT[22] * a[9][5] - iT[3] * a[6][4] + iT[8] * a[3][1] + iT[16] * a[9][4] - iT[21] * a[8][1] + iT[4] * a[7][3] + iT[7] * a[4][2] - iT[17] * a[8][3] + iT[20] * a[1][3] - iT[5] * a[3][5] - iT[6] * a[2][5] + iT[18] * a[1][5] + iT[19] * a[0][5] + t[1] + add) >> shift);
@@ -1240,7 +1240,7 @@ void fastInverseDST7_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in
     dst[19] = Clip3(outputMinimum, outputMaximum, (int)(iT[19] * b[0] + iT[ 4] * b[1] - iT[29] * b[2] + iT[ 9] * b[3] + iT[14] * b[4] - iT[24] * b[5] + add) >> shift);
     dst[24] = Clip3(outputMinimum, outputMaximum, (int)(iT[24] * b[0] - iT[ 9] * b[1] - iT[ 4] * b[2] + iT[19] * b[3] - iT[29] * b[4] + iT[14] * b[5] + add) >> shift);
     dst[29] = Clip3(outputMinimum, outputMaximum, (int)(iT[29] * b[0] - iT[24] * b[1] + iT[19] * b[2] - iT[14] * b[3] + iT[ 9] * b[4] - iT[ 4] * b[5] + add) >> shift);
-    
+
     dst[12] = Clip3(outputMinimum, outputMaximum, (int)(iT[12]*c[0] + iT[25]*c[1] + add) >> shift);
     dst[25] = Clip3(outputMinimum, outputMaximum, (int)(iT[25]*c[0] - iT[12]*c[1] + add) >> shift);
 
@@ -1411,7 +1411,7 @@ void fastInverseDCT8_B16(const TCoeff *src, TCoeff *dst, int shift, int line, in
 #if JVET_M0497_FAST_DST7 && !JVET_M0497_MATRIX_MULT
   int j, k;
   TCoeff a[5], b[5], c[5], d[5], t;
-  
+
   TCoeff add = (shift > 0) ? (1 << (shift - 1)) : 0;
 
   const TMatrixCoeff *iT = g_trCoreDST7P16[TRANSFORM_INVERSE][0];
@@ -1495,14 +1495,14 @@ void fastForwardDCT8_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in
 
       b[k] = src[31-k] + src[20+k] - src[18-k] - src[7+k] + src[5-k];
     }
-    
+
     for (k = 0; k < 2; k++)
     {
       c[k] = src[31-k] + src[28+k] - src[26-k] - src[23+k] + src[21-k] + src[18+k] - src[16-k] - src[13+k] + src[11-k] + src[8+k] - src[6-k] - src[3+k] + src[1-k];
     }
-    
-    t[0] = iT[12] * src[19] + iT[25] * src[6]; 
-    t[1] = iT[12] * src[6] - iT[25] * src[19]; 
+
+    t[0] = iT[12] * src[19] + iT[25] * src[6];
+    t[1] = iT[12] * src[6] - iT[25] * src[19];
 
     dst[ 0 * line] = (   iT[0] * a[3][0] + iT[11] * a[6][5] + iT[13] * a[8][0] + iT[24] * a[9][5] + iT[1] * a[3][1] + iT[10] * a[6][4] + iT[14] * a[8][1] + iT[23] * a[9][4] + iT[2] * a[3][2] + iT[9] * a[6][3] + iT[15] * a[8][2] + iT[22] * a[9][3] + iT[3] * a[3][3] + iT[8] * a[6][2] + iT[16] * a[8][3] + iT[21] * a[9][2] + iT[4] * a[3][4] + iT[7] * a[6][1] + iT[17] * a[8][4] + iT[20] * a[9][1] + iT[5] * a[3][5] + iT[6] * a[6][0] + iT[18] * a[8][5] + iT[19] * a[9][0] + t[0] + add) >> shift;
     dst[ 1 * line] = (   iT[0] * a[5][2] - iT[11] * a[0][3] - iT[13] * a[4][2] - iT[24] * a[6][2] - iT[1] * a[9][1] - iT[10] * a[8][4] - iT[14] * a[3][4] - iT[23] * a[6][1] - iT[2] * a[0][0] + iT[9] * a[5][5] - iT[15] * a[6][5] - iT[22] * a[4][5] + iT[3] * a[5][3] - iT[8] * a[0][2] - iT[16] * a[4][3] - iT[21] * a[6][3] - iT[4] * a[9][0] - iT[7] * a[8][5] - iT[17] * a[3][5] - iT[20] * a[6][0] - iT[5] * a[0][1] + iT[6] * a[5][4] - iT[18] * a[6][4] - iT[19] * a[4][4] + t[1] + add) >> shift;
@@ -1535,7 +1535,7 @@ void fastForwardDCT8_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in
     dst[17 * line] = ( - iT[29] * b[0] + iT[ 4] * b[1] + iT[24] * b[2] - iT[ 9] * b[3] - iT[19] * b[4] + iT[14] * b[5] + add) >> shift;
     dst[22 * line] = (   iT[19] * b[0] - iT[24] * b[1] + iT[ 4] * b[2] + iT[14] * b[3] - iT[29] * b[4] + iT[ 9] * b[5] + add) >> shift;
     dst[27 * line] = ( - iT[ 9] * b[0] + iT[19] * b[1] - iT[29] * b[2] + iT[24] * b[3] - iT[14] * b[4] + iT[ 4] * b[5] + add) >> shift;
-                       
+
     dst[ 6 * line] = (   iT[12] * c[0] + iT[25] * c[1] + add) >> shift;
     dst[19 * line] = ( - iT[25] * c[0] + iT[12] * c[1] + add) >> shift;
 
@@ -1600,8 +1600,8 @@ void fastInverseDCT8_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in
       c[k] = src[(31 - k)*line] + src[(28 + k)*line] - src[(26 - k)*line] - src[(23 + k)*line] + src[(21 - k)*line] + src[(18 + k)*line] - src[(16 - k)*line] - src[(13 + k)*line] + src[(11 - k)*line] + src[(8 + k)*line] - src[(6 - k)*line] - src[(3 + k)*line] + src[(1 - k)*line];
     }
 
-    t[0] = iT[12] * src[19 * line] + iT[25] * src[ 6 * line]; 
-    t[1] = iT[12] * src[ 6 * line] - iT[25] * src[19 * line]; 
+    t[0] = iT[12] * src[19 * line] + iT[25] * src[ 6 * line];
+    t[1] = iT[12] * src[ 6 * line] - iT[25] * src[19 * line];
 
     dst[ 0] = Clip3(outputMinimum, outputMaximum, (int)(   iT[0] * a[3][0] + iT[11] * a[6][5] + iT[13] * a[8][0] + iT[24] * a[9][5] + iT[1] * a[3][1] + iT[10] * a[6][4] + iT[14] * a[8][1] + iT[23] * a[9][4] + iT[2] * a[3][2] + iT[9] * a[6][3] + iT[15] * a[8][2] + iT[22] * a[9][3] + iT[3] * a[3][3] + iT[8] * a[6][2] + iT[16] * a[8][3] + iT[21] * a[9][2] + iT[4] * a[3][4] + iT[7] * a[6][1] + iT[17] * a[8][4] + iT[20] * a[9][1] + iT[5] * a[3][5] + iT[6] * a[6][0] + iT[18] * a[8][5] + iT[19] * a[9][0] + t[0] + add) >> shift);
     dst[ 1] = Clip3(outputMinimum, outputMaximum, (int)(   iT[0] * a[5][2] - iT[11] * a[0][3] - iT[13] * a[4][2] - iT[24] * a[6][2] - iT[1] * a[9][1] - iT[10] * a[8][4] - iT[14] * a[3][4] - iT[23] * a[6][1] - iT[2] * a[0][0] + iT[9] * a[5][5] - iT[15] * a[6][5] - iT[22] * a[4][5] + iT[3] * a[5][3] - iT[8] * a[0][2] - iT[16] * a[4][3] - iT[21] * a[6][3] - iT[4] * a[9][0] - iT[7] * a[8][5] - iT[17] * a[3][5] - iT[20] * a[6][0] - iT[5] * a[0][1] + iT[6] * a[5][4] - iT[18] * a[6][4] - iT[19] * a[4][4] + t[1] + add) >> shift);
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 54c85084d5d0def49f07bacfc956d6655f707ce8..a016282c5dd869196637b40137a0d6bc29e46a15 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -64,7 +64,7 @@
 
 #define FIX_DB_MAX_TRANSFORM_SIZE                         1
 #define JVET_M0908_CIIP_DB                                1
-#define JVET_M0471_LONG_DEBLOCKING_FILTERS                1 
+#define JVET_M0471_LONG_DEBLOCKING_FILTERS                1
 #define JVET_M0427_INLOOP_RESHAPER                        1
 #define JVET_M0470                                        1 // Fixed GR/TU+EG-k transition point, use limited prefix length for escape codes
 
@@ -149,7 +149,7 @@ typedef std::pair<int, int>  TrCost;
 
 #define REMOVE_BIN_DECISION_TREE                          1
 
-#define JVET_M0446_M0888_M0905_VPDU_AT_PIC_BOUNDARY       1 
+#define JVET_M0446_M0888_M0905_VPDU_AT_PIC_BOUNDARY       1
 
 // clang-format off
 #define JVET_M0453_CABAC_ENGINE                           1
@@ -319,7 +319,7 @@ typedef std::pair<int, int>  TrCost;
 #define ENABLE_SIMD_OPT_AFFINE_ME                       ( 1 && ENABLE_SIMD_OPT )                            ///< SIMD optimization for affine ME, no impact on RD performance
 #define ENABLE_SIMD_OPT_ALF                             ( 1 && ENABLE_SIMD_OPT )                            ///< SIMD optimization for ALF
 #if ENABLE_SIMD_OPT_BUFFER
-#define ENABLE_SIMD_OPT_GBI                               1                                                 ///< SIMD optimization for GBi   
+#define ENABLE_SIMD_OPT_GBI                               1                                                 ///< SIMD optimization for GBi
 #endif
 
 // End of SIMD optimizations
@@ -1003,7 +1003,7 @@ enum MergeType
 {
   MRG_TYPE_DEFAULT_N        = 0, // 0
   MRG_TYPE_SUBPU_ATMVP,
-  MRG_TYPE_IBC,                  
+  MRG_TYPE_IBC,
   NUM_MRG_TYPE                   // 5
 };
 
diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h
index f25184cb118f0a6a7bb1df126884376dde65ca81..ad4eee3b5e29daff548f36e0869ff58db1341cb7 100644
--- a/source/Lib/CommonLib/Unit.h
+++ b/source/Lib/CommonLib/Unit.h
@@ -153,7 +153,7 @@ struct CompArea : public Area
 
   const bool operator!=(const CompArea &other) const { return !(operator==(other)); }
 
-#if REUSE_CU_RESULTS_WITH_MULTIPLE_TUS 
+#if REUSE_CU_RESULTS_WITH_MULTIPLE_TUS
   void     resizeTo          (const Size& newSize)          { Size::resizeTo(newSize); }
 #endif
   void     repositionTo      (const Position& newPos)       { Position::repositionTo(newPos); }
@@ -463,7 +463,7 @@ struct TransformUnit : public UnitArea
   ChannelType      chType;
  #if JVET_M0427_INLOOP_RESHAPER
   int              m_chromaResScaleInv;
-#endif 
+#endif
 
   uint8_t        depth;
 #if JVET_M0464_UNI_MTS
diff --git a/source/Lib/CommonLib/UnitPartitioner.cpp b/source/Lib/CommonLib/UnitPartitioner.cpp
index 35a17fc19fe3ff5550d0305858bf67a336eb0ed6..9482d41885e875db134a5676581ced37d256ebb1 100644
--- a/source/Lib/CommonLib/UnitPartitioner.cpp
+++ b/source/Lib/CommonLib/UnitPartitioner.cpp
@@ -139,14 +139,14 @@ void AdaptiveDepthPartitioner::setMaxMinDepth( unsigned& minDepth, unsigned& max
   const unsigned    curTileIdx  = cs.picture->tileMap->getTileIdxMap( currArea().lumaPos() );
 
   const CodingUnit* cuLeft        = cs.getCURestricted( pos.offset( -1,                               0 ), curSliceIdx, curTileIdx, chType );
-  const CodingUnit* cuBelowLeft   = cs.getCURestricted( pos.offset( -1, currArea().blocks[chType].height), curSliceIdx, curTileIdx, chType );  
+  const CodingUnit* cuBelowLeft   = cs.getCURestricted( pos.offset( -1, currArea().blocks[chType].height), curSliceIdx, curTileIdx, chType );
   const CodingUnit* cuAbove       = cs.getCURestricted( pos.offset(  0,                              -1 ), curSliceIdx, curTileIdx, chType );
-  const CodingUnit* cuAboveRight  = cs.getCURestricted( pos.offset( currArea().blocks[chType].width, -1 ), curSliceIdx, curTileIdx, chType );  
+  const CodingUnit* cuAboveRight  = cs.getCURestricted( pos.offset( currArea().blocks[chType].width, -1 ), curSliceIdx, curTileIdx, chType );
 #else
   const CodingUnit* cuLeft        = cs.getCURestricted( pos.offset( -1,                               0 ), curSliceIdx, chType );
   const CodingUnit* cuBelowLeft   = cs.getCURestricted( pos.offset( -1, currArea().blocks[chType].height), curSliceIdx, chType );
   const CodingUnit* cuAbove       = cs.getCURestricted( pos.offset(  0,                              -1 ), curSliceIdx, chType );
-  const CodingUnit* cuAboveRight  = cs.getCURestricted( pos.offset( currArea().blocks[chType].width, -1 ), curSliceIdx, chType ); 
+  const CodingUnit* cuAboveRight  = cs.getCURestricted( pos.offset( currArea().blocks[chType].width, -1 ), curSliceIdx, chType );
 #endif
 
   minDepth = stdMaxDepth;
@@ -319,7 +319,7 @@ void QTBTPartitioner::splitCurrArea( const PartSplit split, const CodingStructur
 void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& canQt, bool& canBh, bool& canBv, bool& canTh, bool& canTv )
 {
   const PartSplit implicitSplit = m_partStack.back().checkdIfImplicit ? m_partStack.back().implicitSplit : getImplicitSplit( cs );
-  
+
   const unsigned maxBTD         = cs.pcv->getMaxBtDepth( *cs.slice, chType ) + currImplicitBtDepth;
   const unsigned maxBtSize      = cs.pcv->getMaxBtSize ( *cs.slice, chType );
   const unsigned minBtSize      = cs.pcv->getMinBtSize ( *cs.slice, chType );
@@ -385,7 +385,7 @@ void QTBTPartitioner::canSplit( const CodingStructure &cs, bool& canNo, bool& ca
   if( area.width <= MAX_TU_SIZE_FOR_PROFILE && area.height > MAX_TU_SIZE_FOR_PROFILE ) canBv = false;
 
   if( ( cs.sps->getSpsNext().getMTTMode() & 1 ) != 1 )                                 canTh = false;
-  if( area.height <= 2 * minTtSize || area.height > maxTtSize || area.width > maxTtSize ) 
+  if( area.height <= 2 * minTtSize || area.height > maxTtSize || area.width > maxTtSize )
                                                                                        canTh = false;
   if( area.width > MAX_TU_SIZE_FOR_PROFILE || area.height > MAX_TU_SIZE_FOR_PROFILE )  canTh = false;
 
diff --git a/source/Lib/CommonLib/UnitPartitioner.h b/source/Lib/CommonLib/UnitPartitioner.h
index 4b49746d13fdf2c1097661acf7886d942fd9ae22..3060e8459eaea49de2550f987fea8a468b7806aa 100644
--- a/source/Lib/CommonLib/UnitPartitioner.h
+++ b/source/Lib/CommonLib/UnitPartitioner.h
@@ -169,7 +169,7 @@ public:
   void exitCurrSplit              ();
   bool nextPart                   ( const CodingStructure &cs, bool autoPop = false );
   bool hasNextPart                ();
-  
+
 #if JVET_M0421_SPLIT_SIG
   void canSplit                   ( const CodingStructure &cs, bool& canNo, bool& canQt, bool& canBh, bool& canBv, bool& canTh, bool& canTv );
 #endif
diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index a491122ee8616ccd359318f4e4c85f43412cbe8a..c6bcb60a7d231f67f2662277727c5e10d7dce17b 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -76,7 +76,7 @@ void CS::setRefinedMotionField(CodingStructure &cs)
       int dx, dy, x, y, num = 0;
       dy = std::min<int>(pu.lumaSize().height, DMVR_SUBCU_HEIGHT);
       dx = std::min<int>(pu.lumaSize().width, DMVR_SUBCU_WIDTH);
-      Position puPos = pu.lumaPos();      
+      Position puPos = pu.lumaPos();
       if (PU::checkDMVRCondition(pu))
       {
         for (y = puPos.y; y < (puPos.y + pu.lumaSize().height); y = y + dy)
@@ -95,7 +95,7 @@ void CS::setRefinedMotionField(CodingStructure &cs)
         }
       }
     }
-  }  
+  }
 }
 #endif
 // CU tools
@@ -220,7 +220,7 @@ bool CU::isQGStart( const CodingUnit& cu, Partitioner& partitioner )
   int maxDqpDepth = cu.slice->getPPS()->getMaxCuDQPDepth();
   if( partitioner.currDepth >= maxDqpDepth )
   {
-    PartLevel splitAtMaxDepth = partitioner.getPartStack().at( maxDqpDepth ); 
+    PartLevel splitAtMaxDepth = partitioner.getPartStack().at( maxDqpDepth );
     // the parent node of qtDepth + mttDepth == maxDqpDepth
     if( splitAtMaxDepth.parts[splitAtMaxDepth.idx].blocks[partitioner.chType].pos() == cu.blocks[partitioner.chType].pos() )
       return true;
@@ -1366,7 +1366,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const
 #endif
        mrgCtx.mvFieldNeighbours[cnt * 2    ].setMvField(Mv(0, 0), NOT_VALID);
        mrgCtx.mvFieldNeighbours[cnt * 2 + 1].setMvField(Mv(0, 0), NOT_VALID);
-  
+
 #if JVET_M0193_PAIR_AVG_REDUCTION
        const Mv& MvI = mrgCtx.mvFieldNeighbours[0 * 2].mv;
        const Mv& MvJ = mrgCtx.mvFieldNeighbours[1 * 2].mv;
@@ -1387,7 +1387,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const
        avgMv.setVer(avgMv.getVer() / 2);
        avgMv.setHor((avgMv.getHor() / 16) << 4);
        avgMv.setVer((avgMv.getVer() / 16) << 4);
-#endif 
+#endif
       mrgCtx.mvFieldNeighbours[cnt * 2 ].setMvField(avgMv, MAX_NUM_REF);
       mrgCtx.interDirNeighbours[cnt] = 1;
       cnt++;
@@ -2596,7 +2596,7 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv)
 }
 
 #if JVET_M0483_IBC
-/** 
+/**
  * Constructs a list of candidates for IBC AMVP (See specification, section "Derivation process for motion vector predictor candidates")
  */
 void PU::fillIBCMvpCand(PredictionUnit &pu, AMVPInfo &amvpInfo)
@@ -3014,7 +3014,7 @@ void PU::xInheritedAffineMv( const PredictionUnit &pu, const PredictionUnit* puN
   int curW = pu.Y().width;
   int neiH = puNeighbour->Y().height;
   int curH = pu.Y().height;
-  
+
   Mv mvLT, mvRT, mvLB;
   mvLT = puNeighbour->mvAffi[eRefPicList][0];
   mvRT = puNeighbour->mvAffi[eRefPicList][1];
@@ -3103,7 +3103,7 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co
   Position posRT = pu.Y().topRight();
   Position posLB = pu.Y().bottomLeft();
 
-  // check left neighbor 
+  // check left neighbor
   if ( !addAffineMVPCandUnscaled( pu, eRefPicList, refIdx, posLB, MD_BELOW_LEFT, affiAMVPInfo ) )
   {
     addAffineMVPCandUnscaled( pu, eRefPicList, refIdx, posLB, MD_LEFT, affiAMVPInfo );
@@ -3311,8 +3311,8 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co
     if ( pu.cu->imv != 1 )
     {
 #endif
-      affiAMVPInfo.mvCandLT[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); 
-      affiAMVPInfo.mvCandRT[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); 
+      affiAMVPInfo.mvCandLT[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
+      affiAMVPInfo.mvCandRT[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
       affiAMVPInfo.mvCandLB[i].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
 #if JVET_M0246_AFFINE_AMVR
     }
@@ -3541,7 +3541,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
 #endif
 #endif
 
-    for (int predictorSource = 0; predictorSource < 2; predictorSource++) 
+    for (int predictorSource = 0; predictorSource < 2; predictorSource++)
     {
       const RefPicList eRefPicListIndex = (predictorSource == 0) ? eRefPicList : eRefPicList2nd;
       const int        neibRefIdx = neibMi.refIdx[eRefPicListIndex];
@@ -4082,7 +4082,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
         const PredictionUnit* puNeigh = cs.getPURestricted( pos, pu, pu.chType );
 
 
-        if ( puNeigh && CU::isInter( *puNeigh->cu ) 
+        if ( puNeigh && CU::isInter( *puNeigh->cu )
 #if JVET_M0483_IBC==0
           && !puNeigh->cu->ibc
 #endif
@@ -4102,7 +4102,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
         const PredictionUnit* puNeigh = cs.getPURestricted( pos, pu, pu.chType );
 
 
-        if ( puNeigh && CU::isInter( *puNeigh->cu ) 
+        if ( puNeigh && CU::isInter( *puNeigh->cu )
 #if JVET_M0483_IBC==0
           && !puNeigh->cu->ibc
 #endif
@@ -4439,7 +4439,7 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b
     if ( count )
     {
       RefPicList currRefPicList = RefPicList(slice.getCheckLDC() ? (slice.getColFromL0Flag() ? currRefListId : 1 - currRefListId) : currRefListId);
-        
+
       if ((mrgCtx.interDirNeighbours[0] & (1 << currRefPicList)) && slice.getRefPic(currRefPicList, mrgCtx.mvFieldNeighbours[0 * 2 + currRefPicList].refIdx) == pColPic)
       {
         cTMv = mrgCtx.mvFieldNeighbours[0 * 2 + currRefPicList].mv;
@@ -4589,7 +4589,7 @@ void PU::spanMotionInfo( PredictionUnit &pu, const MergeCtx &mrgCtx )
 {
   MotionBuf mb = pu.getMotionBuf();
 
-  if( !pu.mergeFlag || pu.mergeType == MRG_TYPE_DEFAULT_N 
+  if( !pu.mergeFlag || pu.mergeType == MRG_TYPE_DEFAULT_N
     || pu.mergeType == MRG_TYPE_IBC
     )
   {
@@ -4726,7 +4726,7 @@ void PU::applyImv( PredictionUnit& pu, MergeCtx &mrgCtx, InterPrediction *interP
   {
     // this function is never called for merge
     THROW("unexpected");
-    PU::getInterMergeCandidates ( pu, mrgCtx 
+    PU::getInterMergeCandidates ( pu, mrgCtx
       , 0
     );
 #if !JVET_M0068_M0171_MMVD_CLEANUP
@@ -4860,7 +4860,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
   if( isAvailableB1 )
   {
     miAbove = puAbove->getMotionInfo( posRT.offset( 0, -1 ) );
-    
+
     if( !isAvailableA1 || ( miAbove != miLeft ) )
     {
       candidate[candCount].isInter   = true;
@@ -4872,7 +4872,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
       candCount++;
     }
   }
-  
+
   // above right
   const PredictionUnit *puAboveRight = cs.getPURestricted( posRT.offset( 1, -1 ), pu, pu.chType );
   bool isAvailableB0 = puAboveRight && isDiffMER( pu, *puAboveRight ) && CU::isInter( *puAboveRight->cu )
@@ -4895,7 +4895,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
       candidate[candCount].refIdx[1] = miAboveRight.refIdx[1];
       candCount++;
     }
-  }  
+  }
 
   //left bottom
   const PredictionUnit *puLeftBottom = cs.getPURestricted( posLB.offset( -1, 1 ), pu, pu.chType );
@@ -4907,7 +4907,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
   if( isAvailableA0 )
   {
     miBelowLeft = puLeftBottom->getMotionInfo( posLB.offset( -1, 1 ) );
-    
+
     if( ( !isAvailableA1 || ( miBelowLeft != miLeft ) ) && ( !isAvailableB1 || ( miBelowLeft != miAbove ) ) && ( !isAvailableB0 || ( miBelowLeft != miAboveRight ) ) )
     {
       candidate[candCount].isInter   = true;
@@ -4943,7 +4943,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
       candCount++;
     }
   }
-  
+
   if( slice.getEnableTMVPFlag() )
   {
     Position posRB = pu.Y().bottomRight().offset(-3, -3);
@@ -5015,7 +5015,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
       candidate[candCount].refIdx[1] = temporalMv.refIdx[1];
       candCount++;
     }
-   
+
     // C1
     temporalMv.interDir = 0;
 #if JVET_M0170_MRG_SHARELIST
@@ -5055,7 +5055,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
   }
   // put uni-prediction candidate to the triangle candidate list
   for( int32_t i = 0; i < candCount; i++ )
-  { 
+  {
     if( candidate[i].interDir != 3 )
     {
       triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = candidate[i].interDir;
@@ -5130,7 +5130,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
 #else
       aveMv.setHor( ( aveMv.getHor() + candidate[i].mv[0].getHor() + 1 ) >> 1 );
       aveMv.setVer( ( aveMv.getVer() + candidate[i].mv[0].getVer() + 1 ) >> 1 );
-#endif    
+#endif
       triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 1;
       triangleMrgCtx.mrgTypeNeighbours [triangleMrgCtx.numValidMergeCand] = MRG_TYPE_DEFAULT_N;
       triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1)    ].mv = aveMv;
@@ -5143,8 +5143,8 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
         return;
       }
     }
-  } 
-    
+  }
+
   // fill with Mv(0, 0)
   int32_t numRefIdx = std::min( slice.getNumRefIdx(REF_PIC_LIST_0), slice.getNumRefIdx(REF_PIC_LIST_1) );
   int32_t cnt = 0;
@@ -5155,19 +5155,19 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
       triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 1;
       triangleMrgCtx.mvFieldNeighbours[triangleMrgCtx.numValidMergeCand << 1].setMvField(Mv(0, 0), cnt);
       triangleMrgCtx.numValidMergeCand++;
-      
+
       if( triangleMrgCtx.numValidMergeCand == TRIANGLE_MAX_NUM_UNI_CANDS )
       {
         return;
       }
-      
+
       triangleMrgCtx.interDirNeighbours[triangleMrgCtx.numValidMergeCand] = 2;
       triangleMrgCtx.mvFieldNeighbours [(triangleMrgCtx.numValidMergeCand << 1) + 1 ].setMvField(Mv(0, 0), cnt);
       triangleMrgCtx.numValidMergeCand++;
-      
+
       cnt = (cnt + 1) % numRefIdx;
     }
-  }  
+  }
 }
 
 bool PU::isUniqueTriangleCandidates( const PredictionUnit &pu, MergeCtx& triangleMrgCtx )
@@ -5184,7 +5184,7 @@ bool PU::isUniqueTriangleCandidates( const PredictionUnit &pu, MergeCtx& triangl
       return false;
     }
   }
-  return true;  
+  return true;
 }
 
 #if !JVET_M0328_KEEP_ONE_WEIGHT_GROUP
@@ -5194,17 +5194,17 @@ bool PU::getTriangleWeights( const PredictionUnit& pu, MergeCtx &triangleMrgCtx,
   RefPicList refPicListCand1 = triangleMrgCtx.interDirNeighbours[candIdx1] == 1 ? REF_PIC_LIST_0 : REF_PIC_LIST_1;
   int32_t refPicPoc0 = pu.cs->slice->getRefPOC( refPicListCand0, triangleMrgCtx.mvFieldNeighbours[ (candIdx0 << 1) + refPicListCand0 ].refIdx );
   int32_t refPicPoc1 = pu.cs->slice->getRefPOC( refPicListCand1, triangleMrgCtx.mvFieldNeighbours[ (candIdx1 << 1) + refPicListCand1 ].refIdx );
-  
+
   if( refPicPoc0 != refPicPoc1 )
   {
     // different reference picture
     return true;
   }
-  
+
   // same reference picture, but mv difference is larger than 16 pel
   int32_t threshold = 16 << 4;
   Mv diffMv = triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + refPicListCand0].mv - triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + refPicListCand1].mv;
-  
+
   if( diffMv.getAbsHor() > threshold || diffMv.getAbsVer() > threshold  )
   {
     return true;
@@ -5231,7 +5231,7 @@ void PU::spanTriangleMotionInfo( PredictionUnit &pu, MergeCtx &triangleMrgCtx, c
 
   MotionInfo biMv;
   biMv.isInter  = true;
-  
+
   if( triangleMrgCtx.interDirNeighbours[candIdx0] == 1 && triangleMrgCtx.interDirNeighbours[candIdx1] == 2 )
   {
     biMv.interDir  = 3;
@@ -5286,7 +5286,7 @@ void PU::spanTriangleMotionInfo( PredictionUnit &pu, MergeCtx &triangleMrgCtx, c
       biMv.interDir  = ( refIdx != -1 ) ? 3 : 2;
       biMv.mv[0]     = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv : Mv(0, 0);
       biMv.mv[1]     = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].mv : triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].mv;
-      biMv.refIdx[0] = ( refIdx != -1 ) ? refIdx : -1; 
+      biMv.refIdx[0] = ( refIdx != -1 ) ? refIdx : -1;
       biMv.refIdx[1] = ( refIdx != -1 ) ? triangleMrgCtx.mvFieldNeighbours[(candIdx1 << 1) + 1].refIdx : triangleMrgCtx.mvFieldNeighbours[(candIdx0 << 1) + 1].refIdx;
     }
   }
@@ -5396,7 +5396,7 @@ void CU::resetMVDandMV2Int( CodingUnit& cu, InterPrediction *interPred )
     }
     else
     {
-        PU::getInterMergeCandidates ( pu, mrgCtx 
+        PU::getInterMergeCandidates ( pu, mrgCtx
           , 0
         );
 #if !JVET_M0068_M0171_MMVD_CLEANUP
diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h
index 3414c2c5511d1fd7f68af90da51adc59e6aabb5a..0262da89e4cb878926770611ebec0f29008202d8 100644
--- a/source/Lib/CommonLib/UnitTools.h
+++ b/source/Lib/CommonLib/UnitTools.h
@@ -158,7 +158,7 @@ namespace PU
   bool xCheckSimilarMotion(const int mergeCandIndex, const int prevCnt, const MergeCtx mergeCandList, bool hasPruned[MRG_MAX_NUM_CANDS]);
 #if JVET_L0090_PAIR_AVG
   bool addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos
-#if JVET_M0483_IBC==0 
+#if JVET_M0483_IBC==0
     , int mmvdList
 #endif
 #if JVET_M0483_IBC
@@ -170,7 +170,7 @@ namespace PU
   );
 #else
   bool addMergeHMVPCand(const Slice &slice, MergeCtx& mrgCtx, bool isCandInter[MRG_MAX_NUM_CANDS], bool canFastExit, const int& mrgCandIdx, const uint32_t maxNumMergeCandMin1, int &cnt, const int prevCnt, bool isAvailableSubPu, unsigned subPuMvpPos
-#if JVET_M0483_IBC==0 
+#if JVET_M0483_IBC==0
     , int mmvdList
 #endif
   );
@@ -183,7 +183,7 @@ namespace PU
   void getAffineControlPointCand( const PredictionUnit &pu, MotionInfo mi[4], bool isAvailable[4], int verIdx[4], int modelIdx, int verNum, AffineMergeCtx& affMrgCtx );
   void getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx, const int mrgCandIdx = -1 );
   void setAllAffineMvField            (      PredictionUnit &pu, MvField *mvField, RefPicList eRefList );
-  void setAllAffineMv                 (      PredictionUnit &pu, Mv affLT, Mv affRT, Mv affLB, RefPicList eRefList 
+  void setAllAffineMv                 (      PredictionUnit &pu, Mv affLT, Mv affRT, Mv affLB, RefPicList eRefList
     , bool setHighPrec = false
   );
   bool getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx &mrgCtx, bool& LICFlag, const int count
@@ -301,7 +301,7 @@ uint32_t updateCandList(T uiMode, double uiCost, static_vector<T, N>& candModeLi
       if (extendRef != -1)
       {
         extendRefList[currSize - i] = extendRefList[currSize - 1 - i];
-      }  
+      }
     }
     candModeList[currSize - shift] = uiMode;
     candCostList[currSize - shift] = uiCost;
@@ -375,7 +375,7 @@ uint32_t updateDoubleCandList(T mode, double cost, static_vector<T, N>& candMode
     candCostList.insert(candCostList.end() - shift, cost);
     if (iserttPos != nullptr)
     {
-      *iserttPos = int(candModeList.size() - shift - 1);  
+      *iserttPos = int(candModeList.size() - shift - 1);
     }
     return 1;
   }
diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp
index d1f0fb80159cca51c69b9eefd4eeaf173b1a6e7c..f277a7c29d7113785e5e62ff6ae319a9b2f0e128 100644
--- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp
+++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp
@@ -195,7 +195,7 @@ void CDTrace::dtrace_block_vector( int k, const PredictionUnit &pu, std::string
 }
 
 void CDTrace::dtrace_block_scalar(int k, const TransformUnit &tu, std::string stat_type, signed value, bool isChroma /*= false*/  )
-{ 
+{
   const CodingStructure& cs = *tu.cs;
 #if BLOCK_STATS_AS_CSV
   if(isChroma)
@@ -300,7 +300,7 @@ void retrieveTriangularMvInfo(const PredictionUnit& pu, MotionInfo& mi0, MotionI
         mi1.mv[0]     = mb.at(x, y).mv[0];
         mi1.mv[1]     = mb.at(x, y).mv[1];
         mi1.refIdx[0] = mb.at(x, y).refIdx[0];
-        mi1.refIdx[1] = mb.at(x, y).refIdx[1];        
+        mi1.refIdx[1] = mb.at(x, y).refIdx[1];
         foundMv[1] = true;
       }
       if (g_triangleMvStorage[triangleDir][idxH][idxW][y][x] == 2 && foundMv[0] == false && foundMv[1] == false)
@@ -334,7 +334,7 @@ void retrieveTrianglePolygon(const PredictionUnit& pu, std::vector<Position>& tr
 #else
   TriangleSplit triangleDir = TriangleSplit(g_triangleCombination[pu.mergeIdx][0]);
 #endif
-  Position TL = pu.Y().topLeft();  
+  Position TL = pu.Y().topLeft();
   Position TR = pu.Y().topRight();    TR = TR.offset(1, 0);
   Position BL = pu.Y().bottomLeft();  BL = BL.offset(0, 1);
   Position BR = pu.Y().bottomRight(); BR = BR.offset(1, 1);
@@ -345,7 +345,7 @@ void retrieveTrianglePolygon(const PredictionUnit& pu, std::vector<Position>& tr
     E = Position(pu.Y().width, pu.Y().height);
     triangle0.push_back(TL);
     triangle0.push_back(TR);
-    triangle0.push_back(BR);               
+    triangle0.push_back(BR);
     triangle1.push_back(TL);
     triangle1.push_back(BL);
     triangle1.push_back(BR);
@@ -356,7 +356,7 @@ void retrieveTrianglePolygon(const PredictionUnit& pu, std::vector<Position>& tr
     E = Position(pu.Y().width, 0);
     triangle0.push_back(TL);
     triangle0.push_back(TR);
-    triangle0.push_back(BL);               
+    triangle0.push_back(BL);
     triangle1.push_back(TR);
     triangle1.push_back(BL);
     triangle1.push_back(BR);
@@ -747,7 +747,7 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea)
           DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::TransformSkipFlag_Cb), tu.transformSkip[COMPONENT_Cb]);
           DTRACE_BLOCK_SCALAR_CHROMA(g_trace_ctx, D_BLOCK_STATISTICS_ALL, tu, GetBlockStatisticName(BlockStatistic::TransformSkipFlag_Cr), tu.transformSkip[COMPONENT_Cr]);
 #endif
-        }        
+        }
       }
     }
   }
@@ -830,7 +830,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea)
         switch (pu.cu->predMode)
         {
           case MODE_INTRA:
-          {          
+          {
             if (pu.Y().valid())
             {
               DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_CODED, pu, GetBlockStatisticName(BlockStatistic::Luma_IntraMode), PU::getFinalIntraMode(pu, ChannelType(chType)));
@@ -998,7 +998,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea)
             }
             if (CU::isGBiIdxCoded(cu))
             {
-              DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::GBIIndex), cu.GBiIdx);           
+              DTRACE_BLOCK_SCALAR(g_trace_ctx, D_BLOCK_STATISTICS_ALL, cu, GetBlockStatisticName(BlockStatistic::GBIIndex), cu.GBiIdx);
             }
             break;
           }
@@ -1018,7 +1018,7 @@ void writeAllCodedData(const CodingStructure & cs, const UnitArea & ctuArea)
         }
       }
       if (cu.rootCbf || CU::isIntra(cu))
-      {        
+      {
         for (const TransformUnit &tu : CU::traverseTUs(cu))
         {
           if (tu.Y().valid())
diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.h b/source/Lib/CommonLib/dtrace_blockstatistics.h
index a7c5c5fa5c7f9fb136678d1469df2d17830a8e5a..72241ce8ae4f56ea5b04dbcd5d4be5cfd8e7c0bd 100644
--- a/source/Lib/CommonLib/dtrace_blockstatistics.h
+++ b/source/Lib/CommonLib/dtrace_blockstatistics.h
@@ -163,11 +163,11 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType
   { BlockStatistic::TransformSkipFlag_Cb,   std::tuple<std::string, BlockStatisticType, std::string>{"TransformSkipFlag_Cb",        BlockStatisticType::Flag,                   ""}},
   { BlockStatistic::TransformSkipFlag_Cr,   std::tuple<std::string, BlockStatisticType, std::string>{"TransformSkipFlag_Cr",        BlockStatisticType::Flag,                   ""}},
 #endif
-  { BlockStatistic::Depth,                  std::tuple<std::string, BlockStatisticType, std::string>{"Depth",                       BlockStatisticType::Integer,                "[0, 7]"}}, 
-  { BlockStatistic::QT_Depth,               std::tuple<std::string, BlockStatisticType, std::string>{"QT_Depth",                    BlockStatisticType::Integer,                "[0, 7]"}}, 
-  { BlockStatistic::BT_Depth,               std::tuple<std::string, BlockStatisticType, std::string>{"BT_Depth",                    BlockStatisticType::Integer,                "[0, 7]"}}, 
-  { BlockStatistic::MT_Depth,               std::tuple<std::string, BlockStatisticType, std::string>{"MT_Depth",                    BlockStatisticType::Integer,                "[0, 7]"}}, 
-  { BlockStatistic::ChromaQPAdj,            std::tuple<std::string, BlockStatisticType, std::string>{"ChromaQPAdj",                 BlockStatisticType::Integer,                "[-10, 10]"}}, 
+  { BlockStatistic::Depth,                  std::tuple<std::string, BlockStatisticType, std::string>{"Depth",                       BlockStatisticType::Integer,                "[0, 7]"}},
+  { BlockStatistic::QT_Depth,               std::tuple<std::string, BlockStatisticType, std::string>{"QT_Depth",                    BlockStatisticType::Integer,                "[0, 7]"}},
+  { BlockStatistic::BT_Depth,               std::tuple<std::string, BlockStatisticType, std::string>{"BT_Depth",                    BlockStatisticType::Integer,                "[0, 7]"}},
+  { BlockStatistic::MT_Depth,               std::tuple<std::string, BlockStatisticType, std::string>{"MT_Depth",                    BlockStatisticType::Integer,                "[0, 7]"}},
+  { BlockStatistic::ChromaQPAdj,            std::tuple<std::string, BlockStatisticType, std::string>{"ChromaQPAdj",                 BlockStatisticType::Integer,                "[-10, 10]"}},
   { BlockStatistic::QP,                     std::tuple<std::string, BlockStatisticType, std::string>{"QP",                          BlockStatisticType::Integer,                "[0, 51]"}},
   { BlockStatistic::SplitSeries,            std::tuple<std::string, BlockStatisticType, std::string>{"SplitSeries",                 BlockStatisticType::Integer,                "[0, " + std::to_string(std::numeric_limits<SplitSeries>::max()) + "]"}},
   { BlockStatistic::RootCbf,                std::tuple<std::string, BlockStatisticType, std::string>{"RootCbf",                     BlockStatisticType::Flag,                   ""}},
@@ -178,12 +178,12 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType
   { BlockStatistic::MergeIdx,               std::tuple<std::string, BlockStatisticType, std::string>{"MergeIdx",                    BlockStatisticType::Integer,                "[0, 7]"}},
   { BlockStatistic::InterDir,               std::tuple<std::string, BlockStatisticType, std::string>{"InterDir",                    BlockStatisticType::Integer,                "[1, 3]"}},
   { BlockStatistic::MergeType,              std::tuple<std::string, BlockStatisticType, std::string>{"MergeType",                   BlockStatisticType::Integer,                "[0, 2]"}},
-  { BlockStatistic::MVPIdxL0,               std::tuple<std::string, BlockStatisticType, std::string>{"MVPIdxL0",                    BlockStatisticType::Integer,                "[0, 1]"}}, 
+  { BlockStatistic::MVPIdxL0,               std::tuple<std::string, BlockStatisticType, std::string>{"MVPIdxL0",                    BlockStatisticType::Integer,                "[0, 1]"}},
   { BlockStatistic::MVDL0,                  std::tuple<std::string, BlockStatisticType, std::string>{"MVDL0",                       BlockStatisticType::Vector,                 "Scale: 4"}},
-  { BlockStatistic::RefIdxL0,               std::tuple<std::string, BlockStatisticType, std::string>{"RefIdxL0",                    BlockStatisticType::Integer,                "[0, 4]"}}, 
-  { BlockStatistic::MVPIdxL1,               std::tuple<std::string, BlockStatisticType, std::string>{"MVPIdxL1",                    BlockStatisticType::Integer,                "[0, 1]"}}, 
+  { BlockStatistic::RefIdxL0,               std::tuple<std::string, BlockStatisticType, std::string>{"RefIdxL0",                    BlockStatisticType::Integer,                "[0, 4]"}},
+  { BlockStatistic::MVPIdxL1,               std::tuple<std::string, BlockStatisticType, std::string>{"MVPIdxL1",                    BlockStatisticType::Integer,                "[0, 1]"}},
   { BlockStatistic::MVDL1,                  std::tuple<std::string, BlockStatisticType, std::string>{"MVDL1",                       BlockStatisticType::Vector,                 "Scale: 4"}},
-  { BlockStatistic::RefIdxL1,               std::tuple<std::string, BlockStatisticType, std::string>{"RefIdxL1",                    BlockStatisticType::Integer,                "[0, 4]"}}, 
+  { BlockStatistic::RefIdxL1,               std::tuple<std::string, BlockStatisticType, std::string>{"RefIdxL1",                    BlockStatisticType::Integer,                "[0, 4]"}},
   { BlockStatistic::IMVMode,                std::tuple<std::string, BlockStatisticType, std::string>{"IMVMode",                     BlockStatisticType::Integer,                "[0, 2]"}},
   { BlockStatistic::AffineFlag,             std::tuple<std::string, BlockStatisticType, std::string>{"AffineFlag",                  BlockStatisticType::Flag,                   ""}},
   { BlockStatistic::AffineMVL0,             std::tuple<std::string, BlockStatisticType, std::string>{"AffineMVL0",                  BlockStatisticType::AffineTFVectors,        "Scale: 4"}},
@@ -194,16 +194,16 @@ static const std::map<BlockStatistic, std::tuple<std::string, BlockStatisticType
 #endif
   { BlockStatistic::MotionBufL0,            std::tuple<std::string, BlockStatisticType, std::string>{"MotionBufL0",                 BlockStatisticType::Vector,                 "Scale: 16"}},
   { BlockStatistic::MotionBufL1,            std::tuple<std::string, BlockStatisticType, std::string>{"MotionBufL1",                 BlockStatisticType::Vector,                 "Scale: 16"}},
-  { BlockStatistic::MultiRefIdx,            std::tuple<std::string, BlockStatisticType, std::string>{"MultiRefIdx",                 BlockStatisticType::Integer,                "[0, 1]"}}, 
+  { BlockStatistic::MultiRefIdx,            std::tuple<std::string, BlockStatisticType, std::string>{"MultiRefIdx",                 BlockStatisticType::Integer,                "[0, 1]"}},
   { BlockStatistic::MMVDSkipFlag,           std::tuple<std::string, BlockStatisticType, std::string>{"MMVDSkipFlag",                BlockStatisticType::Flag,                   ""}},
   { BlockStatistic::MMVDMergeFlag,          std::tuple<std::string, BlockStatisticType, std::string>{"MMVDMergeFlag",               BlockStatisticType::Flag,                   ""}},
-  { BlockStatistic::MMVDMergeIdx,           std::tuple<std::string, BlockStatisticType, std::string>{"MMVDMergeIdx",                BlockStatisticType::Integer,                "[0, 1]"}}, 
+  { BlockStatistic::MMVDMergeIdx,           std::tuple<std::string, BlockStatisticType, std::string>{"MMVDMergeIdx",                BlockStatisticType::Integer,                "[0, 1]"}},
   { BlockStatistic::MHIntraFlag,            std::tuple<std::string, BlockStatisticType, std::string>{"MHIntraFlag",                 BlockStatisticType::Flag,                   ""}},
   { BlockStatistic::TriangleFlag,           std::tuple<std::string, BlockStatisticType, std::string>{"TriangleFlag",                BlockStatisticType::Flag,                   ""}},
   { BlockStatistic::TrianglePartitioning,   std::tuple<std::string, BlockStatisticType, std::string>{"TrianglePartitioning",        BlockStatisticType::Line,                   ""}},
   { BlockStatistic::TriangleMVL0,           std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL0",                BlockStatisticType::VectorPolygon,          "Scale: 4"}},
   { BlockStatistic::TriangleMVL1,           std::tuple<std::string, BlockStatisticType, std::string>{"TriangleMVL1",                BlockStatisticType::VectorPolygon,          "Scale: 4"}},
-  { BlockStatistic::GBIIndex,               std::tuple<std::string, BlockStatisticType, std::string>{"GBIIndex",                    BlockStatisticType::Integer,                "[0, 4]"}}, 
+  { BlockStatistic::GBIIndex,               std::tuple<std::string, BlockStatisticType, std::string>{"GBIIndex",                    BlockStatisticType::Integer,                "[0, 4]"}},
   { BlockStatistic::IBCFlag,                std::tuple<std::string, BlockStatisticType, std::string>{"IBCFlag",                     BlockStatisticType::Flag,                   ""}},
   // for dual tree
   { BlockStatistic::Depth_Chroma,                  std::tuple<std::string, BlockStatisticType, std::string>{"Depth_Chroma",                       BlockStatisticType::Integer,                "[0, 10]"}}, // todo: actual limits?
diff --git a/source/Lib/CommonLib/dtrace_codingstruct.h b/source/Lib/CommonLib/dtrace_codingstruct.h
index a6876cd95ee89111e17e98f020488d9a5beeb1d7..eafc916e1b9cbfbb4fb646a057cbd8e59f1bc436 100644
--- a/source/Lib/CommonLib/dtrace_codingstruct.h
+++ b/source/Lib/CommonLib/dtrace_codingstruct.h
@@ -107,7 +107,7 @@ inline void dtraceModeCost(CodingStructure &cs, double lambda)
     cs.cus[0]->predMode,
     cs.cus[0]->skip,
     cs.pus[0]->mergeFlag,
-    0, 0, 
+    0, 0,
     imvVal,
     0, 0,
           intraModeL, intraModeC,
diff --git a/source/Lib/CommonLib/x86/AffineGradientSearchX86.h b/source/Lib/CommonLib/x86/AffineGradientSearchX86.h
index b422db4f866e9c189c5d596e044e11d44dfc61c7..b49d703b9113dabc67a7c9d0637da9035a8cb3f7 100644
--- a/source/Lib/CommonLib/x86/AffineGradientSearchX86.h
+++ b/source/Lib/CommonLib/x86/AffineGradientSearchX86.h
@@ -214,7 +214,7 @@ static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDe
   int idx1 = 0, idx2 = 0;
   idx1 = -2 * derivateBufStride - 4;
   idx2 = -derivateBufStride - 4;
-  
+
   for ( int j = 0; j < height; j += 2 )
   {
     if (!(j & 3))
diff --git a/source/Lib/CommonLib/x86/InitX86.cpp b/source/Lib/CommonLib/x86/InitX86.cpp
index 00f18ae12450d7db4c8c03c51cd6d3c31850b756..334987013a8315ad5381a103efed5cbf226c448c 100644
--- a/source/Lib/CommonLib/x86/InitX86.cpp
+++ b/source/Lib/CommonLib/x86/InitX86.cpp
@@ -171,7 +171,7 @@ void AdaptiveLoopFilter::initAdaptiveLoopFilterX86()
 void IbcHashMap::initIbcHashMapX86()
 {
   auto vext = read_x86_extension_flags();
-  switch (vext) 
+  switch (vext)
   {
   case AVX512:
   case AVX2:
diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index 2b484e9050db28500e71d808f253dba7e93cb880..7219e398b8d527b25189bbc0d1559f45ad263ba2 100644
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -690,7 +690,7 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__SPLIT_FLAG, partitioner.currArea().blocks[partitioner.chType].size(), partitioner.chType );
 
   PartSplit mode = CU_DONT_SPLIT;
-  
+
   bool canNo, canQt, canBh, canBv, canTh, canTv;
   partitioner.canSplit( cs, canNo, canQt, canBh, canBv, canTh, canTv );
 
@@ -813,7 +813,7 @@ PartSplit CABACReader::split_cu_mode_mt( CodingStructure& cs, Partitioner &parti
 
   dt.setAvail( DTT_SPLIT_BT_HORZ,  partitioner.canSplit( CU_HORZ_SPLIT, cs ) );
   dt.setAvail( DTT_SPLIT_BT_VERT,  partitioner.canSplit( CU_VERT_SPLIT, cs ) );
-  
+
   dt.setAvail( DTT_SPLIT_TT_HORZ,  partitioner.canSplit( CU_TRIH_SPLIT, cs ) );
   dt.setAvail( DTT_SPLIT_TT_VERT,  partitioner.canSplit( CU_TRIV_SPLIT, cs ) );
   dt.setAvail( DTT_SPLIT_NO_SPLIT, partitioner.canSplit( CU_DONT_SPLIT, cs ) );
@@ -971,7 +971,7 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
       cu.predMode = MODE_IBC;
       cu.mmvdSkip = false;
     }
-   
+
     return;
   }
 #endif
@@ -1164,7 +1164,7 @@ void CABACReader::pred_mode( CodingUnit& cu )
 void CABACReader::pcm_flag( CodingUnit& cu, Partitioner &partitioner )
 {
   const SPS& sps = *cu.cs->sps;
-  if( !sps.getPCMEnabledFlag() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize()) 
+  if( !sps.getPCMEnabledFlag() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize())
       || partitioner.currArea().lheight() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lheight() < (1 << sps.getPCMLog2MinSize()) )
   {
     cu.ipcm = false;
@@ -1822,7 +1822,7 @@ void CABACReader::merge_flag( PredictionUnit& pu )
   pu.mergeFlag = ( m_BinDecoder.decodeBin( Ctx::MergeFlag() ) );
 
   DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height );
-  
+
 #if JVET_M0483_IBC
   if (pu.mergeFlag && CU::isIBC(*pu.cu))
   {
@@ -2253,7 +2253,7 @@ void CABACReader::triangle_mode( CodingUnit& cu )
   {
     return;
   }
-  
+
 #if JVET_M0118_M0185_TRIANGLE_FLAG_FIX
   if ( cu.firstPU->mmvdMergeFlag || cu.mmvdSkip )
   {
diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp
index abc137c5671813430951618f54e6970031f2ff54..4460dc6ac748f5f4a1c1828815b71c8b0113a724 100644
--- a/source/Lib/DecoderLib/DecCu.cpp
+++ b/source/Lib/DecoderLib/DecCu.cpp
@@ -120,7 +120,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea )
     const ChannelType chType = ChannelType( ch );
 #if JVET_M0170_MRG_SHARELIST
     Position prevTmpPos;
-    prevTmpPos.x = -1; prevTmpPos.y = -1; 
+    prevTmpPos.x = -1; prevTmpPos.y = -1;
 #endif
 
     for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, chType ), chType ) )
@@ -133,7 +133,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea )
           m_shareStateDec = GEN_ON_SHARED_BOUND;
           cs.slice->copyMotionLUTs(cs.slice->getMotionLUTs(), cs.slice->m_MotionCandLuTsBkup);
         }
-        
+
         if (currCU.shareParentPos.x < 0)
         {
           m_shareStateDec = 0;
@@ -248,7 +248,7 @@ void DecCu::xIntraRecBlk( TransformUnit& tu, const ComponentID compID )
 #if JVET_M0427_INLOOP_RESHAPER
   flag = flag && (tu.blocks[compID].width*tu.blocks[compID].height > 4);
   if (flag && TU::getCbf(tu, compID) && isChroma(compID) && slice.getReshapeInfo().getSliceReshapeChromaAdj())
-  {  
+  {
     piResi.scaleSignal(tu.getChromaAdj(), 0, tu.cu->cs->slice->clpRng(compID));
   }
 #endif
@@ -512,7 +512,7 @@ void DecCu::xReconInter(CodingUnit &cu)
 
   DTRACE    ( g_trace_ctx, D_TMP, "pred " );
   DTRACE_CRC( g_trace_ctx, D_TMP, *cu.cs, cu.cs->getPredBuf( cu ), &cu.Y() );
-    
+
   // inter recon
   xDecodeInterTexture(cu);
 
@@ -574,9 +574,9 @@ void DecCu::xReconInter(CodingUnit &cu)
     {
       cs.getRecoBuf(cu).get(COMPONENT_Y).rspSignal(m_pcReshape->getFwdLUT());
     }
-#endif 
+#endif
   }
-  
+
   DTRACE    ( g_trace_ctx, D_TMP, "reco " );
   DTRACE_CRC( g_trace_ctx, D_TMP, *cu.cs, cu.cs->getRecoBuf( cu ), &cu.Y() );
 
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index 36d835319261542470fc7a5bb7ebdfe88b6e6aca..bf11480a35980cd9a366cbb259af6ef7166b0878 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -447,7 +447,7 @@ void DecLib::destroy()
 
 void DecLib::init(
 #if JVET_J0090_MEMORY_BANDWITH_MEASURE
-  const std::string& cacheCfgFileName 
+  const std::string& cacheCfgFileName
 #endif
 )
 {
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index f2c5adb630d1709f476aa871d1cd27a8362fd0f8..896c90d1b51021f897f2df313dc5956e11fe1c6f 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1089,7 +1089,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   }
 
   READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" );                  pcSPS->setSPSTemporalMVPEnabledFlag(uiCode);
-  
+
   if ( pcSPS->getSPSTemporalMVPEnabledFlag() )
   {
     READ_FLAG( uiCode,    "sps_sbtmvp_enabled_flag" );                   pcSPS->setSBTMVPEnabledFlag      ( uiCode != 0 );
@@ -1819,7 +1819,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
       }
     }
 
-#if JVET_M0483_IBC 
+#if JVET_M0483_IBC
     if (!pcSlice->isIntra() || sps->getIBCFlag())
     {
       READ_UVLC(uiCode, "six_minus_max_num_merge_cand");
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index 339ea35f26bb18258ce2a643ce655decf8ff23d9..090994ca8d6702ab505bcfc9aeddfc4521959c35 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -544,7 +544,7 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c
 
   unsigned ctxSplit = 0, ctxQtSplit = 0, ctxBttHV = 0, ctxBttH12 = 0, ctxBttV12;
   DeriveCtx::CtxSplit( cs, partitioner, ctxSplit, ctxQtSplit, ctxBttHV, ctxBttH12, ctxBttV12, canSpl );
-  
+
   const bool canSplit = canBh || canBv || canTh || canTv || canQt;
   const bool isNo     = split == CU_DONT_SPLIT;
 
@@ -749,7 +749,7 @@ void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, C
 
   extend_ref_line(cu);
 
-#if JVET_M0102_INTRA_SUBPARTITIONS 
+#if JVET_M0102_INTRA_SUBPARTITIONS
   isp_mode( cu );
 #endif
 
@@ -878,7 +878,7 @@ void CABACWriter::pcm_data( const CodingUnit& cu, Partitioner& partitioner  )
 void CABACWriter::pcm_flag( const CodingUnit& cu, Partitioner& partitioner )
 {
   const SPS& sps = *cu.cs->sps;
-  if( !sps.getPCMEnabledFlag() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize()) 
+  if( !sps.getPCMEnabledFlag() || partitioner.currArea().lwidth() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lwidth() < (1 << sps.getPCMLog2MinSize())
       || partitioner.currArea().lheight() > (1 << sps.getPCMLog2MaxSize()) || partitioner.currArea().lheight() < (1 << sps.getPCMLog2MinSize()) )
   {
     return;
@@ -1165,7 +1165,7 @@ void CABACWriter::intra_luma_pred_mode( const PredictionUnit& pu )
   // prev_intra_luma_pred_flag
   const int numMPMs  = NUM_MOST_PROBABLE_MODES;
   unsigned  mpm_pred[numMPMs];
-  
+
   PU::getIntraMPMs( pu, mpm_pred );
 
   unsigned ipred_mode = pu.intraDir[0];
@@ -1638,7 +1638,7 @@ void CABACWriter::merge_flag( const PredictionUnit& pu )
   m_BinEncoder.encodeBin( pu.mergeFlag, Ctx::MergeFlag() );
 
   DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height );
-  
+
 #if JVET_M0483_IBC
   if (pu.mergeFlag && CU::isIBC(*pu.cu))
   {
diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
index 1cab68f20b39910504f441e7a2ea14f136434f07..19e0949e5f9dbfa2c8cbb922f83d508a9b01b8b4 100644
--- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
+++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp
@@ -522,7 +522,7 @@ double EncAdaptiveLoopFilter::getFilterCoeffAndCost( CodingStructure& cs, double
     uiSliceFlag = lengthTruncatedUnary(alfChromaIdc, 3);
   }
 
-  double rate = uiCoeffBits + uiSliceFlag;  
+  double rate = uiCoeffBits + uiSliceFlag;
   m_CABACEstimator->resetBits();
   m_CABACEstimator->codeAlfCtuEnableFlags( cs, channel, &m_alfSliceParamTemp);
   rate += FracBitsScale * (double)m_CABACEstimator->getEstFracBits();
@@ -659,7 +659,7 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfSliceParam& alfSliceParam,
     dist = deriveFilterCoeffs( covFrame, covMerged, alfShape, m_filterIndices[numFilters - 1], numFilters, errorForce0CoeffTab );
     // filter coeffs are stored in m_filterCoeffSet
     distForce0 = getDistForce0( alfShape, numFilters, errorForce0CoeffTab, codedVarBins );
-    coeffBits = deriveFilterCoefficientsPredictionMode( alfShape, m_filterCoeffSet, m_diffFilterCoeff, numFilters, predMode ); 
+    coeffBits = deriveFilterCoefficientsPredictionMode( alfShape, m_filterCoeffSet, m_diffFilterCoeff, numFilters, predMode );
     coeffBitsForce0 = getCostFilterCoeffForce0( alfShape, m_filterCoeffSet, numFilters, codedVarBins );
 
     cost = dist + m_lambda[COMPONENT_Y] * coeffBits;
@@ -1153,7 +1153,7 @@ double EncAdaptiveLoopFilter::deriveCoeffQuant( int *filterCoeffQuant, double **
   filterCoeffQuant[numCoeff - 1] = -quantCoeffSum;
   filterCoeff[numCoeff - 1] = filterCoeffQuant[numCoeff - 1] / double(factor);
 
-  
+
   //Restrict the range of the center coefficient
   int max_value_center = (2 * factor - 1) - factor;
   int min_value_center = 0 - factor;
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index 05eed781d75e7631cd246cb38776cba2c2502313..07e78283c1954f8eaa915671b770c5d956286904 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -327,8 +327,8 @@ protected:
 
   int       m_chromaCbQpOffset;                 //  Chroma Cb QP Offset (0:default)
   int       m_chromaCrQpOffset;                 //  Chroma Cr Qp Offset (0:default)
-  int       m_chromaCbQpOffsetDualTree;         //  Chroma Cb QP Offset for dual tree 
-  int       m_chromaCrQpOffsetDualTree;         //  Chroma Cr Qp Offset for dual tree 
+  int       m_chromaCbQpOffsetDualTree;         //  Chroma Cb QP Offset for dual tree
+  int       m_chromaCrQpOffsetDualTree;         //  Chroma Cr Qp Offset for dual tree
 #if ER_CHROMA_QP_WCG_PPS
   WCGChromaQPControl m_wcgChromaQpControl;                    ///< Wide-colour-gamut chroma QP control.
 #endif
@@ -1505,5 +1505,5 @@ public:
 };
 
 //! \}
-  
+
 #endif // !defined(AFX_TENCCFG_H__6B99B797_F4DA_4E46_8E78_7656339A6C41__INCLUDED_)
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index 4317ca13d9405822fe80eaa761733acb20cd6c9f..17314f06b8e5d36e07b13f69221f17bcf3b33672 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -65,7 +65,7 @@ extern std::recursive_mutex g_cache_mutex;
 // Constructor / destructor / create / destroy
 // ====================================================================================================================
 #if JVET_M0883_TRIANGLE_SIGNALING
-const TriangleMotionInfo  EncCu::m_triangleModeTest[TRIANGLE_MAX_NUM_CANDS] = 
+const TriangleMotionInfo  EncCu::m_triangleModeTest[TRIANGLE_MAX_NUM_CANDS] =
 {
   TriangleMotionInfo( 0, 1, 0 ), TriangleMotionInfo( 1, 0, 1 ), TriangleMotionInfo( 1, 0, 2 ), TriangleMotionInfo( 0, 0, 1 ), TriangleMotionInfo( 0, 2, 0 ),
   TriangleMotionInfo( 1, 0, 3 ), TriangleMotionInfo( 1, 0, 4 ), TriangleMotionInfo( 1, 1, 0 ), TriangleMotionInfo( 0, 3, 0 ), TriangleMotionInfo( 0, 4, 0 ),
@@ -701,7 +701,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
   const unsigned wIdx = gp_sizeIdxInfo->idxFrom( partitioner.currArea().lwidth()  );
 
   const UnitArea currCsArea = clipArea( CS::getArea( *bestCS, bestCS->area, partitioner.chType ), *tempCS->picture );
-#if JVET_M0483_IBC 
+#if JVET_M0483_IBC
   if (m_pImvTempCS && (!slice.isIntra() || slice.getSPS()->getIBCFlag()))
 #else
   if( m_pImvTempCS && !slice.isIntra() )
@@ -760,7 +760,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
 #if JVET_M0170_MRG_SHARELIST
   int startShareThisLevel = 0;
 #endif
-#if JVET_M0246_AFFINE_AMVR 
+#if JVET_M0246_AFFINE_AMVR
   m_pcInterSearch->resetSavedAffineMotion();
 #endif
 
@@ -907,13 +907,13 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
 #if JVET_M0483_IBC
   if ((!slice.isIntra() || slice.getSPS()->getIBCFlag())
 #else
-  if (!slice.isIntra() 
+  if (!slice.isIntra()
 #endif
     && bestCS->chType == CHANNEL_TYPE_LUMA
 #if JVET_M0483_IBC
     && bestCS->cus.size() == 1 && (bestCS->cus.back()->predMode == MODE_INTER || bestCS->cus.back()->predMode == MODE_IBC)
 #else
-    && bestCS->cus.size() == 1 && bestCS->cus.back()->predMode == MODE_INTER 
+    && bestCS->cus.size() == 1 && bestCS->cus.back()->predMode == MODE_INTER
 #endif
     && bestCS->area.Y() == (*bestCS->cus.back()).Y()
     )
@@ -1372,7 +1372,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
 
   partitioner.exitCurrSplit();
 
-#if JVET_M0170_MRG_SHARELIST 
+#if JVET_M0170_MRG_SHARELIST
   if (startShareThisLevel == 1)
   {
     m_shareState = NO_SHARE;
@@ -1564,7 +1564,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
 #if !JVET_M0464_UNI_MTS
     cu.emtFlag          = emtCuFlag;
 #endif
-#if JVET_M0102_INTRA_SUBPARTITIONS 
+#if JVET_M0102_INTRA_SUBPARTITIONS
     cu.ispMode          = NOT_INTRA_SUBPARTITIONS;
 #endif
 
@@ -1575,7 +1575,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
     if( isLuma( partitioner.chType ) )
     {
 #if JVET_M0102_INTRA_SUBPARTITIONS
-      //the Intra SubPartitions mode uses the value of the best cost so far (luma if it is the fast version) to avoid test non-necessary lines 
+      //the Intra SubPartitions mode uses the value of the best cost so far (luma if it is the fast version) to avoid test non-necessary lines
       const double bestCostSoFar = CS::isDualITree( *tempCS ) ? m_modeCtrl->getBestCostWithoutSplitFlags() : bestCU && bestCU->predMode == MODE_INTRA ? bestCS->lumaCost : bestCS->cost;
       m_pcIntraSearch->estIntraPredLumaQT( cu, partitioner, bestCostSoFar );
 
@@ -1652,7 +1652,7 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
 #if JVET_M0483_IBC
     if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getIBCFlag())
 #else
-    if( !cu.cs->slice->isIntra() 
+    if( !cu.cs->slice->isIntra()
 #endif
       && cu.Y().valid()
       )
@@ -1773,7 +1773,7 @@ void EncCu::xCheckIntraPCM(CodingStructure *&tempCS, CodingStructure *&bestCS, P
 #if JVET_M0483_IBC
   if ((!cu.cs->slice->isIntra() || cu.cs->slice->getSPS()->getIBCFlag())
 #else
-  if( !cu.cs->slice->isIntra() 
+  if( !cu.cs->slice->isIntra()
 #endif
     && cu.Y().valid()
     )
@@ -2038,7 +2038,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
   {
     isIntrainterEnabled = false;
   }
-  bool isTestSkipMerge[MRG_MAX_NUM_CANDS]; // record if the merge candidate has tried skip mode 
+  bool isTestSkipMerge[MRG_MAX_NUM_CANDS]; // record if the merge candidate has tried skip mode
   for (uint32_t idx = 0; idx < MRG_MAX_NUM_CANDS; idx++)
   {
     isTestSkipMerge[idx] = false;
@@ -2281,7 +2281,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
 #endif
             distParam.cur = pu.cs->getPredBuf(pu).Y();
             Distortion sadValue = distParam.distFunc(distParam);
-#if JVET_M0427_INLOOP_RESHAPER 
+#if JVET_M0427_INLOOP_RESHAPER
             if (pu.cs->slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag())
             {
               pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT());
@@ -2599,7 +2599,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
         m_pcInterSearch->motionCompensation( pu );
 #if JVET_M0147_DMVR
         pu.mvRefine = false;
-#endif        
+#endif
       }
       if (!cu.mmvdSkip && !pu.mhIntraFlag && uiNoResidualPass != 0)
       {
@@ -2662,9 +2662,9 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
   const SPS &sps = *tempCS->sps;
 
   CHECK( slice.getSliceType() != B_SLICE, "Triangle mode is only applied to B-slices" );
-  
+
   tempCS->initStructData( encTestMode.qp, encTestMode.lossless );
-  
+
   bool trianglecandHasNoResidual[TRIANGLE_MAX_NUM_CANDS];
   for( int mergeCand = 0; mergeCand < TRIANGLE_MAX_NUM_CANDS; mergeCand++ )
   {
@@ -2721,7 +2721,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
       triangleBuffer[mergeCand] = m_acMergeBuffer[mergeCand].getBuf(localUnitArea);
       triangleMrgCtx.setMergeInfo( pu, mergeCand );
       PU::spanMotionInfo( pu, triangleMrgCtx );
-      
+
       m_pcInterSearch->motionCompensation( pu, triangleBuffer[mergeCand] );
     }
   }
@@ -2738,7 +2738,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
   else
   {
     CodingUnit &cu      = tempCS->addCU( tempCS->area, partitioner.chType );
-      
+
     partitioner.setCUData( cu );
     cu.slice            = tempCS->slice;
 #if HEVC_TILES_WPP
@@ -2754,7 +2754,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
     cu.GBiIdx           = GBI_DEFAULT;
 
     PredictionUnit &pu  = tempCS->addPU( cu, partitioner.chType );
-      
+
     if( abs(g_aucLog2[cu.lwidth()] - g_aucLog2[cu.lheight()]) >= 2 )
     {
       numTriangleCandidate = 30;
@@ -2810,7 +2810,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
         , *nullList, -1
         , triangleNumMrgSATDCand );
     }
-        
+
     // limit number of candidates using SATD-costs
     for( uint8_t i = 0; i < triangleNumMrgSATDCand; i++ )
     {
@@ -2834,7 +2834,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
       uint8_t  candIdx0  = g_triangleCombination[mergeCand][1];
       uint8_t  candIdx1  = g_triangleCombination[mergeCand][2];
 #endif
-        
+
 #if JVET_M0883_TRIANGLE_SIGNALING
       pu.triangleSplitDir = splitDir;
       pu.triangleMergeIdx0 = candIdx0;
@@ -2843,7 +2843,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
       pu.mergeIdx  = mergeCand;
 #endif
       pu.mergeFlag = true;
-                
+
 #if JVET_M0328_KEEP_ONE_WEIGHT_GROUP
       m_pcInterSearch->weightedTriangleBlk( pu, splitDir, CHANNEL_TYPE_CHROMA, triangleWeightedBuffer[mergeCand], triangleBuffer[candIdx0], triangleBuffer[candIdx1] );
 #else
@@ -2940,7 +2940,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
           m_pcInterSearch->weightedTriangleBlk( pu, PU::getTriangleWeights(pu, triangleMrgCtx, candIdx0, candIdx1), splitDir, MAX_NUM_CHANNEL_TYPE, predBuf, triangleBuffer[candIdx0], triangleBuffer[candIdx1] );
 #endif
         }
-        
+
 #if JVET_M0464_UNI_MTS
         xEncodeInterResidual( tempCS, bestCS, partitioner, encTestMode, noResidualPass, NULL, ( noResidualPass == 0 ? &trianglecandHasNoResidual[mergeCand] : NULL ) );
 #else
@@ -2953,7 +2953,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
         }
         tempCS->initStructData(encTestMode.qp, encTestMode.lossless);
       }// end loop mrgHADIdx
-    }   
+    }
   }
 }
 
@@ -3608,7 +3608,7 @@ void EncCu::xCheckRDCostIBCMode(CodingStructure *&tempCS, CodingStructure *&best
     pu.intraDir[1] = PLANAR_IDX; // set intra pred for ibc block
 
     pu.interDir = 1; // use list 0 for IBC mode
-#if JVET_M0483_IBC 
+#if JVET_M0483_IBC
     pu.refIdx[REF_PIC_LIST_0] = MAX_NUM_REF; // last idx in the list
 #else
     pu.refIdx[REF_PIC_LIST_0] = pu.cs->slice->getNumRefIdx(REF_PIC_LIST_0) - 1; // last idx in the list
@@ -3771,7 +3771,7 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC
 {
   tempCS->initStructData( encTestMode.qp, encTestMode.lossless );
 
-  
+
   m_pcInterSearch->setAffineModeSelected(false);
 
   if( tempCS->slice->getCheckLDC() )
@@ -4004,7 +4004,7 @@ bool EncCu::xCheckRDCostInterIMV( CodingStructure *&tempCS, CodingStructure *&be
 #if JVET_M0246_AFFINE_AMVR
   bool affineAmvrEanbledFlag = cu.slice->getSPS()->getAffineAmvrEnabledFlag();
 #endif
-  
+
   if( pcCUInfo2Reuse != nullptr )
   {
     // reuse the motion info from pcCUInfo2Reuse
@@ -4423,7 +4423,7 @@ void EncCu::xEncodeInterResidual( CodingStructure *&tempCS, CodingStructure *&be
 
       const bool bCond3 = emtFirstPassCost > ( bestCost * thresholdToSkipEmtSecondPass );
 
-      if( m_pcEncCfg->getFastInterEMT() && (bCond1 || bCond3 ) ) 
+      if( m_pcEncCfg->getFastInterEMT() && (bCond1 || bCond3 ) )
       {
         maxEMTMode = 0; // do not test EMT
       }
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index 35b96a12227bcbbb8c4cc4084d0b0cedac4dc600..78c21c8c0973353432bfa6889bdc47f588f58233 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -2384,7 +2384,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
       CodingStructure& cs = *pcPic->cs;
       pcSlice = pcPic->slices[0];
 
-#if JVET_M0427_INLOOP_RESHAPER 
+#if JVET_M0427_INLOOP_RESHAPER
       if (pcSlice->getSPS()->getUseReshaper() && m_pcReshaper->getSliceReshaperInfo().getUseSliceReshaper())
       {
           CHECK((m_pcReshaper->getRecReshaped() == false), "Rec picture is not reshaped!");
@@ -2420,7 +2420,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
 
       m_pcLoopFilter->loopFilterPic( cs );
 
-#if JVET_M0147_DMVR 
+#if JVET_M0147_DMVR
       CS::setRefinedMotionField(cs);
 #endif
       DTRACE_UPDATE( g_trace_ctx, ( std::make_pair( "final", 1 ) ) );
@@ -2809,7 +2809,7 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool
 
   msg( DETAILS,"\n\nB Slices--------------------------------------------------------\n" );
   m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths);
-  
+
 #if WCG_WPSNR
   if (useLumaWPSNR)
   {
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index ebe96c8a98fe743422d72aa4d7046cc5c93a80cc..64cc386d5788c69ee55258cc2d929b44acc78746 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -224,7 +224,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
   omp_set_nested( true );
 #endif
 
-  if (sps0.getSpsNext().getUseCompositeRef()) 
+  if (sps0.getSpsNext().getUseCompositeRef())
   {
     sps0.setLongTermRefsPresent(true);
   }
@@ -327,7 +327,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
                        &m_cTrQuant,
                        &m_cRdCost,
                        cabacEstimator,
-                       getCtxCache(), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth 
+                       getCtxCache(), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth
 #if JVET_M0427_INLOOP_RESHAPER
                      , &m_cReshaper
 #endif
@@ -365,7 +365,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
 #if ENABLE_WPP_PARALLELISM
   m_entropyCodingSyncContextStateVec.resize( pps0.pcv->heightInCtus );
 #endif
-  if (sps0.getSpsNext().getUseCompositeRef()) 
+  if (sps0.getSpsNext().getUseCompositeRef())
   {
     Picture *picBg = new Picture;
     picBg->create(sps0.getChromaFormatIdc(), Size(sps0.getPicWidthInLumaSamples(), sps0.getPicHeightInLumaSamples()), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false);
@@ -1382,7 +1382,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
   pps.setSliceChromaQpFlag(bChromaDeltaQPEnabled);
 #endif
   if (
-    !pps.getSliceChromaQpFlag() && sps.getUseDualITree() 
+    !pps.getSliceChromaQpFlag() && sps.getUseDualITree()
     && (getChromaFormatIdc() != CHROMA_400))
   {
     pps.setSliceChromaQpFlag(m_chromaCbQpOffsetDualTree != 0 || m_chromaCrQpOffsetDualTree != 0);
diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp
index d01aedbedb7db486b58a540a087d28ace6d35d5d..748003d1f20f8456d88fd1d6f8266507bc3dc8ec 100644
--- a/source/Lib/EncoderLib/EncModeCtrl.cpp
+++ b/source/Lib/EncoderLib/EncModeCtrl.cpp
@@ -662,7 +662,7 @@ static bool isTheSameNbHood( const CodingUnit &cu, const CodingStructure& cs, co
   bool sharedListReuseMode = true;
   if(
       pu.mergeFlag == true &&
-      cu.affine == false &&    
+      cu.affine == false &&
       cu.predMode == MODE_INTER
     )
   {
@@ -802,14 +802,14 @@ void BestEncInfoCache::init( const Slice &slice )
   m_slice_bencinf = &slice;
 
   if( isInitialized ) return;
-  
+
   const unsigned numPos = MAX_CU_SIZE >> MIN_CU_LOG2;
 
   m_numWidths  = gp_sizeIdxInfo->numWidths();
   m_numHeights = gp_sizeIdxInfo->numHeights();
 
   size_t numCoeff = 0;
-  
+
   for( unsigned x = 0; x < numPos; x++ )
   {
     for( unsigned y = 0; y < numPos; y++ )
@@ -953,7 +953,7 @@ bool BestEncInfoCache::isValid( const CodingStructure& cs, const Partitioner& pa
 #if JVET_M0170_MRG_SHARELIST
     , encInfo.pu, (cs.picture->Y().width), (cs.picture->Y().height)
 #endif
-) 
+)
 #if JVET_M0483_IBC
     || CU::isIBC(encInfo.cu)
 #else
@@ -976,7 +976,7 @@ bool BestEncInfoCache::setCsFrom( CodingStructure& cs, EncTestMode& testMode, co
 
   BestEncodingInfo& encInfo = *m_bestEncInfo[idx1][idx2][idx3][idx4];
 
-  if( cs.picture->poc != encInfo.poc || CS::getArea( cs, cs.area, partitioner.chType ) != CS::getArea( cs, encInfo.cu, partitioner.chType ) || !isTheSameNbHood( encInfo.cu, cs, partitioner 
+  if( cs.picture->poc != encInfo.poc || CS::getArea( cs, cs.area, partitioner.chType ) != CS::getArea( cs, encInfo.cu, partitioner.chType ) || !isTheSameNbHood( encInfo.cu, cs, partitioner
 #if JVET_M0170_MRG_SHARELIST
     , encInfo.pu, (cs.picture->Y().width), (cs.picture->Y().height)
 #endif
@@ -1186,7 +1186,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
     switch (ibcLumaCoverage)
     {
     case IBC_LUMA_COVERAGE_FULL:
-      // check IBC 
+      // check IBC
       break;
     case IBC_LUMA_COVERAGE_PARTIAL:
       // do not check IBC
@@ -1507,10 +1507,10 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
       return true;
     CHECK( !slice.isIntra() && !cuECtx.bestTU, "No possible non-intra encoding for a P- or B-slice found" );
 
-    if( !( slice.isIRAP() || bestMode.type == ETM_INTRA || 
+    if( !( slice.isIRAP() || bestMode.type == ETM_INTRA ||
 #if JVET_M0483_IBC
       ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && (!relatedCU.isInter || !relatedCU.isIBC) && (
-#else    
+#else
       ( ( !m_pcEncCfg->getDisableIntraPUsInInterSlices() ) && !relatedCU.isInter && (
 #endif
                                          ( cuECtx.bestTU->cbf[0] != 0 ) ||
@@ -1626,7 +1626,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
       return false;
     }
     if( encTestmode.type == ETM_MERGE_TRIANGLE && ( partitioner.currArea().lumaSize().area() < TRIANGLE_MIN_SIZE || relatedCU.isIntra ) )
-    { 
+    {
       return false;
     }
     return true;
@@ -1639,7 +1639,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
     //////////////////////////////////////////////////////////////////////////
     int skipScore = 0;
 
-#if JVET_M0483_IBC 
+#if JVET_M0483_IBC
     if ((!slice.isIntra() || slice.getSPS()->getIBCFlag()) && cuECtx.get<bool>(IS_BEST_NOSPLIT_SKIP))
 #else
     if( !slice.isIntra() && cuECtx.get<bool>( IS_BEST_NOSPLIT_SKIP ) )
diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h
index 9aa3abe477e94a5e59c25011bc7fcf0d13b0f0a5..bda381a20add28a2700b6d833f3939c0c24fc4df 100644
--- a/source/Lib/EncoderLib/EncModeCtrl.h
+++ b/source/Lib/EncoderLib/EncModeCtrl.h
@@ -282,7 +282,7 @@ protected:
 public:
 
   virtual ~EncModeCtrl              () {}
-  
+
 #if REUSE_CU_RESULTS
   virtual void create               ( const EncCfg& cfg )                                                                   = 0;
   virtual void destroy              ()                                                                                      = 0;
diff --git a/source/Lib/EncoderLib/EncReshape.cpp b/source/Lib/EncoderLib/EncReshape.cpp
index e9be72f9f41d4b4bc9438b83af03669f57e52102..ce7d76aa2f826341f21c7b15e6aa425b02a7441a 100644
--- a/source/Lib/EncoderLib/EncReshape.cpp
+++ b/source/Lib/EncoderLib/EncReshape.cpp
@@ -193,7 +193,7 @@ void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const
 
       double blockBinVarSum[PIC_ANALYZE_CW_BINS] = { 0.0 };
       uint32_t   bockBinCnt[PIC_ANALYZE_CW_BINS] = { 0 };
-      
+
       const int PIC_ANALYZE_WIN_SIZE = 5;
       const uint32_t winSize = PIC_ANALYZE_WIN_SIZE;
       const uint32_t winLens = (winSize - 1) >> 1;
@@ -313,7 +313,7 @@ void EncReshape::preAnalyzerSDR(Picture *pcPic, const SliceType sliceType, const
                   pWinY += stride;
                 }
               }
-              else                        // for the main area, calc the B-R point 
+              else                        // for the main area, calc the B-R point
               {
                 leftColSum[x + winLens] = topColSum[x + winLens];
                 leftColSumSq[x + winLens] = topColSumSq[x + winLens];
@@ -704,13 +704,13 @@ void EncReshape::deriveReshapeParametersSDRfromStats(uint32_t * blockBinCnt, dou
 
       if (maxBinVar > 2.4)
       {
-        if (binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.88) 
+        if (binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.88)
         {
           if (maxBinVar < 2.695)
           {
             *reshapeTH2 = 2.2;
           }
-          else 
+          else
           {
             if (binVarSortDsdCDF[firstBinVarLessThanVal3] < 0.45)
             {
@@ -728,7 +728,7 @@ void EncReshape::deriveReshapeParametersSDRfromStats(uint32_t * blockBinCnt, dou
             }
           }
         }
-        else 
+        else
         {
           if (maxBinVar > 2.8)
           {
@@ -882,7 +882,7 @@ void EncReshape::deriveReshapeParametersSDRfromStats(uint32_t * blockBinCnt, dou
     {
       *reshapeTH1 = 2.5;
       *reshapeTH2 = 4.5;
-      m_rateAdpMode = 1; 
+      m_rateAdpMode = 1;
 
       if (meanBinVar < 2.52)
       {
@@ -919,7 +919,7 @@ void EncReshape::deriveReshapeParametersSDRfromStats(uint32_t * blockBinCnt, dou
     else if (m_reshapeCW.rspPicSize > 660480)
     {
       *intraAdp = true;
-      m_rateAdpMode = 1;  
+      m_rateAdpMode = 1;
 
       if (binVarSortDsdCDF[firstBinVarLessThanVal4] > 0.6)
       {
@@ -933,7 +933,7 @@ void EncReshape::deriveReshapeParametersSDRfromStats(uint32_t * blockBinCnt, dou
           *reshapeTH1 = 2.4;
           *reshapeTH2 = 4.5;
           m_reshapeCW.binCW[0] = 40;
-          m_rateAdpMode = 0;  
+          m_rateAdpMode = 0;
         }
       }
       else
@@ -1150,7 +1150,7 @@ void EncReshape::constructReshaperSDR()
 
   cwScaleBins1 = m_reshapeCW.binCW[0];
   cwScaleBins2 = m_reshapeCW.binCW[1];
-  
+
   for (i = 0; i < histBins; i++)
     usedCW += m_binCW[i];
 
diff --git a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp
index a3bfa14a62b059b379adf1a8bd09d1ebf5334428..8e467b2eec9fe3c335f9602e6efbe696cce1ab3a 100644
--- a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp
+++ b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp
@@ -799,7 +799,7 @@ void EncSampleAdaptiveOffset::decideBlkParams(CodingStructure& cs, bool* sliceEn
   SAOBlkParam modeParam;
   double minCost, modeCost;
 
-#if K0238_SAO_GREEDY_MERGE_ENCODING 
+#if K0238_SAO_GREEDY_MERGE_ENCODING
   double minCost2 = 0;
   std::vector<SAOStatData**> groupBlkStat;
   if (isGreedymergeEncoding)
@@ -919,7 +919,7 @@ void EncSampleAdaptiveOffset::decideBlkParams(CodingStructure& cs, bool* sliceEn
       reconParams[ctuRsAddr] = codedParams[ctuRsAddr];
       reconstructBlkSAOParam(reconParams[ctuRsAddr], mergeList);
 
-#if K0238_SAO_GREEDY_MERGE_ENCODING  
+#if K0238_SAO_GREEDY_MERGE_ENCODING
       if (isGreedymergeEncoding)
       {
         if (ctuRsAddr == (mergeCtuAddr - 1))
@@ -1037,7 +1037,7 @@ void EncSampleAdaptiveOffset::decideBlkParams(CodingStructure& cs, bool* sliceEn
       {
 #endif
       offsetCTU(area, srcYuv, resYuv, reconParams[ctuRsAddr], cs);
-#if K0238_SAO_GREEDY_MERGE_ENCODING 
+#if K0238_SAO_GREEDY_MERGE_ENCODING
       }
 #endif
 
diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp
index 8e401d9999096ad1854f8723188421350a22b60f..e9afed70b9368c82e9293a7c584a1e26b3fbcfce 100644
--- a/source/Lib/EncoderLib/EncSlice.cpp
+++ b/source/Lib/EncoderLib/EncSlice.cpp
@@ -1494,7 +1494,7 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
   }
 #endif
 #if JVET_M0255_FRACMMVD_SWITCH
-  if ( pcSlice->getSPS()->getDisFracMmvdEnabledFlag() || 
+  if ( pcSlice->getSPS()->getDisFracMmvdEnabledFlag() ||
 #if JVET_M0483_IBC
       (pcSlice->getSPS()->getIBCFlag() && m_pcCuEncoder->getEncCfg()->getIBCHashSearch()))
 #else
diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp
index b609261953894e51f221f858df5496a6c4367f2e..032ac64ed148b0b5f3d3eed358fa6b088f1b3dbb 100644
--- a/source/Lib/EncoderLib/InterSearch.cpp
+++ b/source/Lib/EncoderLib/InterSearch.cpp
@@ -1948,7 +1948,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
 
 #if JVET_M0246_AFFINE_AMVR
   bool checkAffine    = pu.cu->imv == 0 || pu.cu->slice->getSPS()->getAffineAmvrEnabledFlag();
-  bool checkNonAffine = pu.cu->imv == 0 || ( pu.cu->slice->getSPS()->getSpsNext().getUseIMV() && 
+  bool checkNonAffine = pu.cu->imv == 0 || ( pu.cu->slice->getSPS()->getSpsNext().getUseIMV() &&
                                              pu.cu->imv <= pu.cu->slice->getSPS()->getSpsNext().getImvMode() );
   CodingUnit *bestCU  = pu.cu->cs->bestCS != nullptr ? pu.cu->cs->bestCS->getCU( CHANNEL_TYPE_LUMA ) : nullptr;
 #if JVET_M0444_SMVD
@@ -2121,7 +2121,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
         ::memcpy( cMvHevcTemp, cMvTemp, sizeof( cMvTemp ) );
       }
       //  Bi-predictive Motion estimation
-      if( ( cs.slice->isInterB() ) && ( PU::isBipredRestriction( pu ) == false ) 
+      if( ( cs.slice->isInterB() ) && ( PU::isBipredRestriction( pu ) == false )
         && (cu.slice->getCheckLDC() || gbiIdx == GBI_DEFAULT || !m_affineModeSelected || !m_pcEncCfg->getUseGBiFast())
         )
       {
@@ -2384,7 +2384,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
 
           Distortion mvpCost = m_pcRdCost->getCost(m_auiMVPIdxCost[mvpIdxSym[curRefList]][AMVP_MAX_NUM_CANDS] + m_auiMVPIdxCost[mvpIdxSym[tarRefList]][AMVP_MAX_NUM_CANDS]);
           symCost = costStart - mvpCost;
-          
+
           // ME
           xSymmetricMotionEstimation( pu, origBuf, cMvPredSym[curRefList], cMvPredSym[tarRefList], eCurRefList, cCurMvField, cTarMvField, symCost, gbiIdx );
 
@@ -2454,8 +2454,8 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
         uiLastMode = 2;
         pu.mv    [REF_PIC_LIST_0] = cMvBi[0];
         pu.mv    [REF_PIC_LIST_1] = cMvBi[1];
-        pu.mv[REF_PIC_LIST_0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
-        pu.mv[REF_PIC_LIST_1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
+        pu.mv[REF_PIC_LIST_0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
+        pu.mv[REF_PIC_LIST_1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
         pu.mvd   [REF_PIC_LIST_0] = cMvBi[0] - cMvPredBi[0][iRefIdxBi[0]];
         pu.mvd   [REF_PIC_LIST_1] = cMvBi[1] - cMvPredBi[1][iRefIdxBi[1]];
         pu.refIdx[REF_PIC_LIST_0] = iRefIdxBi[0];
@@ -2474,7 +2474,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
       {
         uiLastMode = 0;
         pu.mv    [REF_PIC_LIST_0] = cMv[0];
-        pu.mv    [REF_PIC_LIST_0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
+        pu.mv    [REF_PIC_LIST_0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
         pu.mvd   [REF_PIC_LIST_0] = cMv[0] - cMvPred[0][iRefIdx[0]];
         pu.refIdx[REF_PIC_LIST_0] = iRefIdx[0];
         pu.mvpIdx[REF_PIC_LIST_0] = aaiMvpIdx[0][iRefIdx[0]];
@@ -2485,7 +2485,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
       {
         uiLastMode = 1;
         pu.mv    [REF_PIC_LIST_1] = cMv[1];
-        pu.mv    [REF_PIC_LIST_1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
+        pu.mv    [REF_PIC_LIST_1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
         pu.mvd   [REF_PIC_LIST_1] = cMv[1] - cMvPred[1][iRefIdx[1]];
         pu.refIdx[REF_PIC_LIST_1] = iRefIdx[1];
         pu.mvpIdx[REF_PIC_LIST_1] = aaiMvpIdx[1][iRefIdx[1]];
@@ -2502,7 +2502,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
 #if JVET_M0246_AFFINE_AMVR
     }
 #endif
-    if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getSpsNext().getUseAffine() 
+    if (cu.Y().width > 8 && cu.Y().height > 8 && cu.slice->getSPS()->getSpsNext().getUseAffine()
 #if JVET_M0246_AFFINE_AMVR
       && checkAffine
 #else
@@ -2608,10 +2608,10 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
               pu.mvdAffi[REF_PIC_LIST_1][verIdx] = bestMvd[1][verIdx];
             }
 
-            PU::setAllAffineMv( pu, bestMv[0][0], bestMv[0][1], bestMv[0][2], REF_PIC_LIST_0 
+            PU::setAllAffineMv( pu, bestMv[0][0], bestMv[0][1], bestMv[0][2], REF_PIC_LIST_0
               , false
             );
-            PU::setAllAffineMv( pu, bestMv[1][0], bestMv[1][1], bestMv[1][2], REF_PIC_LIST_1 
+            PU::setAllAffineMv( pu, bestMv[1][0], bestMv[1][1], bestMv[1][2], REF_PIC_LIST_1
               , false
             );
           }
@@ -2875,7 +2875,7 @@ Distortion InterSearch::xGetTemplateCost( const PredictionUnit& pu,
   Distortion uiCost = std::numeric_limits<Distortion>::max();
 
   const Picture* picRef = pu.cu->slice->getRefPic( eRefPicList, iRefIdx );
-  cMvCand.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
+  cMvCand.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
   clipMv( cMvCand, pu.cu->lumaPos(),
           pu.cu->lumaSize(),
           *pu.cs->sps );
@@ -2917,9 +2917,9 @@ Distortion InterSearch::xGetAffineTemplateCost( PredictionUnit& pu, PelUnitBuf&
   if ( pu.cu->imv != 1 )
   {
 #endif
-    mv[0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
-    mv[1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
-    mv[2].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
+    mv[0].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
+    mv[1].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
+    mv[2].changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
 #if JVET_M0246_AFFINE_AMVR
   }
 #endif
@@ -2932,7 +2932,7 @@ Distortion InterSearch::xGetAffineTemplateCost( PredictionUnit& pu, PelUnitBuf&
   // calc distortion
 
   uiCost  = m_pcRdCost->getDistPart( origBuf.Y(), predBuf.Y(), pu.cs->sps->getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y
-    , DF_HAD 
+    , DF_HAD
   );
   uiCost += m_pcRdCost->getCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum] );
   DTRACE( g_trace_ctx, D_COMMON, " (%d) affineTemplateCost=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiCost );
@@ -3089,7 +3089,7 @@ void InterSearch::xSetSearchRange ( const PredictionUnit& pu,
 {
   const int iMvShift = MV_FRACTIONAL_BITS_INTERNAL;
   Mv cFPMvPred = cMvPred;
-  cFPMvPred.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
+  cFPMvPred.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
   clipMv( cFPMvPred, pu.cu->lumaPos(),
           pu.cu->lumaSize(),
           *pu.cs->sps );
@@ -3245,11 +3245,11 @@ void InterSearch::xTZSearch( const PredictionUnit& pu,
   const bool bNewZeroNeighbourhoodTest               = bExtendedSettings;
 
   int iSearchRange = m_iSearchRange;
-  rcMv.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL); 
+  rcMv.changePrecision(MV_PRECISION_QUARTER, MV_PRECISION_INTERNAL);
   clipMv( rcMv, pu.cu->lumaPos(),
           pu.cu->lumaSize(),
           *pu.cs->sps );
-  rcMv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER); 
+  rcMv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
   rcMv.divideByPowerOf2(2);
 
   // init TZSearchStruct
@@ -4141,7 +4141,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit&       pu,
 
       //check stored affine motion
       bool affine4Para    = pu.cu->affineType == AFFINEMODEL_4PARAM;
-      bool savedParaAvail = pu.cu->imv && ( ( m_affineMotion.affine4ParaRefIdx[iRefList] == iRefIdxTemp && affine4Para && m_affineMotion.affine4ParaAvail ) || 
+      bool savedParaAvail = pu.cu->imv && ( ( m_affineMotion.affine4ParaRefIdx[iRefList] == iRefIdxTemp && affine4Para && m_affineMotion.affine4ParaAvail ) ||
                                             ( m_affineMotion.affine6ParaRefIdx[iRefList] == iRefIdxTemp && !affine4Para && m_affineMotion.affine6ParaAvail ) );
 
       if ( savedParaAvail )
@@ -4508,7 +4508,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit&       pu,
       iRefIdxBi[1] = bestBiPRefIdxL1;
 
       // Get list1 prediction block
-      PU::setAllAffineMv( pu, cMvBi[1][0], cMvBi[1][1], cMvBi[1][2], REF_PIC_LIST_1 
+      PU::setAllAffineMv( pu, cMvBi[1][0], cMvBi[1][1], cMvBi[1][2], REF_PIC_LIST_1
 #if JVET_M0246_AFFINE_AMVR
         , changeToHighPrec
 #else
@@ -4577,7 +4577,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit&       pu,
       // First iterate, get prediction block of opposite direction
       if( iIter == 0 && !slice.getMvdL1ZeroFlag() )
       {
-        PU::setAllAffineMv( pu, aacMv[1-iRefList][0], aacMv[1-iRefList][1], aacMv[1-iRefList][2], RefPicList(1-iRefList) 
+        PU::setAllAffineMv( pu, aacMv[1-iRefList][0], aacMv[1-iRefList][1], aacMv[1-iRefList][2], RefPicList(1-iRefList)
 #if JVET_M0246_AFFINE_AMVR
           , changeToHighPrec
 #else
@@ -4634,7 +4634,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit&       pu,
         uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
 
         // call Affine ME
-        xAffineMotionEstimation( pu, origBuf, eRefPicList, cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, 
+        xAffineMotionEstimation( pu, origBuf, eRefPicList, cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp,
 #if JVET_M0247_AFFINE_AMVR_ENCOPT
                                  aaiMvpIdxBi[iRefList][iRefIdxTemp], aacAffineAMVPInfo[iRefList][iRefIdxTemp],
 #endif
@@ -4659,7 +4659,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit&       pu,
           if ( iNumIter != 1 ) // MC for next iter
           {
             //  Set motion
-            PU::setAllAffineMv( pu, cMvBi[iRefList][0], cMvBi[iRefList][1], cMvBi[iRefList][2], eRefPicList 
+            PU::setAllAffineMv( pu, cMvBi[iRefList][0], cMvBi[iRefList][1], cMvBi[iRefList][2], eRefPicList
 #if JVET_M0246_AFFINE_AMVR
               , changeToHighPrec
 #else
@@ -4725,14 +4725,14 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit&       pu,
     lastMode = 2;
     affineCost = uiCostBi;
 
-    PU::setAllAffineMv( pu, cMvBi[0][0], cMvBi[0][1], cMvBi[0][2], REF_PIC_LIST_0 
+    PU::setAllAffineMv( pu, cMvBi[0][0], cMvBi[0][1], cMvBi[0][2], REF_PIC_LIST_0
 #if JVET_M0246_AFFINE_AMVR
       , changeToHighPrec
 #else
       , true
 #endif
     );
-    PU::setAllAffineMv( pu, cMvBi[1][0], cMvBi[1][1], cMvBi[1][2], REF_PIC_LIST_1 
+    PU::setAllAffineMv( pu, cMvBi[1][0], cMvBi[1][1], cMvBi[1][2], REF_PIC_LIST_1
 #if JVET_M0246_AFFINE_AMVR
       , changeToHighPrec
 #else
@@ -4765,7 +4765,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit&       pu,
     lastMode = 0;
     affineCost = uiCost[0];
 
-    PU::setAllAffineMv( pu, aacMv[0][0], aacMv[0][1], aacMv[0][2], REF_PIC_LIST_0 
+    PU::setAllAffineMv( pu, aacMv[0][0], aacMv[0][1], aacMv[0][2], REF_PIC_LIST_0
 #if JVET_M0246_AFFINE_AMVR
       , changeToHighPrec
 #else
@@ -4792,7 +4792,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit&       pu,
     lastMode = 1;
     affineCost = uiCost[1];
 
-    PU::setAllAffineMv( pu, aacMv[1][0], aacMv[1][1], aacMv[1][2], REF_PIC_LIST_1 
+    PU::setAllAffineMv( pu, aacMv[1][0], aacMv[1][1], aacMv[1][2], REF_PIC_LIST_1
 #if JVET_M0246_AFFINE_AMVR
       , changeToHighPrec
 #else
@@ -5169,7 +5169,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu,
   {
 #if JVET_M0247_AFFINE_AMVR_ENCOPT
     memcpy( prevIterMv[iter], acMvTemp, sizeof( Mv ) * 3 );
-#endif 
+#endif
     /*********************************************************************************
      *                         use gradient to update mv
      *********************************************************************************/
@@ -5396,7 +5396,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu,
     }
   }
 
-  auto checkCPMVRdCost = [&](Mv ctrlPtMv[3]) 
+  auto checkCPMVRdCost = [&](Mv ctrlPtMv[3])
   {
     xPredAffineBlk(COMPONENT_Y, pu, refPic, ctrlPtMv, predBuf, false, pu.cu->slice->clpRng(COMPONENT_Y));
     // get error
@@ -5527,7 +5527,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu,
       checkCPMVRdCost(acMvTemp);
     }
 
-    //keep the translation; 
+    //keep the translation;
     if (pu.cu->affineType == AFFINEMODEL_6PARAM && mvME[1] != (mvPredTmp[1] + dMv) && mvME[2] != (mvPredTmp[2] + dMv))
     {
       ::memcpy(acMvTemp, mvME, sizeof(Mv) * 3);
@@ -6038,7 +6038,7 @@ void InterSearch::calcMinDistSbt( CodingStructure &cs, const CodingUnit& cu, con
     return;
   }
 
-  //SBT fast algorithm 2.1 : estimate a minimum RD cost of a SBT mode based on the luma distortion of uncoded part and coded part (assuming distorted can be reduced to 1/16); 
+  //SBT fast algorithm 2.1 : estimate a minimum RD cost of a SBT mode based on the luma distortion of uncoded part and coded part (assuming distorted can be reduced to 1/16);
   //                         if this cost is larger than the best cost, no need to try a specific SBT mode
   int cuWidth  = cu.lwidth();
   int cuHeight = cu.lheight();
@@ -6221,7 +6221,7 @@ uint8_t InterSearch::skipSbtByRDCost( int width, int height, int mtDepth, uint8_
 {
   int sbtMode = CU::getSbtMode( sbtIdx, sbtPos );
 
-  //SBT fast algorithm 2.2 : estimate a minimum RD cost of a SBT mode based on the luma distortion of uncoded part and coded part (assuming distorted can be reduced to 1/16); 
+  //SBT fast algorithm 2.2 : estimate a minimum RD cost of a SBT mode based on the luma distortion of uncoded part and coded part (assuming distorted can be reduced to 1/16);
   //                         if this cost is larger than the best cost, no need to try a specific SBT mode
   if( m_pcRdCost->calcRdCost( 11 << SCALE_BITS, m_estMinDistSbt[sbtMode] ) > bestCost )
   {
@@ -6502,7 +6502,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par
             double cRescale = round((double)(1 << CSCALE_FP_PREC) / (double)(tu.getChromaAdj()));
             m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cRescale*cRescale));
           }
-#endif 
+#endif
           TCoeff     currAbsSum = 0;
           uint64_t   currCompFracBits = 0;
           Distortion currCompDist = 0;
@@ -6624,7 +6624,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par
             }
 
             currCompDist = m_pcRdCost->getDistPart(orgResiBuf, resiBuf, channelBitDepth, compID, DF_SSE);
-            
+
 #if WCG_EXT
             currCompCost = m_pcRdCost->calcRdCost(currCompFracBits, currCompDist, false);
 #else
@@ -7177,8 +7177,8 @@ void InterSearch::encodeResAndCalcRdInterCU(CodingStructure &cs, Partitioner &pa
     CPelBuf org  = cs.getOrgBuf  (compID);
 
 #if WCG_EXT
-#if JVET_M0427_INLOOP_RESHAPER 
-    if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || ( 
+#if JVET_M0427_INLOOP_RESHAPER
+    if (m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() || (
       m_pcEncCfg->getReshaper() && (cs.slice->getReshapeInfo().getUseSliceReshaper() && m_pcReshape->getCTUFlag() ) ) )
 #else
     if( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() )
@@ -7387,11 +7387,11 @@ uint32_t InterSearch::xDetermineBestMvp( PredictionUnit& pu, Mv acMvTemp[3], int
 
 #if JVET_M0444_SMVD
 void InterSearch::symmvdCheckBestMvp(
-  PredictionUnit& pu, 
+  PredictionUnit& pu,
   PelUnitBuf& origBuf,
   Mv curMv,
-  RefPicList curRefList, 
-  AMVPInfo amvpInfo[2][33], 
+  RefPicList curRefList,
+  AMVPInfo amvpInfo[2][33],
   int32_t gbiIdx,
   Mv cMvPredSym[2],
   int32_t mvpIdxSym[2],
@@ -7402,7 +7402,7 @@ void InterSearch::symmvdCheckBestMvp(
   RefPicList tarRefList = (RefPicList)(1 - curRefList);
   int32_t refIdxCur = pu.cu->slice->getSymRefIdx(curRefList);
   int32_t refIdxTar = pu.cu->slice->getSymRefIdx(tarRefList);
-  
+
   MvField cCurMvField, cTarMvField;
   cCurMvField.setMvField(curMv, refIdxCur);
   AMVPInfo& amvpCur = amvpInfo[curRefList][refIdxCur];
diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp
index 648f5042c0a4acd7a009b5c71769ae65fca662f6..189e272c801a55f8b028a680542e27ec2c98af29 100644
--- a/source/Lib/EncoderLib/IntraSearch.cpp
+++ b/source/Lib/EncoderLib/IntraSearch.cpp
@@ -1324,7 +1324,7 @@ void IntraSearch::IPCMSearch(CodingStructure &cs, Partitioner& partitioner)
   cs.setDecomp(cs.area);
 #if JVET_M0427_INLOOP_RESHAPER
   cs.picture->getPredBuf(cs.area).copyFrom(cs.getPredBuf());
-#endif 
+#endif
 }
 
 void IntraSearch::xEncPCM(CodingStructure &cs, Partitioner& partitioner, const ComponentID &compID)
@@ -1378,10 +1378,10 @@ void IntraSearch::xEncIntraHeader(CodingStructure &cs, Partitioner &partitioner,
     // CU header
     if( isFirst )
     {
-#if JVET_M0483_IBC 
+#if JVET_M0483_IBC
       if ((!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag())
 #else
-      if( !cs.slice->isIntra() 
+      if( !cs.slice->isIntra()
 #endif
         && cu.Y().valid()
         )
@@ -1537,7 +1537,7 @@ void IntraSearch::xEncSubdivCbfQT(CodingStructure &cs, Partitioner &partitioner,
   else
   {
 #if !JVET_M0464_UNI_MTS
-#if JVET_M0102_INTRA_SUBPARTITIONS 
+#if JVET_M0102_INTRA_SUBPARTITIONS
     if (!currCU.ispMode && isLuma( compID ) && currDepth == 0 && bLuma && TU::getCbfAtDepth( currTU, COMPONENT_Y, 0) ) m_CABACEstimator->emt_cu_flag( currCU );
 #else
     if( currDepth == 0 && bLuma && TU::getCbfAtDepth( currTU, COMPONENT_Y, 0 ) ) m_CABACEstimator->emt_cu_flag( currCU );
@@ -1688,7 +1688,7 @@ uint64_t IntraSearch::xGetIntraFracBitsQTSingleChromaComponent( CodingStructure
 
   if( compID == COMPONENT_Cb )
   {
-    //intra mode coding 
+    //intra mode coding
     PredictionUnit &pu = *cs.getPU( partitioner.currArea().lumaPos(), partitioner.chType );
     m_CABACEstimator->intra_chroma_pred_mode( pu );
     //xEncIntraHeader(cs, partitioner, false, true);
@@ -1872,7 +1872,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp
     m_pcTrQuant->setLambda(m_pcTrQuant->getLambda() / (cResScale*cResScale));
     piResi.scaleSignal(cResScaleInv, 1, tu.cu->cs->slice->clpRng(compID));
   }
-#endif 
+#endif
 
 #if JVET_M0102_INTRA_SUBPARTITIONS
   double diagRatio = 0, horVerRatio = 0;
@@ -1949,7 +1949,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp
     tmpPred.copyFrom(piPred);
     piReco.reconstruct(tmpPred, piResi, cs.slice->clpRng(compID));
   }
-  else 
+  else
 #endif
   piReco.reconstruct(piPred, piResi, cs.slice->clpRng( compID ));
 
diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h
index 9f4a99ac2a08fdfd6e02e63dbbbaa162658c7c1b..1879d06c794c87a4c8b36d7a9fee1526e61702bb 100644
--- a/source/Lib/EncoderLib/IntraSearch.h
+++ b/source/Lib/EncoderLib/IntraSearch.h
@@ -66,7 +66,7 @@ class IntraSearch : public IntraPrediction, CrossComponentPrediction
 {
 private:
 #if JVET_M0102_INTRA_SUBPARTITIONS
-  EncModeCtrl    *m_modeCtrl; 
+  EncModeCtrl    *m_modeCtrl;
 #endif
   Pel*            m_pSharedPredTransformSkip[MAX_NUM_TBLOCKS];
 
diff --git a/source/Lib/EncoderLib/RateCtrl.cpp b/source/Lib/EncoderLib/RateCtrl.cpp
index d88faa991ef244fcecad7dc8d5a8a321cfd4dae9..f70203efe2aa2a9d6827c633b7fd2be693003e4c 100644
--- a/source/Lib/EncoderLib/RateCtrl.cpp
+++ b/source/Lib/EncoderLib/RateCtrl.cpp
@@ -1158,7 +1158,7 @@ double EncRCPic::calAverageLambda()
       if (m_LCUs[i].m_QP > 0 || m_encRCSeq->getAdaptiveBits() != 1)
       {
         m_validPixelsInPic += m_LCUs[i].m_numberOfPixel;
-        
+
         totalLambdas += log(m_LCUs[i].m_lambda);
         numTotalLCUs++;
       }
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 39e5a703c434d8b35361aa479d4d004d8814102b..e69f862ced3ed017592d035198086fff77fe80f3 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -1332,7 +1332,7 @@ void HLSWriter::codeSliceHeader         ( Slice* pcSlice )
         }
       }
     }
-#if JVET_M0483_IBC 
+#if JVET_M0483_IBC
     if (!cs.slice->isIntra() || cs.slice->getSPS()->getIBCFlag())
     {
       CHECK(pcSlice->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported");