diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
index 69d39506d0d048e9ea2e6a215d38ea7fdce4178e..4753a70882fbe1dc239d2dd171094caad4a3beae 100644
--- a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
+++ b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
@@ -113,7 +113,7 @@ bool BitstreamExtractorApp::xCheckSliceSubpicture(InputNALUnit &nalu, int target
   slice.setTLayer(nalu.m_temporalId);
 
   m_hlSynaxReader.parseSliceHeader(&slice, &m_picHeader, &m_parameterSetManager, m_prevTid0Poc);
-  
+
   PPS *pps = m_parameterSetManager.getPPS(m_picHeader.getPPSId());
   CHECK (nullptr==pps, "referenced PPS not found");
   SPS *sps = m_parameterSetManager.getSPS(pps->getSPSId());
@@ -129,7 +129,7 @@ bool BitstreamExtractorApp::xCheckSliceSubpicture(InputNALUnit &nalu, int target
   {
     THROW ("Subpicture signalling disbled, cannot extract.");
   }
-    
+
   return true;
 }
 
@@ -497,7 +497,7 @@ uint32_t BitstreamExtractorApp::decode()
           {
             SubPic subPic;
             bool found = false;
-            
+
             for (int i=0; i< pps->getNumSubPics() && !found; i++)
             {
               subPic = pps->getSubPic(i);
diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.h b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.h
index 67ca21234ab323647852f6d12ee1342a3fe26659..97c1108f75737661562af2445c0900d34f2123d9 100644
--- a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.h
+++ b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.h
@@ -59,7 +59,7 @@ public:
   virtual ~BitstreamExtractorApp         ()  {}
 
   uint32_t  decode            (); ///< main decoding function
-  
+
 protected:
   void xPrintVPSInfo (VPS *vps);
   void xPrintSubPicInfo (PPS *pps);
@@ -72,7 +72,7 @@ protected:
   void xSetSPSUpdated(int spsId)   { return m_updatedSPSList.push_back(spsId); }
   bool xIsSPSUpdate(int spsId)     { return (std::find(m_updatedSPSList.begin(),m_updatedSPSList.end(), spsId) != m_updatedSPSList.end()); }
   void xClearSPSUpdated(int spsId) { m_updatedSPSList.erase(std::remove(m_updatedSPSList.begin(), m_updatedSPSList.end(), spsId)); };
-  
+
   void xWriteVPS(VPS *vps, std::ostream& out, int layerId, int temporalId);
   void xWriteSPS(SPS *sps, std::ostream& out, int layerId, int temporalId);
   void xWritePPS(PPS *pps, std::ostream& out, int layerId, int temporalId);
diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorAppCfg.cpp b/source/App/BitstreamExtractorApp/BitstreamExtractorAppCfg.cpp
index b5b989effe83a3f0bd45ec8129e2a7cc5886df38..b438884f1bd4c5fc98fc043bc9f01f070daed7f4 100644
--- a/source/App/BitstreamExtractorApp/BitstreamExtractorAppCfg.cpp
+++ b/source/App/BitstreamExtractorApp/BitstreamExtractorAppCfg.cpp
@@ -109,7 +109,7 @@ namespace po = df::program_options_lite;
   }
   DTRACE_UPDATE( g_trace_ctx, std::make_pair( "final", 1 ) );
 #endif
-  
+
   g_verbosity = MsgLevel( verbosity );
 
   if (err.is_errored)
diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp
index 2de06ad2c9a4b9acf92f479ff2162c8ec9de86ac..8a15a0d49117e4d085f75c467d7bddd1ad0a1ec6 100644
--- a/source/App/DecoderApp/DecApp.cpp
+++ b/source/App/DecoderApp/DecApp.cpp
@@ -132,8 +132,8 @@ uint32_t DecApp::decode()
     // determine if next NAL unit will be the first one from a new picture
     bool bNewPicture = isNewPicture(&bitstreamFile, &bytestream);
     bool bNewAccessUnit = bNewPicture && isNewAccessUnit( bNewPicture, &bitstreamFile, &bytestream );
-    if(!bNewPicture) 
-    { 
+    if(!bNewPicture)
+    {
       AnnexBStats stats = AnnexBStats();
 
       // find next NAL unit in stream
@@ -270,7 +270,7 @@ uint32_t DecApp::decode()
         xWriteOutput( pcListPic, nalu.m_temporalId );
       }
     }
-    if(bNewAccessUnit) 
+    if(bNewAccessUnit)
     {
       m_cDecLib.checkTidLayerIdInAccessUnit();
       m_cDecLib.resetAccessUnitSeiTids();
@@ -378,7 +378,7 @@ bool DecApp::isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytest
           ret = false;
           finished = true;
           break;
-        
+
         // NUT that might indicate the start of a new picture - keep looking
         case NAL_UNIT_PREFIX_APS:
         case NAL_UNIT_PREFIX_SEI:
@@ -393,7 +393,7 @@ bool DecApp::isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytest
       }
     }
   }
-  
+
   // restore previous stream location - minus 3 due to the need for the annexB parser to read three extra bytes
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
   bitstreamFile->clear();
@@ -418,7 +418,7 @@ bool DecApp::isNewAccessUnit( bool newPicture, ifstream *bitstreamFile, class In
 {
   bool ret = false;
   bool finished = false;
-  
+
   // can only be the start of an AU if this is the start of a new picture
   if( newPicture == false )
   {
@@ -448,7 +448,7 @@ bool DecApp::isNewAccessUnit( bool newPicture, ifstream *bitstreamFile, class In
       // get next NAL unit type
       read(nalu);
       switch( nalu.m_nalUnitType ) {
-        
+
         // AUD always indicates the start of a new access unit
         case NAL_UNIT_ACCESS_UNIT_DELIMITER:
           ret = true;
@@ -464,10 +464,10 @@ bool DecApp::isNewAccessUnit( bool newPicture, ifstream *bitstreamFile, class In
         case NAL_UNIT_CODED_SLICE_IDR_N_LP:
         case NAL_UNIT_CODED_SLICE_CRA:
         case NAL_UNIT_CODED_SLICE_GDR:
-          ret = m_cDecLib.isSliceNaluFirstInAU( newPicture, nalu );          
+          ret = m_cDecLib.isSliceNaluFirstInAU( newPicture, nalu );
           finished = true;
           break;
-          
+
         // NUT that are not the start of a new access unit
         case NAL_UNIT_EOS:
         case NAL_UNIT_EOB:
@@ -477,14 +477,14 @@ bool DecApp::isNewAccessUnit( bool newPicture, ifstream *bitstreamFile, class In
           ret = false;
           finished = true;
           break;
-        
+
         // all other NUT - keep looking to find first VCL
         default:
           break;
       }
     }
   }
-  
+
   // restore previous stream location
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
   bitstreamFile->clear();
diff --git a/source/App/DecoderApp/DecAppCfg.h b/source/App/DecoderApp/DecAppCfg.h
index a13a6766e7849596e4a8e05939617106d9ebdec8..f28b07d77d951287f0e67544dc8cda3fd9bb9e02 100644
--- a/source/App/DecoderApp/DecAppCfg.h
+++ b/source/App/DecoderApp/DecAppCfg.h
@@ -65,7 +65,7 @@ protected:
   int           m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output
   InputColourSpaceConversion m_outputColourSpaceConvert;
   int           m_targetOlsIdx;                       ///< target output layer set
-  std::vector<int> m_targetOutputLayerIdSet;          ///< set of LayerIds to be outputted           
+  std::vector<int> m_targetOutputLayerIdSet;          ///< set of LayerIds to be outputted
   int           m_iMaxTemporalLayer;                  ///< maximum temporal layer to be decoded
   int           m_decodedPictureHashSEIEnabled;       ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
   bool          m_decodedNoDisplaySEIEnabled;         ///< Enable(true)/disable(false) writing only pictures that get displayed based on the no display SEI message
@@ -73,7 +73,7 @@ protected:
   std::vector<int> m_targetDecLayerIdSet;             ///< set of LayerIds to be included in the sub-bitstream extraction process.
   std::string   m_outputDecodedSEIMessagesFilename;   ///< filename to output decoded SEI messages to. If '-', then use stdout. If empty, do not output details.
 
-  
+
   bool          m_bClipOutputVideoToRec709Range;      ///< If true, clip the output video to the Rec 709 range on saving.
   bool          m_packedYUVMode;                      ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data
   std::string   m_cacheCfgFile;                       ///< Config file of cache model
diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index a5f25f522e6db28fb7d47a84ede490426a40099b..98d5290c82a57007f500ab410c1fd9b85da3fb2d 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -178,7 +178,7 @@ void EncApp::xInitLibCfg()
   {
     if( i > 0 )
       vps.setPtPresentFlag                                         (i, 0);
-    vps.setPtlMaxTemporalId                                      (i, vps.getMaxSubLayers() - 1); 
+    vps.setPtlMaxTemporalId                                      (i, vps.getMaxSubLayers() - 1);
   }
   for (int i = 0; i < vps.getNumOutputLayerSets(); i++)
   {
@@ -607,11 +607,11 @@ void EncApp::xInitLibCfg()
   m_cEncLib.setFramePackingArrangementSEIId                      ( m_framePackingSEIId );
   m_cEncLib.setFramePackingArrangementSEIQuincunx                ( m_framePackingSEIQuincunx );
   m_cEncLib.setFramePackingArrangementSEIInterpretation          ( m_framePackingSEIInterpretation );
-  m_cEncLib.setErpSEIEnabled                                     ( m_erpSEIEnabled );           
-  m_cEncLib.setErpSEICancelFlag                                  ( m_erpSEICancelFlag );        
-  m_cEncLib.setErpSEIPersistenceFlag                             ( m_erpSEIPersistenceFlag );   
-  m_cEncLib.setErpSEIGuardBandFlag                               ( m_erpSEIGuardBandFlag );     
-  m_cEncLib.setErpSEIGuardBandType                               ( m_erpSEIGuardBandType );     
+  m_cEncLib.setErpSEIEnabled                                     ( m_erpSEIEnabled );
+  m_cEncLib.setErpSEICancelFlag                                  ( m_erpSEICancelFlag );
+  m_cEncLib.setErpSEIPersistenceFlag                             ( m_erpSEIPersistenceFlag );
+  m_cEncLib.setErpSEIGuardBandFlag                               ( m_erpSEIGuardBandFlag );
+  m_cEncLib.setErpSEIGuardBandType                               ( m_erpSEIGuardBandType );
   m_cEncLib.setErpSEILeftGuardBandWidth                          ( m_erpSEILeftGuardBandWidth );
   m_cEncLib.setErpSEIRightGuardBandWidth                         ( m_erpSEIRightGuardBandWidth );
   m_cEncLib.setSphereRotationSEIEnabled                          ( m_sphereRotationSEIEnabled );
@@ -620,16 +620,16 @@ void EncApp::xInitLibCfg()
   m_cEncLib.setSphereRotationSEIYaw                              ( m_sphereRotationSEIYaw );
   m_cEncLib.setSphereRotationSEIPitch                            ( m_sphereRotationSEIPitch );
   m_cEncLib.setSphereRotationSEIRoll                             ( m_sphereRotationSEIRoll );
-  m_cEncLib.setOmniViewportSEIEnabled                            ( m_omniViewportSEIEnabled );          
-  m_cEncLib.setOmniViewportSEIId                                 ( m_omniViewportSEIId );               
-  m_cEncLib.setOmniViewportSEICancelFlag                         ( m_omniViewportSEICancelFlag );       
-  m_cEncLib.setOmniViewportSEIPersistenceFlag                    ( m_omniViewportSEIPersistenceFlag );  
-  m_cEncLib.setOmniViewportSEICntMinus1                          ( m_omniViewportSEICntMinus1 );        
-  m_cEncLib.setOmniViewportSEIAzimuthCentre                      ( m_omniViewportSEIAzimuthCentre );    
-  m_cEncLib.setOmniViewportSEIElevationCentre                    ( m_omniViewportSEIElevationCentre );  
-  m_cEncLib.setOmniViewportSEITiltCentre                         ( m_omniViewportSEITiltCentre );       
-  m_cEncLib.setOmniViewportSEIHorRange                           ( m_omniViewportSEIHorRange );         
-  m_cEncLib.setOmniViewportSEIVerRange                           ( m_omniViewportSEIVerRange );         
+  m_cEncLib.setOmniViewportSEIEnabled                            ( m_omniViewportSEIEnabled );
+  m_cEncLib.setOmniViewportSEIId                                 ( m_omniViewportSEIId );
+  m_cEncLib.setOmniViewportSEICancelFlag                         ( m_omniViewportSEICancelFlag );
+  m_cEncLib.setOmniViewportSEIPersistenceFlag                    ( m_omniViewportSEIPersistenceFlag );
+  m_cEncLib.setOmniViewportSEICntMinus1                          ( m_omniViewportSEICntMinus1 );
+  m_cEncLib.setOmniViewportSEIAzimuthCentre                      ( m_omniViewportSEIAzimuthCentre );
+  m_cEncLib.setOmniViewportSEIElevationCentre                    ( m_omniViewportSEIElevationCentre );
+  m_cEncLib.setOmniViewportSEITiltCentre                         ( m_omniViewportSEITiltCentre );
+  m_cEncLib.setOmniViewportSEIHorRange                           ( m_omniViewportSEIHorRange );
+  m_cEncLib.setOmniViewportSEIVerRange                           ( m_omniViewportSEIVerRange );
   m_cEncLib.setRwpSEIEnabled                                     (m_rwpSEIEnabled);
   m_cEncLib.setRwpSEIRwpCancelFlag                               (m_rwpSEIRwpCancelFlag);
   m_cEncLib.setRwpSEIRwpPersistenceFlag                          (m_rwpSEIRwpPersistenceFlag);
@@ -657,15 +657,15 @@ void EncApp::xInitLibCfg()
   m_cEncLib.setRwpSEIRwpGuardBandType                            (m_rwpSEIRwpGuardBandType);
   m_cEncLib.setGcmpSEIEnabled                                    ( m_gcmpSEIEnabled );
   m_cEncLib.setGcmpSEICancelFlag                                 ( m_gcmpSEICancelFlag );
-  m_cEncLib.setGcmpSEIPersistenceFlag                            ( m_gcmpSEIPersistenceFlag );                                                              
+  m_cEncLib.setGcmpSEIPersistenceFlag                            ( m_gcmpSEIPersistenceFlag );
   m_cEncLib.setGcmpSEIPackingType                                ( (uint8_t)m_gcmpSEIPackingType );
-  m_cEncLib.setGcmpSEIMappingFunctionType                        ( (uint8_t)m_gcmpSEIMappingFunctionType );                                                              
+  m_cEncLib.setGcmpSEIMappingFunctionType                        ( (uint8_t)m_gcmpSEIMappingFunctionType );
   m_cEncLib.setGcmpSEIFaceIndex                                  ( m_gcmpSEIFaceIndex );
   m_cEncLib.setGcmpSEIFaceRotation                               ( m_gcmpSEIFaceRotation );
   m_cEncLib.setGcmpSEIFunctionCoeffU                             ( m_gcmpSEIFunctionCoeffU );
   m_cEncLib.setGcmpSEIFunctionUAffectedByVFlag                   ( m_gcmpSEIFunctionUAffectedByVFlag );
   m_cEncLib.setGcmpSEIFunctionCoeffV                             ( m_gcmpSEIFunctionCoeffV );
-  m_cEncLib.setGcmpSEIFunctionVAffectedByUFlag                   ( m_gcmpSEIFunctionVAffectedByUFlag );                                                              
+  m_cEncLib.setGcmpSEIFunctionVAffectedByUFlag                   ( m_gcmpSEIFunctionVAffectedByUFlag );
   m_cEncLib.setGcmpSEIGuardBandFlag                              ( m_gcmpSEIGuardBandFlag );
   m_cEncLib.setGcmpSEIGuardBandType                              ( m_gcmpSEIGuardBandType );
   m_cEncLib.setGcmpSEIGuardBandBoundaryExteriorFlag              ( m_gcmpSEIGuardBandBoundaryExteriorFlag );
diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp
index 582d7476dcb5b8d26c9230bd4e1b7f137ecfa8c9..727eb90c18b5f2d620ffbb54dec57e0af0b356b0 100644
--- a/source/App/EncoderApp/EncAppCfg.cpp
+++ b/source/App/EncoderApp/EncAppCfg.cpp
@@ -492,7 +492,7 @@ static inline istream& operator >> (std::istream& in, std::map<T1, T2>& map)
 
 static uint32_t getMaxTileColsByLevel( Level::Name level )
 {
-  switch( level ) 
+  switch( level )
   {
     case Level::LEVEL1:
     case Level::LEVEL2:
@@ -519,7 +519,7 @@ static uint32_t getMaxTileColsByLevel( Level::Name level )
 
 static uint32_t getMaxTileRowsByLevel( Level::Name level )
 {
-  switch( level ) 
+  switch( level )
   {
     case Level::LEVEL1:
     case Level::LEVEL2:
@@ -546,7 +546,7 @@ static uint32_t getMaxTileRowsByLevel( Level::Name level )
 
 static uint32_t getMaxSlicesByLevel( Level::Name level )
 {
-  switch( level ) 
+  switch( level )
   {
     case Level::LEVEL1:
     case Level::LEVEL2:
@@ -653,7 +653,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
   SMultiValueInput<uint32_t> cfg_omniViewportSEIHorRange         (        1, 23592960, 0, 15);
   SMultiValueInput<uint32_t> cfg_omniViewportSEIVerRange         (        1, 11796480, 0, 15);
   SMultiValueInput<uint32_t>   cfg_rwpSEIRwpTransformType                 (0, 7, 0, std::numeric_limits<uint8_t>::max());
-  SMultiValueInput<bool>       cfg_rwpSEIRwpGuardBandFlag                 (0, 1, 0, std::numeric_limits<uint8_t>::max()); 
+  SMultiValueInput<bool>       cfg_rwpSEIRwpGuardBandFlag                 (0, 1, 0, std::numeric_limits<uint8_t>::max());
   SMultiValueInput<uint32_t>   cfg_rwpSEIProjRegionWidth                  (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint8_t>::max());
   SMultiValueInput<uint32_t>   cfg_rwpSEIProjRegionHeight                 (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint8_t>::max());
   SMultiValueInput<uint32_t>   cfg_rwpSEIRwpSEIProjRegionTop              (0, std::numeric_limits<uint32_t>::max(), 0, std::numeric_limits<uint8_t>::max());
@@ -1597,7 +1597,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
     }
   }
 
-  if( m_picPartitionFlag ) 
+  if( m_picPartitionFlag )
   {
     // store tile column widths
     m_tileColumnWidth.resize(cfgTileColumnWidth.values.size());
@@ -1614,7 +1614,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
     }
 
     // store rectangular slice positions
-    if( !m_rasterSliceFlag ) 
+    if( !m_rasterSliceFlag )
     {
       m_rectSlicePos.resize(cfgRectSlicePos.values.size());
       for(uint32_t i=0; i<cfgRectSlicePos.values.size(); i++)
@@ -1624,7 +1624,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
     }
 
     // store raster-scan slice sizes
-    else 
+    else
     {
       m_rasterSliceSize.resize(cfgRasterSliceSize.values.size());
       for(uint32_t i=0; i<cfgRasterSliceSize.values.size(); i++)
@@ -1633,7 +1633,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
       }
     }
   }
-  else 
+  else
   {
     m_tileColumnWidth.clear();
     m_tileRowHeight.clear();
@@ -1676,7 +1676,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
     m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_outputBitDepth     [CHANNEL_TYPE_LUMA  ];
   }
 
-  if( !m_entropyCodingSyncEnabledFlag ) 
+  if( !m_entropyCodingSyncEnabledFlag )
   {
     m_entropyCodingSyncEntryPointPresentFlag = false;
   }
@@ -2101,7 +2101,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
       m_rwpSEIPackedRegionWidth[i]                    = cfg_rwpSEIPackedRegionWidth.values[i];
       m_rwpSEIPackedRegionHeight[i]                   = cfg_rwpSEIPackedRegionHeight.values[i];
       m_rwpSEIPackedRegionTop[i]                      = cfg_rwpSEIPackedRegionTop.values[i];
-      m_rwpSEIPackedRegionLeft[i]                     = cfg_rwpSEIPackedRegionLeft.values[i]; 
+      m_rwpSEIPackedRegionLeft[i]                     = cfg_rwpSEIPackedRegionLeft.values[i];
       if( m_rwpSEIRwpGuardBandFlag[i] )
       {
         m_rwpSEIRwpLeftGuardBandWidth[i]              =  cfg_rwpSEIRwpLeftGuardBandWidth.values[i];
@@ -2544,14 +2544,14 @@ bool EncAppCfg::xCheckParameter()
   xConfirmPara( m_uiMaxBT[0] > m_uiCTUSize,                                                 "Maximum BT size for luma block in I slice should be smaller than or equal to CTUSize");
   xConfirmPara( m_uiMaxBT[1] < m_uiMinQT[1],                                                "Maximum BT size for luma block in non I slice should be larger than minimum QT size");
   xConfirmPara( m_uiMaxBT[1] > m_uiCTUSize,                                                 "Maximum BT size for luma block in non I slice should be smaller than or equal to CTUSize");
-  xConfirmPara( m_uiMaxBT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), 
+  xConfirmPara( m_uiMaxBT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)),
                                                                                             "Maximum BT size for chroma block in I slice should be larger than minimum QT size");
   xConfirmPara( m_uiMaxBT[2] > m_uiCTUSize,                                                 "Maximum BT size for chroma block in I slice should be smaller than or equal to CTUSize");
   xConfirmPara( m_uiMaxTT[0] < m_uiMinQT[0],                                                "Maximum TT size for luma block in I slice should be larger than minimum QT size");
   xConfirmPara( m_uiMaxTT[0] > m_uiCTUSize,                                                 "Maximum TT size for luma block in I slice should be smaller than or equal to CTUSize");
   xConfirmPara( m_uiMaxTT[1] < m_uiMinQT[1],                                                "Maximum TT size for luma block in non I slice should be larger than minimum QT size");
   xConfirmPara( m_uiMaxTT[1] > m_uiCTUSize,                                                 "Maximum TT size for luma block in non I slice should be smaller than or equal to CTUSize");
-  xConfirmPara( m_uiMaxTT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), 
+  xConfirmPara( m_uiMaxTT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)),
                                                                                             "Maximum TT size for chroma block in I slice should be larger than minimum QT size");
   xConfirmPara( m_uiMaxTT[2] > m_uiCTUSize,                                                 "Maximum TT size for chroma block in I slice should be smaller than or equal to CTUSize");
   xConfirmPara( (m_iSourceWidth  % (std::max(8u, m_log2MinCuSize))) != 0,                   "Resulting coded frame width must be a multiple of Max(8, the minimum CU size)");
@@ -3039,23 +3039,23 @@ bool EncAppCfg::xCheckParameter()
     m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1;
   }
 
-  if( m_picPartitionFlag ) 
+  if( m_picPartitionFlag )
   {
     PPS pps;
     uint32_t colIdx, rowIdx;
     uint32_t remSize;
- 
+
     pps.setPicWidthInLumaSamples( m_iSourceWidth );
     pps.setPicHeightInLumaSamples( m_iSourceHeight );
     pps.setLog2CtuSize( floorLog2(m_uiCTUSize) );
 
     // set default tile column if not provided
-    if( m_tileColumnWidth.size() == 0 ) 
+    if( m_tileColumnWidth.size() == 0 )
     {
       m_tileColumnWidth.push_back( pps.getPicWidthInCtu() );
     }
     // set default tile row if not provided
-    if( m_tileRowHeight.size() == 0 ) 
+    if( m_tileRowHeight.size() == 0 )
     {
       m_tileRowHeight.push_back( pps.getPicHeightInCtu() );
     }
@@ -3082,7 +3082,7 @@ bool EncAppCfg::xCheckParameter()
       remSize -= m_tileColumnWidth[ colIdx ];
     }
     m_tileColumnWidth.resize( colIdx );
-    pps.setNumExpTileColumns( (uint32_t)m_tileColumnWidth.size() );    
+    pps.setNumExpTileColumns( (uint32_t)m_tileColumnWidth.size() );
     remSize = pps.getPicHeightInCtu();
     for( rowIdx=0; remSize > 0 && rowIdx<m_tileRowHeight.size(); rowIdx++ )
     {
@@ -3267,7 +3267,7 @@ bool EncAppCfg::xCheckParameter()
       uint32_t remTiles = pps.getNumTiles();
 
       // set default slice size if not provided
-      if( m_rasterSliceSize.size() == 0 ) 
+      if( m_rasterSliceSize.size() == 0 )
       {
         m_rasterSliceSize.push_back( remTiles );
       }
@@ -3291,12 +3291,12 @@ bool EncAppCfg::xCheckParameter()
       }
       // shrink list if too many sizes were provided
       m_rasterSliceSize.resize( listIdx );
-      
+
       m_numSlicesInPic = (uint32_t)m_rasterSliceSize.size();
       xConfirmPara(m_rasterSliceSize.size() > getMaxSlicesByLevel( m_level ), "Number of raster-scan slices exceeds maximum number allowed according to specified level");
     }
   }
-  else 
+  else
   {
     m_numTileCols = 1;
     m_numTileRows = 1;
@@ -3484,7 +3484,7 @@ void EncAppCfg::xPrintParameter()
   if (m_subPicInfoPresentFlag)
   {
     msg(DETAILS, "number of subpictures                            : %d\n", m_numSubPics);
-    for (int i = 0; i < m_numSubPics; i++) 
+    for (int i = 0; i < m_numSubPics; i++)
     {
       msg(DETAILS, "[%d]th subpictures location                           :[%d %d]\n", i, m_subPicCtuTopLeftX[i], m_subPicCtuTopLeftY[i]);
       msg(DETAILS, "[%d]th subpictures size                           :[%d %d]\n", i, m_subPicWidth[i], m_subPicHeight[i]);
@@ -3498,7 +3498,7 @@ void EncAppCfg::xPrintParameter()
   if (m_subPicIdMappingExplicitlySignalledFlag)
   {
     msg(DETAILS, "subpicture ID signalling present flag                            : %d\n", m_subPicIdMappingInSpsFlag);
-    for (int i = 0; i < m_numSubPics; i++) 
+    for (int i = 0; i < m_numSubPics; i++)
     {
       msg(DETAILS, "[%d]th subpictures ID length                           :%d\n", i, m_subPicIdLen);
       msg(DETAILS, "[%d]th subpictures ID                          :%d\n", i, m_subPicId[i]);
diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h
index 25f89d5b5dc69d62bcd8e5c44cc8d22ec211fe4d..2dfb8315b59a0e73a8b552b968645d9f51e2a77e 100644
--- a/source/App/EncoderApp/EncAppCfg.h
+++ b/source/App/EncoderApp/EncAppCfg.h
@@ -693,7 +693,7 @@ protected:
 
   int         m_numPtlsInVps;
   Level::Name m_levelPtl[MAX_NUM_OLSS];
-  int         m_olsPtlIdx[MAX_NUM_OLSS]; 
+  int         m_olsPtlIdx[MAX_NUM_OLSS];
 
 #if EXTENSION_360_VIDEO
   TExt360AppEncCfg m_ext360;
diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp
index 51a237c90d4a88c1a45c51d12d81e7840001f248..ab7287b5d22b009d6cc78c66d71e5acdcdb1b288 100644
--- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp
+++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp
@@ -126,7 +126,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs
   {
     const Position prevCtuPos(xPos, yPos - ctuSize);
     const CodingUnit *prevCtu = cs.getCU(prevCtuPos, CHANNEL_TYPE_LUMA);
-    if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *prevCtu)) || 
+    if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *prevCtu)) ||
         (!pps->getLoopFilterAcrossTilesEnabledFlag()  && !CU::isSameTile(*currCtu,  *prevCtu))
       || (!loopFilterAcrossSubPicEnabledFlag && !CU::isSameSubPic(*currCtu, *prevCtu))
       )
@@ -140,7 +140,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs
   {
     const Position nextCtuPos(xPos, yPos + ctuSize);
     const CodingUnit *nextCtu = cs.getCU(nextCtuPos, CHANNEL_TYPE_LUMA);
-    if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *nextCtu)) || 
+    if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *nextCtu)) ||
         (!pps->getLoopFilterAcrossTilesEnabledFlag()  && !CU::isSameTile(*currCtu,  *nextCtu))
       || (!loopFilterAcrossSubPicEnabledFlag && !CU::isSameSubPic(*currCtu, *nextCtu))
       )
@@ -154,7 +154,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs
   {
     const Position prevCtuPos(xPos - ctuSize, yPos);
     const CodingUnit *prevCtu = cs.getCU(prevCtuPos, CHANNEL_TYPE_LUMA);
-    if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *prevCtu)) || 
+    if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *prevCtu)) ||
         (!pps->getLoopFilterAcrossTilesEnabledFlag()  && !CU::isSameTile(*currCtu,  *prevCtu))
       || (!loopFilterAcrossSubPicEnabledFlag && !CU::isSameSubPic(*currCtu, *prevCtu))
       )
@@ -168,7 +168,7 @@ bool AdaptiveLoopFilter::isCrossedByVirtualBoundaries( const CodingStructure& cs
   {
     const Position nextCtuPos(xPos + ctuSize, yPos);
     const CodingUnit *nextCtu = cs.getCU(nextCtuPos, CHANNEL_TYPE_LUMA);
-    if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *nextCtu)) || 
+    if ((!pps->getLoopFilterAcrossSlicesEnabledFlag() && !CU::isSameSlice(*currCtu, *nextCtu)) ||
         (!pps->getLoopFilterAcrossTilesEnabledFlag()  && !CU::isSameTile(*currCtu,  *nextCtu))
       || (!loopFilterAcrossSubPicEnabledFlag && !CU::isSameSubPic(*currCtu, *nextCtu))
       )
diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp
index aaa870866ce7bd16d721860eb9d0ec66257a3fa7..b1ed883e4b4c5453dc2f053b157c7f6c688102fc 100644
--- a/source/Lib/CommonLib/Buffer.cpp
+++ b/source/Lib/CommonLib/Buffer.cpp
@@ -564,7 +564,7 @@ void AreaBuf<Pel>::roundToOutputBitdepth( const AreaBuf<const Pel> &src, const C
   const int32_t clipbd            = clpRng.bd;
   const int32_t shiftDefault      = std::max<int>(2, (IF_INTERNAL_PREC - clipbd));
   const int32_t offsetDefault     = (1<<(shiftDefault-1)) + IF_INTERNAL_OFFS;
-   
+
   if( width == 1 )
   {
     THROW( "Blocks of width = 1 not supported" );
diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp
index b52500e14ee9c831202cbf1d42620030b5f5172f..89aeff42909655da58d96aaa0b88444a6c8adeb9 100644
--- a/source/Lib/CommonLib/CodingStructure.cpp
+++ b/source/Lib/CommonLib/CodingStructure.cpp
@@ -665,7 +665,7 @@ void CodingStructure::addEmptyTUs( Partitioner &partitioner )
 
   if( split )
   {
-    partitioner.splitCurrArea( TU_MAX_TR_SPLIT, *this );  
+    partitioner.splitCurrArea( TU_MAX_TR_SPLIT, *this );
     do
     {
       addEmptyTUs( partitioner );
diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp
index 5eccb4993fc04cfe657779f3941dd312fb9a3915..56562db081ac84639bbd339686f3edd932b4b099 100644
--- a/source/Lib/CommonLib/ContextModelling.cpp
+++ b/source/Lib/CommonLib/ContextModelling.cpp
@@ -547,7 +547,7 @@ unsigned DeriveCtx::CtxPltCopyFlag( const unsigned prevRunType, const unsigned d
      return ucCtxLut[dist];
   }
   else
-  { 
+  {
     return ucCtxLut[RUN_IDX_THRE];
   }
 }
diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h
index 15ced18b47d8f24d46cde24b4bd2287983684108..b06839a3b40c685c0c86d6d845c75349129488a4 100644
--- a/source/Lib/CommonLib/ContextModelling.h
+++ b/source/Lib/CommonLib/ContextModelling.h
@@ -298,7 +298,7 @@ public:
 
   int deriveModCoeff(int rightPixel, int belowPixel, int absCoeff, int bdpcm = 0)
   {
-    
+
     if (absCoeff == 0)
       return 0;
     int pred1, absBelow = abs(belowPixel), absRight = abs(rightPixel);
@@ -324,7 +324,7 @@ public:
 
   int decDeriveModCoeff(int rightPixel, int belowPixel, int absCoeff)
   {
-    
+
     if (absCoeff == 0)
       return 0;
 
diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp
index 5aed9cd5dddaf418e5c6bc8e7337a33fc8ff315b..537fa61ec7ed18174428ef6ff823c696b8fd1dc4 100644
--- a/source/Lib/CommonLib/InterPrediction.cpp
+++ b/source/Lib/CommonLib/InterPrediction.cpp
@@ -566,7 +566,7 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co
   bool dmvrApplied = false;
   dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu);
 
-  bool refIsScaled = ( refIdx0 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->isRefScaled( pu.cs->pps ) ) || 
+  bool refIsScaled = ( refIdx0 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->isRefScaled( pu.cs->pps ) ) ||
                      ( refIdx1 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_1, refIdx1 )->isRefScaled( pu.cs->pps ) );
   dmvrApplied = dmvrApplied && !refIsScaled;
   bioApplied = bioApplied && !refIsScaled;
@@ -1460,7 +1460,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
         , false
         , luma, chroma
       );
-      xWeightedPredictionUni( pu, predBuf, eRefPicList, predBuf, -1, m_maxCompIDToPred 
+      xWeightedPredictionUni( pu, predBuf, eRefPicList, predBuf, -1, m_maxCompIDToPred
         , (luma && !chroma), (!luma && chroma)
       );
     }
@@ -1526,7 +1526,7 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
       }
     }
 
-    bool refIsScaled = ( refIdx0 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->isRefScaled( pu.cs->pps ) ) || 
+    bool refIsScaled = ( refIdx0 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->isRefScaled( pu.cs->pps ) ) ||
                        ( refIdx1 < 0 ? false : pu.cu->slice->getRefPic( REF_PIC_LIST_1, refIdx1 )->isRefScaled( pu.cs->pps ) );
     bioApplied = refIsScaled ? false : bioApplied;
     bool dmvrApplied = false;
@@ -1607,7 +1607,7 @@ void InterPrediction::motionCompensationGeo( CodingUnit &cu, MergeCtx &geoMrgCtx
     {
       printf( "DECODER_GEO_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() );
     }
-    
+
     geoMrgCtx.setMergeInfo( pu, candIdx1 );
     PU::spanMotionInfo( pu );
     motionCompensation(pu, tmpGeoBuf1, REF_PIC_LIST_X, true, isChromaEnabled(pu.chromaFormat)); // TODO: check 4:0:0 interaction with weighted prediction.
@@ -1841,7 +1841,7 @@ void InterPrediction::xFinalPaddedMCForDMVR(PredictionUnit& pu, PelUnitBuf &pcYu
     m_iRefListIdx = refId;
     const Picture* refPic = pu.cu->slice->getRefPic( refId, pu.refIdx[refId] )->unscaledPic;
     Mv cMvClipped = cMv;
-    if( !pu.cs->sps->getWrapAroundEnabledFlag() ) 
+    if( !pu.cs->sps->getWrapAroundEnabledFlag() )
     {
       clipMv( cMvClipped, pu.lumaPos(), pu.lumaSize(), *pu.cs->sps, *pu.cs->pps );
     }
@@ -2309,7 +2309,7 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio,
 
     int xFilter = filterIndex;
     int yFilter = filterIndex;
-    const int rprThreshold1 = ( 1 << SCALE_RATIO_BITS ) * 5 / 4; 
+    const int rprThreshold1 = ( 1 << SCALE_RATIO_BITS ) * 5 / 4;
     const int rprThreshold2 = ( 1 << SCALE_RATIO_BITS ) * 7 / 4;
     if( filterIndex == 0 )
     {
@@ -2403,7 +2403,7 @@ bool InterPrediction::xPredInterBlkRPR( const std::pair<int, int>& scalingRatio,
 
     int xInt0 = ( (int32_t)x0Int + offX ) >> posShift;
     xInt0 = std::min( std::max( -(NTAPS_LUMA / 2), xInt0 ), ( refPicWidth >> ::getComponentScaleX( compID, chFmt ) ) + (NTAPS_LUMA / 2) );
-        
+
     int refHeight = ((((int32_t)y0Int + (height-1) * stepY) + offY ) >> posShift) - ((((int32_t)y0Int + 0 * stepY) + offY ) >> posShift) + 1;
     refHeight = std::max<int>( 1, refHeight );
 
diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp
index faaf5d1ec286850a3b29b0ebfea6f61be12482af..1c042ca69920a243ceb4dfb29a07105fea2e4cc0 100644
--- a/source/Lib/CommonLib/IntraPrediction.cpp
+++ b/source/Lib/CommonLib/IntraPrediction.cpp
@@ -1447,7 +1447,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom
 
         if ((i == 0 && !bLeftAvaillable) || (i == uiCWidth + addedAboveRight - 1 + logSubWidthC))
         {
-          pDst[i] = (piSrc[mult * i] * c0_3tap + piSrc[mult * i] * c1_3tap + piSrc[mult * i + 1] * c2_3tap + offset_3tap) >> shift_3tap;          
+          pDst[i] = (piSrc[mult * i] * c0_3tap + piSrc[mult * i] * c1_3tap + piSrc[mult * i + 1] * c2_3tap + offset_3tap) >> shift_3tap;
         }
         else
         {
diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp
index ac007d78db692098770e1080bbb31eda6d2dd28b..8033d2357335090d91ea5522b7d2c322a65fa333 100644
--- a/source/Lib/CommonLib/LoopFilter.cpp
+++ b/source/Lib/CommonLib/LoopFilter.cpp
@@ -329,7 +329,7 @@ void LoopFilter::xDeblockCU( CodingUnit& cu, const DeblockEdgeDir edgeDir )
     {
       edgeIdx.push_back( ( edgeDir == EDGE_HOR ) ? ( currTU.blocks[cu.chType].y - cu.blocks[cu.chType].y ) / 4 : ( currTU.blocks[cu.chType].x - cu.blocks[cu.chType].x ) / 4 );
     }
-    else 
+    else
     {
       edgeIdx.push_back( ( edgeDir == EDGE_HOR ) ? (( currTU.blocks[cu.chType].y - cu.blocks[cu.chType].y ) << ::getComponentScaleY(COMPONENT_Cb, cu.chromaFormat))  / 4 : (( currTU.blocks[cu.chType].x - cu.blocks[cu.chType].x ) << ::getComponentScaleX(COMPONENT_Cb, cu.chromaFormat)) / 4 );
     }
@@ -676,11 +676,11 @@ void LoopFilter::xSetEdgefilterMultiple( const CodingUnit&    cu,
   for( int ui = 0; ui < uiNumElem; ui++ )
   {
     m_aapbEdgeFilter[edgeDir][uiBsIdx] = bValue;
-    if ( m_aapucBS[edgeDir][uiBsIdx] && bValue ) 
+    if ( m_aapucBS[edgeDir][uiBsIdx] && bValue )
     {
       m_aapucBS[edgeDir][uiBsIdx] = 3;  // both the TU and PU edge
     }
-    else 
+    else
     {
       if( ! EdgeIdx )
       {
@@ -705,9 +705,9 @@ void LoopFilter::xSetLoopfilterParam( const CodingUnit& cu )
 
   m_stLFCUParam.internalEdge = true;
 
-  m_stLFCUParam.leftEdge = (0 < pos.x) && isAvailableLeft(cu, *cu.cs->getCU(pos.offset(-1, 0), cu.chType), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), 
+  m_stLFCUParam.leftEdge = (0 < pos.x) && isAvailableLeft(cu, *cu.cs->getCU(pos.offset(-1, 0), cu.chType), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(),
     !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(*cu.cs->getCU(pos.offset(-1, 0), cu.chType)).getloopFilterAcrossEnabledFlag()));
-  m_stLFCUParam.topEdge = (0 < pos.y) && isAvailableAbove(cu, *cu.cs->getCU(pos.offset(0, -1), cu.chType), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), 
+  m_stLFCUParam.topEdge = (0 < pos.y) && isAvailableAbove(cu, *cu.cs->getCU(pos.offset(0, -1), cu.chType), !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(),
     !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(*cu.cs->getCU(pos.offset(0, -1), cu.chType)).getloopFilterAcrossEnabledFlag()));
 }
 
@@ -723,7 +723,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
   const Position  posP  = ( edgeDir == EDGE_VER ) ? posQ.offset( -1, 0 ) : posQ.offset( 0, -1 );
 
   const CodingUnit& cuQ = cu;
-  const CodingUnit& cuP = (chType == CHANNEL_TYPE_CHROMA && cuQ.chType == CHANNEL_TYPE_LUMA) ? 
+  const CodingUnit& cuP = (chType == CHANNEL_TYPE_CHROMA && cuQ.chType == CHANNEL_TYPE_LUMA) ?
                           *cu.cs->getCU(recalcPosition( cu.chromaFormat, CHANNEL_TYPE_LUMA, CHANNEL_TYPE_CHROMA, posP), CHANNEL_TYPE_CHROMA) :
                           *cu.cs->getCU( posP, cu.chType );
 
@@ -731,12 +731,12 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
   //-- Set BS for Intra MB : BS = 4 or 3
   if( ( MODE_INTRA == cuP.predMode ) || ( MODE_INTRA == cuQ.predMode ) )
   {
-    if( chType == CHANNEL_TYPE_LUMA ) 
+    if( chType == CHANNEL_TYPE_LUMA )
     {
       int bsY = (MODE_INTRA == cuP.predMode && cuP.bdpcmMode) && (MODE_INTRA == cuQ.predMode && cuQ.bdpcmMode) ? 0 : 2;
       return BsSet(bsY, COMPONENT_Y);
     }
-    else 
+    else
     {
       int bsC = (MODE_INTRA == cuP.predMode && cuP.bdpcmModeChroma) && (MODE_INTRA == cuQ.predMode && cuQ.bdpcmModeChroma) ? 0 : 2;
       return (BsSet(bsC, COMPONENT_Cb) + BsSet(bsC, COMPONENT_Cr));
@@ -756,7 +756,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
     {
       return BsSet(2, COMPONENT_Y);
     }
-    else 
+    else
     {
       return BsSet(2, COMPONENT_Cb) + BsSet(2, COMPONENT_Cr);
     }
@@ -772,7 +772,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
       tmpBs += BsSet(1, COMPONENT_Y);
     }
   }
-  else 
+  else
   {
   if (pcv.chrFormat != CHROMA_400)
   {
@@ -985,7 +985,7 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg
       // Derive neighboring PU index
       if (edgeDir == EDGE_VER)
       {
-        if (!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), 
+        if (!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(),
           !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(cuP).getloopFilterAcrossEnabledFlag())))
         {
           m_aapucBS[edgeDir][uiBsAbsIdx] = uiBs = 0;
@@ -994,7 +994,7 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg
       }
       else  // (iDir == EDGE_HOR)
       {
-        if (!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), 
+        if (!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(),
           !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(cuP).getloopFilterAcrossEnabledFlag())))
         {
           m_aapucBS[edgeDir][uiBsAbsIdx] = uiBs = 0;
@@ -1250,12 +1250,12 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
 
       if (edgeDir == EDGE_VER)
       {
-        CHECK(!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), 
+        CHECK(!isAvailableLeft(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(),
           !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(cuP).getloopFilterAcrossEnabledFlag())), "Neighbour not available");
       }
       else  // (iDir == EDGE_HOR)
       {
-        CHECK(!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(), 
+        CHECK(!isAvailableAbove(cu, cuP, !pps.getLoopFilterAcrossSlicesEnabledFlag(), !pps.getLoopFilterAcrossTilesEnabledFlag(),
           !( pps.getSubPicFromCU(cu).getloopFilterAcrossEnabledFlag() && pps.getSubPicFromCU(cuP).getloopFilterAcrossEnabledFlag())), "Neighbour not available");
       }
 
diff --git a/source/Lib/CommonLib/MCTS.cpp b/source/Lib/CommonLib/MCTS.cpp
index 6af615f59d214e42dd0af09f52e0bafc94eb3df1..b0795736dcb039e78d8a37a4ae5fd080995dbdd6 100644
--- a/source/Lib/CommonLib/MCTS.cpp
+++ b/source/Lib/CommonLib/MCTS.cpp
@@ -97,9 +97,9 @@ Area MCTSHelper::getTileArea( const CodingStructure* cs, const int ctuAddr )
   const uint32_t tileIdx = pps->getTileIdx( (uint32_t)ctuAddr );
   const uint32_t tileX = tileIdx % pps->getNumTileColumns();
   const uint32_t tileY = tileIdx / pps->getNumTileColumns();
-  
+
   const int tileWidthtInCtus = pps->getTileColumnWidth( tileX );
-  const int tileHeightInCtus = pps->getTileRowHeight  ( tileY );  
+  const int tileHeightInCtus = pps->getTileRowHeight  ( tileY );
   const int tileXPosInCtus   = pps->getTileColumnBd( tileX );
   const int tileYPosInCtus   = pps->getTileRowBd( tileY );
 
diff --git a/source/Lib/CommonLib/MatrixIntraPrediction.cpp b/source/Lib/CommonLib/MatrixIntraPrediction.cpp
index 45165a7cc44d3f426886494bb9e9d886d375be7f..9ddb6bac7ebe3a802d6069da6ec683d6357b2e0b 100644
--- a/source/Lib/CommonLib/MatrixIntraPrediction.cpp
+++ b/source/Lib/CommonLib/MatrixIntraPrediction.cpp
@@ -274,7 +274,7 @@ const uint8_t* MatrixIntraPrediction::getMatrixData(const int modeIdx) const
   }
 }
 
-void MatrixIntraPrediction::computeReducedPred( int*const result, const int* const input, 
+void MatrixIntraPrediction::computeReducedPred( int*const result, const int* const input,
                                                 const uint8_t* matrix,
                                                 const bool transpose, const int bitDepth )
 {
diff --git a/source/Lib/CommonLib/MatrixIntraPrediction.h b/source/Lib/CommonLib/MatrixIntraPrediction.h
index 12b26eac24fdae1b42f1e823f6b9f69525cafb58..d9b3b377bdefbdf17157bc4591f44da745804249 100644
--- a/source/Lib/CommonLib/MatrixIntraPrediction.h
+++ b/source/Lib/CommonLib/MatrixIntraPrediction.h
@@ -83,7 +83,7 @@ public:
     const uint8_t* getMatrixData(const int modeIdx) const;
 
 
-    void computeReducedPred( int*const result, const int* const input, 
+    void computeReducedPred( int*const result, const int* const input,
                              const uint8_t* matrix,
                              const bool transpose, const int bitDepth );
   };
diff --git a/source/Lib/CommonLib/Mv.cpp b/source/Lib/CommonLib/Mv.cpp
index 436fee1bf94e3c80319580902446a760d35d8f2b..b4d7bef7a1f33ba048792c2e7a374ea553a05740 100644
--- a/source/Lib/CommonLib/Mv.cpp
+++ b/source/Lib/CommonLib/Mv.cpp
@@ -67,7 +67,7 @@ void clipMv( Mv& rcMv, const Position& pos, const struct Size& size, const SPS&
   int iVerMax = ( pps.getPicHeightInLumaSamples() + iOffset - (int)pos.y - 1 ) << iMvShift;
   int iVerMin = ( -( int ) sps.getMaxCUHeight()   - iOffset - ( int ) pos.y + 1 ) << iMvShift;
   const SubPic& curSubPic = pps.getSubPicFromPos(pos);
-  if (curSubPic.getTreatedAsPicFlag()) 
+  if (curSubPic.getTreatedAsPicFlag())
   {
     iHorMax = ((curSubPic.getSubPicRight() + 1)  + iOffset - (int)pos.x - 1 ) << iMvShift;
     iHorMin = (-(int)sps.getMaxCUWidth() -  iOffset - ((int)pos.x - curSubPic.getSubPicLeft()) + 1) << iMvShift;
diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp
index d8079c89c3b5f2d98e0f75d34d419eaa02ba843b..5a73072f8e955a38ccc2e94e080b8104d02c4e76 100644
--- a/source/Lib/CommonLib/Picture.cpp
+++ b/source/Lib/CommonLib/Picture.cpp
@@ -723,8 +723,8 @@ void Picture::rescalePicture( const std::pair<int, int> scalingRatio,
     const PelBuf& afterScale = afterScaling.get( compID );
 
     sampleRateConv( scalingRatio, std::pair<int, int>( ::getComponentScaleX( compID, chromaFormatIDC ), ::getComponentScaleY( compID, chromaFormatIDC ) ),
-                    beforeScale, scalingWindowBefore.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), scalingWindowBefore.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), 
-                    afterScale, scalingWindowAfter.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), scalingWindowAfter.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), 
+                    beforeScale, scalingWindowBefore.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), scalingWindowBefore.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ),
+                    afterScale, scalingWindowAfter.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), scalingWindowAfter.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ),
                     bitDepths.recon[toChannelType(compID)], downsampling || useLumaFilter ? true : isLuma( compID ), downsampling,
                     isLuma( compID ) ? 1 : horCollocatedChromaFlag, isLuma( compID ) ? 1 : verCollocatedChromaFlag );
   }
@@ -749,7 +749,7 @@ void Picture::saveSubPicBorder(int POC, int subPicX0, int subPicY0, int subPicWi
   m_bufSubPicLeft.create(unitAreaLeftRight);
   m_bufSubPicRight.create(unitAreaLeftRight);
 
-  for (int comp = 0; comp < getNumberValidComponents(cs->area.chromaFormat); comp++) 
+  for (int comp = 0; comp < getNumberValidComponents(cs->area.chromaFormat); comp++)
   {
     ComponentID compID = ComponentID(comp);
 
@@ -782,7 +782,7 @@ void Picture::saveSubPicBorder(int POC, int subPicX0, int subPicY0, int subPicWi
     // 3.2.3 copy to recon picture to back up buffer
     Pel *srcLeft  = src - xmargin;
     Pel *srcRight = src + width;
-    for (int y = 0; y < height; y++) 
+    for (int y = 0; y < height; y++)
     {
       ::memcpy(dstLeft  + y *  dBufLeft.stride, srcLeft  + y * s.stride, sizeof(Pel) * xmargin);
       ::memcpy(dstRight + y * dBufRight.stride, srcRight + y * s.stride, sizeof(Pel) * xmargin);
@@ -799,7 +799,7 @@ void Picture::saveSubPicBorder(int POC, int subPicX0, int subPicY0, int subPicWi
     // 3.3.3 copy to recon picture to back up buffer
     Pel *srcTop    = src - xmargin - ymargin * s.stride;
     Pel *srcBottom = src - xmargin +  height * s.stride;
-    for (int y = 0; y < ymargin; y++) 
+    for (int y = 0; y < ymargin; y++)
     {
       ::memcpy(dstTop    + y *    dBufTop.stride, srcTop    + y * s.stride, sizeof(Pel) * (2 * xmargin + width));
       ::memcpy(dstBottom + y * dBufBottom.stride, srcBottom + y * s.stride, sizeof(Pel) * (2 * xmargin + width));
@@ -810,7 +810,7 @@ void Picture::saveSubPicBorder(int POC, int subPicX0, int subPicY0, int subPicWi
 void Picture::extendSubPicBorder(int POC, int subPicX0, int subPicY0, int subPicWidth, int subPicHeight)
 {
 
-  for (int comp = 0; comp < getNumberValidComponents(cs->area.chromaFormat); comp++) 
+  for (int comp = 0; comp < getNumberValidComponents(cs->area.chromaFormat); comp++)
   {
     ComponentID compID = ComponentID(comp);
 
@@ -837,9 +837,9 @@ void Picture::extendSubPicBorder(int POC, int subPicX0, int subPicY0, int subPic
       Pel *srcLeft  = src + 0;
       Pel *srcRight = src + width - 1;
 
-      for (int y = 0; y < height; y++) 
+      for (int y = 0; y < height; y++)
       {
-        for (int x = 0; x < xmargin; x++) 
+        for (int x = 0; x < xmargin; x++)
         {
           dstLeft[x]  = *srcLeft;
           dstRight[x] = *srcRight;
@@ -851,7 +851,7 @@ void Picture::extendSubPicBorder(int POC, int subPicX0, int subPicY0, int subPic
       }
     }
 
-    // 4.2 apply padding on bottom 
+    // 4.2 apply padding on bottom
     Pel *srcBottom = src + s.stride * (height - 1) - xmargin;
     Pel *dstBottom = srcBottom + s.stride;
     for (int y = 0; y < ymargin; y++)
@@ -870,12 +870,12 @@ void Picture::extendSubPicBorder(int POC, int subPicX0, int subPicY0, int subPic
       ::memcpy(dstTop, srcTop, sizeof(Pel)*(2 * xmargin + width));
       dstTop -= s.stride;
     }
-  } // end of for  
+  } // end of for
 }
 
 void Picture::restoreSubPicBorder(int POC, int subPicX0, int subPicY0, int subPicWidth, int subPicHeight)
 {
-  for (int comp = 0; comp < getNumberValidComponents(cs->area.chromaFormat); comp++) 
+  for (int comp = 0; comp < getNumberValidComponents(cs->area.chromaFormat); comp++)
   {
     ComponentID compID = ComponentID(comp);
 
@@ -907,7 +907,7 @@ void Picture::restoreSubPicBorder(int POC, int subPicX0, int subPicY0, int subPi
     Pel *srcLeft  = src - xmargin;
     Pel *srcRight = src + width;
 
-    for (int y = 0; y < height; y++) 
+    for (int y = 0; y < height; y++)
     {
       // the destination and source position is reversed on purpose
       ::memcpy(srcLeft  + y * s.stride,  dstLeft + y *  dBufLeft.stride, sizeof(Pel) * xmargin);
@@ -927,7 +927,7 @@ void Picture::restoreSubPicBorder(int POC, int subPicX0, int subPicY0, int subPi
     Pel *srcTop = src - xmargin - ymargin * s.stride;
     Pel *srcBottom = src - xmargin + height * s.stride;
 
-    for (int y = 0; y < ymargin; y++) 
+    for (int y = 0; y < ymargin; y++)
     {
       ::memcpy(srcTop    + y * s.stride, dstTop    + y *    dBufTop.stride, sizeof(Pel) * (2 * xmargin + width));
       ::memcpy(srcBottom + y * s.stride, dstBottom + y * dBufBottom.stride, sizeof(Pel) * (2 * xmargin + width));
diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h
index 0c8a7ba71902c2e19ad7c518827b0775b88f3347..4a0b4ab8b4d01c255ec75af1b8c5a9ff47985475 100644
--- a/source/Lib/CommonLib/Picture.h
+++ b/source/Lib/CommonLib/Picture.h
@@ -165,8 +165,8 @@ struct Picture : public UnitArea
                                 const int bitDepth, const bool useLumaFilter, const bool downsampling,
                                 const bool horCollocatedPositionFlag, const bool verCollocatedPositionFlag );
 
-  static void   rescalePicture( const std::pair<int, int> scalingRatio, 
-                                const CPelUnitBuf& beforeScaling, const Window& scalingWindowBefore, 
+  static void   rescalePicture( const std::pair<int, int> scalingRatio,
+                                const CPelUnitBuf& beforeScaling, const Window& scalingWindowBefore,
                                 const PelUnitBuf& afterScaling, const Window& scalingWindowAfter,
                                 const ChromaFormat chromaFormatIDC, const BitDepths& bitDepths, const bool useLumaFilter, const bool downsampling,
                                 const bool horCollocatedChromaFlag, const bool verCollocatedChromaFlag );
diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp
index cf4f78c1bc33f89880e0ce2270bb2729123b104c..c73ad6c79de801331fadffe5952a249460349ccc 100644
--- a/source/Lib/CommonLib/Quant.cpp
+++ b/source/Lib/CommonLib/Quant.cpp
@@ -1254,7 +1254,7 @@ void Quant::lambdaAdjustColorTrans(bool forward)
     }
     m_resetStore = false;
   }
-  
+
   if (forward)
   {
     CHECK(m_pairCheck == 1, "lambda has been already adjusted");
diff --git a/source/Lib/CommonLib/Quant.h b/source/Lib/CommonLib/Quant.h
index 1ca79b093bbafa3608c642594a45d40b8fa2337c..8e218506795156803dadfefdb25a8927b5022ce6 100644
--- a/source/Lib/CommonLib/Quant.h
+++ b/source/Lib/CommonLib/Quant.h
@@ -130,8 +130,8 @@ public:
   int* getDequantCoeff           ( uint32_t list, int qp, uint32_t sizeX, uint32_t sizeY ) { return m_dequantCoef          [sizeX][sizeY][list][qp]; };  //!< get DeQuant Coefficent
 
   void setUseScalingList         ( bool bUseScalingList){ m_scalingListEnabledFlag = bUseScalingList; };
-  bool getUseScalingList(const uint32_t width, const uint32_t height, const bool isTransformSkip, const bool lfnstApplied, const bool disableScalingMatrixForLFNSTBlks) 
-  { 
+  bool getUseScalingList(const uint32_t width, const uint32_t height, const bool isTransformSkip, const bool lfnstApplied, const bool disableScalingMatrixForLFNSTBlks)
+  {
     return (m_scalingListEnabledFlag && !isTransformSkip && (!lfnstApplied || !disableScalingMatrixForLFNSTBlks));
   }
   void setScalingListDec         ( const ScalingList &scalingList);
diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp
index 0f3ad32e650afbc2d2db808999f7f034f8035428..378c30ed7ad7102ee20da82936c457618a8fe75a 100644
--- a/source/Lib/CommonLib/QuantRDOQ.cpp
+++ b/source/Lib/CommonLib/QuantRDOQ.cpp
@@ -1701,7 +1701,7 @@ inline uint32_t QuantRDOQ::xGetCodedLevelTSPred(double&            rd64CodedCost
     dErr = double(levelDouble - (Intermediate_Int(absLevel) << qBits));
     coeffLevelError[errorInd] = dErr * dErr * errorScale;
     int modAbsLevel = absLevel;
-    if (cctx.numCtxBins() >= 4) 
+    if (cctx.numCtxBins() >= 4)
     {
       modAbsLevel = cctx.deriveModCoeff(rightPixel, belowPixel, absLevel, m_bdpcm);
     }
@@ -1735,11 +1735,11 @@ inline int QuantRDOQ::xGetICRateTS( const uint32_t            absLevel,
                                     const bool                useLimitedPrefixLength,
                                     const int                 maxLog2TrDynamicRange  ) const
 {
- 
-  
-  if (cctx.numCtxBins() < 4) // Full by-pass coding 
+
+
+  if (cctx.numCtxBins() < 4) // Full by-pass coding
   {
-    int rate = absLevel ? (1 << SCALE_BITS) : 0; // 1 bit to signal sign of non-zero 
+    int rate = absLevel ? (1 << SCALE_BITS) : 0; // 1 bit to signal sign of non-zero
 
     uint32_t symbol = absLevel;
 
@@ -1846,8 +1846,8 @@ inline int QuantRDOQ::xGetICRateTS( const uint32_t            absLevel,
 
   }
 
-  
-  
+
+
   int rate = fracBitsSign.intBits[sign];
 
   if (absLevel)
diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp
index 95b8e460da269de1585405fd481733ddcfdf3236..b11d98bb47c40f68580be63408b36497b5495397 100644
--- a/source/Lib/CommonLib/RdCost.cpp
+++ b/source/Lib/CommonLib/RdCost.cpp
@@ -101,7 +101,7 @@ void RdCost::lambdaAdjustColorTrans(bool forward, ComponentID componentID)
     }
     m_resetStore = false;
   }
-  
+
   if (forward)
   {
     CHECK(m_pairCheck == 1, "lambda has been already adjusted");
diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h
index fb5cd351c76b4c2ed2d50ab4610d77ec36ec2491..15a2c5c740dfd3e57fb4116a06e23ba378974409 100644
--- a/source/Lib/CommonLib/RdCost.h
+++ b/source/Lib/CommonLib/RdCost.h
@@ -94,7 +94,7 @@ public:
   int                   cShiftX;
   int                   cShiftY;
   DistParam() :
-  org(), cur(), 
+  org(), cur(),
   mask( nullptr ),
   maskStride( 0 ),
   stepX(0),
diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp
index 2ce823a75c79a260b77af0b368a5c5e552de0f89..c22e29f5648307a8ded6cab7fa858afe93c200e4 100644
--- a/source/Lib/CommonLib/Rom.cpp
+++ b/source/Lib/CommonLib/Rom.cpp
@@ -711,7 +711,7 @@ void initGeoTemplate()
       continue;
     g_globalGeoWeights[g_angle2mask[angleIdx]] = new int16_t[GEO_WEIGHT_MASK_SIZE * GEO_WEIGHT_MASK_SIZE];
     g_globalGeoEncSADmask[g_angle2mask[angleIdx]] = new int16_t[GEO_WEIGHT_MASK_SIZE * GEO_WEIGHT_MASK_SIZE];
-  
+
     int distanceX = angleIdx;
     int distanceY = (distanceX + (GEO_NUM_ANGLES >> 2)) % GEO_NUM_ANGLES;
     int16_t rho = (g_Dis[distanceX] << (GEO_MAX_CU_LOG2+1)) + (g_Dis[distanceY] << (GEO_MAX_CU_LOG2 + 1));
diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h
index 182cdbe46f6e0968951aef8ecf85fbff0fe4c792..c45634c6121541828dd13bc3acf0577136d4ee8e 100644
--- a/source/Lib/CommonLib/SEI.h
+++ b/source/Lib/CommonLib/SEI.h
@@ -141,7 +141,7 @@ public:
   bool     m_omniViewportCancelFlag;
   bool     m_omniViewportPersistenceFlag;
   uint8_t  m_omniViewportCntMinus1;
-  std::vector<OmniViewport> m_omniViewportRegions;  
+  std::vector<OmniViewport> m_omniViewportRegions;
 };
 
 class SEIRegionWisePacking : public SEI
@@ -494,7 +494,7 @@ void xTraceSEIHeader();
 void xTraceSEIMessageType( SEI::PayloadType payloadType );
 #endif
 
-#if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI 
+#if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
 class SEIAlternativeTransferCharacteristics : public SEI
 {
 public:
diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index e59b9c29a3090af16ab069429c6a3900c6faa5b0..7e02c2fcc9c994e8a5a97181d173ec469e3f01e7 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -191,7 +191,7 @@ void Slice::initSlice()
 }
 
 void Slice::inheritFromPicHeader( PicHeader *picHeader, const PPS *pps, const SPS *sps )
-{ 
+{
   if (pps->getRplInfoInPhFlag())
   {
     setRPL0idx( picHeader->getRPL0idx() );
@@ -204,7 +204,7 @@ void Slice::inheritFromPicHeader( PicHeader *picHeader, const PPS *pps, const SP
     {
       setRPL0(getLocalRPL0());
     }
-    
+
     setRPL1idx( picHeader->getRPL1idx() );
     *getLocalRPL1() = *picHeader->getLocalRPL1();
     if(getRPL1idx() != -1)
@@ -242,7 +242,7 @@ void Slice::inheritFromPicHeader( PicHeader *picHeader, const PPS *pps, const SP
   m_ccAlfFilterParam.ccAlfFilterEnabled[COMPONENT_Cr - 1] = picHeader->getCcAlfEnabledFlag(COMPONENT_Cr);
 }
 
-void Slice::setNumSubstream(const SPS* sps, const PPS* pps) 
+void Slice::setNumSubstream(const SPS* sps, const PPS* pps)
 {
   uint32_t ctuAddr, ctuX, ctuY;
   m_numSubstream = 0;
@@ -270,7 +270,7 @@ void Slice::setNumEntryPoints(const SPS *sps, const PPS *pps)
 
   // count the number of CTUs that align with either the start of a tile, or with an entropy coding sync point
   // ignore the first CTU since it doesn't count as an entry point
-  for( uint32_t i = 1; i < m_sliceMap.getNumCtuInSlice(); i++ ) 
+  for( uint32_t i = 1; i < m_sliceMap.getNumCtuInSlice(); i++ )
   {
     ctuAddr = m_sliceMap.getCtuAddrInSlice( i );
     ctuX = ( ctuAddr % pps->getPicWidthInCtu() );
@@ -671,7 +671,7 @@ void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureLi
     // entry in RefPicList[0] or RefPicList[1] that precedes the associated IRAP picture in output order or decoding order"
     // Note that when not in field coding, we know that all leading pictures of an IRAP precedes all trailing pictures of the
     // same IRAP picture.
-    if (currentPictureIsTrailing && !fieldSeqFlag) // 
+    if (currentPictureIsTrailing && !fieldSeqFlag) //
     {
       CHECK(refPicPOC < irapPOC || refPicDecodingOrderNumber < associatedIRAPDecodingOrderNumber, "Trailing picture detected that follows one or more leading pictures, if any, and violates the rule that no entry in RefPicList[] shall precede the associated IRAP picture in output order or decoding order.");
     }
@@ -1222,7 +1222,7 @@ void Slice::applyReferencePictureListBasedMarking( PicList& rcListPic, const Ref
     {
       continue;
     }
-          
+
     int isAvailable = 0;
     PicList::iterator iterPic = rcListPic.begin();
     while (iterPic != rcListPic.end())
@@ -1288,7 +1288,7 @@ void Slice::applyReferencePictureListBasedMarking( PicList& rcListPic, const Ref
     {
       continue;
     }
-          
+
     int isAvailable = 0;
     PicList::iterator iterPic = rcListPic.begin();
     while (iterPic != rcListPic.end())
@@ -2601,7 +2601,7 @@ SubPic::~SubPic()
   m_ctuAddrInSubPic.clear();
 }
 
-  
+
 PPS::PPS()
 : m_PPSId                            (0)
 , m_SPSId                            (0)
@@ -2625,7 +2625,7 @@ PPS::PPS()
 , m_picHeightInCtu                   (0)
 , m_numTileCols                      (1)
 , m_numTileRows                      (1)
-, m_rectSliceFlag                    (1)  
+, m_rectSliceFlag                    (1)
 , m_singleSlicePerSubPicFlag         (0)
 , m_numSlicesInPic                   (1)
 , m_tileIdxDeltaPresentFlag          (0)
@@ -2705,7 +2705,7 @@ void PPS::initTiles()
 {
   int       colIdx, rowIdx;
   int       ctuX, ctuY;
-  
+
   // check explicit tile column sizes
   uint32_t  remainingWidthInCtu  = m_picWidthInCtu;
   for( colIdx = 0; colIdx < m_numExpTileCols; colIdx++ )
@@ -2716,7 +2716,7 @@ void PPS::initTiles()
 
   // divide remaining picture width into uniform tile columns
   uint32_t  uniformTileColWidth = m_tileColWidth[colIdx-1];
-  while( remainingWidthInCtu > 0 ) 
+  while( remainingWidthInCtu > 0 )
   {
     CHECK(colIdx >= MAX_TILE_COLS, "Number of tile columns exceeds valid range");
     uniformTileColWidth = std::min(remainingWidthInCtu, uniformTileColWidth);
@@ -2725,7 +2725,7 @@ void PPS::initTiles()
     colIdx++;
   }
   m_numTileCols = colIdx;
-    
+
   // check explicit tile row sizes
   uint32_t  remainingHeightInCtu  = m_picHeightInCtu;
   for( rowIdx = 0; rowIdx < m_numExpTileRows; rowIdx++ )
@@ -2733,10 +2733,10 @@ void PPS::initTiles()
     CHECK(m_tileRowHeight[rowIdx] > remainingHeightInCtu,     "Tile row height exceeds picture height");
     remainingHeightInCtu -= m_tileRowHeight[rowIdx];
   }
-    
+
   // divide remaining picture height into uniform tile rows
   uint32_t  uniformTileRowHeight = m_tileRowHeight[rowIdx - 1];
-  while( remainingHeightInCtu > 0 ) 
+  while( remainingHeightInCtu > 0 )
   {
     CHECK(rowIdx >= MAX_TILE_ROWS, "Number of tile rows exceeds valid range");
     uniformTileRowHeight = std::min(remainingHeightInCtu, uniformTileRowHeight);
@@ -2752,7 +2752,7 @@ void PPS::initTiles()
   {
     m_tileColBd.push_back( m_tileColBd[ colIdx ] + m_tileColWidth[ colIdx ] );
   }
-  
+
   // set top row bounaries
   m_tileRowBd.push_back( 0 );
   for( rowIdx = 0; rowIdx < m_numTileRows; rowIdx++ )
@@ -2762,7 +2762,7 @@ void PPS::initTiles()
 
   // set mapping between horizontal CTU address and tile column index
   colIdx = 0;
-  for( ctuX = 0; ctuX <= m_picWidthInCtu; ctuX++ ) 
+  for( ctuX = 0; ctuX <= m_picWidthInCtu; ctuX++ )
   {
     if( ctuX == m_tileColBd[ colIdx + 1 ] )
     {
@@ -2770,10 +2770,10 @@ void PPS::initTiles()
     }
     m_ctuToTileCol.push_back( colIdx );
   }
-  
+
   // set mapping between vertical CTU address and tile row index
   rowIdx = 0;
-  for( ctuY = 0; ctuY <= m_picHeightInCtu; ctuY++ ) 
+  for( ctuY = 0; ctuY <= m_picHeightInCtu; ctuY++ )
   {
     if( ctuY == m_tileRowBd[ rowIdx + 1 ] )
     {
@@ -2787,7 +2787,7 @@ void PPS::initTiles()
  - initialize memory for rectangular slice parameters
  */
 void PPS::initRectSlices()
-{ 
+{
   CHECK(m_numSlicesInPic > MAX_SLICES, "Number of slices in picture exceeds valid range");
   m_rectSlices.resize(m_numSlicesInPic);
 }
@@ -2846,7 +2846,7 @@ void PPS::initRectSliceMap(const SPS  *sps)
       uint32_t leftX = sps->getSubPicCtuTopLeftX(i);
       uint32_t rightX = leftX + sps->getSubPicWidth(i) - 1;
       subpicWidthInTiles[i] = m_ctuToTileCol[rightX] + 1 - m_ctuToTileCol[leftX];
-      
+
       uint32_t topY = sps->getSubPicCtuTopLeftY(i);
       uint32_t bottomY = topY + sps->getSubPicHeight(i) - 1;
       subpicHeightInTiles[i] = m_ctuToTileRow[bottomY] + 1 - m_ctuToTileRow[topY];
@@ -2867,7 +2867,7 @@ void PPS::initRectSliceMap(const SPS  *sps)
       m_sliceMap[ i ].initSliceMap();
       if (subpicHeightLessThanOneTileFlag[i])
       {
-        m_sliceMap[i].addCtusToSlice(sps->getSubPicCtuTopLeftX(i), sps->getSubPicCtuTopLeftX(i) + sps->getSubPicWidth(i), 
+        m_sliceMap[i].addCtusToSlice(sps->getSubPicCtuTopLeftX(i), sps->getSubPicCtuTopLeftX(i) + sps->getSubPicWidth(i),
                                      sps->getSubPicCtuTopLeftY(i), sps->getSubPicCtuTopLeftY(i) + sps->getSubPicHeight(i), m_picWidthInCtu);
       }
       else
@@ -2875,7 +2875,7 @@ void PPS::initRectSliceMap(const SPS  *sps)
         tileX = m_ctuToTileCol[sps->getSubPicCtuTopLeftX(i)];
         tileY = m_ctuToTileRow[sps->getSubPicCtuTopLeftY(i)];
         for (uint32_t j = 0; j< subpicHeightInTiles[i]; j++)
-        { 
+        {
           for (uint32_t k = 0; k < subpicWidthInTiles[i]; k++)
           {
             m_sliceMap[i].addCtusToSlice(getTileColumnBd(tileX + k), getTileColumnBd(tileX + k + 1), getTileRowBd(tileY + j), getTileRowBd(tileY + j + 1), m_picWidthInCtu);
@@ -2999,31 +2999,31 @@ void PPS::initSubPic(const SPS &sps)
     m_subPics[i].setSubPicCtuTopLeftY(sps.getSubPicCtuTopLeftY(i));
     m_subPics[i].setSubPicWidthInCTUs(sps.getSubPicWidth(i));
     m_subPics[i].setSubPicHeightInCTUs(sps.getSubPicHeight(i));
-    
+
     uint32_t firstCTU = sps.getSubPicCtuTopLeftY(i) * m_picWidthInCtu + sps.getSubPicCtuTopLeftX(i); 	
-    m_subPics[i].setFirstCTUInSubPic(firstCTU);  
+    m_subPics[i].setFirstCTUInSubPic(firstCTU);
     uint32_t lastCTU = (sps.getSubPicCtuTopLeftY(i) + sps.getSubPicHeight(i) - 1) * m_picWidthInCtu + sps.getSubPicCtuTopLeftX(i) + sps.getSubPicWidth(i) - 1;
     m_subPics[i].setLastCTUInSubPic(lastCTU);
-    
+
     uint32_t left = sps.getSubPicCtuTopLeftX(i) * m_ctuSize;
     m_subPics[i].setSubPicLeft(left);
-    
+
     uint32_t right = std::min(m_picWidthInLumaSamples - 1, (sps.getSubPicCtuTopLeftX(i) + sps.getSubPicWidth(i)) * m_ctuSize - 1);
     m_subPics[i].setSubPicRight(right);
-    
+
     m_subPics[i].setSubPicWidthInLumaSample(right - left + 1);
 
     uint32_t top = sps.getSubPicCtuTopLeftY(i) * m_ctuSize;
     m_subPics[i].setSubPicTop(top);
-    
+
     uint32_t bottom = std::min(m_picHeightInLumaSamples - 1, (sps.getSubPicCtuTopLeftY(i) + sps.getSubPicHeight(i)) * m_ctuSize - 1);
 
     m_subPics[i].setSubPicHeightInLumaSample(bottom - top + 1);
 
     m_subPics[i].setSubPicBottom(bottom);
-    
+
     m_subPics[i].clearCTUAddrList();
-    
+
     if (m_numSlicesInPic == 1)
     {
       CHECK(getNumSubPics() != 1, "only one slice in picture, but number of subpic is not one");
@@ -3041,7 +3041,7 @@ void PPS::initSubPic(const SPS &sps)
         if (ctu_x >= sps.getSubPicCtuTopLeftX(i) &&
           ctu_x < (sps.getSubPicCtuTopLeftX(i) + sps.getSubPicWidth(i)) &&
           ctu_y >= sps.getSubPicCtuTopLeftY(i) &&
-          ctu_y < (sps.getSubPicCtuTopLeftY(i) + sps.getSubPicHeight(i)))  
+          ctu_y < (sps.getSubPicCtuTopLeftY(i) + sps.getSubPicHeight(i)))
         {
           // add ctus in a slice to the subpicture it belongs to
           m_subPics[i].addCTUsToSubPic(m_sliceMap[j].getCtuAddrList());
@@ -3067,7 +3067,7 @@ const SubPic& PPS::getSubPicFromPos(const Position& pos)  const
   return m_subPics[0];
 }
 
-const SubPic&  PPS::getSubPicFromCU(const CodingUnit& cu) const 
+const SubPic&  PPS::getSubPicFromCU(const CodingUnit& cu) const
 {
   const Position lumaPos = cu.Y().valid() ? cu.Y().pos() : recalcPosition(cu.chromaFormat, cu.chType, CHANNEL_TYPE_LUMA, cu.blocks[cu.chType].pos());
   return getSubPicFromPos(lumaPos);
@@ -3094,7 +3094,7 @@ void PPS::initRasterSliceMap( std::vector<uint32_t> numTilesInSlice )
   CHECK(m_numSlicesInPic > MAX_SLICES, "Number of slices in picture exceeds valid range");
   m_sliceMap.resize( m_numSlicesInPic );
 
-  for( uint32_t sliceIdx = 0; sliceIdx < numTilesInSlice.size(); sliceIdx++ ) 
+  for( uint32_t sliceIdx = 0; sliceIdx < numTilesInSlice.size(); sliceIdx++ )
   {
     m_sliceMap[sliceIdx].initSliceMap();
     m_sliceMap[sliceIdx].setSliceID( tileIdx );
@@ -3106,7 +3106,7 @@ void PPS::initRasterSliceMap( std::vector<uint32_t> numTilesInSlice )
       CHECK(tileY >= getNumTileRows(), "Number of tiles in slice exceeds the remaining number of tiles in picture");
 
       m_sliceMap[sliceIdx].addCtusToSlice(getTileColumnBd(tileX), getTileColumnBd(tileX + 1),
-                                          getTileRowBd(tileY), getTileRowBd(tileY + 1), 
+                                          getTileRowBd(tileY), getTileRowBd(tileY + 1),
                                           getPicWidthInCtu());
       tileIdx++;
     }
@@ -3128,10 +3128,10 @@ void PPS::checkSliceMap()
   {
     sliceList = m_sliceMap[ i ].getCtuAddrList();
     ctuList.insert( ctuList.end(), sliceList.begin(), sliceList.end() );
-  }  
+  }
   CHECK( ctuList.size() < picSizeInCtu, "Slice map contains too few CTUs");
   CHECK( ctuList.size() > picSizeInCtu, "Slice map contains too many CTUs");
-  std::sort( ctuList.begin(), ctuList.end() );   
+  std::sort( ctuList.begin(), ctuList.end() );
   for( i = 1; i < ctuList.size(); i++ )
   {
     CHECK( ctuList[i] > ctuList[i-1]+1, "CTU missing in slice map");
@@ -3715,7 +3715,7 @@ uint32_t PreCalcValues::getValIdx( const Slice &slice, const ChannelType chType
 
 uint32_t PreCalcValues::getMaxBtDepth( const Slice &slice, const ChannelType chType ) const
 {
-  if ( slice.getPicHeader()->getSplitConsOverrideFlag() )    
+  if ( slice.getPicHeader()->getSplitConsOverrideFlag() )
     return slice.getPicHeader()->getMaxMTTHierarchyDepth( slice.getSliceType(), ISingleTree ? CHANNEL_TYPE_LUMA : chType);
   else
   return maxBtDepth[getValIdx( slice, chType )];
@@ -3761,7 +3761,7 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS
   const PPS* pps = getPPS();
 
   bool refPicIsSameRes = false;
-   
+
   // this is needed for IBC
   m_pcPic->unscaledPic = m_pcPic;
 
@@ -3850,9 +3850,9 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS
 
           // rescale the reference picture
           const bool downsampling = m_apcRefPicList[refList][rIdx]->getRecoBuf().Y().width >= scaledRefPic[j]->getRecoBuf().Y().width && m_apcRefPicList[refList][rIdx]->getRecoBuf().Y().height >= scaledRefPic[j]->getRecoBuf().Y().height;
-          Picture::rescalePicture( m_scalingRatio[refList][rIdx], 
-                                   m_apcRefPicList[refList][rIdx]->getRecoBuf(), m_apcRefPicList[refList][rIdx]->slices[0]->getPPS()->getScalingWindow(), 
-                                   scaledRefPic[j]->getRecoBuf(), pps->getScalingWindow(), 
+          Picture::rescalePicture( m_scalingRatio[refList][rIdx],
+                                   m_apcRefPicList[refList][rIdx]->getRecoBuf(), m_apcRefPicList[refList][rIdx]->slices[0]->getPPS()->getScalingWindow(),
+                                   scaledRefPic[j]->getRecoBuf(), pps->getScalingWindow(),
                                    sps->getChromaFormatIdc(), sps->getBitDepths(), true, downsampling,
                                    sps->getHorCollocatedChromaFlag(), sps->getVerCollocatedChromaFlag() );
           scaledRefPic[j]->extendPicBorder();
@@ -3884,7 +3884,7 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], PicHeader *picHeader, APS
       m_apcRefPicList[refList][rIdx]->unscaledPic = m_savedRefPicList[refList][rIdx];
     }
   }
-  
+
   //Make sure that TMVP is disabled when there are no reference pictures with the same resolution
   if(!refPicIsSameRes)
   {
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index 6c1dd85a9cac0ac31f877cd9000d21d1bc3f6818..d4362df191fbc1e9178e08e20e104202eab178fb 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -171,7 +171,7 @@ public:
 
   void       setRefMatrixId(uint32_t scalingListId, uint32_t u)               { m_refMatrixId[scalingListId] = u;                         } //!< set reference matrix ID
   uint32_t       getRefMatrixId(uint32_t scalingListId) const                 { return m_refMatrixId[scalingListId];                      } //!< get reference matrix ID
-  
+
   static const int* getScalingListDefaultAddress(uint32_t scalinListId);                                                                           //!< get default matrix coefficient
   void       processDefaultMatrix(uint32_t scalinListId);
 
@@ -661,7 +661,7 @@ public:
   uint32_t               getCtuAddrInSlice( int idx ) const   { CHECK(idx >= m_ctuAddrInSlice.size(), "CTU index exceeds number of CTUs in slice."); return m_ctuAddrInSlice[idx]; }
   void                   pushToCtuAddrInSlice( uint32_t u )   { m_ctuAddrInSlice.push_back(u); m_numCtuInSlice++;}
 
-  void  initSliceMap() 
+  void  initSliceMap()
   {
     m_sliceID = 0;
     m_numTilesInSlice = 0;
@@ -669,12 +669,12 @@ public:
     m_ctuAddrInSlice.clear();
   }
 
-  void  addCtusToSlice( uint32_t startX, uint32_t stopX, uint32_t startY, uint32_t stopY, uint32_t picWidthInCtbsY ) 
+  void  addCtusToSlice( uint32_t startX, uint32_t stopX, uint32_t startY, uint32_t stopY, uint32_t picWidthInCtbsY )
   {
     CHECK( startX >= stopX || startY >= stopY, "Invalid slice definition");
-    for( uint32_t ctbY = startY; ctbY < stopY; ctbY++ ) 
+    for( uint32_t ctbY = startY; ctbY < stopY; ctbY++ )
     {
-      for( uint32_t ctbX = startX; ctbX < stopX; ctbX++ ) 
+      for( uint32_t ctbX = startX; ctbX < stopX; ctbX++ )
       {
         m_ctuAddrInSlice.push_back( ctbY * picWidthInCtbsY + ctbX );
         m_numCtuInSlice++;
@@ -691,11 +691,11 @@ private:
   uint32_t         m_sliceHeightInTiles;                //!< slice height in units of tiles
   uint32_t         m_numSlicesInTile;                   //!< number of slices in current tile for the special case of multiple slices inside a single tile
   uint32_t         m_sliceHeightInCtu;                  //!< slice height in units of CTUs for the special case of multiple slices inside a single tile
-  
+
 public:
   RectSlice();
   virtual ~RectSlice();
-  
+
   void             setSliceWidthInTiles( uint32_t u )   { m_sliceWidthInTiles = u;      }
   uint32_t         getSliceWidthInTiles( ) const        { return  m_sliceWidthInTiles;  }
   void             setSliceHeightInTiles( uint32_t u )  { m_sliceHeightInTiles = u;     }
@@ -723,7 +723,7 @@ private:
   uint32_t         m_subPicHeightInLumaSample;                  //!< the height of subpicture in units of luma sample
   uint32_t         m_firstCtuInSubPic;                          //!< the raster scan index of the first CTU in a subpicture
   uint32_t         m_lastCtuInSubPic;                           //!< the raster scan index of the last CTU in a subpicture
-  uint32_t         m_subPicLeft;                                //!< the position of left boundary 
+  uint32_t         m_subPicLeft;                                //!< the position of left boundary
   uint32_t         m_subPicRight;                               //!< the position of right boundary
   uint32_t         m_subPicTop;                                 //!< the position of top boundary
   uint32_t         m_subPicBottom;                              //!< the position of bottom boundary
@@ -732,7 +732,7 @@ private:
   bool             m_treatedAsPicFlag;                          //!< whether the subpicture is treated as a picture in the decoding process excluding in-loop filtering operations
   bool             m_loopFilterAcrossSubPicEnabledFlag;         //!< whether in-loop filtering operations may be performed across the boundaries of the subpicture
   uint32_t         m_numSlicesInSubPic;                         //!< Number of slices contained in this subpicture
-  
+
 public:
   SubPic();
   virtual ~SubPic();
@@ -774,7 +774,7 @@ public:
   void                  addCTUsToSubPic(std::vector<uint32_t> ctuAddrInSlice)
   {
     for (auto ctu:ctuAddrInSlice)
-      m_ctuAddrInSubPic.push_back(ctu);    
+      m_ctuAddrInSubPic.push_back(ctu);
   }
   void  addAllCtusInPicToSubPic(uint32_t startX, uint32_t stopX, uint32_t startY, uint32_t stopY, uint32_t picWidthInCtbsY)
   {
@@ -871,7 +871,7 @@ private:
   std::vector<ProfileTierLevel> m_vpsProfileTierLevel;
   uint32_t              m_olsPtlIdx[MAX_NUM_OLSS];
 
-  // stores index ( ilrp_idx within 0 .. NumDirectRefLayers ) of the dependent reference layers 
+  // stores index ( ilrp_idx within 0 .. NumDirectRefLayers ) of the dependent reference layers
   uint32_t              m_interLayerRefIdx[MAX_VPS_LAYERS][MAX_VPS_LAYERS];
   bool                  m_vpsExtensionFlag;
   bool                  m_vpsGeneralHrdParamsPresentFlag;
@@ -973,7 +973,7 @@ public:
   uint32_t          getHrdMaxTid(int olsIdx)                   const { return m_hrdMaxTid[olsIdx]; }
   void              setHrdMaxTid(int olsIdx, uint32_t val)           { m_hrdMaxTid[olsIdx] = val; }
   uint32_t          getOlsHrdIdx(int olsIdx)                   const { return m_olsHrdIdx[olsIdx]; }
-  void              setOlsHrdIdx(int olsIdx, uint32_t val)           { m_olsHrdIdx[olsIdx] = val; }  
+  void              setOlsHrdIdx(int olsIdx, uint32_t val)           { m_olsHrdIdx[olsIdx] = val; }
 
   OlsHrdParams*          getOlsHrdParameters(int olsIdx) { return &m_olsHrdParams[olsIdx][0]; }
   const OlsHrdParams*    getOlsHrdParameters(int olsIdx) const { return &m_olsHrdParams[olsIdx][0]; }
@@ -993,7 +993,7 @@ public:
 
   int               getOlsDpbParamsIdx( int olsIdx ) const               { return m_olsDpbParamsIdx[olsIdx];        }
   void              setOlsDpbParamsIdx( int olsIdx, int paramIdx )       { m_olsDpbParamsIdx[olsIdx] = paramIdx;    }
-  
+
   void              deriveOutputLayerSets();
   void              deriveTargetOutputLayerSet( int targetOlsIdx );
 
@@ -1781,10 +1781,10 @@ private:
   std::vector<uint32_t> m_tileColWidth;                 //!< tile column widths in units of CTUs
   std::vector<uint32_t> m_tileRowHeight;                //!< tile row heights in units of CTUs
   std::vector<uint32_t> m_tileColBd;                    //!< tile column left-boundaries in units of CTUs
-  std::vector<uint32_t> m_tileRowBd;                    //!< tile row top-boundaries in units of CTUs  
+  std::vector<uint32_t> m_tileRowBd;                    //!< tile row top-boundaries in units of CTUs
   std::vector<uint32_t> m_ctuToTileCol;                 //!< mapping between CTU horizontal address and tile column index
   std::vector<uint32_t> m_ctuToTileRow;                 //!< mapping between CTU vertical address and tile row index
-  bool             m_rectSliceFlag;                     //!< rectangular slice flag  
+  bool             m_rectSliceFlag;                     //!< rectangular slice flag
   bool             m_singleSlicePerSubPicFlag;          //!< single slice per sub-picture flag
   std::vector<uint32_t> m_ctuToSubPicIdx;               //!< mapping between CTU and Sub-picture index
   uint32_t         m_numSlicesInPic;                    //!< number of rectangular slices in the picture (raster-scan slice specified at slice level)
@@ -1824,7 +1824,7 @@ private:
   Window           m_conformanceWindow;
   Window           m_scalingWindow;
 
-  
+
 public:
   PreCalcValues   *pcv;
 
@@ -1853,7 +1853,7 @@ public:
 
 
   bool                   getJointCbCrQpOffsetPresentFlag() const                          { return m_chromaJointCbCrQpOffsetPresentFlag;   }
-  void                   setJointCbCrQpOffsetPresentFlag(bool b)                          { m_chromaJointCbCrQpOffsetPresentFlag = b;      } 
+  void                   setJointCbCrQpOffsetPresentFlag(bool b)                          { m_chromaJointCbCrQpOffsetPresentFlag = b;      }
 
   void                   setQpOffset(ComponentID compID, int i )
   {
@@ -1928,8 +1928,8 @@ public:
   uint32_t               getSubPicIdxFromSubPicId( uint32_t subPicId ) const;
   void                   setNoPicPartitionFlag( bool b )                                  { m_noPicPartitionFlag = b;                     }
   bool                   getNoPicPartitionFlag( ) const                                   { return  m_noPicPartitionFlag;                 }
-  void                   setLog2CtuSize( uint8_t u )                                      { m_log2CtuSize = u; m_ctuSize = 1 << m_log2CtuSize; 
-                                                                                            m_picWidthInCtu = (m_picWidthInLumaSamples  + m_ctuSize - 1) / m_ctuSize;  
+  void                   setLog2CtuSize( uint8_t u )                                      { m_log2CtuSize = u; m_ctuSize = 1 << m_log2CtuSize;
+                                                                                            m_picWidthInCtu = (m_picWidthInLumaSamples  + m_ctuSize - 1) / m_ctuSize;
                                                                                             m_picHeightInCtu = (m_picHeightInLumaSamples  + m_ctuSize - 1) / m_ctuSize; }
   uint8_t                getLog2CtuSize( ) const                                          { return  m_log2CtuSize;                        }
   uint8_t                getCtuSize( ) const                                              { return  m_ctuSize;                            }
@@ -1949,7 +1949,7 @@ public:
   void                   addTileColumnWidth( uint32_t u )                                 { CHECK( m_tileColWidth.size()  >= MAX_TILE_COLS, "Number of tile columns exceeds valid range" ); m_tileColWidth.push_back(u);    }
   void                   addTileRowHeight( uint32_t u )                                   { CHECK( m_tileRowHeight.size() >= MAX_TILE_ROWS, "Number of tile rows exceeds valid range" );    m_tileRowHeight.push_back(u);   }
   uint32_t               getTileColumnWidth( int idx ) const                              { CHECK( idx >= m_tileColWidth.size(), "Tile column index exceeds valid range" );                 return  m_tileColWidth[idx];    }
-  uint32_t               getTileRowHeight( int idx ) const                                { CHECK( idx >= m_tileRowHeight.size(), "Tile row index exceeds valid range" );                   return  m_tileRowHeight[idx];   }  
+  uint32_t               getTileRowHeight( int idx ) const                                { CHECK( idx >= m_tileRowHeight.size(), "Tile row index exceeds valid range" );                   return  m_tileRowHeight[idx];   }
   uint32_t               getTileColumnBd( int idx ) const                                 { CHECK( idx >= m_tileColBd.size(), "Tile column index exceeds valid range" );                    return  m_tileColBd[idx];       }
   uint32_t               getTileRowBd( int idx ) const                                    { CHECK( idx >= m_tileRowBd.size(), "Tile row index exceeds valid range" );                       return  m_tileRowBd[idx];       }
   uint32_t               ctuToTileCol( int ctuX ) const                                   { CHECK( ctuX >= m_ctuToTileCol.size(), "CTU address index exceeds valid range" ); return  m_ctuToTileCol[ctuX];                  }
@@ -1995,7 +1995,7 @@ public:
   const SubPic&          getSubPicFromPos(const Position& pos)  const;
   const SubPic&          getSubPicFromCU (const CodingUnit& cu) const;
   void                   initRasterSliceMap( std::vector<uint32_t> sizes );
-  void                   checkSliceMap(); 
+  void                   checkSliceMap();
   SliceMap               getSliceMap( int idx ) const                                     { CHECK( idx >= m_numSlicesInPic, "Slice index exceeds valid range" );    return m_sliceMap[idx];                             }
 
 
@@ -2152,21 +2152,21 @@ private:
   int                         m_rpl1Idx;                                                //!< index of used RPL in the SPS or -1 for local RPL in the picture header
   bool                        m_picInterSliceAllowedFlag;                               //!< inter slice allowed flag in PH
   bool                        m_picIntraSliceAllowedFlag;                               //!< intra slice allowed flag in PH
-  bool                        m_splitConsOverrideFlag;                                  //!< partitioning constraint override flag  
+  bool                        m_splitConsOverrideFlag;                                  //!< partitioning constraint override flag
   uint32_t                    m_cuQpDeltaSubdivIntra;                                   //!< CU QP delta maximum subdivision for intra slices
-  uint32_t                    m_cuQpDeltaSubdivInter;                                   //!< CU QP delta maximum subdivision for inter slices 
-  uint32_t                    m_cuChromaQpOffsetSubdivIntra;                            //!< CU chroma QP offset maximum subdivision for intra slices 
-  uint32_t                    m_cuChromaQpOffsetSubdivInter;                            //!< CU chroma QP offset maximum subdivision for inter slices 
+  uint32_t                    m_cuQpDeltaSubdivInter;                                   //!< CU QP delta maximum subdivision for inter slices
+  uint32_t                    m_cuChromaQpOffsetSubdivIntra;                            //!< CU chroma QP offset maximum subdivision for intra slices
+  uint32_t                    m_cuChromaQpOffsetSubdivInter;                            //!< CU chroma QP offset maximum subdivision for inter slices
   bool                        m_enableTMVPFlag;                                         //!< enable temporal motion vector prediction
   bool                        m_picColFromL0Flag;                                       //!< syntax element collocated_from_l0_flag
   uint32_t                    m_colRefIdx;
-  bool                        m_mvdL1ZeroFlag;                                          //!< L1 MVD set to zero flag  
+  bool                        m_mvdL1ZeroFlag;                                          //!< L1 MVD set to zero flag
   uint32_t                    m_maxNumAffineMergeCand;                                  //!< max number of sub-block merge candidates
   bool                        m_disFracMMVD;                                            //!< fractional MMVD offsets disabled flag
   bool                        m_disBdofFlag;                                            //!< picture level BDOF disable flag
   bool                        m_disDmvrFlag;                                            //!< picture level DMVR disable flag
   bool                        m_disProfFlag;                                            //!< picture level PROF disable flag
-  bool                        m_jointCbCrSignFlag;                                      //!< joint Cb/Cr residual sign flag  
+  bool                        m_jointCbCrSignFlag;                                      //!< joint Cb/Cr residual sign flag
   int                         m_qpDelta;                                                //!< value of Qp delta
   bool                        m_saoEnabledFlag[MAX_NUM_CHANNEL_TYPE];                   //!< sao enabled flags for each channel
   bool                        m_alfEnabledFlag[MAX_NUM_COMPONENT];                      //!< alf enabled flags for each component
@@ -2190,7 +2190,7 @@ private:
   bool                        m_lmcsEnabledFlag;                                        //!< lmcs enabled flag
   int                         m_lmcsApsId;                                              //!< lmcs APS ID
   APS*                        m_lmcsAps;                                                //!< lmcs APS
-  bool                        m_lmcsChromaResidualScaleFlag;                            //!< lmcs chroma residual scale flag  
+  bool                        m_lmcsChromaResidualScaleFlag;                            //!< lmcs chroma residual scale flag
   bool                        m_explicitScalingListEnabledFlag;                         //!< explicit quantization scaling list enabled
   int                         m_scalingListApsId;                                       //!< quantization scaling list APS ID
   APS*                        m_scalingListAps;                                         //!< quantization scaling list APS
@@ -2264,7 +2264,7 @@ public:
   void                        setPicIntraSliceAllowedFlag(bool b)                       { m_picIntraSliceAllowedFlag = b; }
   bool                        getPicIntraSliceAllowedFlag() const                       { return m_picIntraSliceAllowedFlag; }
   void                        setSplitConsOverrideFlag( bool b )                        { m_splitConsOverrideFlag = b;                                                                 }
-  bool                        getSplitConsOverrideFlag() const                          { return m_splitConsOverrideFlag;                                                              }  
+  bool                        getSplitConsOverrideFlag() const                          { return m_splitConsOverrideFlag;                                                              }
   void                        setCuQpDeltaSubdivIntra( uint32_t u )                     { m_cuQpDeltaSubdivIntra = u;                                                                  }
   uint32_t                    getCuQpDeltaSubdivIntra() const                           { return m_cuQpDeltaSubdivIntra;                                                               }
   void                        setCuQpDeltaSubdivInter( uint32_t u )                     { m_cuQpDeltaSubdivInter = u;                                                                  }
@@ -2280,11 +2280,11 @@ public:
   void                        setColRefIdx( uint32_t refIdx)                             { m_colRefIdx = refIdx;                                                                       }
   uint32_t                    getColRefIdx()                                             { return m_colRefIdx;                                                                         }
   void                        setMvdL1ZeroFlag( bool b )                                { m_mvdL1ZeroFlag = b;                                                                         }
-  bool                        getMvdL1ZeroFlag() const                                  { return m_mvdL1ZeroFlag;                                                                      }  
+  bool                        getMvdL1ZeroFlag() const                                  { return m_mvdL1ZeroFlag;                                                                      }
   void                        setMaxNumAffineMergeCand( uint32_t val )                  { m_maxNumAffineMergeCand = val;                                                               }
   uint32_t                    getMaxNumAffineMergeCand() const                          { return m_maxNumAffineMergeCand;                                                              }
   void                        setDisFracMMVD( bool val )                                { m_disFracMMVD = val;                                                                         }
-  bool                        getDisFracMMVD() const                                    { return m_disFracMMVD;                                                                        }  
+  bool                        getDisFracMMVD() const                                    { return m_disFracMMVD;                                                                        }
   void                        setDisBdofFlag( bool val )                                { m_disBdofFlag = val;                                                                         }
   bool                        getDisBdofFlag() const                                    { return m_disBdofFlag;                                                                        }
   void                        setDisDmvrFlag( bool val )                                { m_disDmvrFlag = val;                                                                         }
@@ -2296,7 +2296,7 @@ public:
   void                        setQpDelta(int b)                                         { m_qpDelta = b;                                                                               }
   int                         getQpDelta() const                                        { return m_qpDelta;                                                                            }
   void                        setSaoEnabledFlag(ChannelType chType, bool b)             { m_saoEnabledFlag[chType] = b;                                                                }
-  bool                        getSaoEnabledFlag(ChannelType chType) const               { return m_saoEnabledFlag[chType];                                                             }  
+  bool                        getSaoEnabledFlag(ChannelType chType) const               { return m_saoEnabledFlag[chType];                                                             }
   void                        setAlfEnabledFlag(ComponentID compId, bool b)             { m_alfEnabledFlag[compId] = b;                                                                }
   bool                        getAlfEnabledFlag(ComponentID compId) const               { return m_alfEnabledFlag[compId];                                                             }
   void                        setNumAlfAps(int i)                                       { m_numAlfAps = i;                                                                             }
@@ -2313,17 +2313,17 @@ public:
   void setCcAlfCrApsId(int i) { m_ccalfCrApsId = i; }
   int  getCcAlfCrApsId() const { return m_ccalfCrApsId; }
   void                        setDepQuantEnabledFlag( bool b )                          { m_depQuantEnabledFlag = b;                                                                   }
-  bool                        getDepQuantEnabledFlag() const                            { return m_depQuantEnabledFlag;                                                                }  
+  bool                        getDepQuantEnabledFlag() const                            { return m_depQuantEnabledFlag;                                                                }
   void                        setSignDataHidingEnabledFlag( bool b )                    { m_signDataHidingEnabledFlag = b;                                                             }
-  bool                        getSignDataHidingEnabledFlag() const                      { return m_signDataHidingEnabledFlag;                                                          }  
+  bool                        getSignDataHidingEnabledFlag() const                      { return m_signDataHidingEnabledFlag;                                                          }
   void                        setDeblockingFilterOverrideFlag( bool b )                 { m_deblockingFilterOverrideFlag = b;                                                          }
-  bool                        getDeblockingFilterOverrideFlag() const                   { return m_deblockingFilterOverrideFlag;                                                       }    
-  void                        setDeblockingFilterDisable( bool b )                      { m_deblockingFilterDisable= b;                                                                }  
+  bool                        getDeblockingFilterOverrideFlag() const                   { return m_deblockingFilterOverrideFlag;                                                       }
+  void                        setDeblockingFilterDisable( bool b )                      { m_deblockingFilterDisable= b;                                                                }
   bool                        getDeblockingFilterDisable() const                        { return m_deblockingFilterDisable;                                                            }
-  void                        setDeblockingFilterBetaOffsetDiv2( int i )                { m_deblockingFilterBetaOffsetDiv2 = i;                                                        }  
+  void                        setDeblockingFilterBetaOffsetDiv2( int i )                { m_deblockingFilterBetaOffsetDiv2 = i;                                                        }
   int                         getDeblockingFilterBetaOffsetDiv2()const                  { return m_deblockingFilterBetaOffsetDiv2;                                                     }
-  void                        setDeblockingFilterTcOffsetDiv2( int i )                  { m_deblockingFilterTcOffsetDiv2 = i;                                                          }  
-  int                         getDeblockingFilterTcOffsetDiv2() const                   { return m_deblockingFilterTcOffsetDiv2;                                                       }    
+  void                        setDeblockingFilterTcOffsetDiv2( int i )                  { m_deblockingFilterTcOffsetDiv2 = i;                                                          }
+  int                         getDeblockingFilterTcOffsetDiv2() const                   { return m_deblockingFilterTcOffsetDiv2;                                                       }
   void                        setDeblockingFilterCbBetaOffsetDiv2( int i )              { m_deblockingFilterCbBetaOffsetDiv2 = i;                                                      }
   int                         getDeblockingFilterCbBetaOffsetDiv2()const                { return m_deblockingFilterCbBetaOffsetDiv2;                                                   }
   void                        setDeblockingFilterCbTcOffsetDiv2( int i )                { m_deblockingFilterCbTcOffsetDiv2 = i;                                                        }
@@ -2354,7 +2354,7 @@ public:
   unsigned*                   getMaxMTTHierarchyDepths() const                          { return (unsigned *)m_maxMTTHierarchyDepth;                                                   }
   unsigned*                   getMaxBTSizes() const                                     { return (unsigned *)m_maxBTSize;                                                              }
   unsigned*                   getMaxTTSizes() const                                     { return (unsigned *)m_maxTTSize;                                                              }
-  
+
   void                        setMinQTSize(unsigned idx, unsigned minQT)                { m_minQT[idx] = minQT;                                                                        }
   void                        setMaxMTTHierarchyDepth(unsigned idx, unsigned maxMTT)    { m_maxMTTHierarchyDepth[idx] = maxMTT;                                                        }
   void                        setMaxBTSize(unsigned idx, unsigned maxBT)                { m_maxBTSize[idx] = maxBT;                                                                    }
@@ -2364,7 +2364,7 @@ public:
   void                        setMaxMTTHierarchyDepths(unsigned*   maxMTT)              { m_maxMTTHierarchyDepth[0] = maxMTT[0]; m_maxMTTHierarchyDepth[1] = maxMTT[1]; m_maxMTTHierarchyDepth[2] = maxMTT[2]; }
   void                        setMaxBTSizes(unsigned*   maxBT)                          { m_maxBTSize[0] = maxBT[0]; m_maxBTSize[1] = maxBT[1]; m_maxBTSize[2] = maxBT[2];                                     }
   void                        setMaxTTSizes(unsigned*   maxTT)                          { m_maxTTSize[0] = maxTT[0]; m_maxTTSize[1] = maxTT[1]; m_maxTTSize[2] = maxTT[2];                                     }
-    
+
   unsigned                    getMinQTSize(SliceType   slicetype,
                                        ChannelType chType = CHANNEL_TYPE_LUMA) const    { return slicetype == I_SLICE ? (chType == CHANNEL_TYPE_LUMA ? m_minQT[0] : m_minQT[2]) : m_minQT[1];                                              }
   unsigned                    getMaxMTTHierarchyDepth(SliceType   slicetype,
@@ -2373,7 +2373,7 @@ public:
                                        ChannelType chType = CHANNEL_TYPE_LUMA) const    { return slicetype == I_SLICE ? (chType == CHANNEL_TYPE_LUMA ? m_maxBTSize[0] : m_maxBTSize[2]) : m_maxBTSize[1];                                  }
   unsigned                    getMaxTTSize(SliceType   slicetype,
                                        ChannelType chType = CHANNEL_TYPE_LUMA) const    { return slicetype == I_SLICE ? (chType == CHANNEL_TYPE_LUMA ? m_maxTTSize[0] : m_maxTTSize[2]) : m_maxTTSize[1];                                  }
-  
+
   void                        setAlfAPSs(std::vector<int> apsIDs)                       { m_alfApsId.resize(m_numAlfAps);
                                                                                           for (int i = 0; i < m_numAlfAps; i++)
                                                                                           {
@@ -2500,15 +2500,15 @@ private:
 
   uint32_t                   m_sliceSubPicId;
 
-  
-  
+
+
 
 
   SliceType                  m_encCABACTableIdx;           // Used to transmit table selection across slices.
 
   clock_t                    m_iProcessingStartTime;
   double                     m_dProcessingTime;
-  
+
   int                        m_rpPicOrderCntVal;
   APS*                       m_alfApss[ALF_CTB_MAX_NUM_APS];
   bool                       m_tileGroupAlfEnabledFlag[MAX_NUM_COMPONENT];
@@ -2712,8 +2712,8 @@ public:
   uint32_t                    getNumCtuInSlice() const                               { return m_sliceMap.getNumCtuInSlice();                                     }
   uint32_t                    getCtuAddrInSlice( int idx ) const                     { return m_sliceMap.getCtuAddrInSlice( idx );                               }
   void                        initSliceMap()                                         { m_sliceMap.initSliceMap();                                                }
-  void                        addCtusToSlice( uint32_t startX, uint32_t stopX, 
-                                              uint32_t startY, uint32_t stopY, 
+  void                        addCtusToSlice( uint32_t startX, uint32_t stopX,
+                                              uint32_t startY, uint32_t stopY,
                                               uint32_t picWidthInCtbsY )             { m_sliceMap.addCtusToSlice(startX, stopX, startY, stopY, picWidthInCtbsY); }
   void                        setIndependentSliceIdx( uint32_t i)                        { m_independentSliceIdx = i;                                    }
   uint32_t                        getIndependentSliceIdx() const                         { return  m_independentSliceIdx;                                }
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 0715bffceb854e19ca1a35646940f3c052bcb25e..7dee7b6fa79401995307491614c5153f43ba9919 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -65,7 +65,7 @@ typedef std::pair<int, bool> TrMode;
 typedef std::pair<int, int>  TrCost;
 
 // clang-format off
-#define REUSE_CU_RESULTS                                  1 
+#define REUSE_CU_RESULTS                                  1
 #if REUSE_CU_RESULTS
 #define REUSE_CU_RESULTS_WITH_MULTIPLE_TUS                1
 #endif
diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index a2bc9ed21430c7c06f09342f0b5f7dc7d93b733a..0c191dc7427e076eb2683d77eb7c32fd7f142a25 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -116,7 +116,7 @@ bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, Picture* refPic, int&
   int curSeqMaxPicWidthY = sps->getMaxPicWidthInLumaSamples();                  // pic_width_max_in_luma_samples
   int curSeqMaxPicHeightY = sps->getMaxPicHeightInLumaSamples();                // pic_height_max_in_luma_samples
   int curPicWidthY = curPPS->getPicWidthInLumaSamples();                        // pic_width_in_luma_samples
-  int curPicHeightY = curPPS->getPicHeightInLumaSamples();                      // pic_height_in_luma_samples 
+  int curPicHeightY = curPPS->getPicHeightInLumaSamples();                      // pic_height_in_luma_samples
   int max8MinCbSizeY = std::max((int)8, (1<<sps->getLog2MinCodingBlockSize())); // Max(8, MinCbSizeY)
 
   CHECK((curPicWidth * curSeqMaxPicWidthY) < refPicWidth * (curPicWidthY - max8MinCbSizeY), "(curPicWidth * curSeqMaxPicWidthY) should be greater than or equal to refPicWidth * (curPicWidthY - max8MinCbSizeY))");
@@ -211,8 +211,8 @@ int CU::predictQP( const CodingUnit& cu, const int prevQP )
   uint32_t  tileXPosInCtus  = cu.slice->getPPS()->getTileColumnBd( tileColIdx );
   if( ctuXPosInCtus == tileXPosInCtus &&
       !( cu.blocks[cu.chType].x & ( cs.pcv->maxCUWidthMask  >> getChannelTypeScaleX( cu.chType, cu.chromaFormat ) ) ) &&
-      !( cu.blocks[cu.chType].y & ( cs.pcv->maxCUHeightMask >> getChannelTypeScaleY( cu.chType, cu.chromaFormat ) ) ) && 
-      ( cs.getCU( cu.blocks[cu.chType].pos().offset( 0, -1 ), cu.chType) != NULL ) && 
+      !( cu.blocks[cu.chType].y & ( cs.pcv->maxCUHeightMask >> getChannelTypeScaleY( cu.chType, cu.chromaFormat ) ) ) &&
+      ( cs.getCU( cu.blocks[cu.chType].pos().offset( 0, -1 ), cu.chType) != NULL ) &&
       CU::isSameSliceAndTile( *cs.getCU( cu.blocks[cu.chType].pos().offset( 0, -1 ), cu.chType), cu ) )
   {
     return ( ( cs.getCU( cu.blocks[cu.chType].pos().offset( 0, -1 ), cu.chType ) )->qp );
@@ -1062,7 +1062,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
     {
       boundaryCond = ((posRB.x + pcv.minCUWidth) <= curSubPic.getSubPicRight() &&
                       (posRB.y + pcv.minCUHeight) <= curSubPic.getSubPicBottom());
-    }    
+    }
     if (boundaryCond)
     {
       int posYInCtu = posRB.y & pcv.maxCUHeightMask;
@@ -1759,7 +1759,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
     {
       boundaryCond = ((posRB.x + pcv.minCUWidth) <= curSubPic.getSubPicRight() &&
                       (posRB.y + pcv.minCUHeight) <= curSubPic.getSubPicBottom());
-    }    
+    }
     if (boundaryCond)
     {
       int posYInCtu = posRB.y & pcv.maxCUHeightMask;
diff --git a/source/Lib/CommonLib/WeightPrediction.h b/source/Lib/CommonLib/WeightPrediction.h
index 4cc91597c8251dda3cffd509d6b87a0cdc36ac4e..3b4596964e36c308486aec9bd483af7595d14d2a 100644
--- a/source/Lib/CommonLib/WeightPrediction.h
+++ b/source/Lib/CommonLib/WeightPrediction.h
@@ -69,7 +69,7 @@ public:
                                 const WPScalingParam *const wp1,
                                       PelUnitBuf           &rpcYuvDst,
                                 const bool                  bRoundLuma = true,
-                                const ComponentID           maxNumComp = MAX_NUM_COMPONENT 
+                                const ComponentID           maxNumComp = MAX_NUM_COMPONENT
                                 , bool                      lumaOnly = false
                                 , bool                      chromaOnly = false
                                 );
@@ -106,7 +106,7 @@ public:
                                 const CPelUnitBuf          &pcYuvSrc0,
                                 const CPelUnitBuf          &pcYuvSrc1,
                                       PelUnitBuf           &pcYuvDst,
-                                const ComponentID           maxNumComp = MAX_NUM_COMPONENT 
+                                const ComponentID           maxNumComp = MAX_NUM_COMPONENT
                                 , bool                      lumaOnly = false
                                 , bool                      chromaOnly = false
                                 );
diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index 139862fb9e70b66fe78c61a2a141441e672cc99f..f5f9e3d255c57f0423ba9fc5791cb0141b28fe0c 100644
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -1186,7 +1186,7 @@ void CABACReader::cu_pred_data( CodingUnit &cu )
     if( ( !cu.Y().valid() || (!cu.isSepTree() && cu.Y().valid() ) ) && isChromaEnabled(cu.chromaFormat) )
     {
       bdpcm_mode(cu, ComponentID(CHANNEL_TYPE_CHROMA));
-    } 
+    }
     intra_chroma_pred_modes( cu );
     return;
   }
@@ -2198,7 +2198,7 @@ void CABACReader::merge_data( PredictionUnit& pu )
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__MERGE_FLAG );
 
     const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE && pu.cu->lwidth() * pu.cu->lheight() >= 64;
-    const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() && 
+    const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() &&
       pu.cs->sps->getMaxNumGeoCand() > 1
                                                                       && pu.cu->lwidth() >= GEO_MIN_CU_SIZE && pu.cu->lheight() >= GEO_MIN_CU_SIZE
                                                                       && pu.cu->lwidth() <= GEO_MAX_CU_SIZE && pu.cu->lheight() <= GEO_MAX_CU_SIZE
@@ -2961,9 +2961,9 @@ void CABACReader::ts_flag( TransformUnit& tu, ComponentID compID )
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__MTS_FLAGS, tu.blocks[compID], compID );
     tsFlag = m_BinDecoder.decodeBin( Ctx::TransformSkipFlag( ctxIdx ) );
   }
-  
+
   tu.mtsIdx[compID] = tsFlag ? MTS_SKIP : MTS_DCT2_DCT2;
-  
+
   DTRACE(g_trace_ctx, D_SYNTAX, "ts_flag() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), tsFlag);
 }
 
@@ -2978,7 +2978,7 @@ void CABACReader::mts_idx( CodingUnit& cu, CUCtx& cuCtx )
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__MTS_FLAGS, tu.blocks[COMPONENT_Y], COMPONENT_Y );
     int ctxIdx = 0;
     int symbol = m_BinDecoder.decodeBin( Ctx::MTSIdx(ctxIdx));
-    
+
     if( symbol )
     {
       ctxIdx = 1;
@@ -2987,7 +2987,7 @@ void CABACReader::mts_idx( CodingUnit& cu, CUCtx& cuCtx )
       {
         symbol  = m_BinDecoder.decodeBin( Ctx::MTSIdx(ctxIdx));
         mtsIdx += symbol;
-        
+
         if( !symbol )
         {
           break;
@@ -2995,12 +2995,12 @@ void CABACReader::mts_idx( CodingUnit& cu, CUCtx& cuCtx )
       }
     }
   }
-  
+
   tu.mtsIdx[COMPONENT_Y] = mtsIdx;
-  
+
   DTRACE(g_trace_ctx, D_SYNTAX, "mts_idx() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), mtsIdx);
 }
-  
+
 void CABACReader::isp_mode( CodingUnit& cu )
 {
   if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || !cu.cs->sps->getUseISP() || cu.bdpcmMode || !CU::canUseISP( cu, getFirstComponentOfChannel( cu.chType ) ) || cu.colorTransform )
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index c50fbedd251f57ea3313f9232ac350a81e0e26e4..567b1e07633d53dcb5ffe1df7c89f5ca1cf3dff3 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -647,7 +647,7 @@ void DecLib::executeLoopFilters()
           cs.getRecoBuf().Cr().at(col>>1, row>>1) = 0;
         }
       }
-    } 
+    }
   }
 
   m_pcPic->cs->slice->stopProcessingTimer();
@@ -724,7 +724,7 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl )
       if( pcSlice->getRefPOC( RefPicList( iRefList ), iRefIndex ) == pcSlice->getPOC() )
       {
         msg( msgl, ".%d", pcSlice->getRefPic( RefPicList( iRefList ), iRefIndex )->layerId );
-      }   
+      }
     }
     msg( msgl, "] ");
   }
@@ -930,7 +930,7 @@ void DecLib::checkSEIInAccessUnit()
         }
       }
       CHECK(!inZeroOls, "non-scalable-nested timing related SEI shall apply only to the 0-th OLS");
-      
+
       int layerId = m_vps->getLayerId(0);
       CHECK(nuhLayerId != layerId, "the nuh_layer_id of non-scalable-nested timing related SEI shall be equal to vps_layer_id[0]");
     }
@@ -961,7 +961,7 @@ bool DecLib::isSliceNaluFirstInAU( bool newPicture, InputNALUnit &nalu )
     return false;
   }
 
-  
+
   // check for layer ID less than or equal to previous picture's layer ID
   if( nalu.m_nuhLayerId <= m_prevLayerID )
   {
@@ -970,7 +970,7 @@ bool DecLib::isSliceNaluFirstInAU( bool newPicture, InputNALUnit &nalu )
 
   // get slice POC
   m_apcSlicePilot->setPicHeader( &m_picHeader );
-  m_apcSlicePilot->initSlice(); 
+  m_apcSlicePilot->initSlice();
   m_HLSReader.setBitstream( &nalu.getBitstream() );
   m_HLSReader.getSlicePoc( m_apcSlicePilot, &m_picHeader, &m_parameterSetManager, m_prevTid0POC );
 
@@ -1140,7 +1140,7 @@ void DecLib::xActivateParameterSets( const int layerId )
     {
       THROW("Parameter set activation failed!");
     }
-    
+
 
     m_parameterSetManager.getApsMap()->clear();
     for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++)
@@ -1371,7 +1371,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId)
   const int minCuSize = 1 << sps->getLog2MinCodingBlockSize();
   CHECK( ( pps->getPicWidthInLumaSamples() % ( std::max( 8, minCuSize) ) ) != 0, "Coded frame width must be a multiple of Max(8, the minimum unit size)" );
   CHECK( ( pps->getPicHeightInLumaSamples() % ( std::max( 8, minCuSize) ) ) != 0, "Coded frame height must be a multiple of Max(8, the minimum unit size)" );
-  if( !sps->getRprEnabledFlag() ) 
+  if( !sps->getRprEnabledFlag() )
   {
     CHECK( pps->getPicWidthInLumaSamples() != sps->getMaxPicWidthInLumaSamples(), "When res_change_in_clvs_allowed_flag equal to 0, the value of pic_width_in_luma_samples shall be equal to pic_width_max_in_luma_samples." );
     CHECK( pps->getPicHeightInLumaSamples() != sps->getMaxPicHeightInLumaSamples(), "When res_change_in_clvs_allowed_flag equal to 0, the value of pic_height_in_luma_samples shall be equal to pic_height_max_in_luma_samples." );
@@ -1462,7 +1462,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId)
   // When the current picture is not the first picture of the CLVS, if the value of SubpicId[ i ] is not equal to the value of SubpicId[ i ] of previous picture in decoding order in the same layer,
   // the nal_unit_type for all coded slice NAL units of the the subpicture with subpicture index i shall be in the range of IDR_W_RADL to CRA_NUT, inclusive.
   if( sps->getSubPicInfoPresentFlag() )
-  {    
+  {
     static std::unordered_map<int, std::vector<int>> previousSubPicIds;
 
     if( m_firstSliceInSequence[layerId] )
@@ -1501,7 +1501,7 @@ void DecLib::xCheckParameterSetConstraints(const int layerId)
           previousSubPicIds[layerId].push_back( pps->getSubPic( subPicIdx ).getSubPicID() );
         }
       }
-    }    
+    }
   }
 }
 
@@ -1612,7 +1612,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
   }
   if( currSubPicIdx > m_maxDecSubPicIdx )
   {
-    m_maxDecSubPicIdx = currSubPicIdx; 
+    m_maxDecSubPicIdx = currSubPicIdx;
     m_maxDecSliceAddrInSubPic = currSliceAddr;
   }
   if ((sps->getVPSId() == 0) && (m_prevLayerID != MAX_INT))
@@ -1621,11 +1621,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
                                               "when sps_video_parameter_set_id is equal to 0");
   }
   CHECK((sps->getVPSId() > 0) && (vps == 0), "Invalid VPS");
-  if (vps != nullptr && (vps->getIndependentLayerFlag(nalu.m_nuhLayerId) == 0)) 
+  if (vps != nullptr && (vps->getIndependentLayerFlag(nalu.m_nuhLayerId) == 0))
   {
     bool pocIsSet = false;
     for(auto auNALit=m_accessUnitPicInfo.begin(); auNALit != m_accessUnitPicInfo.end();auNALit++)
-    {      
+    {
       for (int iRefIdx = 0; iRefIdx < m_apcSlicePilot->getNumRefIdx(REF_PIC_LIST_0) && !pocIsSet; iRefIdx++)
       {
         if (m_apcSlicePilot->getRefPic(REF_PIC_LIST_0, iRefIdx) && m_apcSlicePilot->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC() == (*auNALit).m_POC)
diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h
index 21f6350a4b182d3a6496ed06900f3b7ef3fcba42..c7ec5006f9dced19b86c08a2cfb28a2ebd635d8b 100644
--- a/source/Lib/DecoderLib/DecLib.h
+++ b/source/Lib/DecoderLib/DecLib.h
@@ -148,7 +148,7 @@ private:
     NalUnitType     m_nalUnitType; ///< nal_unit_type
     uint32_t        m_nuhLayerId;  ///< nuh_layer_id
     uint32_t        m_firstCTUinSlice; /// the first CTU in slice, specified with raster scan order ctu address
-    int             m_POC;             /// the picture order 
+    int             m_POC;             /// the picture order
   };
   std::vector<NalUnitInfo> m_nalUnitInfo[MAX_VPS_LAYERS];
   std::vector<int> m_accessUnitApsNals;
diff --git a/source/Lib/DecoderLib/DecSlice.cpp b/source/Lib/DecoderLib/DecSlice.cpp
index 37b8392c6bcfa7222037002887ebddac43e26c0b..4a141bdebdeba278af7ab938a812f2a13b3d7944 100644
--- a/source/Lib/DecoderLib/DecSlice.cpp
+++ b/source/Lib/DecoderLib/DecSlice.cpp
@@ -133,7 +133,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb
   {
     const unsigned  ctuRsAddr       = slice->getCtuAddrInSlice(ctuIdx);
     const unsigned  ctuXPosInCtus   = ctuRsAddr % widthInCtus;
-    const unsigned  ctuYPosInCtus   = ctuRsAddr / widthInCtus;    
+    const unsigned  ctuYPosInCtus   = ctuRsAddr / widthInCtus;
     const unsigned  tileColIdx      = slice->getPPS()->ctuToTileCol( ctuXPosInCtus );
     const unsigned  tileRowIdx      = slice->getPPS()->ctuToTileRow( ctuYPosInCtus );
     const unsigned  tileXPosInCtus  = slice->getPPS()->getTileColumnBd( tileColIdx );
@@ -152,13 +152,13 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb
       int subPicY      = (int)curSubPic.getSubPicTop();
       int subPicWidth  = (int)curSubPic.getSubPicWidthInLumaSample();
       int subPicHeight = (int)curSubPic.getSubPicHeightInLumaSample();
-      for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++) 
+      for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++)
       {
         int n = slice->getNumRefIdx((RefPicList)rlist);
-        for (int idx = 0; idx < n; idx++) 
+        for (int idx = 0; idx < n; idx++)
         {
           Picture *refPic = slice->getRefPic((RefPicList)rlist, idx);
-          if (!refPic->getSubPicSaved()) 
+          if (!refPic->getSubPicSaved())
           {
             refPic->saveSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
             refPic->extendSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
@@ -248,7 +248,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb
       unsigned binVal = cabacReader.terminating_bit();
       CHECK( !binVal, "Expecting a terminating bit" );
       bool isLastTileCtu = (ctuXPosInCtus + 1 == tileXPosInCtus + tileColWidth) && (ctuYPosInCtus + 1 == tileYPosInCtus + tileRowHeight);
-      if( isLastTileCtu || wavefrontsEntryPointPresent ) 
+      if( isLastTileCtu || wavefrontsEntryPointPresent )
       {
 #if DECODER_CHECK_SUBSTREAM_AND_SLICE_TRAILING_BYTES
         cabacReader.remaining_bytes( true );
@@ -263,13 +263,13 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb
       int subPicY = (int)curSubPic.getSubPicTop();
       int subPicWidth = (int)curSubPic.getSubPicWidthInLumaSample();
       int subPicHeight = (int)curSubPic.getSubPicHeightInLumaSample();
-      for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++) 
+      for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++)
       {
         int n = slice->getNumRefIdx((RefPicList)rlist);
-        for (int idx = 0; idx < n; idx++) 
+        for (int idx = 0; idx < n; idx++)
         {
           Picture *refPic = slice->getRefPic((RefPicList)rlist, idx);
-          if (refPic->getSubPicSaved()) 
+          if (refPic->getSubPicSaved())
           {
             refPic->restoreSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
             refPic->setSubPicSaved(false);
diff --git a/source/Lib/DecoderLib/NALread.cpp b/source/Lib/DecoderLib/NALread.cpp
index bbcebd40309d8d2d6bc6ec9411e34aff0f5ce7f0..a1cbcf760166c542dd07b02cefde7f61eda32e6a 100644
--- a/source/Lib/DecoderLib/NALread.cpp
+++ b/source/Lib/DecoderLib/NALread.cpp
@@ -150,7 +150,7 @@ void readNalUnitHeader(InputNALUnit& nalu)
     else
     {
       CHECK(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA
-        , "When NAL unit type is equal to STSA_NUT, TemporalId shall not be equal to 0"); 
+        , "When NAL unit type is equal to STSA_NUT, TemporalId shall not be equal to 0");
     }
   }
 }
diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp
index 4fc6b8a0945d582798713a8f2f50b27937a2199a..d8b8049e581530bd2f1dc86cc39e5dc126cb17ad 100644
--- a/source/Lib/DecoderLib/SEIread.cpp
+++ b/source/Lib/DecoderLib/SEIread.cpp
@@ -677,10 +677,10 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi
   sei_read_code( pDecodedMessageOutputStream, bp.m_cpbRemovalDelayLength, symbol, "cpb_removal_delay_minus1[bp_max_sub_layers_minus1]" );
   sei.m_auCpbRemovalDelay[bp.m_bpMaxSubLayers - 1] = symbol + 1;
 
-  if( bp.m_altCpbParamsPresentFlag ) 
+  if( bp.m_altCpbParamsPresentFlag )
   {
     sei_read_flag( pDecodedMessageOutputStream, symbol, "cpb_alt_timing_info_present_flag" ); sei.m_cpbAltTimingInfoPresentFlag = symbol;
-    if( sei.m_cpbAltTimingInfoPresentFlag ) 
+    if( sei.m_cpbAltTimingInfoPresentFlag )
     {
       sei.m_cpbAltInitialCpbRemovalDelayDelta.resize(bp.m_bpMaxSubLayers);
       sei.m_cpbAltInitialCpbRemovalOffsetDelta.resize(bp.m_bpMaxSubLayers);
@@ -1087,7 +1087,7 @@ void SEIReader::xParseSEIOmniViewport(SEIOmniViewport& sei, uint32_t payloadSize
   if (!sei.m_omniViewportCancelFlag)
   {
     uint32_t numRegions;
-    sei_read_flag( pDecodedMessageOutputStream,    code,       "omni_viewport_persistence_flag" ); sei.m_omniViewportPersistenceFlag = code;    
+    sei_read_flag( pDecodedMessageOutputStream,    code,       "omni_viewport_persistence_flag" ); sei.m_omniViewportPersistenceFlag = code;
     sei_read_code( pDecodedMessageOutputStream, 4, numRegions, "omni_viewport_cnt_minus1"       ); numRegions++;
     sei.m_omniViewportRegions.resize(numRegions);
     for(uint32_t region=0; region<numRegions; region++)
@@ -1098,7 +1098,7 @@ void SEIReader::xParseSEIOmniViewport(SEIOmniViewport& sei, uint32_t payloadSize
       sei_read_scode( pDecodedMessageOutputStream, 32, scode, "omni_viewport_tilt_centre"      );   viewport.tiltCentre = code;
       sei_read_code( pDecodedMessageOutputStream,  32, code, "omni_viewport_hor_range"         );   viewport.horRange        = code;
       sei_read_code( pDecodedMessageOutputStream,  32, code, "omni_viewport_ver_range"         );   viewport.verRange        = code;
-    }    
+    }
   }
   else
   {
@@ -1237,7 +1237,7 @@ void SEIReader::xParseSEISubpictureLevelInfo(SEISubpicureLevelInfo& sei, uint32_
     sei.m_refLevelFraction.resize(sei.m_numRefLevels);
   }
 
-  for( int i = 0; i  <  sei.m_numRefLevels; i++ ) 
+  for( int i = 0; i  <  sei.m_numRefLevels; i++ )
   {
     sei_read_code( pDecodedMessageOutputStream,   8,  val,    "ref_level_idc[i]" );         sei.m_refLevelIdc[i]  = (Level::Name) val;
     if( sei.m_explicitFractionPresentFlag )
@@ -1263,7 +1263,7 @@ void SEIReader::xParseSEISampleAspectRatioInfo(SEISampleAspectRatioInfo& sei, ui
     sei_read_flag( pDecodedMessageOutputStream,         val,    "sari_persistence_flag" );                 sei.m_sariPersistenceFlag = val;
     sei_read_code( pDecodedMessageOutputStream,     8,  val,    "sari_aspect_ratio_idc" );                 sei.m_sariAspectRatioIdc = val;
     if (sei.m_sariAspectRatioIdc == 255)
-    { 
+    {
       sei_read_code( pDecodedMessageOutputStream,  16,  val,    "sari_sar_width" );                        sei.m_sariSarWidth = val;
       sei_read_code( pDecodedMessageOutputStream,  16,  val,    "sari_sar_height" );                       sei.m_sariSarHeight = val;
     }
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index f8e632e9d5f473dd146222fe72222520bcd65412..dc368125a3de3dba6386faef30d4ccbfd44617b5 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -480,13 +480,13 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
     // CTU size - required to match size in SPS
     READ_CODE(2, uiCode, "pps_log2_ctu_size_minus5");                 pcPPS->setLog2CtuSize(uiCode + 5);
     CHECK(uiCode > 2, "pps_log2_ctu_size_minus5 must be less than or equal to 2");
-    
+
     // number of explicit tile columns/rows
     READ_UVLC( uiCode, "num_exp_tile_columns_minus1" );               pcPPS->setNumExpTileColumns( uiCode + 1 );
     READ_UVLC( uiCode, "num_exp_tile_rows_minus1" );                  pcPPS->setNumExpTileRows( uiCode + 1 );
     CHECK(pcPPS->getNumExpTileColumns() > MAX_TILE_COLS,              "Number of explicit tile columns exceeds valid range");
     CHECK(pcPPS->getNumExpTileRows() > MAX_TILE_ROWS,                 "Number of explicit tile rows exceeds valid range");
-    
+
     // tile sizes
     for( colIdx = 0; colIdx < pcPPS->getNumExpTileColumns(); colIdx++ )
     {
@@ -509,7 +509,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
       uiCode = 1;
     }
     pcPPS->setRectSliceFlag(uiCode == 1);
-    if (pcPPS->getRectSliceFlag()) 
+    if (pcPPS->getRectSliceFlag())
     {
       READ_FLAG(uiCode, "single_slice_per_subpic_flag");            pcPPS->setSingleSlicePerSubPicFlag(uiCode == 1);
     }
@@ -534,7 +534,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
         pcPPS->setTileIdxDeltaPresentFlag(0);
       }
       pcPPS->initRectSlices();
-      
+
       // read rectangular slice parameters
       for( int i = 0; i < pcPPS->getNumSlicesInPic()-1; i++ )
       {
@@ -556,7 +556,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
           }
           pcPPS->setSliceHeightInTiles( i, uiCode + 1 );
         }
-        else 
+        else
         {
           pcPPS->setSliceHeightInTiles( i, pcPPS->getSliceHeightInTiles(i-1) );
         }
@@ -617,7 +617,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
         // tile index offset to start of next slice
         if( i < pcPPS->getNumSlicesInPic()-1 )
         {
-          if( pcPPS->getTileIdxDeltaPresentFlag() ) 
+          if( pcPPS->getTileIdxDeltaPresentFlag() )
           {
             int32_t  tileIdxDelta;
             READ_SVLC( tileIdxDelta, "tile_idx_delta[i]" );
@@ -1047,12 +1047,12 @@ void  HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS)
   READ_FLAG(     symbol, "vui_chroma_loc_info_present_flag");             pcVUI->setChromaLocInfoPresentFlag(symbol);
   if (pcVUI->getChromaLocInfoPresentFlag())
   {
-    if(pcSPS->getProfileTierLevel()->getConstraintInfo()->getProgressiveSourceFlag() && 
+    if(pcSPS->getProfileTierLevel()->getConstraintInfo()->getProgressiveSourceFlag() &&
        !pcSPS->getProfileTierLevel()->getConstraintInfo()->getInterlacedSourceFlag())
     {
       READ_UVLC(   symbol, "vui_chroma_sample_loc_type" );        pcVUI->setChromaSampleLocType(symbol);
     }
-    else 
+    else
     {
       READ_UVLC(   symbol, "vui_chroma_sample_loc_type_top_field" );        pcVUI->setChromaSampleLocTypeTopField(symbol);
       READ_UVLC(   symbol, "vui_chroma_sample_loc_type_bottom_field" );     pcVUI->setChromaSampleLocTypeBottomField(symbol);
@@ -1184,13 +1184,13 @@ void HLSyntaxReader::parseExtraPHBitsStruct( SPS *sps, int numBytes )
   uint32_t symbol;
   std::vector<bool> presentFlags;
   presentFlags.resize ( 8 * numBytes );
-  
+
   for (int i=0; i < 8*numBytes; i++)
   {
     READ_FLAG(symbol, "extra_ph_bit_present_flag[ i ]");
     presentFlags[i] = symbol;
   }
-  
+
   sps->setExtraPHBitPresentFlags(presentFlags);
 }
 
@@ -1199,13 +1199,13 @@ void HLSyntaxReader::parseExtraSHBitsStruct( SPS *sps, int numBytes )
   uint32_t symbol;
   std::vector<bool> presentFlags;
   presentFlags.resize ( 8 * numBytes );
-  
+
   for (int i=0; i < 8*numBytes; i++)
   {
     READ_FLAG(symbol, "extra_sh_bit_present_flag[ i ]");
     presentFlags[i] = symbol;
   }
-  
+
   sps->setExtraSHBitPresentFlags(presentFlags);
 }
 
@@ -1224,7 +1224,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   READ_CODE(4, uiCode, "sps_reserved_zero_4bits");
   CHECK(uiCode != 0, "sps_reserved_zero_4bits not equal to zero");
   READ_FLAG(uiCode, "sps_ptl_dpb_hrd_params_present_flag"); pcSPS->setPtlDpbHrdParamsPresentFlag(uiCode);
-  
+
   if (pcSPS->getPtlDpbHrdParamsPresentFlag())
   {
 
@@ -1377,7 +1377,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (int) (6*uiCode) );
 
   READ_FLAG( uiCode, "sps_entropy_coding_sync_enabled_flag" );       pcSPS->setEntropyCodingSyncEnabledFlag(uiCode == 1);
-  if (pcSPS->getEntropyCodingSyncEnabledFlag()) 
+  if (pcSPS->getEntropyCodingSyncEnabledFlag())
   {
     READ_FLAG(uiCode, "sps_wpp_entry_point_offsets_present_flag");   pcSPS->setEntropyCodingSyncEntryPointsPresentFlag(uiCode == 1);
   }
@@ -1405,7 +1405,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   if (pcSPS->getMaxTLayers() - 1 > 0)
   {
     READ_FLAG(uiCode, "sps_sublayer_dpb_params_flag");     pcSPS->setSubLayerDpbParamsFlag(uiCode ? true : false);
-  }    
+  }
   if (pcSPS->getPtlDpbHrdParamsPresentFlag())
   {
     dpb_parameters(pcSPS->getMaxTLayers() - 1, pcSPS->getSubLayerDpbParamsFlag(), pcSPS);
@@ -1457,7 +1457,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
 
   unsigned  maxBTSize[3] = { 0, 0, 0 };
   unsigned  maxTTSize[3] = { 0, 0, 0 };
-  if( pcSPS->getChromaFormatIdc() != CHROMA_400 ) 
+  if( pcSPS->getChromaFormatIdc() != CHROMA_400 )
   {
     READ_FLAG(uiCode, "qtbtt_dual_tree_intra_flag");           pcSPS->setUseDualITree(uiCode);
   }
@@ -1613,7 +1613,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   READ_FLAG(uiCode, "sps_isp_enabled_flag");                        pcSPS->setUseISP( uiCode != 0 );
   READ_FLAG(uiCode, "sps_mrl_enabled_flag");                        pcSPS->setUseMRL( uiCode != 0 );
   READ_FLAG(uiCode, "sps_mip_enabled_flag");                        pcSPS->setUseMIP( uiCode != 0 );
-  if( pcSPS->getChromaFormatIdc() != CHROMA_400) 
+  if( pcSPS->getChromaFormatIdc() != CHROMA_400)
   {
     READ_FLAG( uiCode, "sps_cclm_enabled_flag" );                   pcSPS->setUseLMChroma( uiCode != 0 );
   }
@@ -1896,7 +1896,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS)
 #endif
   uint32_t  uiCode;
 
-  READ_CODE(4, uiCode, "vps_video_parameter_set_id");         
+  READ_CODE(4, uiCode, "vps_video_parameter_set_id");
   CHECK( uiCode == 0, "vps_video_parameter_set_id equal to zero is reserved and shall not be used in a bitstream" );
   pcVPS->setVPSId(uiCode);
 
@@ -1984,14 +1984,14 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS)
   {
     if(i > 0)
     {
-      READ_FLAG(uiCode, "pt_present_flag");           
+      READ_FLAG(uiCode, "pt_present_flag");
       pcVPS->setPtPresentFlag(i, uiCode);
     }
     else
       pcVPS->setPtPresentFlag(0, 1);
     if(pcVPS->getMaxSubLayers() > 1 && !pcVPS->getAllLayersSameNumSublayersFlag())
     {
-      READ_CODE(3, uiCode, "ptl_max_temporal_id");    
+      READ_CODE(3, uiCode, "ptl_max_temporal_id");
       pcVPS->setPtlMaxTemporalId(i, uiCode);
     }
     else if(pcVPS->getMaxSubLayers() > 1)
@@ -2126,7 +2126,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS)
         {
           pcVPS->setHrdMaxTid(i, pcVPS->getMaxSubLayers()- 1);
         }
-        
+
       }
       uint32_t firstSublayer = pcVPS->getVPSSublayerCpbParamsPresentFlag() ? 0 : pcVPS->getHrdMaxTid(i);
       parseOlsHrdParameters(pcVPS->getGeneralHrdParameters(),pcVPS->getOlsHrdParameters(i), firstSublayer, pcVPS->getHrdMaxTid(i));
@@ -2166,11 +2166,11 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS)
 
 void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManager *parameterSetManager, bool readRbspTrailingBits )
 {
-  uint32_t  uiCode; 
+  uint32_t  uiCode;
   int       iCode;
   PPS*      pps = NULL;
   SPS*      sps = NULL;
-  
+
 #if ENABLE_TRACING
   xTracePictureHeader();
 #endif
@@ -2205,15 +2205,15 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
   {
     READ_FLAG(uiCode, "no_output_of_prior_pics_flag");   picHeader->setNoOutputOfPriorPicsFlag(uiCode != 0);
   }
-  if( picHeader->getGdrPicFlag() ) 
+  if( picHeader->getGdrPicFlag() )
   {
     READ_UVLC(uiCode, "recovery_poc_cnt");               picHeader->setRecoveryPocCnt( uiCode );
   }
-  else 
+  else
   {
     picHeader->setRecoveryPocCnt( 0 );
   }
-  
+
   std::vector<bool> phExtraBitsPresent = sps->getExtraPHBitPresentFlags();
   for (int i=0; i< sps->getNumExtraPHBitsBytes() * 8; i++)
   {
@@ -2223,7 +2223,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
       READ_FLAG(uiCode, "ph_extra_bit[ i ]");
     }
   }
-  
+
   if (sps->getPocMsbFlag())
   {
     READ_FLAG(uiCode, "ph_poc_msb_present_flag"); picHeader->setPocMsbPresentFlag(uiCode != 0);
@@ -2360,7 +2360,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
   {
     picHeader->setExplicitScalingListEnabledFlag(false);
   }
-  
+
   // initialize tile/slice info for no partitioning case
 
   if( pps->getNoPicPartitionFlag() )
@@ -2381,7 +2381,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
     // when no Pic partition, number of sub picture shall be less than 2
     CHECK(pps->getNumSubPics()>=2, "error, no picture partitions, but have equal to or more than 2 sub pictures");
   }
-  else 
+  else
   {
     CHECK(pps->getCtuSize() != sps->getCTUSize(), "PPS CTU size does not match CTU size in SPS");
     if (pps->getRectSliceFlag())
@@ -2425,21 +2425,21 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
     {
     picHeader->setNumVerVirtualBoundaries( sps->getNumVerVirtualBoundaries() );
     picHeader->setNumHorVirtualBoundaries( sps->getNumHorVirtualBoundaries() );
-    for( unsigned i = 0; i < 3; i++ ) 
+    for( unsigned i = 0; i < 3; i++ )
     {
       picHeader->setVirtualBoundariesPosX( sps->getVirtualBoundariesPosX(i), i );
       picHeader->setVirtualBoundariesPosY( sps->getVirtualBoundariesPosY(i), i );
     }
     }
   }
-  
+
 
   // picture output flag
   if( pps->getOutputFlagPresentFlag() )
   {
     READ_FLAG( uiCode, "pic_output_flag" ); picHeader->setPicOutputFlag( uiCode != 0 );
   }
-  else 
+  else
   {
     picHeader->setPicOutputFlag( true );
   }
@@ -2450,8 +2450,8 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
     bool rplSpsFlag0 = 0;
 
     // List0 and List1
-    for(int listIdx = 0; listIdx < 2; listIdx++) 
-    {                 
+    for(int listIdx = 0; listIdx < 2; listIdx++)
+    {
       if (sps->getNumRPL(listIdx) > 0 &&
           (listIdx == 0 || (listIdx == 1 && pps->getRpl1IdxPresentFlag())))
       {
@@ -2610,7 +2610,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
     {
       READ_UVLC( uiCode, "ph_cu_qp_delta_subdiv_intra_slice" );   picHeader->setCuQpDeltaSubdivIntra( uiCode );
     }
-    else 
+    else
     {
       picHeader->setCuQpDeltaSubdivIntra( 0 );
     }
@@ -2618,7 +2618,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
     {
       READ_UVLC( uiCode, "ph_cu_chroma_qp_offset_subdiv_intra_slice" );   picHeader->setCuChromaQpOffsetSubdivIntra( uiCode );
     }
-    else 
+    else
     {
       picHeader->setCuChromaQpOffsetSubdivIntra( 0 );
     }
@@ -2695,7 +2695,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
   // mvd L1 zero flag
     READ_FLAG(uiCode, "mvd_l1_zero_flag");
     picHeader->setMvdL1ZeroFlag( uiCode != 0 );
-     
+
   // merge candidate list size
   // subblock merge candidate list size
     if ( sps->getUseAffine() )
@@ -2717,7 +2717,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
     {
       picHeader->setDisFracMMVD(false);
     }
-  
+
   // picture level BDOF disable flags
     if (sps->getBdofControlPresentFlag())
     {
@@ -2791,7 +2791,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
   if(sps->getSAOEnabledFlag())
   {
     if (pps->getSaoInfoInPhFlag())
-    {    
+    {
       READ_FLAG(uiCode, "ph_sao_luma_enabled_flag");
       picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, uiCode != 0);
 
@@ -2801,13 +2801,13 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
         picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, uiCode != 0);
       }
     }
-    else 
+    else
     {
       picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA,   true);
       picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, sps->getChromaFormatIdc() != CHROMA_400);
     }
   }
-  else 
+  else
   {
     picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA,   false);
     picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, false);
@@ -3045,16 +3045,16 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
   }
 
   // raster scan slices
-  if(pps->getRectSliceFlag() == 0) 
+  if(pps->getRectSliceFlag() == 0)
   {
     uint32_t sliceAddr, numTilesInSlice;
 
     // slice address is the raster scan tile index of first tile in slice
-    if( pps->getNumTiles() > 1 ) 
-    {      
+    if( pps->getNumTiles() > 1 )
+    {
       int bitsSliceAddress = ceilLog2(pps->getNumTiles());
       READ_CODE(bitsSliceAddress, uiCode, "slice_address");  sliceAddr = uiCode;
-      READ_UVLC(uiCode, "num_tiles_in_slice_minus1");        numTilesInSlice = uiCode + 1;      
+      READ_UVLC(uiCode, "num_tiles_in_slice_minus1");        numTilesInSlice = uiCode + 1;
       if (!pps->getRectSliceFlag() && sps->getProfileTierLevel()->getConstraintInfo()->getOneSlicePerPicConstraintFlag())
       {
         CHECK(pps->getNumTiles() != uiCode + 1, "When rect_slice_flag is equal to 0 and one_slice_per_pic_constraint_flag equal to 1, the value of num_tiles_in_slice_minus1 present in each slice header shall be equal to NumTilesInPic - 1");
@@ -3067,7 +3067,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
     CHECK(sliceAddr >= pps->getNumTiles(), "Invalid slice address");
     pcSlice->initSliceMap();
     pcSlice->setSliceID(sliceAddr);
-    
+
     for( uint32_t tileIdx = sliceAddr; tileIdx < sliceAddr + numTilesInSlice; tileIdx++ )
     {
       uint32_t tileX = tileIdx % pps->getNumTileColumns();
@@ -3079,7 +3079,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
    }
   }
   // rectangular slices
-  else 
+  else
   {
     uint32_t sliceAddr;
 
@@ -3088,7 +3088,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
     SubPic currSubPic = pps->getSubPic(currSubPicIdx);
     if( currSubPic.getNumSlicesInSubPic() > 1 )
     {
-      int bitsSliceAddress = ceilLog2(currSubPic.getNumSlicesInSubPic());  
+      int bitsSliceAddress = ceilLog2(currSubPic.getNumSlicesInSubPic());
       READ_CODE(bitsSliceAddress, uiCode, "slice_address");  sliceAddr = uiCode;
       CHECK(sliceAddr >= pps->getNumSlicesInPic(), "Invalid slice address");
     }
@@ -4349,7 +4349,7 @@ void HLSyntaxReader::parseScalingList(ScalingList* scalingList)
     {
       READ_UVLC(code, "scaling_list_pred_matrix_id_delta");
       scalingList->setRefMatrixId(scalingListId, (uint32_t)((int)(scalingListId)-(code)));
-    }    
+    }
     else if (scalingListCopyModeFlag || scalingList->getScalingListPreditorModeFlag(scalingListId))
     {
       scalingList->setRefMatrixId(scalingListId, (uint32_t)((int)(scalingListId)));
@@ -4419,7 +4419,7 @@ void HLSyntaxReader::decodeScalingList(ScalingList *scalingList, uint32_t scalin
       continue;
     }
     READ_SVLC( data, "scaling_list_delta_coef");
-    nextCoef += data;  
+    nextCoef += data;
     predCoef = (isPredictor) ? srcPred[scan[i].idx] : 0;
     dst[scan[i].idx] = (nextCoef + predCoef + 256) & 255;
   }
diff --git a/source/Lib/EncoderLib/BinEncoder.cpp b/source/Lib/EncoderLib/BinEncoder.cpp
index 2d94f7765b9e05b77433864d532126729e987c18..9636d2f78cafefaf4a87a9963b1faf838bf7d3b1 100644
--- a/source/Lib/EncoderLib/BinEncoder.cpp
+++ b/source/Lib/EncoderLib/BinEncoder.cpp
@@ -215,7 +215,7 @@ void BinEncoderBase::encodeRemAbsEP(unsigned bins, unsigned goRicePar, unsigned
     encodeBinsEP((1 << length) - 2, length);
     encodeBinsEP(bins & bitMask, goRicePar);
   }
-  else 
+  else
   {
     const unsigned  maxPrefixLength = 32 - cutoff - maxLog2TrDynamicRange;
     unsigned        prefixLength = 0;
@@ -419,7 +419,7 @@ void BitEstimatorBase::encodeRemAbsEP(unsigned bins, unsigned goRicePar, unsigne
   {
     m_EstFracBits += BinProbModelBase::estFracBitsEP((bins >> goRicePar) + 1 + goRicePar);
   }
-  else 
+  else
   {
     const unsigned  maxPrefixLength = 32 - cutoff - maxLog2TrDynamicRange;
     unsigned        prefixLength = 0;
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index 56f66330b1c3b9a3a89118e2a7804ddf1e33f881..d68dc008dcb18104b36f680ef4ddbd46d18dce51 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -768,7 +768,7 @@ void CABACWriter::pred_mode( const CodingUnit& cu )
       unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
       m_BinEncoder.encodeBin(CU::isIBC(cu), Ctx::IBCFlag(ctxidx));
       }
-      if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) ) 
+      if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) )
       {
         m_BinEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0));
       }
@@ -782,7 +782,7 @@ void CABACWriter::pred_mode( const CodingUnit& cu )
       m_BinEncoder.encodeBin((CU::isIntra(cu) || CU::isPLT(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)));
       if (CU::isIntra(cu) || CU::isPLT(cu))
       {
-        if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) ) 
+        if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) )
           m_BinEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0));
       }
       else
@@ -823,7 +823,7 @@ void CABACWriter::bdpcm_mode( const CodingUnit& cu, const ComponentID compID )
 
   int bdpcmMode = isLuma(compID) ? cu.bdpcmMode : cu.bdpcmModeChroma;
 
-  unsigned ctxId = isLuma(compID) ? 0 : 2; 
+  unsigned ctxId = isLuma(compID) ? 0 : 2;
   m_BinEncoder.encodeBin(bdpcmMode > 0 ? 1 : 0, Ctx::BDPCMMode(ctxId));
 
   if (bdpcmMode)
@@ -854,7 +854,7 @@ void CABACWriter::cu_pred_data( const CodingUnit& cu )
     if( ( !cu.Y().valid() || ( !cu.isSepTree() && cu.Y().valid() ) ) && isChromaEnabled(cu.chromaFormat) )
     {
       bdpcm_mode( cu, ComponentID(CHANNEL_TYPE_CHROMA) );
-    } 
+    }
     intra_chroma_pred_modes( cu );
     return;
   }
@@ -1453,7 +1453,7 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u
 
   if (cu.lastPLTSize[compBegin])
   {
-    
+
     xEncodePLTPredIndicator(cu, maxPltSize, compBegin);
   }
 
@@ -1552,7 +1552,7 @@ void CABACWriter::cuPaletteSubblockInfo(const CodingUnit& cu, ComponentID compBe
       || ((runType.at(posx, posy) == PLT_RUN_INDEX) && (curPLTIdx.at(posx, posy) != curPLTIdx.at(posxprev, posyprev))));
 
     const CtxSet&   ctxSet = (prevRunType == PLT_RUN_INDEX)? Ctx::IdxRunModel: Ctx::CopyRunModel;
-    if ( curPos > 0 ) 
+    if ( curPos > 0 )
     {
       int dist = curPos - prevRunPos - 1;
       const unsigned  ctxId = DeriveCtx::CtxPltCopyFlag(prevRunType, dist);
@@ -1902,7 +1902,7 @@ void CABACWriter::merge_data(const PredictionUnit& pu)
     return;
   }
   const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE && pu.cu->lwidth() * pu.cu->lheight() >= 64;
-  const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() && 
+  const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() &&
     pu.cs->sps->getMaxNumGeoCand() > 1
                                                                     && pu.cu->lwidth() >= GEO_MIN_CU_SIZE && pu.cu->lheight() >= GEO_MIN_CU_SIZE
                                                                     && pu.cu->lwidth() <= GEO_MAX_CU_SIZE && pu.cu->lheight() <= GEO_MAX_CU_SIZE
@@ -2710,7 +2710,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID,
       }
     }
     residual_coding_subblock( cctx, coeff, stateTab, state );
-    
+
     if ( cuCtx && isLuma(compID) && cctx.isSigGroup() && ( cctx.cgPosY() > 3 || cctx.cgPosX() > 3 ) )
     {
       cuCtx->violatesMtsCoeffConstraint = true;
@@ -2722,7 +2722,7 @@ void CABACWriter::ts_flag( const TransformUnit& tu, ComponentID compID )
 {
   int tsFlag = tu.mtsIdx[compID] == MTS_SKIP ? 1 : 0;
   int ctxIdx = isLuma(compID) ? 0 : 1;
-  
+
   if( TU::isTSAllowed ( tu, compID ) )
   {
     m_BinEncoder.encodeBin( tsFlag, Ctx::TransformSkipFlag(ctxIdx));
@@ -2734,15 +2734,15 @@ void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx* cuCtx )
 {
   TransformUnit &tu = *cu.firstTU;
   int        mtsIdx = tu.mtsIdx[COMPONENT_Y];
-  
-  if( CU::isMTSAllowed( cu, COMPONENT_Y ) && cuCtx && !cuCtx->violatesMtsCoeffConstraint && 
+
+  if( CU::isMTSAllowed( cu, COMPONENT_Y ) && cuCtx && !cuCtx->violatesMtsCoeffConstraint &&
       cuCtx->mtsLastScanPos && cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP)
   {
     int symbol = mtsIdx != MTS_DCT2_DCT2 ? 1 : 0;
     int ctxIdx = 0;
-    
+
     m_BinEncoder.encodeBin( symbol, Ctx::MTSIdx(ctxIdx));
-    
+
     if( symbol )
     {
       ctxIdx = 1;
@@ -2750,7 +2750,7 @@ void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx* cuCtx )
       {
         symbol = mtsIdx > i + MTS_DST7_DST7 ? 1 : 0;
         m_BinEncoder.encodeBin( symbol, Ctx::MTSIdx(ctxIdx));
-        
+
         if( !symbol )
         {
           break;
diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h
index 11d9f655968f5133bac94cd34adf51918cc78739..7f05fa9e84089b9419c9b9e29c3cbbbb7b02866d 100644
--- a/source/Lib/EncoderLib/CABACWriter.h
+++ b/source/Lib/EncoderLib/CABACWriter.h
@@ -153,7 +153,7 @@ public:
   void        residual_coding_subblockTS( CoeffCodingContext&           cctx,     const TCoeff*     coeff  );
   void        joint_cb_cr               ( const TransformUnit&          tu,       const int cbfMask );
 
-  
+
   void        codeAlfCtuEnableFlags     ( CodingStructure& cs, ChannelType channel, AlfParam* alfParam);
   void        codeAlfCtuEnableFlags     ( CodingStructure& cs, ComponentID compID, AlfParam* alfParam);
   void        codeAlfCtuEnableFlag      ( CodingStructure& cs, uint32_t ctuRsAddr, const int compIdx, AlfParam* alfParam );
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index 4aab1126d30c0865234004eb42ccaa603a54e47d..19ed66be49afe81ccf7a718bad9f7539531d29f1 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -1459,7 +1459,7 @@ public:
   int   getOmniViewportSEITiltCentre(int idx)                        { return m_omniViewportSEITiltCentre[idx]; }
   void  setOmniViewportSEIHorRange(const std::vector<uint32_t>& vi)  { m_omniViewportSEIHorRange = vi; }
   uint32_t  getOmniViewportSEIHorRange(int idx)                      { return m_omniViewportSEIHorRange[idx]; }
-  void  setOmniViewportSEIVerRange(const std::vector<uint32_t>& vi)  { m_omniViewportSEIVerRange = vi; } 
+  void  setOmniViewportSEIVerRange(const std::vector<uint32_t>& vi)  { m_omniViewportSEIVerRange = vi; }
   uint32_t  getOmniViewportSEIVerRange(int idx)                      { return m_omniViewportSEIVerRange[idx]; }
   void     setRwpSEIEnabled(bool b)                                                                     { m_rwpSEIEnabled = b; }
   bool     getRwpSEIEnabled()                                                                           { return m_rwpSEIEnabled; }
@@ -1750,16 +1750,16 @@ public:
 
   bool         getNonProjectedConstraintFlag() const                 { return m_nonProjectedConstraintFlag; }
   void         setNonProjectedConstraintFlag(bool b)                 { m_nonProjectedConstraintFlag = b; }
-               
+
   bool         getNoResChangeInClvsConstraintFlag() const            { return m_noResChangeInClvsConstraintFlag; }
   void         setNoResChangeInClvsConstraintFlag(bool b)            { m_noResChangeInClvsConstraintFlag = b; }
-               
+
   bool         getOneTilePerPicConstraintFlag() const                { return m_oneTilePerPicConstraintFlag; }
   void         setOneTilePerPicConstraintFlag(bool b)                { m_oneTilePerPicConstraintFlag = b; }
-               
+
   bool         getOneSlicePerPicConstraintFlag() const               { return m_oneSlicePerPicConstraintFlag; }
   void         setOneSlicePerPicConstraintFlag(bool b)               { m_oneSlicePerPicConstraintFlag = b; }
-               
+
   bool         getOneSubpicPerPicConstraintFlag() const              { return m_oneSubpicPerPicConstraintFlag; }
   void         setOneSubpicPerPicConstraintFlag(bool b)              { m_oneSubpicPerPicConstraintFlag = b; }
 
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index fafc8552492ce4798677cea8094a5c606e633a53..1a1e531c842baea93c9256686fdb1cec068dd00e 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -577,7 +577,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par
   }
   SplitSeries splitmode = -1;
   uint8_t   bestLastPLTSize[MAX_NUM_CHANNEL_TYPE];
-  Pel       bestLastPLT[MAX_NUM_COMPONENT][MAXPLTPREDSIZE]; // store LastPLT for 
+  Pel       bestLastPLT[MAX_NUM_COMPONENT][MAXPLTPREDSIZE]; // store LastPLT for
   uint8_t   curLastPLTSize[MAX_NUM_CHANNEL_TYPE];
   Pel       curLastPLT[MAX_NUM_COMPONENT][MAXPLTPREDSIZE]; // store LastPLT if no partition
   for (int i = compBegin; i < (compBegin + numComp); i++)
@@ -628,7 +628,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par
     // TODO M0133 : double check encoder decisions with respect to chroma QG detection and actual encode
     int lgMinCuSize = sps.getLog2MinCodingBlockSize() +
       std::max<int>(0, floorLog2(sps.getCTUSize()) - sps.getLog2MinCodingBlockSize() - int(slice.getCuChromaQpOffsetSubdiv() / 2));
-    if( partitioner.currQgChromaEnable() ) 
+    if( partitioner.currQgChromaEnable() )
     {
       m_cuChromaQpOffsetIdxPlus1 = ( ( uiLPelX >> lgMinCuSize ) + ( uiTPelY >> lgMinCuSize ) ) % ( pps.getChromaQpOffsetListLen() + 1 );
     }
@@ -2124,13 +2124,13 @@ void EncCu::xCheckChromaQPOffset( CodingStructure& cs, Partitioner& partitioner
   }
 
   // not needed after the first coded TU in the chroma QG
-  if( !partitioner.currQgChromaEnable() ) 
+  if( !partitioner.currQgChromaEnable() )
   {
     return;
   }
-  
+
   CodingUnit& cu = *cs.getCU( partitioner.chType );
-  
+
   // check if chroma is coded or not
   bool hasResidual = false;
   for( const TransformUnit &tu : CU::traverseTUs(cu) )
diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h
index 882a5ef7fab42f4738754d66da926001415e9879..07d4848fa5423df234e300b69f652635cbd80326 100644
--- a/source/Lib/EncoderLib/EncCu.h
+++ b/source/Lib/EncoderLib/EncCu.h
@@ -110,7 +110,7 @@ class FastGeoCostList
 {
 public:
   FastGeoCostList() { numGeoTemplatesInitialized = 0; };
-  ~FastGeoCostList() 
+  ~FastGeoCostList()
   {
     for (int partIdx = 0; partIdx < 2; partIdx++)
     {
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index 58d6e0002ac89293733f8fb1898f06113090fef6..05249f1a96dda8de7113dc4caeb5f571557bbf57 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -713,7 +713,7 @@ void EncGOP::xCreateIRAPLeadingSEIMessages (SEIMessages& seiMessages, const SPS
 void EncGOP::xCreatePerPictureSEIMessages (int picInGOP, SEIMessages& seiMessages, SEIMessages& nestedSeiMessages, Slice *slice)
 {
   if ((m_pcCfg->getBufferingPeriodSEIEnabled()) && (slice->isIRAP() || slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) &&
-    slice->getNalUnitLayerId()==slice->getVPS()->getLayerId(0) && 
+    slice->getNalUnitLayerId()==slice->getVPS()->getLayerId(0) &&
   (slice->getSPS()->getGeneralHrdParametersPresentFlag()))
   {
     SEIBufferingPeriod *bufferingPeriodSEI = new SEIBufferingPeriod();
@@ -750,7 +750,7 @@ void EncGOP::xCreateScalableNestingSEI(SEIMessages& seiMessages, SEIMessages& ne
     nestedSeiMessages.pop_front();
     tmpMessages.push_back(sei);
     SEIScalableNesting *nestingSEI = new SEIScalableNesting();
-    m_seiEncoder.initSEIScalableNesting(nestingSEI, tmpMessages); 
+    m_seiEncoder.initSEIScalableNesting(nestingSEI, tmpMessages);
     seiMessages.push_back(nestingSEI);
     tmpMessages.clear();
   }
@@ -999,7 +999,7 @@ void EncGOP::xCreatePictureTimingSEI  (int IRAPGOPid, SEIMessages& seiMessages,
     {
       seiMessages.push_back(pictureTimingSEI);
 
-      if (m_pcCfg->getScalableNestingSEIEnabled()) 
+      if (m_pcCfg->getScalableNestingSEIEnabled())
       {
         SEIPictureTiming *pictureTimingSEIcopy = new SEIPictureTiming();
         pictureTimingSEI->copyTo(*pictureTimingSEIcopy);
@@ -2247,7 +2247,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
     }
     //  Set reference list
     pcSlice->constructRefPicList(rcListPic);
-    
+
     xPicInitHashME( pcPic, pcSlice->getPPS(), rcListPic );
 
     if( m_pcCfg->getUseAMaxBT() )
@@ -2648,7 +2648,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
 
     pcPic->cs->picHeader->setPic(pcPic);
     pcPic->cs->picHeader->setValid();
-    if(pcPic->cs->sps->getFpelMmvdEnabledFlag()) 
+    if(pcPic->cs->sps->getFpelMmvdEnabledFlag())
     {
       // cannot set ph_fpel_mmvd_enabled_flag at slice level - need new picture-level version of checkDisFracMmvd algorithm?
       // m_pcSliceEncoder->checkDisFracMmvd( pcPic, 0, numberOfCtusInFrame );
@@ -3042,7 +3042,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
         }
 
         // code picture header before first slice
-        if(sliceSegmentIdxCount == 0) 
+        if(sliceSegmentIdxCount == 0)
         {
           // code RPL in picture header or slice headers
           if( !m_pcCfg->getSliceLevelRpl() && (!pcSlice->getIdrPicFlag() || pcSlice->getSPS()->getIDRRefParamListPresent()) )
@@ -3054,13 +3054,13 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
             *picHeader->getLocalRPL0() = *pcSlice->getLocalRPL0();
             *picHeader->getLocalRPL1() = *pcSlice->getLocalRPL1();
           }
-          
+
           // code DBLK in picture header or slice headers
           if( !m_pcCfg->getSliceLevelDblk() )
           {
             picHeader->setDeblockingFilterOverrideFlag   ( pcSlice->getDeblockingFilterOverrideFlag()   );
-            picHeader->setDeblockingFilterDisable        ( pcSlice->getDeblockingFilterDisable()        ); 
-            picHeader->setDeblockingFilterBetaOffsetDiv2 ( pcSlice->getDeblockingFilterBetaOffsetDiv2() ); 
+            picHeader->setDeblockingFilterDisable        ( pcSlice->getDeblockingFilterDisable()        );
+            picHeader->setDeblockingFilterBetaOffsetDiv2 ( pcSlice->getDeblockingFilterBetaOffsetDiv2() );
             picHeader->setDeblockingFilterTcOffsetDiv2   ( pcSlice->getDeblockingFilterTcOffsetDiv2()   );
             picHeader->setDeblockingFilterCbBetaOffsetDiv2( pcSlice->getDeblockingFilterCbBetaOffsetDiv2() );
             picHeader->setDeblockingFilterCbTcOffsetDiv2  ( pcSlice->getDeblockingFilterCbTcOffsetDiv2() );
@@ -3079,13 +3079,13 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
             picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA,   pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA  ));
             picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA));
           }
-          
+
           // code ALF parameters in picture header or slice headers
           if( !m_pcCfg->getSliceLevelAlf() )
           {
             picHeader->setAlfEnabledFlag(COMPONENT_Y,  pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Y ) );
             picHeader->setAlfEnabledFlag(COMPONENT_Cb, pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cb) );
-            picHeader->setAlfEnabledFlag(COMPONENT_Cr, pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cr) );            
+            picHeader->setAlfEnabledFlag(COMPONENT_Cr, pcSlice->getTileGroupAlfEnabledFlag(COMPONENT_Cr) );
             picHeader->setNumAlfAps(pcSlice->getTileGroupNumAps());
             picHeader->setAlfAPSs(pcSlice->getTileGroupApsIdLuma());
             picHeader->setAlfApsIdChroma(pcSlice->getTileGroupApsIdChroma());
@@ -4150,7 +4150,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni
       for( int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx( RefPicList( iRefList ) ); iRefIndex++ )
       {
         const std::pair<int, int>& scaleRatio = pcSlice->getScalingRatio( RefPicList( iRefList ), iRefIndex );
-        
+
         if( pcPic->cs->picHeader->getEnableTMVPFlag() && pcSlice->getColFromL0Flag() == bool(1 - iRefList) && pcSlice->getColRefIdx() == iRefIndex )
         {
           if( scaleRatio.first != 1 << SCALE_RATIO_BITS || scaleRatio.second != 1 << SCALE_RATIO_BITS )
@@ -5069,7 +5069,7 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL
         int refLayerIdx = vps->getGeneralLayerIdx( rpcPic->layerId );
 
         if( rpcPic->referenced && rpcPic->getPOC() == pic->getPOC() && vps->getDirectRefLayerFlag( layerIdx, refLayerIdx ) )
-        {          
+        {
           pLocalRPL0->setRefPicIdentifier( refPicIdxL0, 0, true, true, vps->getInterLayerRefIdc( layerIdx, refLayerIdx ) );
           refPicIdxL0++;
           numOfILRPL0++;
@@ -5135,7 +5135,7 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL
           isAvailable = true;
           break;
         }
-      }      
+      }
     }
 
     if( isAvailable )
@@ -5148,7 +5148,7 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL
     }
   }
 
-  
+
   // inter-layer reference pictures are added to the end of the reference picture list
   if( layerIdx && vps && !vps->getAllIndependentLayersFlag() )
   {
diff --git a/source/Lib/EncoderLib/EncHRD.cpp b/source/Lib/EncoderLib/EncHRD.cpp
index a9022be55b7268d0db5789a7f2d54b5e9ca9f732..dcfb0ebab88e46de4cbb09b0eecac271210539a5 100644
--- a/source/Lib/EncoderLib/EncHRD.cpp
+++ b/source/Lib/EncoderLib/EncHRD.cpp
@@ -151,7 +151,7 @@ void EncHRD::initHRDParameters(EncCfg* encCfg)
   uint32_t duBitRateValue = 0;
   OlsHrdParams* olsHrdParams = getOlsHrdParametersAddr();
 
-  for (i = 0; i < MAX_TLAYER; i++)  
+  for (i = 0; i < MAX_TLAYER; i++)
   {
     OlsHrdParams curOlsHrdParams = olsHrdParams[i];
 
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 9d190f1adba43fc14f63826c65576e02350904c8..6aaee4261f49d95a0980cb2c004cf2396da2fc6a 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -293,7 +293,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
     int curSeqMaxPicWidthY = sps0.getMaxPicWidthInLumaSamples();    // pic_width_max_in_luma_samples
     int curSeqMaxPicHeightY = sps0.getMaxPicHeightInLumaSamples();  // pic_height_max_in_luma_samples
     int curPicWidthY = width;                                       // pic_width_in_luma_samples
-    int curPicHeightY = height;                                     // pic_height_in_luma_samples 
+    int curPicHeightY = height;                                     // pic_height_in_luma_samples
     int max8MinCbSizeY = std::max((int)8, (1 << sps0.getLog2MinCodingBlockSize())); // Max(8, MinCbSizeY)
     //Warning message of potential scaling window size violation
     for (int i = 0; i < 64; i++)
@@ -713,7 +713,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu
  */
 
 bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, int& iNumEncoded )
-{ 
+{
   // compress GOP
   m_cGOPEncoder.compressGOP( m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut,
     false, false, snrCSC, m_printFrameMSE, false, m_picIdInGOP );
@@ -850,7 +850,7 @@ bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitB
 
     m_picIdInGOP++;
   }
-   
+
   // go over all pictures in a GOP excluding first top field and first bottom field
   if( m_picIdInGOP != m_iGOPSize && m_iPOCLast > 1 )
   {
@@ -860,7 +860,7 @@ bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitB
   iNumEncoded += m_iNumPicRcvd;
   m_uiNumAllPicCoded += m_iNumPicRcvd;
   m_iNumPicRcvd = 0;
-  
+
   return false;
 }
 
@@ -1545,7 +1545,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
     pps.setTileRowHeights( m_tileRowHeight );
     pps.initTiles();
     pps.setRectSliceFlag( m_rectSliceFlag );
-    if( m_rectSliceFlag ) 
+    if( m_rectSliceFlag )
     {
       pps.setSingleSlicePerSubPicFlag(m_singleSlicePerSubPicFlag);
       pps.setNumSlicesInPic( m_numSlicesInPic );
@@ -1674,8 +1674,8 @@ void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps
 
   // parameter sets
   picHeader.setSPSId( sps.getSPSId() );
-  picHeader.setPPSId( pps.getPPSId() );  
-  
+  picHeader.setPPSId( pps.getPPSId() );
+
   // merge list sizes
   picHeader.setMaxNumAffineMergeCand(getMaxNumAffineMergeCand());
   // copy partitioning constraints from SPS
@@ -1688,7 +1688,7 @@ void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps
   // quantization
   picHeader.setDepQuantEnabledFlag( sps.getDepQuantEnabledFlag() );
   picHeader.setSignDataHidingEnabledFlag( sps.getSignDataHidingEnabledFlag() );
-  
+
   bool bUseDQP = (getCuQpDeltaSubdiv() > 0)? true : false;
 
   if( (getMaxDeltaQP() != 0 )|| getUseAdaptiveQP() )
@@ -1741,7 +1741,7 @@ void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps
     picHeader.setCuChromaQpOffsetSubdivIntra(0);
     picHeader.setCuChromaQpOffsetSubdivInter(0);
   }
-  
+
 
   // virtual boundaries
   if( sps.getVirtualBoundariesEnabledFlag() )
@@ -1757,7 +1757,7 @@ void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps
 
   // gradual decoder refresh flag
   picHeader.setGdrPicFlag(false);
-  
+
   // BDOF / DMVR / PROF
   picHeader.setDisBdofFlag(false);
   picHeader.setDisDmvrFlag(false);
diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp
index 332cd533248e492900f787c678ea862cc13c1e36..408a6848a970b89d5d2df367519aff8a88779109 100644
--- a/source/Lib/EncoderLib/EncModeCtrl.cpp
+++ b/source/Lib/EncoderLib/EncModeCtrl.cpp
@@ -1642,7 +1642,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
     {
       return false;
     }
-    if( encTestmode.type == ETM_MERGE_GEO && ( partitioner.currArea().lwidth() < GEO_MIN_CU_SIZE || partitioner.currArea().lheight() < GEO_MIN_CU_SIZE  
+    if( encTestmode.type == ETM_MERGE_GEO && ( partitioner.currArea().lwidth() < GEO_MIN_CU_SIZE || partitioner.currArea().lheight() < GEO_MIN_CU_SIZE
                                             || partitioner.currArea().lwidth() > GEO_MAX_CU_SIZE || partitioner.currArea().lheight() > GEO_MAX_CU_SIZE
                                             || partitioner.currArea().lwidth() >= 8 * partitioner.currArea().lheight()
                                             || partitioner.currArea().lheight() >= 8 * partitioner.currArea().lwidth() ) )
diff --git a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp
index f4be381209941fa3e73b4d616a72cc308b83ec16..03fa92b61acbc85a28b5917554e3f8b265a6efcf 100644
--- a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp
+++ b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp
@@ -1556,7 +1556,7 @@ void EncSampleAdaptiveOffset::deriveLoopFilterBoundaryAvailibility(CodingStructu
     isAboveAvail     = (cuAbove == NULL)     ? false : CU::isSameTile(*cuCurr, *cuAbove);
     isAboveLeftAvail = (cuAboveLeft == NULL) ? false : CU::isSameTile(*cuCurr, *cuAboveLeft);
   }
-  else 
+  else
   {
     isLeftAvail      = (cuLeft != NULL);
     isAboveAvail     = (cuAbove != NULL);
diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp
index 70cd379898380748f19c7a48d8897f33b19b61fe..f10fee633a40b88011552edc101793fc3a901758 100644
--- a/source/Lib/EncoderLib/EncSlice.cpp
+++ b/source/Lib/EncoderLib/EncSlice.cpp
@@ -1470,13 +1470,13 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
       int subPicWidth = (int)curSubPic.getSubPicWidthInLumaSample();
       int subPicHeight = (int)curSubPic.getSubPicHeightInLumaSample();
 
-      for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++) 
+      for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++)
       {
         int n = pcSlice->getNumRefIdx((RefPicList)rlist);
-        for (int idx = 0; idx < n; idx++) 
+        for (int idx = 0; idx < n; idx++)
         {
           Picture *refPic = pcSlice->getRefPic((RefPicList)rlist, idx);
-          if (!refPic->getSubPicSaved()) 
+          if (!refPic->getSubPicSaved())
           {
             refPic->saveSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
             refPic->extendSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
@@ -1677,7 +1677,7 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
 
     m_uiPicTotalBits += actualBits;
     m_uiPicDist       = cs.dist;
-    // for last Ctu in the slice    
+    // for last Ctu in the slice
     if (pcSlice->getPPS()->getNumSubPics() >= 2 && curSubPic.getTreatedAsPicFlag() && ctuIdx == (pcSlice->getNumCtuInSlice() - 1))
     {
 
@@ -1686,13 +1686,13 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
       int subPicWidth = (int)curSubPic.getSubPicWidthInLumaSample();
       int subPicHeight = (int)curSubPic.getSubPicHeightInLumaSample();
 
-      for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++) 
+      for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++)
       {
         int n = pcSlice->getNumRefIdx((RefPicList)rlist);
-        for (int idx = 0; idx < n; idx++) 
+        for (int idx = 0; idx < n; idx++)
         {
           Picture *refPic = pcSlice->getRefPic((RefPicList)rlist, idx);
-          if (refPic->getSubPicSaved()) 
+          if (refPic->getSubPicSaved())
           {
             refPic->restoreSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
             refPic->setSubPicSaved(false);
diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp
index 534a75f2daacea5797bbdda4cb27c52b193420f3..bea5d61e505474fc35867858d543ca88aafef359 100644
--- a/source/Lib/EncoderLib/InterSearch.cpp
+++ b/source/Lib/EncoderLib/InterSearch.cpp
@@ -6527,10 +6527,10 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par
         continue;
       }
 
-      
+
       const bool tsAllowed  = TU::isTSAllowed(tu, compID) && (isLuma(compID) || (isChroma(compID) && m_pcEncCfg->getUseChromaTS()));
       const bool mtsAllowed = CU::isMTSAllowed( *tu.cu, compID );
-      
+
       uint8_t nNumTransformCands = 1 + ( tsAllowed ? 1 : 0 ) + ( mtsAllowed ? 4 : 0 ); // DCT + TS + 4 MTS = 6 tests
       std::vector<TrMode> trModes;
       if (m_pcEncCfg->getCostMode() == COST_LOSSLESS_CODING)
@@ -7745,7 +7745,7 @@ void InterSearch::xClipMv( Mv& rcMv, const Position& pos, const struct Size& siz
   int verMax = ( pps.getPicHeightInLumaSamples() + offset - (int)pos.y - 1 ) << mvShift;
   int verMin = ( -( int ) sps.getMaxCUHeight()   - offset - ( int ) pos.y + 1 ) << mvShift;
   const SubPic &curSubPic = pps.getSubPicFromPos(pos);
-  if (curSubPic.getTreatedAsPicFlag()) 
+  if (curSubPic.getTreatedAsPicFlag())
   {
     horMax = ((curSubPic.getSubPicRight() + 1)  + offset - (int)pos.x - 1) << mvShift;
     horMin = (-(int)sps.getMaxCUWidth()  - offset - ((int)pos.x - curSubPic.getSubPicLeft()) + 1) << mvShift;
diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp
index 68806b094714f33829e00772c984dfa34d4e7824..d5e4c502e5aaafb6a269e4353e753d1bdf9b94bd 100644
--- a/source/Lib/EncoderLib/IntraSearch.cpp
+++ b/source/Lib/EncoderLib/IntraSearch.cpp
@@ -1569,7 +1569,7 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo
   reorderPLT(cs, partitioner, compBegin, numComp);
 
   bool idxExist[MAXPLTSIZE + 1] = { false };
-  preCalcPLTIndexRD(cs, partitioner, compBegin, numComp); // Pre-calculate distortions for each pixel 
+  preCalcPLTIndexRD(cs, partitioner, compBegin, numComp); // Pre-calculate distortions for each pixel
   double rdCost = MAX_DOUBLE;
   deriveIndexMap(cs, partitioner, compBegin, numComp, PLT_SCAN_HORTRAV, rdCost, idxExist); // Optimize palette index map (horizontal scan)
   if ((cu.curPLTSize[compBegin] + cu.useEscape[compBegin]) > 1)
@@ -1876,7 +1876,7 @@ void IntraSearch::preCalcPLTIndexRD(CodingStructure& cs, Partitioner& partitione
       }
       double rdCost = (double)error + m_pcRdCost->getLambda()*(double)rate;
       m_indexError[cu.curPLTSize[compBegin]][rasPos] = rdCost;
-      if (rdCost < minError) 
+      if (rdCost < minError)
       {
         minError = rdCost;
         bestIdx = (uint8_t)cu.curPLTSize[compBegin];
@@ -2056,12 +2056,12 @@ bool IntraSearch::deriveSubblockIndexMap(
       aboveScanPos = -1; // first column/row: above row is not valid
     }
 
-// Trellis stats: 
+// Trellis stats:
 // 1st state: same as previous scanned sample
 // 2nd state: Copy_Above mode
-// 3rd state: Index mode 
+// 3rd state: Index mode
 // Loop of current state
-    for ( int curState = 0; curState < NUM_TRELLIS_STATE; curState++ ) 
+    for ( int curState = 0; curState < NUM_TRELLIS_STATE; curState++ )
     {
       double    minRdCost          = MAX_DOUBLE;
       int       minState           = 0; // best prevState
@@ -2081,14 +2081,14 @@ bool IntraSearch::deriveSubblockIndexMap(
       {
         runType = PLT_RUN_COPY;
       }
-      else if ( curState == 2 ) // 3rd state: Index mode 
+      else if ( curState == 2 ) // 3rd state: Index mode
       {
         runType = PLT_RUN_INDEX;
         runIndex = m_minErrorIndexMap[currRasterPos];
       }
 
 // Loop of previous state
-      for ( int stateID = 0; stateID < NUM_TRELLIS_STATE; stateID++ ) 
+      for ( int stateID = 0; stateID < NUM_TRELLIS_STATE; stateID++ )
       {
         if ( m_stateCostRDOQ[refId][stateID] == MAX_DOUBLE )
         {
@@ -2110,7 +2110,7 @@ bool IntraSearch::deriveSubblockIndexMap(
         double rdCost = m_stateCostRDOQ[refId][stateID];
         if ( rdCost >= minRdCost ) continue;
 
-// Calculate Rd cost 
+// Calculate Rd cost
         bool prevCodedRunType = m_prevRunTypeRDOQ[refId][stateID];
         int  prevCodedPos     = m_prevRunPosRDOQ [refId][stateID];
         const BinFracBits* fracBitsPt = (m_prevRunTypeRDOQ[refId][stateID] == PLT_RUN_INDEX) ? fracBitsPltIndexINDEX : fracBitsPltIndexCOPY;
@@ -2419,8 +2419,8 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
 
       ComponentID tmpCompBegin = compBegin;
       int tmpNumComp = numComp;
-      if( cs.sps->getChromaFormatIdc() != CHROMA_444 && 
-          numComp == 3 && 
+      if( cs.sps->getChromaFormatIdc() != CHROMA_444 &&
+          numComp == 3 &&
          (x != ((x >> scaleX) << scaleX) || (y != ((y >> scaleY) << scaleY))) )
       {
         tmpCompBegin = COMPONENT_Y;
@@ -4197,7 +4197,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti
 
     resiBuf.colorSpaceConvert(orgResiBuf, true, cs.slice->clpRng(COMPONENT_Y));
 
-    // 2. luma residual optimization 
+    // 2. luma residual optimization
     double     dSingleCostLuma = MAX_DOUBLE;
     bool       checkTransformSkip = sps.getTransformSkipEnabledFlag();
     int        bestLumaModeId = 0;
@@ -4405,7 +4405,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti
       else
       {
         singleTmpFracBits = xGetIntraFracBitsQT(*csFull, partitioner, true, false, -1, TU_NO_ISP, &cuCtx);
-        
+
         if (tu.mtsIdx[COMPONENT_Y] > MTS_SKIP)
         {
           if (!cuCtx.mtsLastScanPos)
@@ -4686,7 +4686,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti
       bool        cbfDCT2 = true;
 
       trModes.clear();
-      trModes.push_back(TrMode(0, true)); // DCT2 
+      trModes.push_back(TrMode(0, true)); // DCT2
       if (tsAllowed)
       {
         trModes.push_back(TrMode(1, true));//TS
@@ -5032,7 +5032,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio
       }
       CHECK(!currTU.Cb().valid(), "Invalid TU");
 
-      
+
       const int  totalModesToTest            = nNumTransformCands;
       bool cbfDCT2 = true;
       const bool isOneMode                   = false;
@@ -5213,7 +5213,7 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio
 
         if (!checkTSOnly || currTU.cu->bdpcmModeChroma)
         {
-          trModes.push_back(TrMode(0, true)); // DCT2 
+          trModes.push_back(TrMode(0, true)); // DCT2
         }
         if (tsAllowed && !checkDCTOnly)
         {
@@ -5584,7 +5584,7 @@ void IntraSearch::xGetNextISPMode(ModeInfo& modeInfo, const ModeInfo* lastMode,
 
   int maxNumSubPartitions = ispTestedModes.numTotalParts[nextISPcandSplitType - 1];
 
-  // We try to break the split here for lfnst > 0 according to the first mode 
+  // We try to break the split here for lfnst > 0 according to the first mode
   if (curIspLfnstIdx > 0 && ispTestedModes.numTestedModes[nextISPcandSplitType - 1] == 1)
   {
     int firstModeThisSplit = ispTestedModes.getTestedIntraMode(nextISPcandSplitType, 0);
@@ -5612,7 +5612,7 @@ void IntraSearch::xGetNextISPMode(ModeInfo& modeInfo, const ModeInfo* lastMode,
     }
   }
 
-  // We try to break the split here for lfnst = 0 or all lfnst indices according to the first two modes 
+  // We try to break the split here for lfnst = 0 or all lfnst indices according to the first two modes
   if (curIspLfnstIdx == 0 && ispTestedModes.numTestedModes[nextISPcandSplitType - 1] == 2)
   {
     // Split stop criteria after checking the performance of previously tested intra modes
@@ -5653,7 +5653,7 @@ void IntraSearch::xGetNextISPMode(ModeInfo& modeInfo, const ModeInfo* lastMode,
 
     if (!stopThisSplit)
     {
-      // 2) One split type may be discarded by comparing the number of sub-partitions of the best angle modes of both splits 
+      // 2) One split type may be discarded by comparing the number of sub-partitions of the best angle modes of both splits
       ISPType otherSplit = nextISPcandSplitType == HOR_INTRA_SUBPARTITIONS ? VER_INTRA_SUBPARTITIONS : HOR_INTRA_SUBPARTITIONS;
       int  numSubPartsBestMode2OtherSplit = mode2 != -1 ? ispTestedModes.getNumCompletedSubParts(otherSplit, mode2) : -1;
       if (numSubPartsBestMode2OtherSplit != -1 && numSubPartsBestMode2 != -1 && ispTestedModes.bestSplitSoFar != nextISPcandSplitType)
@@ -5795,7 +5795,7 @@ void IntraSearch::xFindAlreadyTestedNearbyIntraModes(int lfnstIdx, int currentIn
     }
   }
 
-  //The mode has not been checked for another lfnstIdx value, so now we look for a similar mode within a window using the same lfnstIdx 
+  //The mode has not been checked for another lfnstIdx value, so now we look for a similar mode within a window using the same lfnstIdx
   for (int k = 1; k <= windowSize; k++)
   {
     int off = currentIntraMode - 2 - k;
@@ -5871,7 +5871,7 @@ bool IntraSearch::xSortISPCandList(double bestCostSoFar, double bestNonISPCost,
 
   ModeInfo refMode = origHadList.at(0);
   auto* destListPtr = &m_ispCandListHor;
-  //List creation 
+  //List creation
 
   if (m_pcEncCfg->getUseFastISP() && bestISPModeInRelCU != -1) //RelCU intra mode
   {
@@ -6079,7 +6079,7 @@ bool IntraSearch::updateISPStatusFromRelCU( double bestNonISPCostCurrCu, ModeInf
 
 void IntraSearch::xFinishISPModes()
 {
-  //Continue to the next lfnst index 
+  //Continue to the next lfnst index
   m_curIspLfnstIdx++;
 
   if (m_curIspLfnstIdx < NUM_LFNST_NUM_PER_SET)
diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h
index 9209a8b1d509c462e4ac24bf6f18b8eea5abcdc9..51a12a1a448a9ef8abf3c3dbf97dc40aa1ba7ce6 100644
--- a/source/Lib/EncoderLib/IntraSearch.h
+++ b/source/Lib/EncoderLib/IntraSearch.h
@@ -155,7 +155,7 @@ public:
     {
       data[comp] = element.data[comp];
       sumData[comp] = data[comp];
-      shift[comp] = 0; 
+      shift[comp] = 0;
       lastCnt[comp] = 1;
     }
   }
@@ -391,7 +391,7 @@ protected:
   uint16_t*       m_escapeNumBins;
   bool            m_bestEscape;
   double*         m_indexError[MAXPLTSIZE + 1];
-  uint8_t*        m_minErrorIndexMap; // store the best index in terms of distortion for each pixel 
+  uint8_t*        m_minErrorIndexMap; // store the best index in terms of distortion for each pixel
   uint8_t         m_indexMapRDOQ   [2][NUM_TRELLIS_STATE][2 * MAX_CU_BLKSIZE_PLT];
   bool            m_runMapRDOQ     [2][NUM_TRELLIS_STATE][2 * MAX_CU_BLKSIZE_PLT];
   uint8_t*        m_statePtRDOQ    [NUM_TRELLIS_STATE];
diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp
index 7b03e825d8cc881b0382616fa7ccba7613f01cf0..7a03748627dbddc6db14a96a78e11eef2160cdcc 100644
--- a/source/Lib/EncoderLib/SEIEncoder.cpp
+++ b/source/Lib/EncoderLib/SEIEncoder.cpp
@@ -182,7 +182,7 @@ void SEIEncoder::initSEIBufferingPeriod(SEIBufferingPeriod *bufferingPeriodSEI,
   // A commercial encoder should track the buffer state for all layers and sub-layers
   // to ensure CPB conformance. Such tracking is required for calculating alternative
   // CPB parameters.
-  // Unfortunately VTM does not have such tracking. Thus we cannot encode alternative 
+  // Unfortunately VTM does not have such tracking. Thus we cannot encode alternative
   // CPB parameters here.
   bufferingPeriodSEI->m_altCpbParamsPresentFlag = false;
   bufferingPeriodSEI->m_useAltCpbParamsFlag = false;
@@ -275,7 +275,7 @@ void SEIEncoder::initSEIRegionWisePacking(SEIRegionWisePacking *seiRegionWisePac
   seiRegionWisePacking->m_rwpTopGuardBandHeight.resize(seiRegionWisePacking->m_numPackedRegions);
   seiRegionWisePacking->m_rwpBottomGuardBandHeight.resize(seiRegionWisePacking->m_numPackedRegions);
   seiRegionWisePacking->m_rwpGuardBandNotUsedForPredFlag.resize(seiRegionWisePacking->m_numPackedRegions);
-  seiRegionWisePacking->m_rwpGuardBandType.resize(4*seiRegionWisePacking->m_numPackedRegions); 
+  seiRegionWisePacking->m_rwpGuardBandType.resize(4*seiRegionWisePacking->m_numPackedRegions);
   for( int i=0; i < seiRegionWisePacking->m_numPackedRegions; i++ )
   {
     seiRegionWisePacking->m_rwpTransformType[i]                  = m_pcCfg->getRwpSEIRwpTransformType(i);
@@ -374,15 +374,15 @@ void SEIEncoder::initSEISampleAspectRatioInfo(SEISampleAspectRatioInfo* seiSampl
 //! initialize scalable nesting SEI message.
 //! Note: The SEI message structures input into this function will become part of the scalable nesting SEI and will be
 //!       automatically freed, when the nesting SEI is disposed.
-void SEIEncoder::initSEIScalableNesting(SEIScalableNesting *scalableNestingSEI, SEIMessages &nestedSEIs) 
+void SEIEncoder::initSEIScalableNesting(SEIScalableNesting *scalableNestingSEI, SEIMessages &nestedSEIs)
 {
   CHECK(!(m_isInitialized), "Unspecified error");
   CHECK(!(scalableNestingSEI != NULL), "Unspecified error");
   scalableNestingSEI->m_nestingOlsFlag = 1;         // by If the nested SEI messages are picture buffering SEI messages, picture timing SEI messages or sub-picture timing SEI messages, nesting_ols_flag shall be equal to 1, by default case
-  scalableNestingSEI->m_nestingNumOlssMinus1 =  1;  // by default the nesting scalable SEI message applies to two OLSs. 
+  scalableNestingSEI->m_nestingNumOlssMinus1 =  1;  // by default the nesting scalable SEI message applies to two OLSs.
   for (int i = 0; i <= scalableNestingSEI->m_nestingNumOlssMinus1; i++)
   {
-    scalableNestingSEI->m_nestingOlsIdxDeltaMinus1[i] = 0; // first ols to which nesting SEI applies is  
+    scalableNestingSEI->m_nestingOlsIdxDeltaMinus1[i] = 0; // first ols to which nesting SEI applies is
   }
   for (int i = 0; i <= scalableNestingSEI->m_nestingNumOlssMinus1; i++)
   {
diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp
index cc18bb9eb142291803562a21ae21219c793edcfc..813af429f75ad4cfb141d52955adc4c5f3c78ef7 100644
--- a/source/Lib/EncoderLib/SEIwrite.cpp
+++ b/source/Lib/EncoderLib/SEIwrite.cpp
@@ -327,12 +327,12 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei)
 
 void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SEIBufferingPeriod &bp, const uint32_t temporalId)
 {
-  
+
   WRITE_CODE( sei.m_auCpbRemovalDelay[bp.m_bpMaxSubLayers - 1] - 1, bp.m_cpbRemovalDelayLength,               "cpb_removal_delay_minus1[bp_max_sub_layers_minus1]" );
-  if( bp.m_altCpbParamsPresentFlag ) 
+  if( bp.m_altCpbParamsPresentFlag )
   {
     WRITE_FLAG( sei.m_cpbAltTimingInfoPresentFlag, "cpb_alt_timing_info_present_flag" );
-    if( sei.m_cpbAltTimingInfoPresentFlag ) 
+    if( sei.m_cpbAltTimingInfoPresentFlag )
     {
       for (int i = (bp.m_sublayerInitialCpbRemovalDelayPresentFlag ? 0 : bp.m_bpMaxSubLayers - 1);
            i <= bp.m_bpMaxSubLayers - 1; ++i)
@@ -552,9 +552,9 @@ void SEIWriter::xWriteSEIEquirectangularProjection(const SEIEquirectangularProje
     WRITE_CODE( 0, 2, "erp_reserved_zero_2bits" );
     if ( sei.m_erpGuardBandFlag == 1)
     {
-      WRITE_CODE( sei.m_erpGuardBandType,       3, "erp_guard_band_type" );  
-      WRITE_CODE( sei.m_erpLeftGuardBandWidth,  8, "erp_left_guard_band_width" );  
-      WRITE_CODE( sei.m_erpRightGuardBandWidth, 8, "erp_right_guard_band_width" );  
+      WRITE_CODE( sei.m_erpGuardBandType,       3, "erp_guard_band_type" );
+      WRITE_CODE( sei.m_erpLeftGuardBandWidth,  8, "erp_left_guard_band_width" );
+      WRITE_CODE( sei.m_erpRightGuardBandWidth, 8, "erp_right_guard_band_width" );
     }
   }
 }
@@ -566,9 +566,9 @@ void SEIWriter::xWriteSEISphereRotation(const SEISphereRotation &sei)
   {
     WRITE_FLAG( sei.m_sphereRotationPersistenceFlag,    "sphere_rotation_persistence_flag" );
     WRITE_CODE( 0,                                   6, "sphere_rotation_reserved_zero_6bits" );
-    WRITE_SCODE(sei.m_sphereRotationYaw,            32, "sphere_rotation_yaw" );  
-    WRITE_SCODE(sei.m_sphereRotationPitch,          32, "sphere_rotation_pitch" );  
-    WRITE_SCODE(sei.m_sphereRotationRoll,           32, "sphere_rotation_roll" );  
+    WRITE_SCODE(sei.m_sphereRotationYaw,            32, "sphere_rotation_yaw" );
+    WRITE_SCODE(sei.m_sphereRotationPitch,          32, "sphere_rotation_pitch" );
+    WRITE_SCODE(sei.m_sphereRotationRoll,           32, "sphere_rotation_roll" );
   }
 }
 
@@ -584,9 +584,9 @@ void SEIWriter::xWriteSEIOmniViewport(const SEIOmniViewport &sei)
     for(uint32_t region=0; region<numRegions; region++)
     {
       const SEIOmniViewport::OmniViewport &viewport=sei.m_omniViewportRegions[region];
-      WRITE_SCODE( viewport.azimuthCentre,     32,  "omni_viewport_azimuth_centre"   );  
-      WRITE_SCODE( viewport.elevationCentre,   32,  "omni_viewport_elevation_centre" );  
-      WRITE_SCODE( viewport.tiltCentre,        32,  "omni_viewport_tilt_center" );  
+      WRITE_SCODE( viewport.azimuthCentre,     32,  "omni_viewport_azimuth_centre"   );
+      WRITE_SCODE( viewport.elevationCentre,   32,  "omni_viewport_elevation_centre" );
+      WRITE_SCODE( viewport.tiltCentre,        32,  "omni_viewport_tilt_center" );
       WRITE_CODE( viewport.horRange,           32, "omni_viewport_hor_range[i]" );
       WRITE_CODE( viewport.verRange,           32, "omni_viewport_ver_range[i]" );
     }
@@ -607,7 +607,7 @@ void SEIWriter::xWriteSEIRegionWisePacking(const SEIRegionWisePacking &sei)
     WRITE_CODE( (uint32_t)sei.m_packedPictureWidth,               16,            "packed_picture_width" );
     WRITE_CODE( (uint32_t)sei.m_packedPictureHeight,              16,            "packed_picture_height" );
     for( int i=0; i < sei.m_numPackedRegions; i++ )
-    { 
+    {
       WRITE_CODE( 0, 4,                                                      "rwp_reserved_zero_4bits" );
       WRITE_CODE( (uint32_t)sei.m_rwpTransformType[i],            3,             "rwp_tTransform_type" );
       WRITE_FLAG( sei.m_rwpGuardBandFlag[i],                                 "rwp_guard_band_flag" );
@@ -642,18 +642,18 @@ void SEIWriter::xWriteSEIGeneralizedCubemapProjection(const SEIGeneralizedCubema
   if (!sei.m_gcmpCancelFlag)
   {
     WRITE_FLAG( sei.m_gcmpPersistenceFlag,                    "gcmp_persistence_flag" );
-    WRITE_CODE( sei.m_gcmpPackingType,                     3, "gcmp_packing_type" );  
+    WRITE_CODE( sei.m_gcmpPackingType,                     3, "gcmp_packing_type" );
     WRITE_CODE( sei.m_gcmpMappingFunctionType,             2, "gcmp_mapping_function_type" );
     int numFace = sei.m_gcmpPackingType == 4 || sei.m_gcmpPackingType == 5 ? 5 : 6;
     for (int i = 0; i < numFace; i++)
     {
-      WRITE_CODE( sei.m_gcmpFaceIndex[i],                  3, "gcmp_face_index" );  
-      WRITE_CODE( sei.m_gcmpFaceRotation[i],               2, "gcmp_face_rotation" );  
+      WRITE_CODE( sei.m_gcmpFaceIndex[i],                  3, "gcmp_face_index" );
+      WRITE_CODE( sei.m_gcmpFaceRotation[i],               2, "gcmp_face_rotation" );
       if (sei.m_gcmpMappingFunctionType == 2)
       {
-        WRITE_CODE( sei.m_gcmpFunctionCoeffU[i],           7, "gcmp_function_coeff_u" );  
+        WRITE_CODE( sei.m_gcmpFunctionCoeffU[i],           7, "gcmp_function_coeff_u" );
         WRITE_FLAG( sei.m_gcmpFunctionUAffectedByVFlag[i],    "gcmp_function_u_affected_by_v_flag" );
-        WRITE_CODE( sei.m_gcmpFunctionCoeffV[i],           7, "gcmp_function_coeff_v" );  
+        WRITE_CODE( sei.m_gcmpFunctionCoeffV[i],           7, "gcmp_function_coeff_v" );
         WRITE_FLAG( sei.m_gcmpFunctionVAffectedByUFlag[i],    "gcmp_function_v_affected_by_u_flag" );
       }
     }
@@ -662,7 +662,7 @@ void SEIWriter::xWriteSEIGeneralizedCubemapProjection(const SEIGeneralizedCubema
     {
       WRITE_CODE( sei.m_gcmpGuardBandType,                 3, "gcmp_guard_band_type" );
       WRITE_FLAG( sei.m_gcmpGuardBandBoundaryExteriorFlag,    "gcmp_guard_band_boundary_exterior_flag" );
-      WRITE_CODE( sei.m_gcmpGuardBandSamplesMinus1,        4, "gcmp_guard_band_samples_minus1" );  
+      WRITE_CODE( sei.m_gcmpGuardBandSamplesMinus1,        4, "gcmp_guard_band_samples_minus1" );
     }
   }
 }
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 907d13689e4473b5ae501889f7ed3c1049e71422..a0bcd579a4e32e4e498f389b36d7d1f561aae951 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -299,11 +299,11 @@ void HLSWriter::codePPS( const PPS* pcPPS )
 
     // CTU size - required to match size in SPS
     WRITE_CODE( pcPPS->getLog2CtuSize() - 5, 2, "pps_log2_ctu_size_minus5" );
-    
+
     // number of explicit tile columns/rows
     WRITE_UVLC( pcPPS->getNumExpTileColumns() - 1, "num_exp_tile_columns_minus1" );
     WRITE_UVLC( pcPPS->getNumExpTileRows() - 1,    "num_exp_tile_rows_minus1" );
-        
+
     // tile sizes
     for( colIdx = 0; colIdx < pcPPS->getNumExpTileColumns(); colIdx++ )
     {
@@ -313,7 +313,7 @@ void HLSWriter::codePPS( const PPS* pcPPS )
     {
       WRITE_UVLC( pcPPS->getTileRowHeight( rowIdx ) - 1, "tile_row_height_minus1[i]" );
     }
-     
+
     // rectangular slice signalling
     if (pcPPS->getNumTiles() > 1)
     {
@@ -324,13 +324,13 @@ void HLSWriter::codePPS( const PPS* pcPPS )
       WRITE_FLAG(pcPPS->getSingleSlicePerSubPicFlag( ) ? 1 : 0, "single_slice_per_subpic_flag");
     }
     if (pcPPS->getRectSliceFlag() & !(pcPPS->getSingleSlicePerSubPicFlag()))
-    {      
+    {
       WRITE_UVLC( pcPPS->getNumSlicesInPic( ) - 1, "num_slices_in_pic_minus1" );
       if ((pcPPS->getNumSlicesInPic() - 1) > 0)
       {
         WRITE_FLAG(pcPPS->getTileIdxDeltaPresentFlag() ? 1 : 0, "tile_idx_delta_present_flag");
       }
-      
+
       // write rectangular slice parameters
       for( int i = 0; i < pcPPS->getNumSlicesInPic()-1; i++ )
       {
@@ -370,9 +370,9 @@ void HLSWriter::codePPS( const PPS* pcPPS )
         }
 
         // tile index offset to start of next slice
-        if( i < pcPPS->getNumSlicesInPic()-1 ) 
+        if( i < pcPPS->getNumSlicesInPic()-1 )
         {
-          if( pcPPS->getTileIdxDeltaPresentFlag() ) 
+          if( pcPPS->getTileIdxDeltaPresentFlag() )
           {
             int32_t  tileIdxDelta = pcPPS->getSliceTileIdx( i + 1 ) - pcPPS->getSliceTileIdx( i );
             WRITE_SVLC( tileIdxDelta,  "tile_idx_delta[i]" );
@@ -658,7 +658,7 @@ void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS )
     {
       WRITE_UVLC(pcVUI->getChromaSampleLocType(),         "vui_chroma_sample_loc_type");
     }
-    else 
+    else
     {
       WRITE_UVLC(pcVUI->getChromaSampleLocTypeTopField(),         "vui_chroma_sample_loc_type_top_field");
       WRITE_UVLC(pcVUI->getChromaSampleLocTypeBottomField(),      "vui_chroma_sample_loc_type_bottom_field");
@@ -754,7 +754,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   {
     codeProfileTierLevel(pcSPS->getProfileTierLevel(), true, pcSPS->getMaxTLayers() - 1);
   }
-  
+
   WRITE_FLAG(pcSPS->getGDREnabledFlag(), "gdr_enabled_flag");
   WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc");
 
@@ -833,7 +833,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
 
   WRITE_UVLC( pcSPS->getBitDepth(CHANNEL_TYPE_LUMA) - 8,                      "bit_depth_minus8" );
   WRITE_FLAG( pcSPS->getEntropyCodingSyncEnabledFlag() ? 1 : 0, "sps_entropy_coding_sync_enabled_flag" );
-  if (pcSPS->getEntropyCodingSyncEnabledFlag()) 
+  if (pcSPS->getEntropyCodingSyncEnabledFlag())
   {
     WRITE_FLAG( pcSPS->getEntropyCodingSyncEntryPointsPresentFlag() ? 1 : 0, "sps_wpp_entry_point_offsets_present_flag" );
   }
@@ -889,7 +889,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
       xCodeRefPicList( rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred() );
     }
   }
-  if( pcSPS->getChromaFormatIdc() != CHROMA_400 ) 
+  if( pcSPS->getChromaFormatIdc() != CHROMA_400 )
   {
     WRITE_FLAG(pcSPS->getUseDualITree(), "qtbtt_dual_tree_intra_flag");
   }
@@ -991,7 +991,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   WRITE_FLAG( pcSPS->getUseISP() ? 1 : 0,                                             "sps_isp_enabled_flag");
   WRITE_FLAG( pcSPS->getUseMRL() ? 1 : 0,                                             "sps_mrl_enabled_flag");
   WRITE_FLAG( pcSPS->getUseMIP() ? 1 : 0,                                             "sps_mip_enabled_flag");
-  if( pcSPS->getChromaFormatIdc() != CHROMA_400) 
+  if( pcSPS->getChromaFormatIdc() != CHROMA_400)
   {
     WRITE_FLAG( pcSPS->getUseLMChroma() ? 1 : 0,                                      "sps_cclm_enabled_flag");
   }
@@ -1217,7 +1217,7 @@ void HLSWriter::codeVPS(const VPS* pcVPS)
   WRITE_CODE(pcVPS->getVPSId(), 4, "vps_video_parameter_set_id");
   WRITE_CODE(pcVPS->getMaxLayers() - 1, 6, "vps_max_layers_minus1");
   WRITE_CODE(pcVPS->getMaxSubLayers() - 1, 3, "vps_max_sublayers_minus1");
-  if (pcVPS->getMaxLayers() > 1 && pcVPS->getMaxSubLayers() > 1) 
+  if (pcVPS->getMaxLayers() > 1 && pcVPS->getMaxSubLayers() > 1)
   {
     WRITE_FLAG(pcVPS->getAllLayersSameNumSublayersFlag(), "vps_all_layers_same_num_sublayers_flag");
   }
@@ -1242,11 +1242,11 @@ void HLSWriter::codeVPS(const VPS* pcVPS)
   }
   if( pcVPS->getMaxLayers() > 1 )
   {
-    if (pcVPS->getAllIndependentLayersFlag()) 
+    if (pcVPS->getAllIndependentLayersFlag())
     {
       WRITE_FLAG(pcVPS->getEachLayerIsAnOlsFlag(), "each_layer_is_an_ols_flag");
     }
-    if (!pcVPS->getEachLayerIsAnOlsFlag()) 
+    if (!pcVPS->getEachLayerIsAnOlsFlag())
     {
       if (!pcVPS->getAllIndependentLayersFlag()) {
         WRITE_CODE(pcVPS->getOlsModeIdc(), 2, "ols_mode_idc");
@@ -1270,9 +1270,9 @@ void HLSWriter::codeVPS(const VPS* pcVPS)
   for (int i = 0; i < pcVPS->getNumPtls(); i++)
   {
     if(i > 0)
-      WRITE_FLAG(pcVPS->getPtPresentFlag(i), "pt_present_flag");           
+      WRITE_FLAG(pcVPS->getPtPresentFlag(i), "pt_present_flag");
     if(pcVPS->getMaxSubLayers() > 1 && !pcVPS->getAllLayersSameNumSublayersFlag())
-      WRITE_CODE(pcVPS->getPtlMaxTemporalId(i) ,3, "ptl_max_temporal_id");    
+      WRITE_CODE(pcVPS->getPtlMaxTemporalId(i) ,3, "ptl_max_temporal_id");
   }
   int cnt = 0;
   while (m_pcBitIf->getNumBitsUntilByteAligned())
@@ -1413,11 +1413,11 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
   {
     WRITE_FLAG(picHeader->getNoOutputOfPriorPicsFlag(), "no_output_of_prior_pics_flag");
   }
-  if( picHeader->getGdrPicFlag() ) 
+  if( picHeader->getGdrPicFlag() )
   {
     WRITE_UVLC(picHeader->getRecoveryPocCnt(), "recovery_poc_cnt");
   }
-  else 
+  else
   {
     picHeader->setRecoveryPocCnt( 0 );
   }
@@ -1425,7 +1425,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
   // as these bits are reserved for future extensions
   // for( i = 0; i < NumExtraPhBits; i++ )
   //    ph_extra_bit[ i ]
-            
+
   if (sps->getPocMsbFlag())
   {
     WRITE_FLAG(picHeader->getPocMsbPresentFlag(), "ph_poc_msb_present_flag");
@@ -1530,7 +1530,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
     picHeader->setExplicitScalingListEnabledFlag( false );
   }
 
-  
+
 
   // virtual boundaries
   if( sps->getVirtualBoundariesEnabledFlag() && !sps->getVirtualBoundariesPresentFlag() )
@@ -1563,21 +1563,21 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
       {
        picHeader->setNumVerVirtualBoundaries( sps->getNumVerVirtualBoundaries() );
        picHeader->setNumHorVirtualBoundaries( sps->getNumHorVirtualBoundaries() );
-      for( unsigned i = 0; i < 3; i++ ) 
+      for( unsigned i = 0; i < 3; i++ )
       {
         picHeader->setVirtualBoundariesPosX( sps->getVirtualBoundariesPosX(i), i );
         picHeader->setVirtualBoundariesPosY( sps->getVirtualBoundariesPosY(i), i );
       }
     }
   }
-  
-  
+
+
   // picture output flag
   if( pps->getOutputFlagPresentFlag() )
   {
     WRITE_FLAG( picHeader->getPicOutputFlag(), "pic_output_flag" );
   }
-  else 
+  else
   {
     picHeader->setPicOutputFlag(true);
   }
@@ -1586,8 +1586,8 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
   if (pps->getRplInfoInPhFlag())
   {
     // List0 and List1
-    for(int listIdx = 0; listIdx < 2; listIdx++) 
-    {                 
+    for(int listIdx = 0; listIdx < 2; listIdx++)
+    {
       if(sps->getNumRPL(listIdx) > 0 &&
           (listIdx == 0 || (listIdx == 1 && pps->getRpl1IdxPresentFlag())))
       {
@@ -1635,7 +1635,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
           if (picHeader->getRPL(listIdx)->isRefPicLongterm(i))
           {
             if (picHeader->getRPL(listIdx)->getLtrpInSliceHeaderFlag())
-            { 
+            {
               WRITE_CODE(picHeader->getRPL(listIdx)->getRefPicIdentifier(i), sps->getBitsForPOC(),
                          "poc_lsb_lt[listIdx][rplsIdx][j]");
             }
@@ -1691,7 +1691,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
     {
       WRITE_UVLC( picHeader->getCuQpDeltaSubdivIntra(), "ph_cu_qp_delta_subdiv_intra_slice" );
     }
-    else 
+    else
     {
       picHeader->setCuQpDeltaSubdivIntra( 0 );
     }
@@ -1699,7 +1699,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
     {
       WRITE_UVLC( picHeader->getCuChromaQpOffsetSubdivIntra(), "ph_cu_chroma_qp_offset_subdiv_intra_slice" );
     }
-    else 
+    else
     {
       picHeader->setCuChromaQpOffsetSubdivIntra( 0 );
     }
@@ -1757,7 +1757,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
 
   // mvd L1 zero flag
     WRITE_FLAG(picHeader->getMvdL1ZeroFlag(), "mvd_l1_zero_flag");
-   
+
   // merge candidate list size
   // subblock merge candidate list size
     if ( sps->getUseAffine() )
@@ -1778,7 +1778,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
     {
       picHeader->setDisFracMMVD(false);
     }
-  
+
   // picture level BDOF disable flags
     if (sps->getBdofControlPresentFlag())
     {
@@ -1842,25 +1842,25 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
   if(sps->getSAOEnabledFlag())
   {
     if (pps->getSaoInfoInPhFlag())
-    {    
+    {
       WRITE_FLAG(picHeader->getSaoEnabledFlag(CHANNEL_TYPE_LUMA), "ph_sao_luma_enabled_flag");
       if (sps->getChromaFormatIdc() != CHROMA_400)
       {
         WRITE_FLAG(picHeader->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA), "ph_sao_chroma_enabled_flag");
       }
     }
-    else 
+    else
     {
       picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA,   true);
       picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, true);
     }
   }
-  else 
+  else
   {
     picHeader->setSaoEnabledFlag(CHANNEL_TYPE_LUMA,   false);
     picHeader->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, false);
   }
-  
+
 
   // dependent quantization
   if (sps->getDepQuantEnabledFlag())
@@ -1885,13 +1885,13 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
   if (pps->getDeblockingFilterControlPresentFlag())
   {
     if(pps->getDeblockingFilterOverrideEnabledFlag())
-    {    
+    {
       if (pps->getDbfInfoInPhFlag())
       {
         WRITE_FLAG ( picHeader->getDeblockingFilterOverrideFlag(), "ph_deblocking_filter_override_flag" );
       }
       else
-      {    
+      {
         picHeader->setDeblockingFilterOverrideFlag(false);
       }
     }
@@ -1941,7 +1941,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
   {
     WRITE_UVLC(0,"ph_extension_length");
   }
-  
+
   if ( writeRbspTrailingBits )
   {
     xWriteRbspTrailingBits();
@@ -1973,23 +1973,23 @@ void HLSWriter::codeSliceHeader         ( Slice* pcSlice )
   }
 
   // raster scan slices
-  if( pcSlice->getPPS()->getRectSliceFlag() == 0 ) 
+  if( pcSlice->getPPS()->getRectSliceFlag() == 0 )
   {
     // slice address is the raster scan tile index of first tile in slice
-    if( pcSlice->getPPS()->getNumTiles() > 1 ) 
-    {      
+    if( pcSlice->getPPS()->getNumTiles() > 1 )
+    {
       int bitsSliceAddress = ceilLog2(pcSlice->getPPS()->getNumTiles());
       WRITE_CODE( pcSlice->getSliceID(), bitsSliceAddress, "slice_address");
       WRITE_UVLC( pcSlice->getNumTilesInSlice() - 1, "num_tiles_in_slice_minus1");
     }
   }
   // rectangular slices
-  else 
+  else
   {
     // slice address is the index of the slice within the current sub-picture
     uint32_t currSubPicIdx = pcSlice->getPPS()->getSubPicIdxFromSubPicId( pcSlice->getSliceSubPicId() );
     SubPic currSubPic = pcSlice->getPPS()->getSubPic(currSubPicIdx);
-    if( currSubPic.getNumSlicesInSubPic() > 1 ) 
+    if( currSubPic.getNumSlicesInSubPic() > 1 )
     {
       int numSlicesInPreviousSubPics = 0;
       for(int sp = 0; sp < currSubPicIdx; sp++)
@@ -2661,7 +2661,7 @@ void HLSWriter::xCodePredWeightTable(PicHeader *picHeader, const SPS *sps)
 void HLSWriter::codeScalingList( const ScalingList &scalingList )
 {
   //for each size
-  WRITE_FLAG(scalingList.getDisableScalingMatrixForLfnstBlks(), "scaling_matrix_for_lfnst_disabled_flag"); 
+  WRITE_FLAG(scalingList.getDisableScalingMatrixForLfnstBlks(), "scaling_matrix_for_lfnst_disabled_flag");
   WRITE_FLAG(scalingList.getChromaScalingListPresentFlag(), "scaling_list_chroma_present_flag");
   for (uint32_t scalingListId = 0; scalingListId < 28; scalingListId++)
   {