From 67056f16b12556484cd7dc3a5b24d12a21d7acd9 Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Tue, 25 Oct 2022 10:03:10 +0200
Subject: [PATCH] Fix variable names

---
 .../BitstreamExtractorApp.cpp                 |  13 +-
 .../App/SEIFilmGrainApp/SEIFilmGrainApp.cpp   |   2 +-
 source/App/StreamMergeApp/StreamMergeApp.cpp  |   6 +-
 source/App/SubpicMergeApp/SubpicMergeApp.cpp  |  32 +-
 source/Lib/CommonLib/Contexts.cpp             |  58 ++-
 source/Lib/CommonLib/Contexts.h               |  48 ++-
 source/Lib/DecoderLib/BinDecoder.cpp          | 170 ++++-----
 source/Lib/DecoderLib/BinDecoder.h            |  14 +-
 source/Lib/DecoderLib/CABACReader.cpp         | 323 ++++++++--------
 source/Lib/DecoderLib/CABACReader.h           |  18 +-
 source/Lib/DecoderLib/NALread.h               |  10 +-
 source/Lib/EncoderLib/BinEncoder.cpp          | 173 ++++-----
 source/Lib/EncoderLib/BinEncoder.h            |  76 ++--
 source/Lib/EncoderLib/CABACWriter.cpp         | 353 +++++++++---------
 source/Lib/EncoderLib/CABACWriter.h           |  39 +-
 source/Lib/EncoderLib/EncCu.cpp               |   4 +-
 source/Lib/EncoderLib/EncCu.h                 |   2 +-
 source/Lib/EncoderLib/EncGOP.cpp              |  34 +-
 source/Lib/EncoderLib/NALwrite.cpp            |   2 +-
 source/Lib/EncoderLib/NALwrite.h              |  14 +-
 20 files changed, 698 insertions(+), 693 deletions(-)

diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
index 3ce50dad7..a5a2cadca 100644
--- a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
+++ b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
@@ -387,7 +387,7 @@ void BitstreamExtractorApp::xWriteVPS(VPS *vps, std::ostream& out, int layerId,
   CHECK( naluOut.m_temporalId, "The value of TemporalId of VPS NAL units shall be equal to 0" );
 
   // write the VPS to the newly created NAL unit buffer
-  m_hlSyntaxWriter.setBitstream( &naluOut.m_Bitstream );
+  m_hlSyntaxWriter.setBitstream(&naluOut.m_bitstream);
   m_hlSyntaxWriter.codeVPS( vps );
 
   NALUnitEBSP naluWithHeader(naluOut);
@@ -401,7 +401,7 @@ void BitstreamExtractorApp::xWriteSPS(SPS *sps, std::ostream& out, int layerId,
   CHECK( naluOut.m_temporalId, "The value of TemporalId of SPS NAL units shall be equal to 0" );
 
   // write the SPS to the newly created NAL unit buffer
-  m_hlSyntaxWriter.setBitstream( &naluOut.m_Bitstream );
+  m_hlSyntaxWriter.setBitstream(&naluOut.m_bitstream);
   m_hlSyntaxWriter.codeSPS( sps );
 
   NALUnitEBSP naluWithHeader(naluOut);
@@ -414,7 +414,7 @@ void BitstreamExtractorApp::xWritePPS(PPS *pps, std::ostream& out, int layerId,
   OutputNALUnit naluOut (NAL_UNIT_PPS, layerId, temporalId);
 
   // write the PPS to the newly created NAL unit buffer
-  m_hlSyntaxWriter.setBitstream( &naluOut.m_Bitstream );
+  m_hlSyntaxWriter.setBitstream(&naluOut.m_bitstream);
   m_hlSyntaxWriter.codePPS( pps );
 
   NALUnitEBSP naluWithHeader(naluOut);
@@ -457,7 +457,7 @@ bool BitstreamExtractorApp::xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit
       {
         // applies to target subpicture -> extract
         OutputNALUnit outNalu( nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId );
-        m_seiWriter.writeSEImessages(outNalu.m_Bitstream, sei->m_nestedSEIs, m_hrd, false, nalu.m_temporalId);
+        m_seiWriter.writeSEImessages(outNalu.m_bitstream, sei->m_nestedSEIs, m_hrd, false, nalu.m_temporalId);
         NALUnitEBSP naluWithHeader(outNalu);
         writeAnnexBNalUnit(out, naluWithHeader, true);
         return false;
@@ -829,7 +829,8 @@ uint32_t BitstreamExtractorApp::decode()
                 if (seiNesting->m_snOlsFlag || vps->getNumLayersInOls(m_targetOlsIdx) == 1)
                 {
                   OutputNALUnit outNalu(nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId);
-                  m_seiWriter.writeSEImessages(outNalu.m_Bitstream, seiNesting->m_nestedSEIs, m_hrd, false, nalu.m_temporalId);
+                  m_seiWriter.writeSEImessages(outNalu.m_bitstream, seiNesting->m_nestedSEIs, m_hrd, false,
+                                               nalu.m_temporalId);
                   NALUnitEBSP naluWithHeader(outNalu);
                   writeAnnexBNalUnit(bitstreamFileOut, naluWithHeader, true);
                   writeInpuNalUnitToStream = false;
@@ -894,7 +895,7 @@ uint32_t BitstreamExtractorApp::decode()
 
         // create output NAL unit
         OutputNALUnit out (nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId);
-        out.m_Bitstream.getFIFO() = nalu.getBitstream().getFifo();
+        out.m_bitstream.getFIFO() = nalu.getBitstream().getFifo();
         // write with start code emulation prevention
         writeNaluContent (bitstreamFileOut, out);
       }
diff --git a/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp b/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp
index acbb18c2e..bcb41eee5 100644
--- a/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp
+++ b/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp
@@ -260,7 +260,7 @@ uint32_t SEIFilmGrainApp::process()
                                        || nalu.m_nalUnitType == NAL_UNIT_PPS || nalu.m_nalUnitType == NAL_UNIT_PREFIX_APS || nalu.m_nalUnitType == NAL_UNIT_SUFFIX_APS);
         SEIMessages currentMessages = extractSeisByType(SEIs, SEI::FILM_GRAIN_CHARACTERISTICS);
         OutputNALUnit outNalu(NAL_UNIT_PREFIX_SEI, nalu.m_nuhLayerId, nalu.m_temporalId);
-        m_seiWriter.writeSEImessages(outNalu.m_Bitstream, currentMessages, m_hrd, false, nalu.m_temporalId);
+        m_seiWriter.writeSEImessages(outNalu.m_bitstream, currentMessages, m_hrd, false, nalu.m_temporalId);
         NALUnitEBSP naluWithHeader(outNalu);
         writeAnnexBNalUnit(bitstreamFileOut, naluWithHeader, useLongStartCode);
       }
diff --git a/source/App/StreamMergeApp/StreamMergeApp.cpp b/source/App/StreamMergeApp/StreamMergeApp.cpp
index 27db563ee..1f6811a7e 100644
--- a/source/App/StreamMergeApp/StreamMergeApp.cpp
+++ b/source/App/StreamMergeApp/StreamMergeApp.cpp
@@ -392,7 +392,7 @@ bool StreamMergeApp::preInjectNalu(MergeLayer &layer, InputNALUnit &inNalu, Outp
   HLSyntaxReader hlsReader;
   HLSWriter      hlsWriter;
   hlsReader.setBitstream(&inNalu.getBitstream());
-  hlsWriter.setBitstream(&outNalu.m_Bitstream);
+  hlsWriter.setBitstream(&outNalu.m_bitstream);
 
   switch (inNalu.m_nalUnitType)
   {
@@ -433,7 +433,7 @@ void StreamMergeApp::decodeAndRewriteNalu(MergeLayer &layer, InputNALUnit &inNal
   HLSyntaxReader hlsReader;
   HLSWriter      hlsWriter;
   hlsReader.setBitstream(&inNalu.getBitstream());
-  hlsWriter.setBitstream(&outNalu.m_Bitstream);
+  hlsWriter.setBitstream(&outNalu.m_bitstream);
 
   msg(INFO, " layer %i, nalu type ", layer.id);
   switch (inNalu.m_nalUnitType)
@@ -523,7 +523,7 @@ void StreamMergeApp::decodeAndRewriteNalu(MergeLayer &layer, InputNALUnit &inNal
     msg(INFO, " with index %i", inNalu.m_nalUnitType);
     // Copy payload from input nalu to output nalu. Code copied from SubpicMergeApp::copyInputNaluToOutputNalu().
     vector<uint8_t> &inFifo  = inNalu.getBitstream().getFifo();
-    vector<uint8_t> &outFifo = outNalu.m_Bitstream.getFIFO();
+    vector<uint8_t> &outFifo = outNalu.m_bitstream.getFIFO();
     outFifo                  = vector<uint8_t>(inFifo.begin() + 2, inFifo.end());
     break;
   }
diff --git a/source/App/SubpicMergeApp/SubpicMergeApp.cpp b/source/App/SubpicMergeApp/SubpicMergeApp.cpp
index c8a4ee832..6494ac497 100644
--- a/source/App/SubpicMergeApp/SubpicMergeApp.cpp
+++ b/source/App/SubpicMergeApp/SubpicMergeApp.cpp
@@ -828,7 +828,7 @@ void SubpicMergeApp::copyInputNaluToOutputNalu(OutputNALUnit &outNalu, InputNALU
 
   // Copy payload
   std::vector<uint8_t> &inFifo = inNalu.getBitstream().getFifo();
-  std::vector<uint8_t> &outFifo = outNalu.m_Bitstream.getFIFO();
+  std::vector<uint8_t> &outFifo = outNalu.m_bitstream.getFIFO();
   outFifo = std::vector<uint8_t>(inFifo.begin() + 2, inFifo.end());
 }
 
@@ -942,7 +942,7 @@ void SubpicMergeApp::generateMergedPic(ParameterSetManager &psManager, bool mixe
   if (subpic0.dciPresent)
   {
     OutputNALUnit nalu(NAL_UNIT_DCI);
-    hlsWriter.setBitstream( &nalu.m_Bitstream );
+    hlsWriter.setBitstream(&nalu.m_bitstream);
     hlsWriter.codeDCI(&subpic0.dci);
     accessUnit.push_back(new NALUnitEBSP(nalu));
   }
@@ -953,9 +953,9 @@ void SubpicMergeApp::generateMergedPic(ParameterSetManager &psManager, bool mixe
   for (auto vps : vpsList)
   {
     OutputNALUnit nalu(NAL_UNIT_VPS);
-    hlsWriter.setBitstream( &nalu.m_Bitstream );
+    hlsWriter.setBitstream(&nalu.m_bitstream);
     hlsWriter.codeVPS(vps);
-    psManager.storeVPS(vps, nalu.m_Bitstream.getFIFO());
+    psManager.storeVPS(vps, nalu.m_bitstream.getFIFO());
     accessUnit.push_back(new NALUnitEBSP(nalu));
   }
 
@@ -965,9 +965,9 @@ void SubpicMergeApp::generateMergedPic(ParameterSetManager &psManager, bool mixe
   for (auto sps : spsList)
   {
     OutputNALUnit nalu(NAL_UNIT_SPS);
-    hlsWriter.setBitstream( &nalu.m_Bitstream );
+    hlsWriter.setBitstream(&nalu.m_bitstream);
     hlsWriter.codeSPS(sps);
-    psManager.storeSPS(sps, nalu.m_Bitstream.getFIFO());
+    psManager.storeSPS(sps, nalu.m_bitstream.getFIFO());
     accessUnit.push_back(new NALUnitEBSP(nalu));
   }
 
@@ -987,19 +987,19 @@ void SubpicMergeApp::generateMergedPic(ParameterSetManager &psManager, bool mixe
     }
 
     OutputNALUnit nalu(NAL_UNIT_PPS);
-    hlsWriter.setBitstream( &nalu.m_Bitstream );
+    hlsWriter.setBitstream(&nalu.m_bitstream);
     hlsWriter.codePPS(pps);
-    psManager.storePPS(pps, nalu.m_Bitstream.getFIFO());
+    psManager.storePPS(pps, nalu.m_bitstream.getFIFO());
     accessUnit.push_back(new NALUnitEBSP(nalu));
 
     if (mixedNaluFlag)
     {
       OutputNALUnit naluMixed(NAL_UNIT_PPS);
-      hlsWriter.setBitstream( &naluMixed.m_Bitstream );
+      hlsWriter.setBitstream(&naluMixed.m_bitstream);
       ppsMixed->setPPSId(ppsMixed->getPPSId() + MIXED_NALU_PPS_OFFSET);
       ppsMixed->setMixedNaluTypesInPicFlag(true);
       hlsWriter.codePPS(ppsMixed);
-      psManager.storePPS(ppsMixed, naluMixed.m_Bitstream.getFIFO());
+      psManager.storePPS(ppsMixed, naluMixed.m_bitstream.getFIFO());
       accessUnit.push_back(new NALUnitEBSP(naluMixed));
     }
   }
@@ -1018,7 +1018,7 @@ void SubpicMergeApp::generateMergedPic(ParameterSetManager &psManager, bool mixe
         if (std::find(usedApsIds.begin(), usedApsIds.end(), apsIdIt->first) == usedApsIds.end())
         {
         OutputNALUnit naluOut(NAL_UNIT_PREFIX_APS, nalu.m_nuhLayerId, nalu.m_temporalId);
-        hlsWriter.setBitstream( &naluOut.m_Bitstream );
+        hlsWriter.setBitstream(&naluOut.m_bitstream);
         hlsWriter.codeAPS(subpic.psManager.getAPS(apsIdIt->first, apsIdIt->second));
         accessUnit.push_back(new NALUnitEBSP(naluOut));
         apsIdIt++;
@@ -1046,7 +1046,7 @@ void SubpicMergeApp::generateMergedPic(ParameterSetManager &psManager, bool mixe
         if (writePicHeader)
         {
           OutputNALUnit naluOut(NAL_UNIT_PH, nalu.m_nuhLayerId, nalu.m_temporalId);  // Copy IDs from slice NALU
-          hlsWriter.setBitstream( &naluOut.m_Bitstream );
+          hlsWriter.setBitstream(&naluOut.m_bitstream);
           if (isMixedNaluPic)
           {
             subpicForPicHeader.picHeader.setPPSId(subpicForPicHeader.picHeader.getPPSId() + MIXED_NALU_PPS_OFFSET);
@@ -1056,10 +1056,10 @@ void SubpicMergeApp::generateMergedPic(ParameterSetManager &psManager, bool mixe
           writePicHeader = false;
         }
         OutputNALUnit naluOut(nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId);
-        hlsWriter.setBitstream( &naluOut.m_Bitstream );
+        hlsWriter.setBitstream(&naluOut.m_bitstream);
         hlsWriter.codeSliceHeader(&(*slice), &subpicForPicHeader.picHeader);
-        naluOut.m_Bitstream.writeByteAlignment();
-        naluOut.m_Bitstream.addSubstream(&(*sliceData));
+        naluOut.m_bitstream.writeByteAlignment();
+        naluOut.m_bitstream.addSubstream(&(*sliceData));
         accessUnit.push_back(new NALUnitEBSP(naluOut));
         slice++;
         sliceData++;
@@ -1091,7 +1091,7 @@ void SubpicMergeApp::generateMergedPic(ParameterSetManager &psManager, bool mixe
       seiEncoder.initSEIScalableNesting(nestingSEI, nestedSEI, targetOLS, targetLayers, subPicIds, maxSubpicIdInPic);
       OutputNALUnit nalu( NAL_UNIT_SUFFIX_SEI, layerId, temporalId );
       seiMessages.push_back(nestingSEI);
-      seiWriter.writeSEImessages(nalu.m_Bitstream, seiMessages, hrd, false, temporalId);
+      seiWriter.writeSEImessages(nalu.m_bitstream, seiMessages, hrd, false, temporalId);
       accessUnit.push_back(new NALUnitEBSP(nalu));
     }
     subpicId++;
diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp
index 6eb1dd577..62fba6fe7 100644
--- a/source/Lib/CommonLib/Contexts.cpp
+++ b/source/Lib/CommonLib/Contexts.cpp
@@ -882,71 +882,67 @@ const CtxSet ContextSetCfg::Sao = { ContextSetCfg::SaoMergeFlag, ContextSetCfg::
 
 const CtxSet ContextSetCfg::Alf = { ContextSetCfg::ctbAlfFlag, ContextSetCfg::ctbAlfAlternative, ContextSetCfg::AlfUseTemporalFilt };
 
-template <class BinProbModel>
-CtxStore<BinProbModel>::CtxStore()
-  : m_CtxBuffer ()
-  , m_Ctx       ( nullptr )
-{}
+template<class BinProbModel> CtxStore<BinProbModel>::CtxStore() : m_ctxBuffer(), m_ctx(nullptr) {}
 
-template <class BinProbModel>
-CtxStore<BinProbModel>::CtxStore( bool dummy )
-  : m_CtxBuffer ( ContextSetCfg::NumberOfContexts )
-  , m_Ctx       ( m_CtxBuffer.data() )
+template<class BinProbModel>
+CtxStore<BinProbModel>::CtxStore(bool dummy) : m_ctxBuffer(ContextSetCfg::NumberOfContexts), m_ctx(m_ctxBuffer.data())
 {}
 
-template <class BinProbModel>
-CtxStore<BinProbModel>::CtxStore( const CtxStore<BinProbModel>& ctxStore )
-  : m_CtxBuffer ( ctxStore.m_CtxBuffer )
-  , m_Ctx       ( m_CtxBuffer.data() )
+template<class BinProbModel>
+CtxStore<BinProbModel>::CtxStore(const CtxStore<BinProbModel> &ctxStore)
+  : m_ctxBuffer(ctxStore.m_ctxBuffer), m_ctx(m_ctxBuffer.data())
 {}
 
 template <class BinProbModel>
 void CtxStore<BinProbModel>::init( int qp, int initId )
 {
   const std::vector<uint8_t>& initTable = ContextSetCfg::getInitTable( initId );
-  CHECK( m_CtxBuffer.size() != initTable.size(),
-        "Size of init table (" << initTable.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
+  CHECK(m_ctxBuffer.size() != initTable.size(), "Size of init table (" << initTable.size()
+                                                                       << ") does not match size of context buffer ("
+                                                                       << m_ctxBuffer.size() << ").");
   const std::vector<uint8_t> &rateInitTable = ContextSetCfg::getInitTable(NUMBER_OF_SLICE_TYPES);
-  CHECK(m_CtxBuffer.size() != rateInitTable.size(),
+  CHECK(m_ctxBuffer.size() != rateInitTable.size(),
         "Size of rate init table (" << rateInitTable.size() << ") does not match size of context buffer ("
-                                    << m_CtxBuffer.size() << ").");
+                                    << m_ctxBuffer.size() << ").");
   int clippedQP = Clip3( 0, MAX_QP, qp );
-  for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
+  for (std::size_t k = 0; k < m_ctxBuffer.size(); k++)
   {
-    m_CtxBuffer[k].init( clippedQP, initTable[k] );
-    m_CtxBuffer[k].setLog2WindowSize(rateInitTable[k]);
+    m_ctxBuffer[k].init(clippedQP, initTable[k]);
+    m_ctxBuffer[k].setLog2WindowSize(rateInitTable[k]);
   }
 }
 
 template <class BinProbModel>
 void CtxStore<BinProbModel>::setWinSizes( const std::vector<uint8_t>& log2WindowSizes )
 {
-  CHECK( m_CtxBuffer.size() != log2WindowSizes.size(),
-        "Size of window size table (" << log2WindowSizes.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
-  for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
+  CHECK(m_ctxBuffer.size() != log2WindowSizes.size(),
+        "Size of window size table (" << log2WindowSizes.size() << ") does not match size of context buffer ("
+                                      << m_ctxBuffer.size() << ").");
+  for (std::size_t k = 0; k < m_ctxBuffer.size(); k++)
   {
-    m_CtxBuffer[k].setLog2WindowSize( log2WindowSizes[k] );
+    m_ctxBuffer[k].setLog2WindowSize(log2WindowSizes[k]);
   }
 }
 
 template <class BinProbModel>
 void CtxStore<BinProbModel>::loadPStates( const std::vector<uint16_t>& probStates )
 {
-  CHECK( m_CtxBuffer.size() != probStates.size(),
-        "Size of prob states table (" << probStates.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
-  for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
+  CHECK(m_ctxBuffer.size() != probStates.size(), "Size of prob states table ("
+                                                   << probStates.size() << ") does not match size of context buffer ("
+                                                   << m_ctxBuffer.size() << ").");
+  for (std::size_t k = 0; k < m_ctxBuffer.size(); k++)
   {
-    m_CtxBuffer[k].setState( probStates[k] );
+    m_ctxBuffer[k].setState(probStates[k]);
   }
 }
 
 template <class BinProbModel>
 void CtxStore<BinProbModel>::savePStates( std::vector<uint16_t>& probStates ) const
 {
-  probStates.resize( m_CtxBuffer.size(), uint16_t(0) );
-  for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
+  probStates.resize(m_ctxBuffer.size(), uint16_t(0));
+  for (std::size_t k = 0; k < m_ctxBuffer.size(); k++)
   {
-    probStates[k] = m_CtxBuffer[k].getState();
+    probStates[k] = m_ctxBuffer[k].getState();
   }
 }
 
diff --git a/source/Lib/CommonLib/Contexts.h b/source/Lib/CommonLib/Contexts.h
index ed273947e..43ae79631 100644
--- a/source/Lib/CommonLib/Contexts.h
+++ b/source/Lib/CommonLib/Contexts.h
@@ -135,7 +135,7 @@ public:
       q = q ^ 0xff;
     return ((q >> 2) * (range >> 5) >> 1) + 4;
   }
-  static uint8_t  getRenormBitsLPS  ( unsigned LPS )                    { return    m_RenormTable_32  [LPS>>3]; }
+  static uint8_t  getRenormBitsLPS(unsigned lpsRange) { return m_RenormTable_32[lpsRange >> 3]; }
   static uint8_t  getRenormBitsRange( unsigned range )                  { return    1; }
   uint16_t getState() const { return m_state[0] + m_state[1]; }
   void     setState(uint16_t pState)
@@ -300,25 +300,41 @@ public:
   CtxStore( bool dummy );
   CtxStore( const CtxStore<BinProbModel>& ctxStore );
 public:
-  void copyFrom   ( const CtxStore<BinProbModel>& src )                        { checkInit(); ::memcpy( m_Ctx,               src.m_Ctx,               sizeof( BinProbModel ) * ContextSetCfg::NumberOfContexts ); }
-  void copyFrom   ( const CtxStore<BinProbModel>& src, const CtxSet& ctxSet )  { checkInit(); ::memcpy( m_Ctx+ctxSet.Offset, src.m_Ctx+ctxSet.Offset, sizeof( BinProbModel ) * ctxSet.Size ); }
+  void copyFrom(const CtxStore<BinProbModel> &src)
+  {
+    checkInit();
+    ::memcpy(m_ctx, src.m_ctx, sizeof(BinProbModel) * ContextSetCfg::NumberOfContexts);
+  }
+  void copyFrom(const CtxStore<BinProbModel> &src, const CtxSet &ctxSet)
+  {
+    checkInit();
+    ::memcpy(m_ctx + ctxSet.Offset, src.m_ctx + ctxSet.Offset, sizeof(BinProbModel) * ctxSet.Size);
+  }
   void init       ( int qp, int initId );
   void setWinSizes( const std::vector<uint8_t>&   log2WindowSizes );
   void loadPStates( const std::vector<uint16_t>&  probStates );
   void savePStates( std::vector<uint16_t>&        probStates )  const;
 
-  const BinProbModel& operator[]      ( unsigned  ctxId  )  const { return m_Ctx[ctxId]; }
-  BinProbModel&       operator[]      ( unsigned  ctxId  )        { return m_Ctx[ctxId]; }
-  uint32_t            estFracBits     ( unsigned  bin,
-                                        unsigned  ctxId  )  const { return m_Ctx[ctxId].estFracBits(bin); }
+  const BinProbModel &operator[](unsigned ctxId) const { return m_ctx[ctxId]; }
+  BinProbModel       &operator[](unsigned ctxId) { return m_ctx[ctxId]; }
+  uint32_t            estFracBits(unsigned bin, unsigned ctxId) const { return m_ctx[ctxId].estFracBits(bin); }
 
-  BinFracBits         getFracBitsArray( unsigned  ctxId  )  const { return m_Ctx[ctxId].getFracBitsArray(); }
+  BinFracBits getFracBitsArray(unsigned ctxId) const { return m_ctx[ctxId].getFracBitsArray(); }
 
 private:
-  inline void checkInit() { if( m_Ctx ) return; m_CtxBuffer.resize( ContextSetCfg::NumberOfContexts ); m_Ctx = m_CtxBuffer.data(); }
+  inline void checkInit()
+  {
+    if (m_ctx)
+    {
+      return;
+    }
+    m_ctxBuffer.resize(ContextSetCfg::NumberOfContexts);
+    m_ctx = m_ctxBuffer.data();
+  }
+
 private:
-  std::vector<BinProbModel> m_CtxBuffer;
-  BinProbModel*             m_Ctx;
+  std::vector<BinProbModel> m_ctxBuffer;
+  BinProbModel             *m_ctx;
 };
 
 
@@ -328,12 +344,12 @@ class SubCtx
 {
   friend class Ctx;
 public:
-  SubCtx( const CtxSet& ctxSet, const Ctx& ctx ) : m_CtxSet( ctxSet          ), m_Ctx( ctx          ) {}
-  SubCtx( const SubCtx& subCtx )                 : m_CtxSet( subCtx.m_CtxSet ), m_Ctx( subCtx.m_Ctx ) {}
+  SubCtx(const CtxSet &ctxSet, const Ctx &ctx) : m_CtxSet(ctxSet), m_ctx(ctx) {}
+  SubCtx(const SubCtx &subCtx) : m_CtxSet(subCtx.m_CtxSet), m_ctx(subCtx.m_ctx) {}
   const SubCtx& operator= ( const SubCtx& ) = delete;
 private:
   const CtxSet  m_CtxSet;
-  const Ctx&    m_Ctx;
+  const Ctx    &m_ctx;
 };
 
 
@@ -360,10 +376,10 @@ public:
 
   SubCtx operator= ( SubCtx&& subCtx )
   {
-    m_BPMType = subCtx.m_Ctx.m_BPMType;
+    m_BPMType = subCtx.m_ctx.m_BPMType;
     switch( m_BPMType )
     {
-    case BPM_Std:   m_CtxStore_Std  .copyFrom( subCtx.m_Ctx.m_CtxStore_Std,   subCtx.m_CtxSet );  break;
+    case BPM_Std: m_CtxStore_Std.copyFrom(subCtx.m_ctx.m_CtxStore_Std, subCtx.m_CtxSet); break;
     default:        break;
     }
     return std::move(subCtx);
diff --git a/source/Lib/DecoderLib/BinDecoder.cpp b/source/Lib/DecoderLib/BinDecoder.cpp
index 705dfac5f..7079893e2 100644
--- a/source/Lib/DecoderLib/BinDecoder.cpp
+++ b/source/Lib/DecoderLib/BinDecoder.cpp
@@ -44,53 +44,40 @@
 
 #include "CommonLib/dtrace_next.h"
 
-#define CNT_OFFSET 0
-
-
-
-template <class BinProbModel>
-BinDecoderBase::BinDecoderBase( const BinProbModel* dummy )
-  : Ctx         ( dummy )
-  , m_Bitstream ( 0 )
-  , m_Range     ( 0 )
-  , m_Value     ( 0 )
-  , m_bitsNeeded( 0 )
+template<class BinProbModel>
+BinDecoderBase::BinDecoderBase(const BinProbModel *dummy)
+  : Ctx(dummy), m_bitstream(nullptr), m_range(0), m_value(0), m_bitsNeeded(0)
 {}
 
-
 void BinDecoderBase::init( InputBitstream* bitstream )
 {
-  m_Bitstream = bitstream;
+  m_bitstream = bitstream;
 }
 
-
 void BinDecoderBase::uninit()
 {
-  m_Bitstream = 0;
+  m_bitstream = nullptr;
 }
 
-
 void BinDecoderBase::start()
 {
-  CHECK( m_Bitstream->getNumBitsUntilByteAligned(), "Bitstream is not byte aligned." );
+  CHECK(m_bitstream->getNumBitsUntilByteAligned(), "Bitstream is not byte aligned.");
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
   CodingStatistics::UpdateCABACStat(STATS__CABAC_INITIALISATION, 512, 510, 0);
 #endif
-  m_Range       = 510;
-  m_Value       = ( m_Bitstream->readByte() << 8 ) + m_Bitstream->readByte();
+  m_range       = 510;
+  m_value       = (m_bitstream->readByte() << 8) + m_bitstream->readByte();
   m_bitsNeeded  = -8;
 }
 
-
 void BinDecoderBase::finish()
 {
   unsigned lastByte;
-  m_Bitstream->peekPreviousByte( lastByte );
+  m_bitstream->peekPreviousByte(lastByte);
   CHECK( ( ( lastByte << ( 8 + m_bitsNeeded ) ) & 0xff ) != 0x80,
         "No proper stop/alignment pattern at end of CABAC stream." );
 }
 
-
 void BinDecoderBase::reset( int qp, int initId )
 {
   Ctx::init( qp, initId );
@@ -104,35 +91,34 @@ void BinDecoderBase::riceStatReset(int bitDepth, bool persistentRiceAdaptationEn
 
 unsigned BinDecoderBase::decodeBinEP()
 {
-  m_Value            += m_Value;
+  m_value += m_value;
   if( ++m_bitsNeeded >= 0 )
   {
-    m_Value          += m_Bitstream->readByte();
+    m_value += m_bitstream->readByte();
     m_bitsNeeded      = -8;
   }
 
   unsigned bin = 0;
-  unsigned SR  = m_Range << 7;
-  if( m_Value >= SR )
+  unsigned scaledRange = m_range << 7;
+  if (m_value >= scaledRange)
   {
-    m_Value   -= SR;
+    m_value -= scaledRange;
     bin        = 1;
   }
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
   CodingStatistics::IncrementStatisticEP( *ptype, 1, int(bin) );
 #endif
-  DTRACE( g_trace_ctx, D_CABAC, "%d" "  " "%d" "  EP=%d \n",  DTRACE_GET_COUNTER( g_trace_ctx, D_CABAC ), m_Range, bin );
+  DTRACE(g_trace_ctx, D_CABAC, "%d  %d  EP=%d \n", DTRACE_GET_COUNTER(g_trace_ctx, D_CABAC), m_range, bin);
   return bin;
 }
 
-
 unsigned BinDecoderBase::decodeBinsEP( unsigned numBins )
 {
 #if ENABLE_TRACING
   int numBinsOrig = numBins;
 #endif
 
-  if( m_Range == 256 )
+  if (m_range == 256)
   {
     return decodeAlignedBinsEP( numBins );
   }
@@ -140,36 +126,36 @@ unsigned BinDecoderBase::decodeBinsEP( unsigned numBins )
   unsigned bins    = 0;
   while(   remBins > 8 )
   {
-    m_Value     = ( m_Value << 8 ) + ( m_Bitstream->readByte() << ( 8 + m_bitsNeeded ) );
-    unsigned SR =   m_Range << 15;
+    m_value              = (m_value << 8) + (m_bitstream->readByte() << (8 + m_bitsNeeded));
+    unsigned scaledRange = m_range << 15;
     for( int i = 0; i < 8; i++ )
     {
       bins += bins;
-      SR  >>= 1;
-      if( m_Value >= SR )
+      scaledRange >>= 1;
+      if (m_value >= scaledRange)
       {
         bins    ++;
-        m_Value -= SR;
+        m_value -= scaledRange;
       }
     }
     remBins -= 8;
   }
   m_bitsNeeded   += remBins;
-  m_Value       <<= remBins;
+  m_value <<= remBins;
   if( m_bitsNeeded >= 0 )
   {
-    m_Value      += m_Bitstream->readByte() << m_bitsNeeded;
+    m_value += m_bitstream->readByte() << m_bitsNeeded;
     m_bitsNeeded -= 8;
   }
-  unsigned SR = m_Range << ( remBins + 7 );
+  unsigned scaledRange = m_range << (remBins + 7);
   for ( int i = 0; i < remBins; i++ )
   {
     bins += bins;
-    SR  >>= 1;
-    if( m_Value >= SR )
+    scaledRange >>= 1;
+    if (m_value >= scaledRange)
     {
       bins    ++;
-      m_Value -= SR;
+      m_value -= scaledRange;
     }
   }
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
@@ -178,7 +164,8 @@ unsigned BinDecoderBase::decodeBinsEP( unsigned numBins )
 #if ENABLE_TRACING
   for( int i = 0; i < numBinsOrig; i++ )
   {
-    DTRACE( g_trace_ctx, D_CABAC, "%d" "  " "%d" "  EP=%d \n", DTRACE_GET_COUNTER( g_trace_ctx, D_CABAC ), m_Range, ( bins >> ( numBinsOrig - 1 - i ) ) & 1 );
+    DTRACE(g_trace_ctx, D_CABAC, "%d  %d  EP=%d \n", DTRACE_GET_COUNTER(g_trace_ctx, D_CABAC), m_range,
+           (bins >> (numBinsOrig - 1 - i)) & 1);
   }
 #endif
   return bins;
@@ -213,15 +200,14 @@ unsigned BinDecoderBase::decodeRemAbsEP(unsigned goRicePar, unsigned cutoff, int
   return offset + decodeBinsEP(length);
 }
 
-
 unsigned BinDecoderBase::decodeBinTrm()
 {
-  m_Range    -= 2;
-  unsigned SR = m_Range << 7;
-  if( m_Value >= SR )
+  m_range -= 2;
+  unsigned scaledRange = m_range << 7;
+  if (m_value >= scaledRange)
   {
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
-    CodingStatistics::UpdateCABACStat     ( STATS__CABAC_TRM_BITS,       m_Range+2, 2, 1 );
+    CodingStatistics::UpdateCABACStat(STATS__CABAC_TRM_BITS, m_range + 2, 2, 1);
     CodingStatistics::IncrementStatisticEP( STATS__BYTE_ALIGNMENT_BITS, -m_bitsNeeded, 0 );
 #endif
     return 1;
@@ -229,15 +215,15 @@ unsigned BinDecoderBase::decodeBinTrm()
   else
   {
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
-    CodingStatistics::UpdateCABACStat ( STATS__CABAC_TRM_BITS, m_Range+2, m_Range, 0 );
+    CodingStatistics::UpdateCABACStat(STATS__CABAC_TRM_BITS, m_range + 2, m_range, 0);
 #endif
-    if( m_Range < 256 )
+    if (m_range < 256)
     {
-      m_Range += m_Range;
-      m_Value += m_Value;
+      m_range += m_range;
+      m_value += m_value;
       if( ++m_bitsNeeded == 0 )
       {
-        m_Value      += m_Bitstream->readByte();
+        m_value += m_bitstream->readByte();
         m_bitsNeeded  = -8;
       }
     }
@@ -245,18 +231,14 @@ unsigned BinDecoderBase::decodeBinTrm()
   }
 }
 
-
-
-
 void BinDecoderBase::align()
 {
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
-  CodingStatistics::UpdateCABACStat( STATS__CABAC_EP_BIT_ALIGNMENT, m_Range, 256, 0 );
+  CodingStatistics::UpdateCABACStat(STATS__CABAC_EP_BIT_ALIGNMENT, m_range, 256, 0);
 #endif
-  m_Range = 256;
+  m_range = 256;
 }
 
-
 unsigned BinDecoderBase::decodeAlignedBinsEP( unsigned numBins )
 {
 #if ENABLE_TRACING
@@ -266,24 +248,25 @@ unsigned BinDecoderBase::decodeAlignedBinsEP( unsigned numBins )
   unsigned bins    = 0;
   while(   remBins > 0 )
   {
-    // The MSB of m_Value is known to be 0 because range is 256. Therefore:
+    // The MSB of m_value is known to be 0 because range is 256. Therefore:
     //   > The comparison against the symbol range of 128 is simply a test on the next-most-significant bit
     //   > "Subtracting" the symbol range if the decoded bin is 1 simply involves clearing that bit.
-    //  As a result, the required bins are simply the <binsToRead> next-most-significant bits of m_Value
-    //  (m_Value is stored MSB-aligned in a 16-bit buffer - hence the shift of 15)
+    //  As a result, the required bins are simply the <binsToRead> next-most-significant bits of m_value
+    //  (m_value is stored MSB-aligned in a 16-bit buffer - hence the shift of 15)
     //
-    //    m_Value = |0|V|V|V|V|V|V|V|V|B|B|B|B|B|B|B|        (V = usable bit, B = potential buffered bit (buffer refills when m_bitsNeeded >= 0))
+    //    m_value = |0|V|V|V|V|V|V|V|V|B|B|B|B|B|B|B|
+    //    (V = usable bit, B = potential buffered bit (buffer refills when m_bitsNeeded >= 0))
     //
     unsigned binsToRead = std::min<unsigned>( remBins, 8 ); //read bytes if able to take advantage of the system's byte-read function
     unsigned binMask    = ( 1 << binsToRead ) - 1;
-    unsigned newBins    = ( m_Value >> (15 - binsToRead) ) & binMask;
+    unsigned newBins    = (m_value >> (15 - binsToRead)) & binMask;
     bins                = ( bins    << binsToRead) | newBins;
-    m_Value             = ( m_Value << binsToRead) & 0x7FFF;
+    m_value             = (m_value << binsToRead) & 0x7FFF;
     remBins            -= binsToRead;
     m_bitsNeeded       += binsToRead;
     if( m_bitsNeeded >= 0 )
     {
-      m_Value          |= m_Bitstream->readByte() << m_bitsNeeded;
+      m_value |= m_bitstream->readByte() << m_bitsNeeded;
       m_bitsNeeded     -= 8;
     }
   }
@@ -293,49 +276,46 @@ unsigned BinDecoderBase::decodeAlignedBinsEP( unsigned numBins )
 #if ENABLE_TRACING
   for( int i = 0; i < numBinsOrig; i++ )
   {
-    DTRACE( g_trace_ctx, D_CABAC, "%d" "  " "%d" "  " "EP=%d \n", DTRACE_GET_COUNTER( g_trace_ctx, D_CABAC ), m_Range, ( bins >> ( numBinsOrig - 1 - i ) ) & 1 );
+    DTRACE(g_trace_ctx, D_CABAC, "%d  %d  EP=%d \n", DTRACE_GET_COUNTER(g_trace_ctx, D_CABAC), m_range,
+           (bins >> (numBinsOrig - 1 - i)) & 1);
   }
 #endif
   return bins;
 }
 
-
-
-
-template <class BinProbModel>
+template<class BinProbModel>
 TBinDecoder<BinProbModel>::TBinDecoder()
-  : BinDecoderBase( static_cast<const BinProbModel*>    ( nullptr ) )
-  , m_Ctx         ( static_cast<CtxStore<BinProbModel>&>( *this   ) )
+  : BinDecoderBase(static_cast<const BinProbModel *>(nullptr)), m_ctx(static_cast<CtxStore<BinProbModel> &>(*this))
 {}
 
-
 template <class BinProbModel>
 unsigned TBinDecoder<BinProbModel>::decodeBin( unsigned ctxId )
 {
-  BinProbModel& rcProbModel = m_Ctx[ctxId];
-  unsigned      bin         = rcProbModel.mps();
-  uint32_t      LPS         = rcProbModel.getLPS( m_Range );
+  BinProbModel &probModel = m_ctx[ctxId];
+  unsigned      bin       = probModel.mps();
+  uint32_t      lpsRange  = probModel.getLPS(m_range);
 
-  DTRACE( g_trace_ctx, D_CABAC, "%d" " %d " "%d" "  " "[%d:%d]" "  " "%2d(MPS=%d)"  "  " , DTRACE_GET_COUNTER( g_trace_ctx, D_CABAC ), ctxId, m_Range, m_Range-LPS, LPS, ( unsigned int )( rcProbModel.state() ), m_Value < ( ( m_Range - LPS ) << 7 ) );
-  //DTRACE( g_trace_ctx, D_CABAC, " %d " "%d" "  " "[%d:%d]" "  " "%2d(MPS=%d)"  "  ", DTRACE_GET_COUNTER( g_trace_ctx, D_CABAC ), m_Range, m_Range - LPS, LPS, (unsigned int)( rcProbModel.state() ), m_Value < ( ( m_Range - LPS ) << 7 ) );
+  DTRACE(g_trace_ctx, D_CABAC, "%d %d %d  [%d:%d]  %2d(MPS=%d)  ", DTRACE_GET_COUNTER(g_trace_ctx, D_CABAC), ctxId,
+         m_range, m_range - lpsRange, lpsRange, (unsigned int) (probModel.state()),
+         m_value < ((m_range - lpsRange) << 7));
 
-  m_Range   -=  LPS;
-  uint32_t      SR          = m_Range << 7;
-  if( m_Value < SR )
+  m_range -= lpsRange;
+  uint32_t scaledRange = m_range << 7;
+  if (m_value < scaledRange)
   {
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
-    CodingStatistics::UpdateCABACStat( *ptype, m_Range+LPS, m_Range, int( bin ) );
+    CodingStatistics::UpdateCABACStat(*ptype, m_range + lpsRange, m_range, int(bin));
 #endif
     // MPS path
-    if( m_Range < 256 )
+    if (m_range < 256)
     {
-      int numBits   = rcProbModel.getRenormBitsRange( m_Range );
-      m_Range     <<= numBits;
-      m_Value     <<= numBits;
+      int numBits = probModel.getRenormBitsRange(m_range);
+      m_range <<= numBits;
+      m_value <<= numBits;
       m_bitsNeeded += numBits;
       if( m_bitsNeeded >= 0 )
       {
-        m_Value      += m_Bitstream->readByte() << m_bitsNeeded;
+        m_value += m_bitstream->readByte() << m_bitsNeeded;
         m_bitsNeeded -= 8;
       }
     }
@@ -344,27 +324,25 @@ unsigned TBinDecoder<BinProbModel>::decodeBin( unsigned ctxId )
   {
     bin = 1 - bin;
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
-    CodingStatistics::UpdateCABACStat( *ptype, m_Range+LPS, LPS, int( bin ) );
+    CodingStatistics::UpdateCABACStat(*ptype, m_range + lpsRange, lpsRange, int(bin));
 #endif
     // LPS path
-    int numBits   = rcProbModel.getRenormBitsLPS( LPS );
-    m_Value      -= SR;
-    m_Value       = m_Value << numBits;
-    m_Range       = LPS     << numBits;
+    int numBits = probModel.getRenormBitsLPS(lpsRange);
+    m_value -= scaledRange;
+    m_value = m_value << numBits;
+    m_range = lpsRange << numBits;
     m_bitsNeeded += numBits;
     if( m_bitsNeeded >= 0 )
     {
-      m_Value      += m_Bitstream->readByte() << m_bitsNeeded;
+      m_value += m_bitstream->readByte() << m_bitsNeeded;
       m_bitsNeeded -= 8;
     }
   }
-  rcProbModel.update( bin );
+  probModel.update(bin);
   //DTRACE_DECR_COUNTER( g_trace_ctx, D_CABAC );
   DTRACE_WITHOUT_COUNT( g_trace_ctx, D_CABAC, "  -  " "%d" "\n", bin );
   return  bin;
 }
 
-
-
 template class TBinDecoder<BinProbModel_Std>;
 
diff --git a/source/Lib/DecoderLib/BinDecoder.h b/source/Lib/DecoderLib/BinDecoder.h
index f84c6ee6d..e3a1f43ca 100644
--- a/source/Lib/DecoderLib/BinDecoder.h
+++ b/source/Lib/DecoderLib/BinDecoder.h
@@ -75,13 +75,17 @@ public:
   unsigned          decodeRemAbsEP      ( unsigned goRicePar, unsigned cutoff, int maxLog2TrDynamicRange );
   unsigned          decodeBinTrm        ();
   void              align               ();
-  unsigned          getNumBitsRead      () { return m_Bitstream->getNumBitsRead() + m_bitsNeeded; }
+  unsigned          getNumBitsRead()
+  {
+    return m_bitstream->getNumBitsRead() + m_bitsNeeded;
+  }
+
 private:
   unsigned          decodeAlignedBinsEP ( unsigned numBins  );
 protected:
-  InputBitstream*   m_Bitstream;
-  uint32_t          m_Range;
-  uint32_t          m_Value;
+  InputBitstream   *m_bitstream;
+  uint32_t          m_range;
+  uint32_t          m_value;
   int32_t           m_bitsNeeded;
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
   const CodingStatisticsClassType* ptype;
@@ -98,7 +102,7 @@ public:
   ~TBinDecoder() {}
   unsigned decodeBin ( unsigned ctxId );
 private:
-  CtxStore<BinProbModel>& m_Ctx;
+  CtxStore<BinProbModel> &m_ctx;
 };
 
 
diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index d839199f9..50972faf9 100644
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -49,11 +49,19 @@
 #endif
 
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
-#define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(x)           const CodingStatisticsClassType CSCT(x);                       m_BinDecoder.set( CSCT )
-#define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET2(x,y)        const CodingStatisticsClassType CSCT(x,y);                     m_BinDecoder.set( CSCT )
-#define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE(x,s)    const CodingStatisticsClassType CSCT(x, s.width, s.height);    m_BinDecoder.set( CSCT )
-#define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(x,s,z) const CodingStatisticsClassType CSCT(x, s.width, s.height, z); m_BinDecoder.set( CSCT )
-#define RExt__DECODER_DEBUG_BIT_STATISTICS_SET(x)                  m_BinDecoder.set( x );
+#define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(x)                                                               \
+  const CodingStatisticsClassType CSCT(x);                                                                             \
+  m_binDecoder.set(CSCT)
+#define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET2(x, y)                                                           \
+  const CodingStatisticsClassType CSCT(x, y);                                                                          \
+  m_binDecoder.set(CSCT)
+#define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE(x, s)                                                       \
+  const CodingStatisticsClassType CSCT(x, s.width, s.height);                                                          \
+  m_binDecoder.set(CSCT)
+#define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2(x, s, z)                                                   \
+  const CodingStatisticsClassType CSCT(x, s.width, s.height, z);                                                       \
+  m_binDecoder.set(CSCT)
+#define RExt__DECODER_DEBUG_BIT_STATISTICS_SET(x) m_binDecoder.set(x);
 #else
 #define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(x)
 #define RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET2(x,y)
@@ -82,9 +90,10 @@ void CABACReader::initCtxModels( Slice& slice )
       break;
     }
   }
-  m_BinDecoder.reset( qp, (int)sliceType );
-  m_BinDecoder.setBaseLevel(slice.getRiceBaseLevel());
-  m_BinDecoder.riceStatReset(slice.getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), slice.getSPS()->getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag());
+  m_binDecoder.reset(qp, (int) sliceType);
+  m_binDecoder.setBaseLevel(slice.getRiceBaseLevel());
+  m_binDecoder.riceStatReset(slice.getSPS()->getBitDepth(CHANNEL_TYPE_LUMA),
+                             slice.getSPS()->getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag());
 }
 
 
@@ -97,13 +106,13 @@ void CABACReader::initCtxModels( Slice& slice )
 
 bool CABACReader::terminating_bit()
 {
-  if( m_BinDecoder.decodeBinTrm() )
+  if (m_binDecoder.decodeBinTrm())
   {
-    m_BinDecoder.finish();
+    m_binDecoder.finish();
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
-    CodingStatistics::IncrementStatisticEP( STATS__TRAILING_BITS, m_Bitstream->readOutTrailingBits(), 0 );
+    CodingStatistics::IncrementStatisticEP(STATS__TRAILING_BITS, m_bitstream->readOutTrailingBits(), 0);
 #else
-    m_Bitstream->readOutTrailingBits();
+    m_bitstream->readOutTrailingBits();
 #endif
     return true;
   }
@@ -114,13 +123,13 @@ void CABACReader::remaining_bytes( bool noTrailingBytesExpected )
 {
   if( noTrailingBytesExpected )
   {
-    CHECK( 0 != m_Bitstream->getNumBitsLeft(), "Bits left when not supposed" );
+    CHECK(0 != m_bitstream->getNumBitsLeft(), "Bits left when not supposed");
   }
   else
   {
-    while( m_Bitstream->getNumBitsLeft() )
+    while (m_bitstream->getNumBitsLeft())
     {
-      unsigned trailingNullByte = m_Bitstream->readByte();
+      unsigned trailingNullByte = m_bitstream->readByte();
       if( trailingNullByte != 0 )
       {
         THROW( "Trailing byte should be '0', but has a value of " << std::hex << trailingNullByte << std::dec << "\n" );
@@ -171,7 +180,7 @@ void CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i
         ctx += aboveCTUAddr > -1 ? ( ctbAlfFlag[aboveCTUAddr] ? 1 : 0 ) : 0;
 
         RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__ALF);
-        ctbAlfFlag[ctuRsAddr] = m_BinDecoder.decodeBin( Ctx::ctbAlfFlag( compIdx * 3 + ctx ) );
+        ctbAlfFlag[ctuRsAddr] = m_binDecoder.decodeBin(Ctx::ctbAlfFlag(compIdx * 3 + ctx));
 
         if (isLuma((ComponentID)compIdx) && ctbAlfFlag[ctuRsAddr])
         {
@@ -188,7 +197,7 @@ void CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i
           if( ctbAlfFlag[ctuRsAddr] )
           {
             uint8_t decoded = 0;
-            while( decoded < numAlts-1 && m_BinDecoder.decodeBin( Ctx::ctbAlfAlternative( compIdx-1 ) ) )
+            while (decoded < numAlts - 1 && m_binDecoder.decodeBin(Ctx::ctbAlfAlternative(compIdx - 1)))
               ++ decoded;
             ctbAlfAlternative[ctuRsAddr] = decoded;
           }
@@ -250,7 +259,7 @@ void CABACReader::readAlfCtuFilterIndex(CodingStructure& cs, unsigned ctuRsAddr)
   uint32_t filtIndex = 0;
   if (numAvailableFiltSets > NUM_FIXED_FILTER_SETS)
   {
-    unsigned usePrevFilt = m_BinDecoder.decodeBin(Ctx::AlfUseTemporalFilt());
+    unsigned usePrevFilt = m_binDecoder.decodeBin(Ctx::AlfUseTemporalFilt());
     if (usePrevFilt)
     {
       if (numAps > 1)
@@ -293,10 +302,10 @@ void CABACReader::ccAlfFilterControlIdc(CodingStructure &cs, const ComponentID c
   }
   ctxt += ( compID == COMPONENT_Cr ) ? 3 : 0;
 
-  int idcVal  = m_BinDecoder.decodeBin( Ctx::CcAlfFilterControlFlag( ctxt ) );
+  int idcVal = m_binDecoder.decodeBin(Ctx::CcAlfFilterControlFlag(ctxt));
   if ( idcVal )
   {
-    while ( ( idcVal != filterCount ) && m_BinDecoder.decodeBinEP() )
+    while ((idcVal != filterCount) && m_binDecoder.decodeBinEP())
     {
       idcVal++;
     }
@@ -348,13 +357,13 @@ void CABACReader::sao( CodingStructure& cs, unsigned ctuRsAddr )
   if( cs.getCURestricted( pos.offset(-(int)cs.pcv->maxCUWidth, 0), pos, curSliceIdx, curTileIdx, CH_L ) )
   {
     // sao_merge_left_flag
-    sao_merge_type  += int( m_BinDecoder.decodeBin( Ctx::SaoMergeFlag() ) );
+    sao_merge_type += int(m_binDecoder.decodeBin(Ctx::SaoMergeFlag()));
   }
 
   if( sao_merge_type < 0 && cs.getCURestricted( pos.offset(0, -(int)cs.pcv->maxCUHeight), pos, curSliceIdx, curTileIdx, CH_L ) )
   {
     // sao_merge_above_flag
-    sao_merge_type  += int( m_BinDecoder.decodeBin( Ctx::SaoMergeFlag() ) ) << 1;
+    sao_merge_type += int(m_binDecoder.decodeBin(Ctx::SaoMergeFlag())) << 1;
   }
   if( sao_merge_type >= 0 )
   {
@@ -383,9 +392,9 @@ void CABACReader::sao( CodingStructure& cs, unsigned ctuRsAddr )
     // sao_type_idx_luma / sao_type_idx_chroma
     if( compID != COMPONENT_Cr )
     {
-      if( m_BinDecoder.decodeBin( Ctx::SaoTypeIdx() ) )
+      if (m_binDecoder.decodeBin(Ctx::SaoTypeIdx()))
       {
-        if( m_BinDecoder.decodeBinEP( ) )
+        if (m_binDecoder.decodeBinEP())
         {
           // edge offset
           sao_pars.modeIdc = SAO_MODE_NEW;
@@ -423,13 +432,13 @@ void CABACReader::sao( CodingStructure& cs, unsigned ctuRsAddr )
       // sao_offset_sign
       for( int k = 0; k < 4; k++ )
       {
-        if( offset[k] && m_BinDecoder.decodeBinEP( ) )
+        if (offset[k] && m_binDecoder.decodeBinEP())
         {
           offset[k] = -offset[k];
         }
       }
       // sao_band_position
-      sao_pars.typeAuxInfo = m_BinDecoder.decodeBinsEP( NUM_SAO_BO_CLASSES_LOG2 );
+      sao_pars.typeAuxInfo = m_binDecoder.decodeBinsEP(NUM_SAO_BO_CLASSES_LOG2);
       for( int k = 0; k < 4; k++ )
       {
         sao_pars.offset[ ( sao_pars.typeAuxInfo + k ) % MAX_NUM_SAO_CLASSES ] = offset[k];
@@ -442,7 +451,7 @@ void CABACReader::sao( CodingStructure& cs, unsigned ctuRsAddr )
     if( compID != COMPONENT_Cr )
     {
       // sao_eo_class_luma / sao_eo_class_chroma
-      sao_pars.typeIdc += m_BinDecoder.decodeBinsEP( NUM_SAO_EO_TYPES_LOG2 );
+      sao_pars.typeIdc += m_binDecoder.decodeBinsEP(NUM_SAO_EO_TYPES_LOG2);
     }
     else
     {
@@ -717,7 +726,7 @@ ModeType CABACReader::mode_constraint( CodingStructure& cs, Partitioner &partiti
   {
     int ctxIdx = DeriveCtx::CtxModeConsFlag( cs, partitioner );
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__MODE_CONSTRAINT_FLAG, partitioner.currArea().blocks[partitioner.chType].size(), partitioner.chType );
-    bool flag = m_BinDecoder.decodeBin( Ctx::ModeConsFlag( ctxIdx ) );
+    bool flag = m_binDecoder.decodeBin(Ctx::ModeConsFlag(ctxIdx));
     DTRACE( g_trace_ctx, D_SYNTAX, "mode_cons_flag() flag=%d\n", flag );
     return flag ? MODE_TYPE_INTRA : MODE_TYPE_INTER;
   }
@@ -749,7 +758,7 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio
 
   if( canNo && isSplit )
   {
-    isSplit = m_BinDecoder.decodeBin( Ctx::SplitFlag( ctxSplit ) );
+    isSplit = m_binDecoder.decodeBin(Ctx::SplitFlag(ctxSplit));
   }
 
   DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode() ctx=%d split=%d\n", ctxSplit, isSplit );
@@ -764,7 +773,7 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio
 
   if( isQt && canBtt )
   {
-    isQt = m_BinDecoder.decodeBin( Ctx::SplitQtFlag( ctxQtSplit ) );
+    isQt = m_binDecoder.decodeBin(Ctx::SplitQtFlag(ctxQtSplit));
   }
 
   DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode() ctx=%d qt=%d\n", ctxQtSplit, isQt );
@@ -779,7 +788,7 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio
 
   if( isVer && canHor )
   {
-    isVer = m_BinDecoder.decodeBin( Ctx::SplitHvFlag( ctxBttHV ) );
+    isVer = m_binDecoder.decodeBin(Ctx::SplitHvFlag(ctxBttHV));
   }
 
   const bool can14 = isVer ? canTv : canTh;
@@ -787,7 +796,7 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio
 
   if( is12 && can14 )
   {
-    is12 = m_BinDecoder.decodeBin( Ctx::Split12Flag( isVer ? ctxBttV12 : ctxBttH12 ) );
+    is12 = m_binDecoder.decodeBin(Ctx::Split12Flag(isVer ? ctxBttV12 : ctxBttH12));
   }
 
   if (isVer && is12)
@@ -912,7 +921,7 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
     if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64
     {
       unsigned ctxId = DeriveCtx::CtxSkipFlag(cu);
-      unsigned skip  = m_BinDecoder.decodeBin(Ctx::SkipFlag(ctxId));
+      unsigned skip  = m_binDecoder.decodeBin(Ctx::SkipFlag(ctxId));
       DTRACE(g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, skip ? 1 : 0);
       if (skip)
       {
@@ -933,7 +942,7 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
     return;
   }
   unsigned ctxId  = DeriveCtx::CtxSkipFlag(cu);
-  unsigned skip   = m_BinDecoder.decodeBin( Ctx::SkipFlag(ctxId) );
+  unsigned skip   = m_binDecoder.decodeBin(Ctx::SkipFlag(ctxId));
 
   DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, skip ? 1 : 0 );
 
@@ -950,7 +959,7 @@ void CABACReader::cu_skip_flag( CodingUnit& cu )
         return;
       }
       unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
-      if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
+      if (m_binDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
       {
         cu.skip                      = true;
         cu.rootCbf                   = false;
@@ -1007,7 +1016,7 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx )
   }
   else
   {
-    value = m_BinDecoder.decodeBin(Ctx::ImvFlag(0));
+    value = m_binDecoder.decodeBin(Ctx::ImvFlag(0));
   }
   DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 0 );
 
@@ -1016,13 +1025,13 @@ void CABACReader::imv_mode( CodingUnit& cu, MergeCtx& mrgCtx )
   {
     if (!CU::isIBC(cu))
     {
-      value = m_BinDecoder.decodeBin(Ctx::ImvFlag(4));
+      value = m_binDecoder.decodeBin(Ctx::ImvFlag(4));
       DTRACE(g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 4);
       cu.imv = value ? 1 : IMV_HPEL;
     }
     if (value)
     {
-      value = m_BinDecoder.decodeBin(Ctx::ImvFlag(1));
+      value = m_binDecoder.decodeBin(Ctx::ImvFlag(1));
       DTRACE(g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", value, 1);
       value++;
       cu.imv = value;
@@ -1049,12 +1058,12 @@ void CABACReader::affine_amvr_mode( CodingUnit& cu, MergeCtx& mrgCtx )
   }
 
   unsigned value = 0;
-  value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 2 ) );
+  value          = m_binDecoder.decodeBin(Ctx::ImvFlag(2));
   DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() value=%d ctx=%d\n", value, 2 );
 
   if( value )
   {
-    value = m_BinDecoder.decodeBin( Ctx::ImvFlag( 3 ) );
+    value = m_binDecoder.decodeBin(Ctx::ImvFlag(3));
     DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() value=%d ctx=%d\n", value, 3 );
     value++;
   }
@@ -1080,14 +1089,14 @@ void CABACReader::pred_mode( CodingUnit& cu )
       if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64
       {
         unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
-        if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
+        if (m_binDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
         {
           cu.predMode = MODE_IBC;
         }
       }
       if (!CU::isIBC(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) )
       {
-        if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0)))
+        if (m_binDecoder.decodeBin(Ctx::PLTFlag(0)))
         {
           cu.predMode = MODE_PLT;
         }
@@ -1095,12 +1104,12 @@ void CABACReader::pred_mode( CodingUnit& cu )
     }
     else
     {
-      if (m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))))
+      if (m_binDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))))
       {
         cu.predMode = MODE_INTRA;
         if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && (cu.lumaSize().width * cu.lumaSize().height > 16) )
         {
-          if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0)))
+          if (m_binDecoder.decodeBin(Ctx::PLTFlag(0)))
           {
             cu.predMode = MODE_PLT;
           }
@@ -1112,7 +1121,7 @@ void CABACReader::pred_mode( CodingUnit& cu )
         if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64
         {
           unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
-          if (m_BinDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
+          if (m_binDecoder.decodeBin(Ctx::IBCFlag(ctxidx)))
           {
             cu.predMode = MODE_IBC;
           }
@@ -1133,7 +1142,7 @@ void CABACReader::pred_mode( CodingUnit& cu )
       cu.predMode = MODE_INTRA;
       if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && ( ( (!isLuma(cu.chType)) && (cu.chromaSize().width * cu.chromaSize().height > 16) ) || ((isLuma(cu.chType)) && ((cu.lumaSize().width * cu.lumaSize().height) > 16 ) )  ) && (!cu.isLocalSepTree() || isLuma(cu.chType)  )  )
       {
-        if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0)))
+        if (m_binDecoder.decodeBin(Ctx::PLTFlag(0)))
         {
           cu.predMode = MODE_PLT;
         }
@@ -1141,10 +1150,10 @@ void CABACReader::pred_mode( CodingUnit& cu )
     }
     else
     {
-      cu.predMode = m_BinDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))) ? MODE_INTRA : MODE_INTER;
+      cu.predMode = m_binDecoder.decodeBin(Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu))) ? MODE_INTRA : MODE_INTER;
       if (CU::isIntra(cu) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 &&  cu.lheight() <= 64 && ( ( (!isLuma(cu.chType)) && (cu.chromaSize().width * cu.chromaSize().height > 16) ) || ((isLuma(cu.chType)) && ((cu.lumaSize().width * cu.lumaSize().height) > 16 ) )  ) && (!cu.isLocalSepTree() || isLuma(cu.chType)  )  )
       {
-        if (m_BinDecoder.decodeBin(Ctx::PLTFlag(0)))
+        if (m_binDecoder.decodeBin(Ctx::PLTFlag(0)))
         {
           cu.predMode = MODE_PLT;
         }
@@ -1176,10 +1185,10 @@ void CABACReader::bdpcm_mode( CodingUnit& cu, const ComponentID compID )
 
   int bdpcmMode;
   unsigned ctxId = isLuma( compID ) ? 0 : 2;
-  bdpcmMode = m_BinDecoder.decodeBin( Ctx::BDPCMMode(ctxId) );
+  bdpcmMode      = m_binDecoder.decodeBin(Ctx::BDPCMMode(ctxId));
   if (bdpcmMode)
   {
-    bdpcmMode += m_BinDecoder.decodeBin( Ctx::BDPCMMode(ctxId+1) );
+    bdpcmMode += m_binDecoder.decodeBin(Ctx::BDPCMMode(ctxId + 1));
   }
   if (isLuma(compID))
   {
@@ -1245,7 +1254,7 @@ void CABACReader::cu_bcw_flag(CodingUnit& cu)
 
   uint32_t idx = 0;
 
-  uint32_t symbol = m_BinDecoder.decodeBin(Ctx::bcwIdx(0));
+  uint32_t symbol = m_binDecoder.decodeBin(Ctx::bcwIdx(0));
 
   int32_t numBcw = (cu.slice->getCheckLDC()) ? 5 : 3;
   if(symbol == 1)
@@ -1257,7 +1266,7 @@ void CABACReader::cu_bcw_flag(CodingUnit& cu)
 
     for(int ui = 0; ui < prefixNumBits; ++ui)
     {
-      symbol = m_BinDecoder.decodeBinEP();
+      symbol = m_binDecoder.decodeBinEP();
       if (symbol == 0)
       {
         break;
@@ -1292,11 +1301,11 @@ void CABACReader::xReadTruncBinCode(uint32_t& symbol, uint32_t maxSymbol)
 
   int val = 1 << thresh;
   int b = maxSymbol - val;
-  symbol = m_BinDecoder.decodeBinsEP(thresh);
+  symbol  = m_binDecoder.decodeBinsEP(thresh);
   if (symbol >= val - b)
   {
     uint32_t altSymbol;
-    altSymbol = m_BinDecoder.decodeBinEP();
+    altSymbol = m_binDecoder.decodeBinEP();
     symbol <<= 1;
     symbol += altSymbol;
     symbol -= (val - b);
@@ -1333,10 +1342,12 @@ void CABACReader::extend_ref_line(CodingUnit& cu)
 
     if (MRL_NUM_REF_LINES > 1)
     {
-      multiRefIdx = m_BinDecoder.decodeBin(Ctx::MultiRefLineIdx(0)) == 1 ? MULTI_REF_LINE_IDX[1] : MULTI_REF_LINE_IDX[0];
+      multiRefIdx =
+        m_binDecoder.decodeBin(Ctx::MultiRefLineIdx(0)) == 1 ? MULTI_REF_LINE_IDX[1] : MULTI_REF_LINE_IDX[0];
       if (MRL_NUM_REF_LINES > 2 && multiRefIdx != MULTI_REF_LINE_IDX[0])
       {
-        multiRefIdx = m_BinDecoder.decodeBin(Ctx::MultiRefLineIdx(1)) == 1 ? MULTI_REF_LINE_IDX[2] : MULTI_REF_LINE_IDX[1];
+        multiRefIdx =
+          m_binDecoder.decodeBin(Ctx::MultiRefLineIdx(1)) == 1 ? MULTI_REF_LINE_IDX[2] : MULTI_REF_LINE_IDX[1];
       }
 
     }
@@ -1381,7 +1392,7 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu )
     }
     else
     {
-      mpmFlag[k] = m_BinDecoder.decodeBin(Ctx::IntraLumaMpmFlag());
+      mpmFlag[k] = m_binDecoder.decodeBin(Ctx::IntraLumaMpmFlag());
     }
   }
 
@@ -1399,7 +1410,7 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu )
         unsigned ctx = (pu->cu->ispMode == NOT_INTRA_SUBPARTITIONS ? 1 : 0);
         if (pu->multiRefIdx == 0)
         {
-          ipred_idx = m_BinDecoder.decodeBin(Ctx::IntraLumaPlanarFlag(ctx));
+          ipred_idx = m_binDecoder.decodeBin(Ctx::IntraLumaPlanarFlag(ctx));
         }
         else
         {
@@ -1407,19 +1418,19 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu )
         }
         if( ipred_idx )
         {
-          ipred_idx += m_BinDecoder.decodeBinEP();
+          ipred_idx += m_binDecoder.decodeBinEP();
         }
         if (ipred_idx > 1)
         {
-          ipred_idx += m_BinDecoder.decodeBinEP();
+          ipred_idx += m_binDecoder.decodeBinEP();
         }
         if (ipred_idx > 2)
         {
-          ipred_idx += m_BinDecoder.decodeBinEP();
+          ipred_idx += m_binDecoder.decodeBinEP();
         }
         if (ipred_idx > 3)
         {
-          ipred_idx += m_BinDecoder.decodeBinEP();
+          ipred_idx += m_binDecoder.decodeBinEP();
         }
       }
       pu->intraDir[0] = mpm_pred[ipred_idx];
@@ -1468,7 +1479,7 @@ bool CABACReader::intra_chroma_lmc_mode(PredictionUnit& pu)
   int lmModeList[10];
   PU::getLMSymbolList(pu, lmModeList);
 
-  int symbol = m_BinDecoder.decodeBin(Ctx::CclmModeIdx(0));
+  int symbol = m_binDecoder.decodeBin(Ctx::CclmModeIdx(0));
 
   if (symbol == 0)
   {
@@ -1477,7 +1488,7 @@ bool CABACReader::intra_chroma_lmc_mode(PredictionUnit& pu)
   }
   else
   {
-    symbol += m_BinDecoder.decodeBinEP();
+    symbol += m_binDecoder.decodeBinEP();
     pu.intraDir[1] = lmModeList[symbol];
   }
   return true; //it will only enter this function for LMC modes, so always return true ;
@@ -1496,7 +1507,7 @@ void CABACReader::intra_chroma_pred_mode(PredictionUnit& pu)
 
   if (pu.cs->sps->getUseLMChroma() && pu.cu->checkCCLMAllowed())
   {
-    bool isLMCMode = m_BinDecoder.decodeBin(Ctx::CclmModeFlag(0)) ? true : false;
+    bool isLMCMode = m_binDecoder.decodeBin(Ctx::CclmModeFlag(0)) ? true : false;
     if (isLMCMode)
     {
       intra_chroma_lmc_mode(pu);
@@ -1504,13 +1515,13 @@ void CABACReader::intra_chroma_pred_mode(PredictionUnit& pu)
     }
   }
 
-  if (m_BinDecoder.decodeBin(Ctx::IntraChromaPredMode(0)) == 0)
+  if (m_binDecoder.decodeBin(Ctx::IntraChromaPredMode(0)) == 0)
   {
     pu.intraDir[1] = DM_CHROMA_IDX;
     return;
   }
 
-  unsigned candId = m_BinDecoder.decodeBinsEP(2);
+  unsigned candId = m_binDecoder.decodeBinsEP(2);
 
   unsigned chromaCandModes[NUM_CHROMA_MODE];
   PU::getIntraChromaCandModes(pu, chromaCandModes);
@@ -1577,7 +1588,7 @@ void CABACReader::rqt_root_cbf( CodingUnit& cu )
 {
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__QT_ROOT_CBF );
 
-  cu.rootCbf = ( m_BinDecoder.decodeBin( Ctx::QtRootCbf() ) );
+  cu.rootCbf = (m_binDecoder.decodeBin(Ctx::QtRootCbf()));
 
   DTRACE( g_trace_ctx, D_SYNTAX, "rqt_root_cbf() ctx=0 root_cbf=%d pos=(%d,%d)\n", cu.rootCbf ? 1 : 0, cu.lumaPos().x, cu.lumaPos().y );
 }
@@ -1597,7 +1608,7 @@ void CABACReader::adaptive_color_transform(CodingUnit& cu)
   if (CU::isInter(cu) || CU::isIBC(cu) || CU::isIntra(cu))
   {
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__ACT );
-    cu.colorTransform = (m_BinDecoder.decodeBin(Ctx::ACTFlag()));
+    cu.colorTransform = (m_binDecoder.decodeBin(Ctx::ACTFlag()));
   }
 }
 
@@ -1615,7 +1626,7 @@ void CABACReader::sbt_mode( CodingUnit& cu )
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SBT_MODE );
   //bin - flag
   uint8_t ctxIdx = ( cuWidth * cuHeight <= 256 ) ? 1 : 0;
-  bool sbtFlag = m_BinDecoder.decodeBin( Ctx::SbtFlag( ctxIdx ) );
+  bool    sbtFlag = m_binDecoder.decodeBin(Ctx::SbtFlag(ctxIdx));
   if( !sbtFlag )
   {
     return;
@@ -1630,7 +1641,7 @@ void CABACReader::sbt_mode( CodingUnit& cu )
   bool sbtQuadFlag = false;
   if( ( sbtHorHalfAllow || sbtVerHalfAllow ) && ( sbtHorQuadAllow || sbtVerQuadAllow ) )
   {
-    sbtQuadFlag = m_BinDecoder.decodeBin( Ctx::SbtQuadFlag( 0 ) );
+    sbtQuadFlag = m_binDecoder.decodeBin(Ctx::SbtQuadFlag(0));
   }
   else
   {
@@ -1642,7 +1653,7 @@ void CABACReader::sbt_mode( CodingUnit& cu )
   if( ( sbtQuadFlag && sbtVerQuadAllow && sbtHorQuadAllow ) || ( !sbtQuadFlag && sbtVerHalfAllow && sbtHorHalfAllow ) ) //both direction allowed
   {
     uint8_t ctxIdx = ( cuWidth == cuHeight ) ? 0 : ( cuWidth < cuHeight ? 1 : 2 );
-    sbtHorFlag = m_BinDecoder.decodeBin( Ctx::SbtHorFlag( ctxIdx ) );
+    sbtHorFlag     = m_binDecoder.decodeBin(Ctx::SbtHorFlag(ctxIdx));
   }
   else
   {
@@ -1651,7 +1662,7 @@ void CABACReader::sbt_mode( CodingUnit& cu )
   cu.setSbtIdx( sbtHorFlag ? ( sbtQuadFlag ? SBT_HOR_QUAD : SBT_HOR_HALF ) : ( sbtQuadFlag ? SBT_VER_QUAD : SBT_VER_HALF ) );
 
   //bin - pos
-  bool sbtPosFlag = m_BinDecoder.decodeBin( Ctx::SbtPosFlag( 0 ) );
+  bool sbtPosFlag = m_binDecoder.decodeBin(Ctx::SbtPosFlag(0));
   cu.setSbtPos( sbtPosFlag ? SBT_POS1 : SBT_POS0 );
 
   DTRACE( g_trace_ctx, D_SYNTAX, "sbt_mode() pos=(%d,%d) sbtInfo=%d\n", cu.lx(), cu.ly(), (int)cu.sbtInfo );
@@ -1726,7 +1737,7 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_
     {
       ComponentID compID = (ComponentID)comp;
       const int  channelBitDepth = sps.getBitDepth(toChannelType(compID));
-      cu.curPLT[compID][idx] = m_BinDecoder.decodeBinsEP(channelBitDepth);
+      cu.curPLT[compID][idx]      = m_binDecoder.decodeBinsEP(channelBitDepth);
       if( cu.isLocalSepTree() )
       {
         if( isLuma( cu.chType ) )
@@ -1745,7 +1756,7 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_
   if (cu.curPLTSize[compBegin] > 0)
   {
     uint32_t escCode = 0;
-    escCode = m_BinDecoder.decodeBinEP();
+    escCode                 = m_binDecoder.decodeBinEP();
     cu.useEscape[compBegin] = (escCode != 0);
   }
   uint32_t    indexMaxSize = cu.useEscape[compBegin] ? (cu.curPLTSize[compBegin] + 1) : cu.curPLTSize[compBegin];
@@ -1829,7 +1840,7 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u
     {
       int dist = curPos - prevRunPos - 1;
       const unsigned  ctxId = DeriveCtx::CtxPltCopyFlag(prevRunType, dist);
-      identityFlag = m_BinDecoder.decodeBin( ctxSet( ctxId ) );
+      identityFlag          = m_binDecoder.decodeBin(ctxSet(ctxId));
       DTRACE(g_trace_ctx, D_SYNTAX, "plt_copy_flag() bin=%d ctx=%d\n", identityFlag, ctxId);
       runCopyFlag[curPos - minSubPos] = identityFlag;
     }
@@ -1846,7 +1857,7 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u
       }
       else
       {
-        runType.at(posx, posy) = (m_BinDecoder.decodeBin(Ctx::RunTypeFlag()));
+        runType.at(posx, posy) = (m_binDecoder.decodeBin(Ctx::RunTypeFlag()));
       }
       DTRACE(g_trace_ctx, D_SYNTAX, "plt_type_flag() bin=%d sp=%d\n", runType.at(posx, posy), curPos);
       prevRunType = runType.at(posx, posy);
@@ -1949,7 +1960,7 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u
 
 void CABACReader::parseScanRotationModeFlag(CodingUnit& cu, ComponentID compBegin)
 {
-  cu.useRotation[compBegin] = m_BinDecoder.decodeBin(Ctx::RotationFlag());
+  cu.useRotation[compBegin] = m_binDecoder.decodeBin(Ctx::RotationFlag());
 }
 
 void CABACReader::xDecodePLTPredIndicator(CodingUnit& cu, uint32_t maxPLTSize, ComponentID compBegin)
@@ -2161,7 +2172,7 @@ void CABACReader::smvd_mode( PredictionUnit& pu )
 
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__SYMMVD_FLAG );
 
-  pu.cu->smvdMode = m_BinDecoder.decodeBin( Ctx::SmvdFlag() ) ? 1 : 0;
+  pu.cu->smvdMode = m_binDecoder.decodeBin(Ctx::SmvdFlag()) ? 1 : 0;
 
   DTRACE( g_trace_ctx, D_SYNTAX, "symmvd_flag() symmvd=%d pos=(%d,%d) size=%dx%d\n", pu.cu->smvdMode ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height );
 }
@@ -2175,7 +2186,7 @@ void CABACReader::subblock_merge_flag( CodingUnit& cu )
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG );
 
     unsigned ctxId = DeriveCtx::CtxAffineFlag( cu );
-    cu.affine = m_BinDecoder.decodeBin( Ctx::SubblockMergeFlag( ctxId ) );
+    cu.affine      = m_binDecoder.decodeBin(Ctx::SubblockMergeFlag(ctxId));
     DTRACE( g_trace_ctx, D_SYNTAX, "subblock_merge_flag() subblock_merge_flag=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
   }
 }
@@ -2187,13 +2198,13 @@ void CABACReader::affine_flag( CodingUnit& cu )
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__AFFINE_FLAG );
 
     unsigned ctxId = DeriveCtx::CtxAffineFlag( cu );
-    cu.affine = m_BinDecoder.decodeBin( Ctx::AffineFlag( ctxId ) );
+    cu.affine      = m_binDecoder.decodeBin(Ctx::AffineFlag(ctxId));
     DTRACE( g_trace_ctx, D_SYNTAX, "affine_flag() affine=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
 
     if ( cu.affine && cu.cs->sps->getUseAffineType() )
     {
       ctxId = 0;
-      cu.affineType = m_BinDecoder.decodeBin( Ctx::AffineType( ctxId ) );
+      cu.affineType = m_binDecoder.decodeBin(Ctx::AffineType(ctxId));
       DTRACE( g_trace_ctx, D_SYNTAX, "affine_type() affine_type=%d ctx=%d pos=(%d,%d)\n", cu.affineType ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
     }
     else
@@ -2207,7 +2218,7 @@ void CABACReader::merge_flag( PredictionUnit& pu )
 {
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__MERGE_FLAG );
 
-  pu.mergeFlag = ( m_BinDecoder.decodeBin( Ctx::MergeFlag() ) );
+  pu.mergeFlag = (m_binDecoder.decodeBin(Ctx::MergeFlag()));
 
   DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height );
 
@@ -2248,7 +2259,7 @@ void CABACReader::merge_data( PredictionUnit& pu )
                               && pu.cu->lheight() < 8 * pu.cu->lwidth();
     if (geoAvailable || ciipAvailable)
     {
-      cu.firstPU->regularMergeFlag = m_BinDecoder.decodeBin(Ctx::RegularMergeFlag(cu.skip ? 0 : 1));
+      cu.firstPU->regularMergeFlag = m_binDecoder.decodeBin(Ctx::RegularMergeFlag(cu.skip ? 0 : 1));
     }
     else
     {
@@ -2258,7 +2269,7 @@ void CABACReader::merge_data( PredictionUnit& pu )
     {
       if (cu.cs->slice->getSPS()->getUseMMVD())
       {
-        cu.firstPU->mmvdMergeFlag = m_BinDecoder.decodeBin(Ctx::MmvdFlag(0));
+        cu.firstPU->mmvdMergeFlag = m_binDecoder.decodeBin(Ctx::MmvdFlag(0));
       }
       else
       {
@@ -2317,12 +2328,12 @@ void CABACReader::merge_idx( PredictionUnit& pu )
     pu.mergeIdx = 0;
     if ( numCandminus1 > 0 )
     {
-      if ( m_BinDecoder.decodeBin( Ctx::AffMergeIdx() ) )
+      if (m_binDecoder.decodeBin(Ctx::AffMergeIdx()))
       {
         pu.mergeIdx++;
         for ( ; pu.mergeIdx < numCandminus1; pu.mergeIdx++ )
         {
-          if (!m_BinDecoder.decodeBinEP())
+          if (!m_binDecoder.decodeBinEP())
           {
             break;
           }
@@ -2349,13 +2360,13 @@ void CABACReader::merge_idx( PredictionUnit& pu )
       pu.mergeIdx       = 0;
       int mergeCand0    = 0;
       int mergeCand1    = 0;
-      if (m_BinDecoder.decodeBin(Ctx::MergeIdx()))
+      if (m_binDecoder.decodeBin(Ctx::MergeIdx()))
       {
         mergeCand0 += unary_max_eqprob(numCandminus2) + 1;
       }
       if (numCandminus2 > 0)
       {
-        if (m_BinDecoder.decodeBin(Ctx::MergeIdx()))
+        if (m_binDecoder.decodeBin(Ctx::MergeIdx()))
         {
           mergeCand1 += unary_max_eqprob(numCandminus2 - 1) + 1;
         }
@@ -2375,12 +2386,12 @@ void CABACReader::merge_idx( PredictionUnit& pu )
     }
     if (numCandminus1 > 0)
     {
-      if (m_BinDecoder.decodeBin(Ctx::MergeIdx()))
+      if (m_binDecoder.decodeBin(Ctx::MergeIdx()))
       {
         pu.mergeIdx++;
         for (; pu.mergeIdx < numCandminus1; pu.mergeIdx++)
         {
-          if( !m_BinDecoder.decodeBinEP() )
+          if (!m_binDecoder.decodeBinEP())
           {
             break;
           }
@@ -2399,17 +2410,17 @@ void CABACReader::mmvd_merge_idx(PredictionUnit& pu)
   if (pu.cs->sps->getMaxNumMergeCand() > 1)
   {
     static_assert(MMVD_BASE_MV_NUM == 2, "");
-    var0 = m_BinDecoder.decodeBin(Ctx::MmvdMergeIdx());
+    var0 = m_binDecoder.decodeBin(Ctx::MmvdMergeIdx());
   }
   DTRACE(g_trace_ctx, D_SYNTAX, "base_mvp_idx() base_mvp_idx=%d\n", var0);
   int numCandminus1_step = MMVD_REFINE_STEP - 1;
   int var1 = 0;
-  if (m_BinDecoder.decodeBin(Ctx::MmvdStepMvpIdx()))
+  if (m_binDecoder.decodeBin(Ctx::MmvdStepMvpIdx()))
   {
     var1++;
     for (; var1 < numCandminus1_step; var1++)
     {
-      if (!m_BinDecoder.decodeBinEP())
+      if (!m_binDecoder.decodeBinEP())
       {
         break;
       }
@@ -2417,10 +2428,10 @@ void CABACReader::mmvd_merge_idx(PredictionUnit& pu)
   }
   DTRACE(g_trace_ctx, D_SYNTAX, "MmvdStepMvpIdx() MmvdStepMvpIdx=%d\n", var1);
   int var2 = 0;
-  if (m_BinDecoder.decodeBinEP())
+  if (m_binDecoder.decodeBinEP())
   {
     var2 += 2;
-    if (m_BinDecoder.decodeBinEP())
+    if (m_binDecoder.decodeBinEP())
     {
       var2 += 1;
     }
@@ -2428,7 +2439,7 @@ void CABACReader::mmvd_merge_idx(PredictionUnit& pu)
   else
   {
     var2 += 0;
-    if (m_BinDecoder.decodeBinEP())
+    if (m_binDecoder.decodeBinEP())
     {
       var2 += 1;
     }
@@ -2451,14 +2462,14 @@ void CABACReader::inter_pred_idc( PredictionUnit& pu )
   if( !(PU::isBipredRestriction(pu)) )
   {
     unsigned ctxId = DeriveCtx::CtxInterDir(pu);
-    if( m_BinDecoder.decodeBin( Ctx::InterDir(ctxId) ) )
+    if (m_binDecoder.decodeBin(Ctx::InterDir(ctxId)))
     {
       DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=%d value=%d pos=(%d,%d)\n", ctxId, 3, pu.lumaPos().x, pu.lumaPos().y );
       pu.interDir = 3;
       return;
     }
   }
-  if( m_BinDecoder.decodeBin( Ctx::InterDir(5) ) )
+  if (m_binDecoder.decodeBin(Ctx::InterDir(5)))
   {
     DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=5 value=%d pos=(%d,%d)\n", 2, pu.lumaPos().x, pu.lumaPos().y );
     pu.interDir = 2;
@@ -2481,7 +2492,7 @@ void CABACReader::ref_idx( PredictionUnit &pu, RefPicList eRefList )
 
   int numRef  = pu.cs->slice->getNumRefIdx(eRefList);
 
-  if( numRef <= 1 || !m_BinDecoder.decodeBin( Ctx::RefPic() ) )
+  if (numRef <= 1 || !m_binDecoder.decodeBin(Ctx::RefPic()))
   {
     if( numRef > 1 )
     {
@@ -2490,7 +2501,7 @@ void CABACReader::ref_idx( PredictionUnit &pu, RefPicList eRefList )
     pu.refIdx[eRefList] = 0;
     return;
   }
-  if( numRef <= 2 || !m_BinDecoder.decodeBin( Ctx::RefPic(1) ) )
+  if (numRef <= 2 || !m_binDecoder.decodeBin(Ctx::RefPic(1)))
   {
     DTRACE( g_trace_ctx, D_SYNTAX, "ref_idx() value=%d pos=(%d,%d)\n", 1, pu.lumaPos().x, pu.lumaPos().y );
     pu.refIdx[eRefList] = 1;
@@ -2498,7 +2509,7 @@ void CABACReader::ref_idx( PredictionUnit &pu, RefPicList eRefList )
   }
   for( int idx = 3; ; idx++ )
   {
-    if( numRef <= idx || !m_BinDecoder.decodeBinEP() )
+    if (numRef <= idx || !m_binDecoder.decodeBinEP())
     {
       pu.refIdx[eRefList] = (signed char)( idx - 1 );
       DTRACE( g_trace_ctx, D_SYNTAX, "ref_idx() value=%d pos=(%d,%d)\n", idx-1, pu.lumaPos().x, pu.lumaPos().y );
@@ -2511,7 +2522,7 @@ void CABACReader::mvp_flag( PredictionUnit& pu, RefPicList eRefList )
 {
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__MVP_IDX );
 
-  unsigned mvpIdx = m_BinDecoder.decodeBin(Ctx::MVPIdx());
+  unsigned mvpIdx = m_binDecoder.decodeBin(Ctx::MVPIdx());
   DTRACE(g_trace_ctx, D_SYNTAX, "mvp_flag() value=%d pos=(%d,%d)\n", mvpIdx, pu.lumaPos().x, pu.lumaPos().y);
   pu.mvpIdx[eRefList] = mvpIdx;
   DTRACE(g_trace_ctx, D_SYNTAX, "mvpIdx(refList:%d)=%d\n", eRefList, mvpIdx);
@@ -2532,7 +2543,7 @@ void CABACReader::Ciip_flag(PredictionUnit& pu)
 
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__MH_INTRA_FLAG);
 
-  pu.ciipFlag = (m_BinDecoder.decodeBin(Ctx::CiipFlag()));
+  pu.ciipFlag = (m_binDecoder.decodeBin(Ctx::CiipFlag()));
   DTRACE(g_trace_ctx, D_SYNTAX, "Ciip_flag() Ciip=%d pos=(%d,%d) size=%dx%d\n", pu.ciipFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height);
 }
 
@@ -2641,11 +2652,11 @@ bool CABACReader::cbf_comp( CodingStructure& cs, const CompArea& area, unsigned
     {
       ctxId = 2;
     }
-    cbf = m_BinDecoder.decodeBin(ctxSet(ctxId));
+    cbf = m_binDecoder.decodeBin(ctxSet(ctxId));
   }
   else
   {
-    cbf = m_BinDecoder.decodeBin( ctxSet( ctxId ) );
+    cbf = m_binDecoder.decodeBin(ctxSet(ctxId));
   }
 
   DTRACE( g_trace_ctx, D_SYNTAX, "cbf_comp() etype=%d pos=(%d,%d) ctx=%d cbf=%d\n", area.compID, area.x, area.y, ctxId, cbf );
@@ -2668,17 +2679,17 @@ void CABACReader::mvd_coding( Mv &rMvd )
   RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_mvd );
 
   // abs_mvd_greater0_flag[ 0 | 1 ]
-  int horAbs = (int)m_BinDecoder.decodeBin(Ctx::Mvd());
-  int verAbs = (int)m_BinDecoder.decodeBin(Ctx::Mvd());
+  int horAbs = (int) m_binDecoder.decodeBin(Ctx::Mvd());
+  int verAbs = (int) m_binDecoder.decodeBin(Ctx::Mvd());
 
   // abs_mvd_greater1_flag[ 0 | 1 ]
   if (horAbs)
   {
-    horAbs += (int)m_BinDecoder.decodeBin(Ctx::Mvd(1));
+    horAbs += (int) m_binDecoder.decodeBin(Ctx::Mvd(1));
   }
   if (verAbs)
   {
-    verAbs += (int)m_BinDecoder.decodeBin(Ctx::Mvd(1));
+    verAbs += (int) m_binDecoder.decodeBin(Ctx::Mvd(1));
   }
 
   RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_mvd_ep );
@@ -2688,9 +2699,9 @@ void CABACReader::mvd_coding( Mv &rMvd )
   {
     if (horAbs > 1)
     {
-      horAbs += m_BinDecoder.decodeRemAbsEP(1, 0, MV_BITS - 1);
+      horAbs += m_binDecoder.decodeRemAbsEP(1, 0, MV_BITS - 1);
     }
-    if (m_BinDecoder.decodeBinEP())
+    if (m_binDecoder.decodeBinEP())
     {
       horAbs = -horAbs;
     }
@@ -2699,9 +2710,9 @@ void CABACReader::mvd_coding( Mv &rMvd )
   {
     if (verAbs > 1)
     {
-      verAbs += m_BinDecoder.decodeRemAbsEP(1, 0, MV_BITS - 1);
+      verAbs += m_binDecoder.decodeRemAbsEP(1, 0, MV_BITS - 1);
     }
-    if (m_BinDecoder.decodeBinEP())
+    if (m_binDecoder.decodeBinEP())
     {
       verAbs = -verAbs;
     }
@@ -2860,7 +2871,7 @@ void CABACReader::cu_qp_delta( CodingUnit& cu, int predQP, int8_t& qp )
   }
   if( DQp > 0 )
   {
-    if( m_BinDecoder.decodeBinEP( ) )
+    if (m_binDecoder.decodeBinEP())
     {
       DQp = -DQp;
     }
@@ -2879,7 +2890,7 @@ void CABACReader::cu_chroma_qp_offset( CodingUnit& cu )
 
   // cu_chroma_qp_offset_flag
   int       length  = cu.cs->pps->getChromaQpOffsetListLen();
-  unsigned  qpAdj   = m_BinDecoder.decodeBin( Ctx::ChromaQpAdjFlag() );
+  unsigned  qpAdj   = m_binDecoder.decodeBin(Ctx::ChromaQpAdjFlag());
   if( qpAdj && length > 1 )
   {
     // cu_chroma_qp_offset_idx
@@ -2910,7 +2921,7 @@ void CABACReader::joint_cb_cr( TransformUnit& tu, const int cbfMask )
   if( ( CU::isIntra( *tu.cu ) && cbfMask ) || ( cbfMask == 3 ) )
   {
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__JOINT_CB_CR, tu.blocks[COMPONENT_Cr].lumaSize(), CHANNEL_TYPE_CHROMA );
-    tu.jointCbCr = ( m_BinDecoder.decodeBin( Ctx::JointCbCrFlag( cbfMask-1 ) ) ? cbfMask : 0 );
+    tu.jointCbCr = (m_binDecoder.decodeBin(Ctx::JointCbCrFlag(cbfMask - 1)) ? cbfMask : 0);
   }
 }
 
@@ -2963,12 +2974,12 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID, CUCtx&
   int ctxBinSampleRatio = (compID == COMPONENT_Y) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA;
   cctx.regBinLimit = (tu.getTbAreaAfterCoefZeroOut(compID) * ctxBinSampleRatio) >> 4;
 
-  int baseLevel = m_BinDecoder.getCtx().getBaseLevel();
+  int baseLevel = m_binDecoder.getCtx().getBaseLevel();
   cctx.setBaseLevel(baseLevel);
   if (tu.cs->slice->getSPS()->getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag())
   {
     cctx.setUpdateHist(1);
-    unsigned riceStats = m_BinDecoder.getCtx().getGRAdaptStats((unsigned)compID);
+    unsigned riceStats    = m_binDecoder.getCtx().getGRAdaptStats((unsigned) compID);
     TCoeff historyValue = (TCoeff)1 << riceStats;
     cctx.setHistValue(historyValue);
   }
@@ -3002,7 +3013,7 @@ void CABACReader::ts_flag( TransformUnit& tu, ComponentID compID )
   if( TU::isTSAllowed ( tu, 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 ) );
+    tsFlag = m_binDecoder.decodeBin(Ctx::TransformSkipFlag(ctxIdx));
   }
 
   tu.mtsIdx[compID] = tsFlag ? MTS_SKIP : MTS_DCT2_DCT2;
@@ -3020,7 +3031,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));
+    int symbol = m_binDecoder.decodeBin(Ctx::MTSIdx(ctxIdx));
 
     if( symbol )
     {
@@ -3028,7 +3039,7 @@ void CABACReader::mts_idx( CodingUnit& cu, CUCtx& cuCtx )
       mtsIdx = MTS_DST7_DST7; // mtsIdx = 2 -- 4
       for( int i = 0; i < 3; i++, ctxIdx++ )
       {
-        symbol  = m_BinDecoder.decodeBin( Ctx::MTSIdx(ctxIdx));
+        symbol = m_binDecoder.decodeBin(Ctx::MTSIdx(ctxIdx));
         mtsIdx += symbol;
 
         if( !symbol )
@@ -3054,12 +3065,12 @@ void CABACReader::isp_mode( CodingUnit& cu )
 
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__ISP_MODE_FLAG);
 
-  int symbol = m_BinDecoder.decodeBin(Ctx::ISPMode(0));
+  int symbol = m_binDecoder.decodeBin(Ctx::ISPMode(0));
 
   if( symbol )
   {
     RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET( STATS__CABAC_BITS__ISP_SPLIT_FLAG );
-    cu.ispMode = 1 + m_BinDecoder.decodeBin( Ctx::ISPMode( 1 ) );
+    cu.ispMode = 1 + m_binDecoder.decodeBin(Ctx::ISPMode(1));
   }
   DTRACE( g_trace_ctx, D_SYNTAX, "intra_subPartitions() etype=%d pos=(%d,%d) ispIdx=%d\n", cu.chType, cu.blocks[cu.chType].x, cu.blocks[cu.chType].y, (int)cu.ispMode );
 }
@@ -3111,10 +3122,10 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu,  CUCtx& cuCtx  )
   unsigned cctx = 0;
   if ( cu.isSepTree() ) cctx++;
 
-  uint32_t idxLFNST = m_BinDecoder.decodeBin( Ctx::LFNSTIdx( cctx ) );
+  uint32_t idxLFNST = m_binDecoder.decodeBin(Ctx::LFNSTIdx(cctx));
   if( idxLFNST )
   {
-    idxLFNST += m_BinDecoder.decodeBin(Ctx::LFNSTIdx(2));
+    idxLFNST += m_binDecoder.decodeBin(Ctx::LFNSTIdx(2));
   }
   cu.lfnstIdx = idxLFNST;
 
@@ -3142,14 +3153,14 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, Co
 
   for( ; PosLastX < maxLastPosX; PosLastX++ )
   {
-    if( !m_BinDecoder.decodeBin( cctx.lastXCtxId( PosLastX ) ) )
+    if (!m_binDecoder.decodeBin(cctx.lastXCtxId(PosLastX)))
     {
       break;
     }
   }
   for( ; PosLastY < maxLastPosY; PosLastY++ )
   {
-    if( !m_BinDecoder.decodeBin( cctx.lastYCtxId( PosLastY ) ) )
+    if (!m_binDecoder.decodeBin(cctx.lastYCtxId(PosLastY)))
     {
       break;
     }
@@ -3160,7 +3171,7 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, Co
     uint32_t uiCount = ( PosLastX - 2 ) >> 1;
     for ( int i = uiCount - 1; i >= 0; i-- )
     {
-      temp += m_BinDecoder.decodeBinEP() << i;
+      temp += m_binDecoder.decodeBinEP() << i;
     }
     PosLastX = g_minInGroup[PosLastX] + temp;
   }
@@ -3170,7 +3181,7 @@ int CABACReader::last_sig_coeff( CoeffCodingContext& cctx, TransformUnit& tu, Co
     uint32_t uiCount = ( PosLastY - 2 ) >> 1;
     for ( int i = uiCount - 1; i >= 0; i-- )
     {
-      temp += m_BinDecoder.decodeBinEP() << i;
+      temp += m_binDecoder.decodeBinEP() << i;
     }
     PosLastY = g_minInGroup[PosLastY] + temp;
   }
@@ -3225,7 +3236,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
   bool sigGroup = ( isLast || !minSubPos );
   if( !sigGroup )
   {
-    sigGroup = m_BinDecoder.decodeBin( cctx.sigGroupCtxId() );
+    sigGroup = m_binDecoder.decodeBin(cctx.sigGroupCtxId());
   }
   if( sigGroup )
   {
@@ -3255,7 +3266,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
     {
       RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_map );
       const unsigned sigCtxId = cctx.sigCtxIdAbs( nextSigPos, coeff, state );
-      sigFlag = m_BinDecoder.decodeBin( sigCtxId );
+      sigFlag                 = m_binDecoder.decodeBin(sigCtxId);
       DTRACE( g_trace_ctx, D_SYNTAX_RESI, "sig_bin() bin=%d ctx=%d\n", sigFlag, sigCtxId );
       remRegBins--;
     }
@@ -3273,7 +3284,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
       lastNZPos  = std::max<int>( lastNZPos, nextSigPos );
 
       RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt1 );
-      unsigned gt1Flag = m_BinDecoder.decodeBin( cctx.greater1CtxIdAbs(ctxOff) );
+      unsigned gt1Flag = m_binDecoder.decodeBin(cctx.greater1CtxIdAbs(ctxOff));
       DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt1_flag() bin=%d ctx=%d\n", gt1Flag, cctx.greater1CtxIdAbs(ctxOff) );
       remRegBins--;
 
@@ -3282,12 +3293,12 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
       if( gt1Flag )
       {
         RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_par );
-        parFlag = m_BinDecoder.decodeBin( cctx.parityCtxIdAbs( ctxOff ) );
+        parFlag = m_binDecoder.decodeBin(cctx.parityCtxIdAbs(ctxOff));
         DTRACE( g_trace_ctx, D_SYNTAX_RESI, "par_flag() bin=%d ctx=%d\n", parFlag, cctx.parityCtxIdAbs( ctxOff ) );
 
         remRegBins--;
         RExt__DECODER_DEBUG_BIT_STATISTICS_SET(ctype_gt2);
-        gt2Flag = m_BinDecoder.decodeBin( cctx.greater2CtxIdAbs( ctxOff ) );
+        gt2Flag = m_binDecoder.decodeBin(cctx.greater2CtxIdAbs(ctxOff));
         DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt2_flag() bin=%d ctx=%d\n", gt2Flag, cctx.greater2CtxIdAbs( ctxOff ) );
         remRegBins--;
       }
@@ -3310,12 +3321,12 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
     if( tcoeff >= 4 )
     {
       RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_escs );
-      int       rem     = m_BinDecoder.decodeRemAbsEP( ricePar, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange() );
+      int rem = m_binDecoder.decodeRemAbsEP(ricePar, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange());
       DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, ricePar );
       tcoeff += (rem<<1);
       if ((updateHistory) && (rem > 0))
       {
-        unsigned &riceStats = m_BinDecoder.getCtx().getGRAdaptStats((unsigned)(cctx.compID()));
+        unsigned &riceStats = m_binDecoder.getCtx().getGRAdaptStats((unsigned) (cctx.compID()));
         cctx.updateRiceStat(riceStats, rem, 1);
         cctx.setUpdateHist(0);
         updateHistory = 0;
@@ -3329,13 +3340,13 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
     int rice = (cctx.*(cctx.deriveRiceRRC))(scanPos, coeff, 0);
     int       pos0   = g_goRicePosCoeff0(state, rice);
     RExt__DECODER_DEBUG_BIT_STATISTICS_SET(ctype_escs);
-    int       rem       = m_BinDecoder.decodeRemAbsEP( rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange() );
+    int rem = m_binDecoder.decodeRemAbsEP(rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange());
     DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, rice );
     TCoeff    tcoeff  = ( rem == pos0 ? 0 : rem < pos0 ? rem+1 : rem );
     state = ( stateTransTable >> ((state<<2)+((tcoeff&1)<<1)) ) & 3;
     if ((updateHistory) && (rem > 0))
     {
-      unsigned &riceStats = m_BinDecoder.getCtx().getGRAdaptStats((unsigned)(cctx.compID()));
+      unsigned &riceStats = m_binDecoder.getCtx().getGRAdaptStats((unsigned) (cctx.compID()));
       cctx.updateRiceStat(riceStats, rem, 0);
       cctx.setUpdateHist(0);
       updateHistory = 0;
@@ -3353,7 +3364,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
   //===== decode sign's =====
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__SIGN_BIT, Size( cctx.width(), cctx.height() ), cctx.compID() );
   const unsigned  numSigns    = ( cctx.hideSign( firstNZPos, lastNZPos ) ? numNonZero - 1 : numNonZero );
-  unsigned        signPattern = numSigns > 0 ? m_BinDecoder.decodeBinsEP(numSigns) << (32 - numSigns) : 0;
+  unsigned        signPattern = numSigns > 0 ? m_binDecoder.decodeBinsEP(numSigns) << (32 - numSigns) : 0;
 
   //===== set final coefficents =====
   TCoeff sumAbs = 0;
@@ -3432,7 +3443,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
   bool sigGroup = cctx.isLastSubSet() && cctx.noneSigGroup();
   if( !sigGroup )
   {
-    sigGroup = m_BinDecoder.decodeBin(cctx.sigGroupCtxId(true));
+    sigGroup = m_binDecoder.decodeBin(cctx.sigGroupCtxId(true));
     DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() bin=%d ctx=%d\n", sigGroup, cctx.sigGroupCtxId());
   }
   if( sigGroup )
@@ -3459,7 +3470,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
     {
       RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_map );
       const unsigned sigCtxId = cctx.sigCtxIdAbsTS(nextSigPos, coeff);
-      sigFlag                 = m_BinDecoder.decodeBin(sigCtxId);
+      sigFlag                 = m_binDecoder.decodeBin(sigCtxId);
       DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_sig_bin() bin=%d ctx=%d\n", sigFlag, sigCtxId);
       cctx.decimateNumCtxBins(1);
     }
@@ -3474,7 +3485,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
 #endif
       int sign;
       const unsigned signCtxId = cctx.signCtxIdAbsTS(nextSigPos, coeff, cctx.bdpcm());
-      sign                     = m_BinDecoder.decodeBin(signCtxId);
+      sign                     = m_binDecoder.decodeBin(signCtxId);
       cctx.decimateNumCtxBins(1);
 
       signPattern += ( sign << numNonZero );
@@ -3484,7 +3495,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
       RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_gt1 );
       unsigned gt1Flag;
       const unsigned gt1CtxId = cctx.lrg1CtxIdAbsTS(nextSigPos, coeff, cctx.bdpcm());
-      gt1Flag                 = m_BinDecoder.decodeBin(gt1CtxId);
+      gt1Flag                 = m_binDecoder.decodeBin(gt1CtxId);
       DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt1_flag() bin=%d ctx=%d\n", gt1Flag, gt1CtxId);
       cctx.decimateNumCtxBins(1);
 
@@ -3492,7 +3503,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
       if( gt1Flag )
       {
         RExt__DECODER_DEBUG_BIT_STATISTICS_SET( ctype_par );
-        parFlag = m_BinDecoder.decodeBin(cctx.parityCtxIdAbsTS());
+        parFlag = m_binDecoder.decodeBin(cctx.parityCtxIdAbsTS());
         DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_par_flag() bin=%d ctx=%d\n", parFlag, cctx.parityCtxIdAbsTS());
         cctx.decimateNumCtxBins(1);
       }
@@ -3519,7 +3530,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
       {
         RExt__DECODER_DEBUG_BIT_STATISTICS_SET(ctype_gt2);
         unsigned gt2Flag;
-        gt2Flag = m_BinDecoder.decodeBin(cctx.greaterXCtxIdAbsTS(cutoffVal >> 1));
+        gt2Flag = m_binDecoder.decodeBin(cctx.greaterXCtxIdAbsTS(cutoffVal >> 1));
         tcoeff += (gt2Flag << 1);
         DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() bin=%d ctx=%d sp=%d coeff=%d\n", i, gt2Flag,
                cctx.greaterXCtxIdAbsTS(cutoffVal >> 1), scanPos, tcoeff);
@@ -3543,13 +3554,13 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
     if( tcoeff >= cutoffVal )
     {
       int       rice = riceParam;
-      int       rem  = m_BinDecoder.decodeRemAbsEP( rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange() );
+      int       rem  = m_binDecoder.decodeRemAbsEP(rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange());
       DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_rem_val() bin=%d ctx=%d sp=%d\n", rem, rice, scanPos );
       tcoeff += (scanPos <= lastScanPosPass1) ? (rem << 1) : rem;
       if (tcoeff && scanPos > lastScanPosPass1)
       {
         int      blkPos = cctx.blockPos(scanPos);
-        int sign = m_BinDecoder.decodeBinEP();
+        int      sign   = m_binDecoder.decodeBinEP();
         signPattern += (sign << numNonZero);
         sigBlkPos[numNonZero++] = blkPos;
       }
@@ -3586,7 +3597,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
 unsigned CABACReader::unary_max_symbol( unsigned ctxId0, unsigned ctxIdN, unsigned maxSymbol  )
 {
   unsigned onesRead = 0;
-  while( onesRead < maxSymbol && m_BinDecoder.decodeBin( onesRead == 0 ? ctxId0 : ctxIdN ) == 1 )
+  while (onesRead < maxSymbol && m_binDecoder.decodeBin(onesRead == 0 ? ctxId0 : ctxIdN) == 1)
   {
     ++onesRead;
   }
@@ -3597,7 +3608,7 @@ unsigned CABACReader::unary_max_eqprob( unsigned maxSymbol )
 {
   for( unsigned k = 0; k < maxSymbol; k++ )
   {
-    if( !m_BinDecoder.decodeBinEP() )
+    if (!m_binDecoder.decodeBinEP())
     {
       return k;
     }
@@ -3611,12 +3622,12 @@ unsigned CABACReader::exp_golomb_eqprob( unsigned count )
   unsigned bit    = 1;
   while( bit )
   {
-    bit     = m_BinDecoder.decodeBinEP( );
+    bit = m_binDecoder.decodeBinEP();
     symbol += bit << count++;
   }
   if( --count )
   {
-    symbol += m_BinDecoder.decodeBinsEP( count );
+    symbol += m_binDecoder.decodeBinsEP(count);
   }
   return symbol;
 }
@@ -3624,14 +3635,14 @@ unsigned CABACReader::exp_golomb_eqprob( unsigned count )
 unsigned CABACReader::code_unary_fixed( unsigned ctxId, unsigned unary_max, unsigned fixed )
 {
   unsigned idx;
-  bool unary = m_BinDecoder.decodeBin( ctxId );
+  bool     unary = m_binDecoder.decodeBin(ctxId);
   if( unary )
   {
     idx = unary_max_eqprob( unary_max );
   }
   else
   {
-    idx = unary_max + 1 + m_BinDecoder.decodeBinsEP( fixed );
+    idx = unary_max + 1 + m_binDecoder.decodeBinsEP(fixed);
   }
   return idx;
 }
@@ -3651,7 +3662,7 @@ void CABACReader::mip_flag( CodingUnit& cu )
   }
 
   unsigned ctxId = DeriveCtx::CtxMipFlag( cu );
-  cu.mipFlag = m_BinDecoder.decodeBin( Ctx::MipFlag( ctxId ) );
+  cu.mipFlag     = m_binDecoder.decodeBin(Ctx::MipFlag(ctxId));
   DTRACE( g_trace_ctx, D_SYNTAX, "mip_flag() pos=(%d,%d) mode=%d\n", cu.lumaPos().x, cu.lumaPos().y, cu.mipFlag ? 1 : 0 );
 }
 
@@ -3671,7 +3682,7 @@ void CABACReader::mip_pred_modes( CodingUnit &cu )
 
 void CABACReader::mip_pred_mode( PredictionUnit &pu )
 {
-  pu.mipTransposedFlag = bool(m_BinDecoder.decodeBinEP());
+  pu.mipTransposedFlag = bool(m_binDecoder.decodeBinEP());
 
   uint32_t mipMode;
   const int numModes = getNumModesMip( pu.Y() );
diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h
index 7c9dfcb1d..284964a36 100644
--- a/source/Lib/DecoderLib/CABACReader.h
+++ b/source/Lib/DecoderLib/CABACReader.h
@@ -48,14 +48,18 @@
 class CABACReader
 {
 public:
-  CABACReader(BinDecoderBase& binDecoder) : m_BinDecoder(binDecoder), m_Bitstream(0) {}
+  CABACReader(BinDecoderBase &binDecoder) : m_binDecoder(binDecoder), m_bitstream(nullptr) {}
   virtual ~CABACReader() {}
 
 public:
   void        initCtxModels             ( Slice&                        slice );
-  void        initBitstream             ( InputBitstream*               bitstream )           { m_Bitstream = bitstream; m_BinDecoder.init( m_Bitstream ); }
-  const Ctx&  getCtx                    ()                                            const   { return m_BinDecoder.getCtx();  }
-  Ctx&        getCtx                    ()                                                    { return m_BinDecoder.getCtx();  }
+  void        initBitstream(InputBitstream *bitstream)
+  {
+    m_bitstream = bitstream;
+    m_binDecoder.init(m_bitstream);
+  }
+  const Ctx &getCtx() const { return m_binDecoder.getCtx(); }
+  Ctx       &getCtx() { return m_binDecoder.getCtx(); }
 
 public:
   // slice segment data (clause 7.3.8.1)
@@ -146,7 +150,7 @@ private:
   unsigned    unary_max_symbol          ( unsigned ctxId0, unsigned ctxIdN, unsigned maxSymbol );
   unsigned    unary_max_eqprob          (                                   unsigned maxSymbol );
   unsigned    exp_golomb_eqprob         ( unsigned count );
-  unsigned    get_num_bits_read         () { return m_BinDecoder.getNumBitsRead(); }
+  unsigned    get_num_bits_read() { return m_binDecoder.getNumBitsRead(); }
   unsigned    code_unary_fixed          ( unsigned ctxId, unsigned unary_max, unsigned fixed );
 
   void        xReadTruncBinCode(uint32_t& symbol, uint32_t maxSymbol);
@@ -155,8 +159,8 @@ private:
   void        xAdjustPLTIndex           ( CodingUnit& cu,           Pel curLevel,          uint32_t idx, PelBuf& paletteIdx, PLTtypeBuf& paletteRunType, int maxSymbol, ComponentID compBegin );
 public:
 private:
-  BinDecoderBase& m_BinDecoder;
-  InputBitstream* m_Bitstream;
+  BinDecoderBase &m_binDecoder;
+  InputBitstream *m_bitstream;
   ScanElement*    m_scanOrder;
 };
 
diff --git a/source/Lib/DecoderLib/NALread.h b/source/Lib/DecoderLib/NALread.h
index f216ed32b..cfc86c872 100644
--- a/source/Lib/DecoderLib/NALread.h
+++ b/source/Lib/DecoderLib/NALread.h
@@ -55,14 +55,14 @@
 class InputNALUnit : public NALUnit
 {
   private:
-    InputBitstream m_Bitstream;
+    InputBitstream m_bitstream;
 
   public:
-    InputNALUnit(const InputNALUnit &src) : NALUnit(src), m_Bitstream(src.m_Bitstream) {};
-    InputNALUnit() : NALUnit(NAL_UNIT_INVALID), m_Bitstream() {};
+    InputNALUnit(const InputNALUnit &src) : NALUnit(src), m_bitstream(src.m_bitstream){};
+    InputNALUnit() : NALUnit(NAL_UNIT_INVALID), m_bitstream(){};
     virtual ~InputNALUnit() { }
-    const InputBitstream &getBitstream() const { return m_Bitstream; }
-          InputBitstream &getBitstream()       { return m_Bitstream; }
+    const InputBitstream &getBitstream() const { return m_bitstream; }
+    InputBitstream       &getBitstream() { return m_bitstream; }
 };
 
 void read(InputNALUnit& nalu);
diff --git a/source/Lib/EncoderLib/BinEncoder.cpp b/source/Lib/EncoderLib/BinEncoder.cpp
index e24c4e743..796f921bd 100644
--- a/source/Lib/EncoderLib/BinEncoder.cpp
+++ b/source/Lib/EncoderLib/BinEncoder.cpp
@@ -38,101 +38,91 @@
 #include "CommonLib/dtrace_next.h"
 
 BinCounter::BinCounter()
-  : m_CtxBinsCodedBuffer( Ctx::NumberOfContexts )
-  , m_NumBinsCtx        ( m_CtxBinsCodedBuffer.data() )
-  , m_NumBinsEP         ( 0 )
-  , m_NumBinsTrm        ( 0 )
+  : m_ctxBinsCodedBuffer(Ctx::NumberOfContexts)
+  , m_numBinsCtx(m_ctxBinsCodedBuffer.data())
+  , m_numBinsEP(0)
+  , m_numBinsTrm(0)
 {}
 
 
 void BinCounter::reset()
 {
-  for( std::size_t k = 0; k < m_CtxBinsCodedBuffer.size(); k++ )
+  for (std::size_t k = 0; k < m_ctxBinsCodedBuffer.size(); k++)
   {
-    m_NumBinsCtx[k] = 0;
+    m_numBinsCtx[k] = 0;
   }
-  m_NumBinsEP       = 0;
-  m_NumBinsTrm      = 0;
+  m_numBinsEP  = 0;
+  m_numBinsTrm = 0;
 }
 
 
 uint32_t BinCounter::getAll() const
 {
-  uint32_t  count = m_NumBinsEP + m_NumBinsTrm;
-  for( std::size_t k = 0; k < m_CtxBinsCodedBuffer.size(); k++ )
+  uint32_t count = m_numBinsEP + m_numBinsTrm;
+  for (std::size_t k = 0; k < m_ctxBinsCodedBuffer.size(); k++)
   {
-    count += m_NumBinsCtx[k];
+    count += m_numBinsCtx[k];
   }
   return count;
 }
 
-
-
-
-
-template <class BinProbModel>
-BinEncoderBase::BinEncoderBase( const BinProbModel* dummy )
-  : BinEncIf          ( dummy )
-  , m_Bitstream       ( 0 )
-  , m_Low             ( 0 )
-  , m_Range           ( 0 )
-  , m_bufferedByte    ( 0 )
-  , m_numBufferedBytes( 0 )
-  , m_bitsLeft        ( 0 )
+template<class BinProbModel>
+BinEncoderBase::BinEncoderBase(const BinProbModel *dummy)
+  : BinEncIf(dummy), m_bitstream(nullptr), m_low(0), m_range(0), m_bufferedByte(0), m_numBufferedBytes(0), m_bitsLeft(0)
 {}
 
 void BinEncoderBase::init( OutputBitstream* bitstream )
 {
-  m_Bitstream = bitstream;
+  m_bitstream = bitstream;
 }
 
 void BinEncoderBase::uninit()
 {
-  m_Bitstream = 0;
+  m_bitstream = nullptr;
 }
 
 void BinEncoderBase::start()
 {
-  m_Low               = 0;
-  m_Range             = 510;
+  m_low               = 0;
+  m_range             = 510;
   m_bufferedByte      = 0xff;
   m_numBufferedBytes  = 0;
   m_bitsLeft          = 23;
   BinCounter::reset();
-  m_BinStore. reset();
+  m_binStore.reset();
 }
 
 void BinEncoderBase::finish()
 {
-  if( m_Low >> ( 32 - m_bitsLeft ) )
+  if (m_low >> (32 - m_bitsLeft))
   {
-    m_Bitstream->write( m_bufferedByte + 1, 8 );
+    m_bitstream->write(m_bufferedByte + 1, 8);
     while( m_numBufferedBytes > 1 )
     {
-      m_Bitstream->write( 0x00, 8 );
+      m_bitstream->write(0x00, 8);
       m_numBufferedBytes--;
     }
-    m_Low -= 1 << ( 32 - m_bitsLeft );
+    m_low -= 1 << (32 - m_bitsLeft);
   }
   else
   {
     if( m_numBufferedBytes > 0 )
     {
-      m_Bitstream->write( m_bufferedByte, 8 );
+      m_bitstream->write(m_bufferedByte, 8);
     }
     while( m_numBufferedBytes > 1 )
     {
-      m_Bitstream->write( 0xff, 8 );
+      m_bitstream->write(0xff, 8);
       m_numBufferedBytes--;
     }
   }
-  m_Bitstream->write( m_Low >> 8, 24 - m_bitsLeft );
+  m_bitstream->write(m_low >> 8, 24 - m_bitsLeft);
 }
 
 void BinEncoderBase::restart()
 {
-  m_Low               = 0;
-  m_Range             = 510;
+  m_low               = 0;
+  m_range             = 510;
   m_bufferedByte      = 0xff;
   m_numBufferedBytes  = 0;
   m_bitsLeft          = 23;
@@ -146,7 +136,7 @@ void BinEncoderBase::reset( int qp, int initId )
 
 void BinEncoderBase::resetBits()
 {
-  m_Low               = 0;
+  m_low               = 0;
   m_bufferedByte      = 0xff;
   m_numBufferedBytes  = 0;
   m_bitsLeft          = 23;
@@ -155,13 +145,13 @@ void BinEncoderBase::resetBits()
 
 void BinEncoderBase::encodeBinEP( unsigned bin )
 {
-  DTRACE( g_trace_ctx, D_CABAC, "%d" "  " "%d" "  EP=%d \n", DTRACE_GET_COUNTER( g_trace_ctx, D_CABAC ), m_Range, bin );
+  DTRACE(g_trace_ctx, D_CABAC, "%d  %d  EP=%d \n", DTRACE_GET_COUNTER(g_trace_ctx, D_CABAC), m_range, bin);
 
   BinCounter::addEP();
-  m_Low <<= 1;
+  m_low <<= 1;
   if( bin )
   {
-    m_Low += m_Range;
+    m_low += m_range;
   }
   m_bitsLeft--;
   if( m_bitsLeft < 12 )
@@ -174,11 +164,12 @@ void BinEncoderBase::encodeBinsEP( unsigned bins, unsigned numBins )
 {
   for(int i = 0; i < numBins; i++)
   {
-    DTRACE( g_trace_ctx, D_CABAC, "%d" "  " "%d" "  EP=%d \n", DTRACE_GET_COUNTER( g_trace_ctx, D_CABAC ), m_Range, ( bins >> ( numBins - 1 - i ) ) & 1 );
+    DTRACE(g_trace_ctx, D_CABAC, "%d  %d  EP=%d \n", DTRACE_GET_COUNTER(g_trace_ctx, D_CABAC), m_range,
+           (bins >> (numBins - 1 - i)) & 1);
   }
 
   BinCounter::addEP( numBins );
-  if( m_Range == 256 )
+  if (m_range == 256)
   {
     encodeAlignedBinsEP( bins, numBins );
     return;
@@ -187,8 +178,8 @@ void BinEncoderBase::encodeBinsEP( unsigned bins, unsigned numBins )
   {
     numBins          -= 8;
     unsigned pattern  = bins >> numBins;
-    m_Low           <<= 8;
-    m_Low            += m_Range * pattern;
+    m_low <<= 8;
+    m_low += m_range * pattern;
     bins             -= pattern << numBins;
     m_bitsLeft       -= 8;
     if( m_bitsLeft < 12 )
@@ -196,8 +187,8 @@ void BinEncoderBase::encodeBinsEP( unsigned bins, unsigned numBins )
       writeOut();
     }
   }
-  m_Low     <<= numBins;
-  m_Low      += m_Range * bins;
+  m_low <<= numBins;
+  m_low += m_range * bins;
   m_bitsLeft -= numBins;
   if( m_bitsLeft < 12 )
   {
@@ -246,22 +237,22 @@ void BinEncoderBase::encodeRemAbsEP(unsigned bins, unsigned goRicePar, unsigned
 void BinEncoderBase::encodeBinTrm( unsigned bin )
 {
   BinCounter::addTrm();
-  m_Range -= 2;
+  m_range -= 2;
   if( bin )
   {
-    m_Low      += m_Range;
-    m_Low     <<= 7;
-    m_Range     = 2 << 7;
+    m_low += m_range;
+    m_low <<= 7;
+    m_range = 2 << 7;
     m_bitsLeft -= 7;
   }
-  else if( m_Range >= 256 )
+  else if (m_range >= 256)
   {
     return;
   }
   else
   {
-    m_Low     <<= 1;
-    m_Range   <<= 1;
+    m_low <<= 1;
+    m_range <<= 1;
     m_bitsLeft--;
   }
   if( m_bitsLeft < 12 )
@@ -273,7 +264,7 @@ void BinEncoderBase::encodeBinTrm( unsigned bin )
 
 void BinEncoderBase::align()
 {
-  m_Range = 256;
+  m_range = 256;
 }
 
 
@@ -300,7 +291,7 @@ void BinEncoderBase::encodeAlignedBinsEP( unsigned bins, unsigned numBins )
     unsigned binsToCode = std::min<unsigned>( remBins, 8); //code bytes if able to take advantage of the system's byte-write function
     unsigned binMask    = ( 1 << binsToCode ) - 1;
     unsigned newBins    = ( bins >> ( remBins - binsToCode ) ) & binMask;
-    m_Low               = ( m_Low << binsToCode ) + ( newBins << 8 ); //range is known to be 256
+    m_low               = (m_low << binsToCode) + (newBins << 8);   // range is known to be 256
     remBins            -= binsToCode;
     m_bitsLeft         -= binsToCode;
     if( m_bitsLeft < 12 )
@@ -312,9 +303,9 @@ void BinEncoderBase::encodeAlignedBinsEP( unsigned bins, unsigned numBins )
 
 void BinEncoderBase::writeOut()
 {
-  unsigned leadByte = m_Low >> ( 24 - m_bitsLeft );
+  unsigned leadByte = m_low >> (24 - m_bitsLeft);
   m_bitsLeft       += 8;
-  m_Low            &= 0xffffffffu >> m_bitsLeft;
+  m_low &= 0xffffffffu >> m_bitsLeft;
   if( leadByte == 0xff )
   {
     m_numBufferedBytes++;
@@ -326,11 +317,11 @@ void BinEncoderBase::writeOut()
       unsigned carry  = leadByte >> 8;
       unsigned byte   = m_bufferedByte + carry;
       m_bufferedByte  = leadByte & 0xff;
-      m_Bitstream->write( byte, 8 );
+      m_bitstream->write(byte, 8);
       byte            = ( 0xff + carry ) & 0xff;
       while( m_numBufferedBytes > 1 )
       {
-        m_Bitstream->write( byte, 8 );
+        m_bitstream->write(byte, 8);
         m_numBufferedBytes--;
       }
     }
@@ -342,31 +333,29 @@ void BinEncoderBase::writeOut()
   }
 }
 
-
-
-template <class BinProbModel>
+template<class BinProbModel>
 TBinEncoder<BinProbModel>::TBinEncoder()
-  : BinEncoderBase( static_cast<const BinProbModel*>    ( nullptr ) )
-  , m_Ctx         ( static_cast<CtxStore<BinProbModel>&>( *this   ) )
+  : BinEncoderBase(static_cast<const BinProbModel *>(nullptr)), m_ctx(static_cast<CtxStore<BinProbModel> &>(*this))
 {}
 
 template <class BinProbModel>
 void TBinEncoder<BinProbModel>::encodeBin( unsigned bin, unsigned ctxId )
 {
   BinCounter::addCtx( ctxId );
-  BinProbModel& rcProbModel = m_Ctx[ctxId];
-  uint32_t      LPS         = rcProbModel.getLPS( m_Range );
+  BinProbModel &probModel = m_ctx[ctxId];
+  uint32_t      lpsRange  = probModel.getLPS(m_range);
 
-  DTRACE( g_trace_ctx, D_CABAC, "%d" " %d " "%d" "  " "[%d:%d]" "  " "%2d(MPS=%d)"  "  " "  -  " "%d" "\n", DTRACE_GET_COUNTER( g_trace_ctx, D_CABAC ), ctxId, m_Range, m_Range - LPS, LPS, ( unsigned int ) ( rcProbModel.state() ), bin == rcProbModel.mps(), bin );
+  DTRACE(g_trace_ctx, D_CABAC, "%d %d %d  [%d:%d]  %2d(MPS=%d)    -  %d\n", DTRACE_GET_COUNTER(g_trace_ctx, D_CABAC),
+         ctxId, m_range, m_range - lpsRange, lpsRange, (unsigned int) (probModel.state()), bin == probModel.mps(), bin);
 
-  m_Range   -=  LPS;
-  if( bin != rcProbModel.mps() )
+  m_range -= lpsRange;
+  if (bin != probModel.mps())
   {
-    int numBits   = rcProbModel.getRenormBitsLPS( LPS );
+    int numBits = probModel.getRenormBitsLPS(lpsRange);
     m_bitsLeft   -= numBits;
-    m_Low        += m_Range;
-    m_Low         = m_Low << numBits;
-    m_Range       = LPS   << numBits;
+    m_low += m_range;
+    m_low   = m_low << numBits;
+    m_range = lpsRange << numBits;
     if( m_bitsLeft < 12 )
     {
       writeOut();
@@ -374,27 +363,27 @@ void TBinEncoder<BinProbModel>::encodeBin( unsigned bin, unsigned ctxId )
   }
   else
   {
-    if( m_Range < 256 )
+    if (m_range < 256)
     {
-      int numBits   = rcProbModel.getRenormBitsRange( m_Range );
+      int numBits = probModel.getRenormBitsRange(m_range);
       m_bitsLeft   -= numBits;
-      m_Low       <<= numBits;
-      m_Range     <<= numBits;
+      m_low <<= numBits;
+      m_range <<= numBits;
       if( m_bitsLeft < 12 )
       {
         writeOut();
       }
     }
   }
-  rcProbModel.update( bin );
-  BinEncoderBase::m_BinStore.addBin( bin, ctxId );
+  probModel.update(bin);
+  BinEncoderBase::m_binStore.addBin(bin, ctxId);
 }
 
 template <class BinProbModel>
 BinEncIf* TBinEncoder<BinProbModel>::getTestBinEncoder() const
 {
   BinEncIf* testBinEncoder = 0;
-  if( m_BinStore.inUse() )
+  if (m_binStore.inUse())
   {
     testBinEncoder = new TBinEncoder<BinProbModel>();
   }
@@ -409,7 +398,7 @@ template <class BinProbModel>
 BitEstimatorBase::BitEstimatorBase( const BinProbModel* dummy )
   : BinEncIf      ( dummy )
 {
-  m_EstFracBits = 0;
+  m_estFracBits = 0;
 }
 
 void BitEstimatorBase::encodeRemAbsEP(unsigned bins, unsigned goRicePar, unsigned cutoff, int maxLog2TrDynamicRange)
@@ -417,7 +406,7 @@ void BitEstimatorBase::encodeRemAbsEP(unsigned bins, unsigned goRicePar, unsigne
   const unsigned threshold = cutoff << goRicePar;
   if (bins < threshold)
   {
-    m_EstFracBits += BinProbModelBase::estFracBitsEP((bins >> goRicePar) + 1 + goRicePar);
+    m_estFracBits += BinProbModelBase::estFracBitsEP((bins >> goRicePar) + 1 + goRicePar);
   }
   else
   {
@@ -438,7 +427,7 @@ void BitEstimatorBase::encodeRemAbsEP(unsigned bins, unsigned goRicePar, unsigne
       }
       suffixLength = prefixLength + goRicePar + 1; //+1 for the separator bit
     }
-    m_EstFracBits += BinProbModelBase::estFracBitsEP(cutoff + prefixLength + suffixLength);
+    m_estFracBits += BinProbModelBase::estFracBitsEP(cutoff + prefixLength + suffixLength);
   }
 }
 
@@ -446,19 +435,13 @@ void BitEstimatorBase::align()
 {
   static const uint64_t add   = BinProbModelBase::estFracBitsEP() - 1;
   static const uint64_t mask  = ~add;
-  m_EstFracBits += add;
-  m_EstFracBits &= mask;
+  m_estFracBits += add;
+  m_estFracBits &= mask;
 }
 
-
-
-
-
-
-template <class BinProbModel>
+template<class BinProbModel>
 TBitEstimator<BinProbModel>::TBitEstimator()
-  : BitEstimatorBase  ( static_cast<const BinProbModel*>    ( nullptr) )
-  , m_Ctx             ( static_cast<CtxStore<BinProbModel>&>( *this  ) )
+  : BitEstimatorBase(static_cast<const BinProbModel *>(nullptr)), m_ctx(static_cast<CtxStore<BinProbModel> &>(*this))
 {}
 
 
diff --git a/source/Lib/EncoderLib/BinEncoder.h b/source/Lib/EncoderLib/BinEncoder.h
index 47f3ec02e..b94ada784 100644
--- a/source/Lib/EncoderLib/BinEncoder.h
+++ b/source/Lib/EncoderLib/BinEncoder.h
@@ -141,19 +141,20 @@ public:
   ~BinCounter() {}
 public:
   void      reset   ();
-  void      addCtx  ( unsigned ctxId )          { m_NumBinsCtx[ctxId]++; }
-  void      addEP   ( unsigned num   )          { m_NumBinsEP+=num; }
-  void      addEP   ()                          { m_NumBinsEP++; }
-  void      addTrm  ()                          { m_NumBinsTrm++; }
+  void      addCtx(unsigned ctxId) { m_numBinsCtx[ctxId]++; }
+  void      addEP(unsigned num) { m_numBinsEP += num; }
+  void      addEP() { m_numBinsEP++; }
+  void      addTrm() { m_numBinsTrm++; }
   uint32_t  getAll  ()                  const;
-  uint32_t  getCtx  ( unsigned ctxId )  const   { return m_NumBinsCtx[ctxId]; }
-  uint32_t  getEP   ()                  const   { return m_NumBinsEP; }
-  uint32_t  getTrm  ()                  const   { return m_NumBinsTrm; }
+  uint32_t  getCtx(unsigned ctxId) const { return m_numBinsCtx[ctxId]; }
+  uint32_t  getEP() const { return m_numBinsEP; }
+  uint32_t  getTrm() const { return m_numBinsTrm; }
+
 private:
-  std::vector<uint32_t> m_CtxBinsCodedBuffer;
-  uint32_t*             m_NumBinsCtx;
-  uint32_t              m_NumBinsEP;
-  uint32_t              m_NumBinsTrm;
+  std::vector<uint32_t> m_ctxBinsCodedBuffer;
+  uint32_t             *m_numBinsCtx;
+  uint32_t              m_numBinsEP;
+  uint32_t              m_numBinsTrm;
 };
 
 
@@ -186,7 +187,11 @@ public:
                                   int      maxLog2TrDynamicRange    );
   void      encodeBinTrm        ( unsigned bin                      );
   void      align               ();
-  unsigned  getNumWrittenBits   () { return ( m_Bitstream->getNumberOfWrittenBits() + 8 * m_numBufferedBytes + 23 - m_bitsLeft ); }
+  unsigned  getNumWrittenBits()
+  {
+    return (m_bitstream->getNumberOfWrittenBits() + 8 * m_numBufferedBytes + 23 - m_bitsLeft);
+  }
+
 public:
   uint32_t  getNumBins          ()                          { return BinCounter::getAll(); }
   bool      isEncoding          ()                          { return true; }
@@ -194,13 +199,13 @@ protected:
   void      encodeAlignedBinsEP ( unsigned bins,  unsigned numBins  );
   void      writeOut            ();
 protected:
-  OutputBitstream*        m_Bitstream;
-  uint32_t                m_Low;
-  uint32_t                m_Range;
+  OutputBitstream        *m_bitstream;
+  uint32_t                m_low;
+  uint32_t                m_range;
   uint32_t                m_bufferedByte;
   int32_t                 m_numBufferedBytes;
   int32_t                 m_bitsLeft;
-  BinStore                m_BinStore;
+  BinStore                m_binStore;
 };
 
 
@@ -213,11 +218,11 @@ public:
   ~TBinEncoder() {}
   void  encodeBin   ( unsigned bin, unsigned ctxId );
 public:
-  void            setBinStorage     ( bool b )          { m_BinStore.setUse(b); }
-  const BinStore* getBinStore       ()          const   { return &m_BinStore; }
+  void            setBinStorage(bool b) { m_binStore.setUse(b); }
+  const BinStore *getBinStore() const { return &m_binStore; }
   BinEncIf*       getTestBinEncoder ()          const;
 private:
-  CtxStore<BinProbModel>& m_Ctx;
+  CtxStore<BinProbModel> &m_ctx;
 };
 
 
@@ -234,18 +239,23 @@ public:
 public:
   void      init                ( OutputBitstream* bitstream )        {}
   void      uninit              ()                                    {}
-  void      start               ()                                    { m_EstFracBits = 0; }
+  void      start() { m_estFracBits = 0; }
   void      finish              ()                                    {}
-  void      restart             ()                                    { m_EstFracBits = (m_EstFracBits >> SCALE_BITS) << SCALE_BITS; }
-  void      reset               ( int qp, int initId )                { Ctx::init( qp, initId ); m_EstFracBits = 0;}
+  void      restart() { m_estFracBits = (m_estFracBits >> SCALE_BITS) << SCALE_BITS; }
+  void      reset(int qp, int initId)
+  {
+    Ctx::init(qp, initId);
+    m_estFracBits = 0;
+  }
+
 public:
-  void      resetBits           ()                                    { m_EstFracBits = 0; }
+  void resetBits() { m_estFracBits = 0; }
 
-  uint64_t  getEstFracBits      ()                              const { return m_EstFracBits; }
+  uint64_t  getEstFracBits() const { return m_estFracBits; }
   unsigned  getNumBins          ( unsigned ctxId )              const { THROW( "not supported for BitEstimator" ); return 0; }
 public:
-  void      encodeBinEP         ( unsigned bin                      ) { m_EstFracBits += BinProbModelBase::estFracBitsEP (); }
-  void      encodeBinsEP        ( unsigned bins,  unsigned numBins  ) { m_EstFracBits += BinProbModelBase::estFracBitsEP ( numBins ); }
+  void      encodeBinEP(unsigned bin) { m_estFracBits += BinProbModelBase::estFracBitsEP(); }
+  void      encodeBinsEP(unsigned bins, unsigned numBins) { m_estFracBits += BinProbModelBase::estFracBitsEP(numBins); }
   void      encodeRemAbsEP      ( unsigned bins,
                                   unsigned goRicePar,
                                   unsigned cutoff,
@@ -254,10 +264,14 @@ public:
 public:
   uint32_t  getNumBins          ()                                      { THROW("Not supported"); return 0; }
   bool      isEncoding          ()                                      { return false; }
-  unsigned  getNumWrittenBits   ()                                      { /*THROW( "Not supported" );*/ return (uint32_t)( 0/*m_EstFracBits*//* >> SCALE_BITS*/ ); }
+  unsigned  getNumWrittenBits()
+  {
+    // THROW( "Not supported" );
+    return (uint32_t) 0 /*(m_estFracBits >> SCALE_BITS)*/;
+  }
 
 protected:
-  uint64_t                m_EstFracBits;
+  uint64_t m_estFracBits;
 };
 
 
@@ -268,13 +282,13 @@ class TBitEstimator : public BitEstimatorBase
 public:
   TBitEstimator ();
   ~TBitEstimator() {}
-  void encodeBin    ( unsigned bin, unsigned ctxId )  { m_Ctx[ctxId].estFracBitsUpdate( bin, m_EstFracBits ); }
-  void encodeBinTrm ( unsigned bin )                  { m_EstFracBits += BinProbModel::estFracBitsTrm( bin ); }
+  void            encodeBin(unsigned bin, unsigned ctxId) { m_ctx[ctxId].estFracBitsUpdate(bin, m_estFracBits); }
+  void            encodeBinTrm(unsigned bin) { m_estFracBits += BinProbModel::estFracBitsTrm(bin); }
   void            setBinStorage     ( bool b )        {}
   const BinStore* getBinStore       ()          const { return 0; }
   BinEncIf*       getTestBinEncoder ()          const { return 0; }
 private:
-  CtxStore<BinProbModel>& m_Ctx;
+  CtxStore<BinProbModel> &m_ctx;
 };
 
 
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index 6d742c7df..51e432470 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -60,9 +60,10 @@ void CABACWriter::initCtxModels( const Slice& slice )
   {
     sliceType = encCABACTableIdx;
   }
-  m_BinEncoder.reset( qp, (int)sliceType );
-  m_BinEncoder.setBaseLevel(slice.getRiceBaseLevel());
-  m_BinEncoder.riceStatReset(slice.getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), slice.getSPS()->getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag()); // provide bit depth for derivation (CE14_C method)
+  m_binEncoder.reset(qp, (int) sliceType);
+  m_binEncoder.setBaseLevel(slice.getRiceBaseLevel());
+  m_binEncoder.riceStatReset(slice.getSPS()->getBitDepth(CHANNEL_TYPE_LUMA),
+                             slice.getSPS()->getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag());
 }
 
 template <class BinProbModel>
@@ -104,9 +105,9 @@ SliceType xGetCtxInitId( const Slice& slice, const BinEncIf& binEncoder, Ctx& ct
 
 SliceType CABACWriter::getCtxInitId( const Slice& slice )
 {
-  switch( m_TestCtx.getBPMType() )
+  switch (m_testCtx.getBPMType())
   {
-  case BPM_Std:   return  xGetCtxInitId<BinProbModel_Std>   ( slice, m_BinEncoder, m_TestCtx );
+  case BPM_Std: return xGetCtxInitId<BinProbModel_Std>(slice, m_binEncoder, m_testCtx);
   default:        return  NUMBER_OF_SLICE_TYPES;
   }
 }
@@ -135,8 +136,8 @@ unsigned estBits( BinEncIf& binEnc, const std::vector<bool>& bins, const Ctx& ct
 
 void CABACWriter::end_of_slice()
 {
-  m_BinEncoder.encodeBinTrm ( 1 );
-  m_BinEncoder.finish       ();
+  m_binEncoder.encodeBinTrm(1);
+  m_binEncoder.finish();
 }
 
 //================================================================================
@@ -264,13 +265,13 @@ void CABACWriter::sao_block_pars( const SAOBlkParam& saoPars, const BitDepths& b
   {
     // sao_merge_left_flag
     isLeftMerge   = ( saoPars[COMPONENT_Y].modeIdc == SAO_MODE_MERGE && saoPars[COMPONENT_Y].typeIdc == SAO_MERGE_LEFT );
-    m_BinEncoder.encodeBin( (isLeftMerge), Ctx::SaoMergeFlag() );
+    m_binEncoder.encodeBin((isLeftMerge), Ctx::SaoMergeFlag());
   }
   if( aboveMergeAvail && !isLeftMerge )
   {
     // sao_merge_above_flag
     isAboveMerge  = ( saoPars[COMPONENT_Y].modeIdc == SAO_MODE_MERGE && saoPars[COMPONENT_Y].typeIdc == SAO_MERGE_ABOVE );
-    m_BinEncoder.encodeBin( (isAboveMerge), Ctx::SaoMergeFlag() );
+    m_binEncoder.encodeBin((isAboveMerge), Ctx::SaoMergeFlag());
   }
   if( onlyEstMergeInfo )
   {
@@ -300,18 +301,18 @@ void CABACWriter::sao_offset_pars( const SAOOffset& ctbPars, ComponentID compID,
     // sao_type_idx_luma / sao_type_idx_chroma
     if( ctbPars.modeIdc == SAO_MODE_OFF )
     {
-      m_BinEncoder.encodeBin  ( 0, Ctx::SaoTypeIdx() );
+      m_binEncoder.encodeBin(0, Ctx::SaoTypeIdx());
     }
     else if( ctbPars.typeIdc == SAO_TYPE_BO )
     {
-      m_BinEncoder.encodeBin  ( 1, Ctx::SaoTypeIdx() );
-      m_BinEncoder.encodeBinEP( 0 );
+      m_binEncoder.encodeBin(1, Ctx::SaoTypeIdx());
+      m_binEncoder.encodeBinEP(0);
     }
     else
     {
       CHECK(!( ctbPars.typeIdc < SAO_TYPE_START_BO ), "Unspecified error");
-      m_BinEncoder.encodeBin  ( 1, Ctx::SaoTypeIdx() );
-      m_BinEncoder.encodeBinEP( 1 );
+      m_binEncoder.encodeBin(1, Ctx::SaoTypeIdx());
+      m_binEncoder.encodeBinEP(1);
     }
   }
 
@@ -346,11 +347,11 @@ void CABACWriter::sao_offset_pars( const SAOOffset& ctbPars, ComponentID compID,
       {
         if( offset[i] )
         {
-          m_BinEncoder.encodeBinEP( (offset[i] < 0) );
+          m_binEncoder.encodeBinEP((offset[i] < 0));
         }
       }
       // sao_band_position
-      m_BinEncoder.encodeBinsEP( ctbPars.typeAuxInfo, NUM_SAO_BO_CLASSES_LOG2 );
+      m_binEncoder.encodeBinsEP(ctbPars.typeAuxInfo, NUM_SAO_BO_CLASSES_LOG2);
     }
     // edge offset mode
     else
@@ -359,7 +360,7 @@ void CABACWriter::sao_offset_pars( const SAOOffset& ctbPars, ComponentID compID,
       {
         // sao_eo_class_luma / sao_eo_class_chroma
         CHECK( ctbPars.typeIdc - SAO_TYPE_START_EO < 0, "sao edge offset class is outside valid range" );
-        m_BinEncoder.encodeBinsEP( ctbPars.typeIdc - SAO_TYPE_START_EO, NUM_SAO_EO_TYPES_LOG2 );
+        m_binEncoder.encodeBinsEP(ctbPars.typeIdc - SAO_TYPE_START_EO, NUM_SAO_EO_TYPES_LOG2);
       }
     }
   }
@@ -535,7 +536,7 @@ void CABACWriter::mode_constraint( const PartSplit split, const CodingStructure&
     CHECK( modeType == MODE_TYPE_ALL, "shall not be no constraint case" );
     bool flag = modeType == MODE_TYPE_INTRA;
     int ctxIdx = DeriveCtx::CtxModeConsFlag( cs, partitioner );
-    m_BinEncoder.encodeBin( flag, Ctx::ModeConsFlag( ctxIdx ) );
+    m_binEncoder.encodeBin(flag, Ctx::ModeConsFlag(ctxIdx));
     DTRACE( g_trace_ctx, D_SYNTAX, "mode_cons_flag() flag=%d\n", flag );
   }
   else if( val == LDT_MODE_TYPE_INFER )
@@ -563,7 +564,7 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c
 
   if( canNo && canSplit )
   {
-    m_BinEncoder.encodeBin( !isNo, Ctx::SplitFlag( ctxSplit ) );
+    m_binEncoder.encodeBin(!isNo, Ctx::SplitFlag(ctxSplit));
   }
 
   DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode() ctx=%d split=%d\n", ctxSplit, !isNo );
@@ -578,7 +579,7 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c
 
   if( canQt && canBtt )
   {
-    m_BinEncoder.encodeBin( isQt, Ctx::SplitQtFlag( ctxQtSplit ) );
+    m_binEncoder.encodeBin(isQt, Ctx::SplitQtFlag(ctxQtSplit));
   }
 
   DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode() ctx=%d qt=%d\n", ctxQtSplit, isQt );
@@ -594,7 +595,7 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c
 
   if( canVer && canHor )
   {
-    m_BinEncoder.encodeBin( isVer, Ctx::SplitHvFlag( ctxBttHV ) );
+    m_binEncoder.encodeBin(isVer, Ctx::SplitHvFlag(ctxBttHV));
   }
 
   const bool can14 = isVer ? canTv : canTh;
@@ -603,7 +604,7 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c
 
   if( can12 && can14 )
   {
-    m_BinEncoder.encodeBin( is12, Ctx::Split12Flag( isVer ? ctxBttV12 : ctxBttH12 ) );
+    m_binEncoder.encodeBin(is12, Ctx::Split12Flag(isVer ? ctxBttV12 : ctxBttH12));
   }
 
   DTRACE( g_trace_ctx, D_SYNTAX, "split_cu_mode() ctxHv=%d ctx12=%d mode=%d\n", ctxBttHV, isVer ? ctxBttV12 : ctxBttH12, split );
@@ -701,7 +702,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu )
   {
     if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64
     {
-      m_BinEncoder.encodeBin((cu.skip), Ctx::SkipFlag(ctxId));
+      m_binEncoder.encodeBin((cu.skip), Ctx::SkipFlag(ctxId));
       DTRACE(g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0);
     }
     return;
@@ -714,7 +715,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu )
   {
     return;
   }
-  m_BinEncoder.encodeBin( ( cu.skip ), Ctx::SkipFlag( ctxId ) );
+  m_binEncoder.encodeBin((cu.skip), Ctx::SkipFlag(ctxId));
 
   DTRACE( g_trace_ctx, D_SYNTAX, "cu_skip_flag() ctx=%d skip=%d\n", ctxId, cu.skip ? 1 : 0 );
   if (cu.skip && cu.cs->slice->getSPS()->getIBCFlag())
@@ -726,7 +727,7 @@ void CABACWriter::cu_skip_flag( const CodingUnit& cu )
         return;
       }
       unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
-      m_BinEncoder.encodeBin(CU::isIBC(cu) ? 1 : 0, Ctx::IBCFlag(ctxidx));
+      m_binEncoder.encodeBin(CU::isIBC(cu) ? 1 : 0, Ctx::IBCFlag(ctxidx));
       DTRACE(g_trace_ctx, D_SYNTAX, "ibc() ctx=%d cu.predMode=%d\n", ctxidx, cu.predMode);
     }
   }
@@ -747,11 +748,11 @@ void CABACWriter::pred_mode( const CodingUnit& cu )
       if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64
       {
         unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
-        m_BinEncoder.encodeBin(CU::isIBC(cu), Ctx::IBCFlag(ctxidx));
+        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) )
       {
-        m_BinEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0));
+        m_binEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0));
       }
     }
     else
@@ -760,12 +761,12 @@ void CABACWriter::pred_mode( const CodingUnit& cu )
       {
         return;
       }
-      m_BinEncoder.encodeBin((CU::isIntra(cu) || CU::isPLT(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(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) )
         {
-          m_BinEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0));
+          m_binEncoder.encodeBin(CU::isPLT(cu), Ctx::PLTFlag(0));
         }
       }
       else
@@ -773,7 +774,7 @@ void CABACWriter::pred_mode( const CodingUnit& cu )
         if (cu.lwidth() < 128 && cu.lheight() < 128) // disable IBC mode larger than 64x64
         {
           unsigned ctxidx = DeriveCtx::CtxIBCFlag(cu);
-          m_BinEncoder.encodeBin(CU::isIBC(cu), Ctx::IBCFlag(ctxidx));
+          m_binEncoder.encodeBin(CU::isIBC(cu), Ctx::IBCFlag(ctxidx));
         }
       }
     }
@@ -790,14 +791,14 @@ void CABACWriter::pred_mode( const CodingUnit& cu )
     {
       if (cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && ( ( (!isLuma(cu.chType)) && (cu.chromaSize().width * cu.chromaSize().height > 16) ) || ((isLuma(cu.chType)) && ((cu.lumaSize().width * cu.lumaSize().height) > 16 ) )  ) && (!cu.isLocalSepTree() || isLuma(cu.chType)  ) )
       {
-        m_BinEncoder.encodeBin((CU::isPLT(cu)), Ctx::PLTFlag(0));
+        m_binEncoder.encodeBin((CU::isPLT(cu)), Ctx::PLTFlag(0));
       }
       return;
     }
-    m_BinEncoder.encodeBin((CU::isIntra(cu) || CU::isPLT(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)));
+    m_binEncoder.encodeBin((CU::isIntra(cu) || CU::isPLT(cu)), Ctx::PredMode(DeriveCtx::CtxPredModeFlag(cu)));
     if ((CU::isIntra(cu) || CU::isPLT(cu)) && cu.cs->slice->getSPS()->getPLTMode() && cu.lwidth() <= 64 && cu.lheight() <= 64 && ( ( (!isLuma(cu.chType)) && (cu.chromaSize().width * cu.chromaSize().height > 16) ) || ((isLuma(cu.chType)) && ((cu.lumaSize().width * cu.lumaSize().height) > 16 ) )  ) && (!cu.isLocalSepTree() || isLuma(cu.chType)  )  )
     {
-      m_BinEncoder.encodeBin((CU::isPLT(cu)), Ctx::PLTFlag(0));
+      m_binEncoder.encodeBin((CU::isPLT(cu)), Ctx::PLTFlag(0));
     }
   }
 }
@@ -816,11 +817,11 @@ void CABACWriter::bdpcm_mode( const CodingUnit& cu, const ComponentID compID )
   int bdpcmMode = isLuma(compID) ? cu.bdpcmMode : cu.bdpcmModeChroma;
 
   unsigned ctxId = isLuma(compID) ? 0 : 2;
-  m_BinEncoder.encodeBin(bdpcmMode > 0 ? 1 : 0, Ctx::BDPCMMode(ctxId));
+  m_binEncoder.encodeBin(bdpcmMode > 0 ? 1 : 0, Ctx::BDPCMMode(ctxId));
 
   if (bdpcmMode)
   {
-    m_BinEncoder.encodeBin(bdpcmMode > 1 ? 1 : 0, Ctx::BDPCMMode(ctxId+1));
+    m_binEncoder.encodeBin(bdpcmMode > 1 ? 1 : 0, Ctx::BDPCMMode(ctxId + 1));
   }
   if (isLuma(compID))
   {
@@ -875,7 +876,7 @@ void CABACWriter::cu_bcw_flag(const CodingUnit& cu)
   const uint8_t bcwCodingIdx = (uint8_t)g_BcwCodingOrder[CU::getValidBcwIdx(cu)];
 
   const int32_t numBcw = (cu.slice->getCheckLDC()) ? 5 : 3;
-  m_BinEncoder.encodeBin((bcwCodingIdx == 0 ? 0 : 1), Ctx::bcwIdx(0));
+  m_binEncoder.encodeBin((bcwCodingIdx == 0 ? 0 : 1), Ctx::bcwIdx(0));
   if(numBcw > 2 && bcwCodingIdx != 0)
   {
     const uint32_t prefixNumBits = numBcw - 2;
@@ -886,12 +887,12 @@ void CABACWriter::cu_bcw_flag(const CodingUnit& cu)
     {
       if (bcwCodingIdx == idx)
       {
-        m_BinEncoder.encodeBinEP(0);
+        m_binEncoder.encodeBinEP(0);
         break;
       }
       else
       {
-        m_BinEncoder.encodeBinEP(1);
+        m_binEncoder.encodeBinEP(1);
         idx += step;
       }
     }
@@ -927,14 +928,14 @@ void CABACWriter::xWriteTruncBinCode(uint32_t symbol, uint32_t maxSymbol)
   assert(b < val);
   if (symbol < val - b)
   {
-    m_BinEncoder.encodeBinsEP(symbol, thresh);
+    m_binEncoder.encodeBinsEP(symbol, thresh);
   }
   else
   {
     symbol += val - b;
     assert(symbol < (val << 1));
     assert((symbol >> 1) >= val - b);
-    m_BinEncoder.encodeBinsEP(symbol, thresh + 1);
+    m_binEncoder.encodeBinsEP(symbol, thresh + 1);
   }
 }
 
@@ -958,10 +959,10 @@ void CABACWriter::extend_ref_line(const PredictionUnit& pu)
   int multiRefIdx = pu.multiRefIdx;
   if (MRL_NUM_REF_LINES > 1)
   {
-    m_BinEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[0], Ctx::MultiRefLineIdx(0));
+    m_binEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[0], Ctx::MultiRefLineIdx(0));
     if (MRL_NUM_REF_LINES > 2 && multiRefIdx != MULTI_REF_LINE_IDX[0])
     {
-      m_BinEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[1], Ctx::MultiRefLineIdx(1));
+      m_binEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[1], Ctx::MultiRefLineIdx(1));
     }
   }
 }
@@ -990,10 +991,10 @@ void CABACWriter::extend_ref_line(const CodingUnit& cu)
     int multiRefIdx = pu->multiRefIdx;
     if (MRL_NUM_REF_LINES > 1)
     {
-      m_BinEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[0], Ctx::MultiRefLineIdx(0));
+      m_binEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[0], Ctx::MultiRefLineIdx(0));
       if (MRL_NUM_REF_LINES > 2 && multiRefIdx != MULTI_REF_LINE_IDX[0])
       {
-        m_BinEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[1], Ctx::MultiRefLineIdx(1));
+        m_binEncoder.encodeBin(multiRefIdx != MULTI_REF_LINE_IDX[1], Ctx::MultiRefLineIdx(1));
       }
     }
     pu = pu->next;
@@ -1056,7 +1057,7 @@ void CABACWriter::intra_luma_pred_modes( const CodingUnit& cu )
     }
     else
     {
-      m_BinEncoder.encodeBin(mpm_idx < numMPMs, Ctx::IntraLumaMpmFlag());
+      m_binEncoder.encodeBin(mpm_idx < numMPMs, Ctx::IntraLumaMpmFlag());
     }
 
     pu = pu->next;
@@ -1073,23 +1074,23 @@ void CABACWriter::intra_luma_pred_modes( const CodingUnit& cu )
       unsigned ctx = (pu->cu->ispMode == NOT_INTRA_SUBPARTITIONS ? 1 : 0);
       if (pu->multiRefIdx == 0)
       {
-        m_BinEncoder.encodeBin(mpm_idx > 0, Ctx::IntraLumaPlanarFlag(ctx));
+        m_binEncoder.encodeBin(mpm_idx > 0, Ctx::IntraLumaPlanarFlag(ctx));
       }
       if (mpm_idx)
       {
-        m_BinEncoder.encodeBinEP(mpm_idx > 1);
+        m_binEncoder.encodeBinEP(mpm_idx > 1);
       }
       if (mpm_idx > 1)
       {
-        m_BinEncoder.encodeBinEP(mpm_idx > 2);
+        m_binEncoder.encodeBinEP(mpm_idx > 2);
       }
       if (mpm_idx > 2)
       {
-        m_BinEncoder.encodeBinEP(mpm_idx > 3);
+        m_binEncoder.encodeBinEP(mpm_idx > 3);
       }
       if (mpm_idx > 3)
       {
-        m_BinEncoder.encodeBinEP(mpm_idx > 4);
+        m_binEncoder.encodeBinEP(mpm_idx > 4);
       }
     }
     else
@@ -1156,7 +1157,7 @@ void CABACWriter::intra_luma_pred_mode( const PredictionUnit& pu )
   }
   else
   {
-    m_BinEncoder.encodeBin(mpm_idx < numMPMs, Ctx::IntraLumaMpmFlag());
+    m_binEncoder.encodeBin(mpm_idx < numMPMs, Ctx::IntraLumaMpmFlag());
   }
 
   // mpm_idx / rem_intra_luma_pred_mode
@@ -1165,23 +1166,23 @@ void CABACWriter::intra_luma_pred_mode( const PredictionUnit& pu )
     unsigned ctx = (pu.cu->ispMode == NOT_INTRA_SUBPARTITIONS ? 1 : 0);
     if (pu.multiRefIdx == 0)
     {
-      m_BinEncoder.encodeBin(mpm_idx > 0, Ctx::IntraLumaPlanarFlag(ctx));
+      m_binEncoder.encodeBin(mpm_idx > 0, Ctx::IntraLumaPlanarFlag(ctx));
     }
     if (mpm_idx)
     {
-      m_BinEncoder.encodeBinEP(mpm_idx > 1);
+      m_binEncoder.encodeBinEP(mpm_idx > 1);
     }
     if (mpm_idx > 1)
     {
-      m_BinEncoder.encodeBinEP(mpm_idx > 2);
+      m_binEncoder.encodeBinEP(mpm_idx > 2);
     }
     if (mpm_idx > 2)
     {
-      m_BinEncoder.encodeBinEP(mpm_idx > 3);
+      m_binEncoder.encodeBinEP(mpm_idx > 3);
     }
     if (mpm_idx > 3)
     {
-      m_BinEncoder.encodeBinEP(mpm_idx > 4);
+      m_binEncoder.encodeBinEP(mpm_idx > 4);
     }
   }
   else
@@ -1232,13 +1233,13 @@ void CABACWriter::intra_chroma_lmc_mode(const PredictionUnit& pu)
   }
   CHECK(symbol < 0, "invalid symbol found");
 
-  m_BinEncoder.encodeBin(symbol == 0 ? 0 : 1, Ctx::CclmModeIdx(0));
+  m_binEncoder.encodeBin(symbol == 0 ? 0 : 1, Ctx::CclmModeIdx(0));
 
   if (symbol > 0)
   {
     CHECK(symbol > 2, "invalid symbol for MMLM");
     unsigned int symbol_minus_1 = symbol - 1;
-    m_BinEncoder.encodeBinEP(symbol_minus_1);
+    m_binEncoder.encodeBinEP(symbol_minus_1);
   }
 }
 
@@ -1252,7 +1253,7 @@ void CABACWriter::intra_chroma_pred_mode(const PredictionUnit& pu)
   }
   if (pu.cs->sps->getUseLMChroma() && pu.cu->checkCCLMAllowed())
   {
-    m_BinEncoder.encodeBin(PU::isLMCMode(intraDir) ? 1 : 0, Ctx::CclmModeFlag(0));
+    m_binEncoder.encodeBin(PU::isLMCMode(intraDir) ? 1 : 0, Ctx::CclmModeFlag(0));
     if (PU::isLMCMode(intraDir))
     {
       intra_chroma_lmc_mode(pu);
@@ -1261,7 +1262,7 @@ void CABACWriter::intra_chroma_pred_mode(const PredictionUnit& pu)
   }
 
   const bool     isDerivedMode = intraDir == DM_CHROMA_IDX;
-  m_BinEncoder.encodeBin(isDerivedMode ? 0 : 1, Ctx::IntraChromaPredMode(0));
+  m_binEncoder.encodeBin(isDerivedMode ? 0 : 1, Ctx::IntraChromaPredMode(0));
   if (isDerivedMode)
   {
     return;
@@ -1283,7 +1284,7 @@ void CABACWriter::intra_chroma_pred_mode(const PredictionUnit& pu)
   CHECK(candId >= NUM_CHROMA_MODE, "Chroma prediction mode index out of bounds");
   CHECK(chromaCandModes[candId] == DM_CHROMA_IDX, "The intra dir cannot be DM_CHROMA for this path");
   {
-    m_BinEncoder.encodeBinsEP(candId, 2);
+    m_binEncoder.encodeBinsEP(candId, 2);
   }
 }
 
@@ -1335,7 +1336,7 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C
 
 void CABACWriter::rqt_root_cbf( const CodingUnit& cu )
 {
-  m_BinEncoder.encodeBin( cu.rootCbf, Ctx::QtRootCbf() );
+  m_binEncoder.encodeBin(cu.rootCbf, Ctx::QtRootCbf());
 
   DTRACE( g_trace_ctx, D_SYNTAX, "rqt_root_cbf() ctx=0 root_cbf=%d pos=(%d,%d)\n", cu.rootCbf ? 1 : 0, cu.lumaPos().x, cu.lumaPos().y );
 }
@@ -1355,7 +1356,7 @@ void CABACWriter::adaptive_color_transform(const CodingUnit& cu)
 
   if (CU::isInter(cu) || CU::isIBC(cu) || CU::isIntra(cu))
   {
-    m_BinEncoder.encodeBin(cu.colorTransform, Ctx::ACTFlag());
+    m_binEncoder.encodeBin(cu.colorTransform, Ctx::ACTFlag());
   }
 }
 
@@ -1375,7 +1376,7 @@ void CABACWriter::sbt_mode( const CodingUnit& cu )
   //bin - flag
   bool sbtFlag = cu.sbtInfo != 0;
   uint8_t ctxIdx = ( cuWidth * cuHeight <= 256 ) ? 1 : 0;
-  m_BinEncoder.encodeBin( sbtFlag, Ctx::SbtFlag( ctxIdx ) );
+  m_binEncoder.encodeBin(sbtFlag, Ctx::SbtFlag(ctxIdx));
   if( !sbtFlag )
   {
     return;
@@ -1392,7 +1393,7 @@ void CABACWriter::sbt_mode( const CodingUnit& cu )
   //bin - type
   if( ( sbtHorHalfAllow || sbtVerHalfAllow ) && ( sbtHorQuadAllow || sbtVerQuadAllow ) )
   {
-    m_BinEncoder.encodeBin( sbtQuadFlag, Ctx::SbtQuadFlag( 0 ) );
+    m_binEncoder.encodeBin(sbtQuadFlag, Ctx::SbtQuadFlag(0));
   }
   else
   {
@@ -1403,7 +1404,7 @@ void CABACWriter::sbt_mode( const CodingUnit& cu )
   if( ( sbtQuadFlag && sbtVerQuadAllow && sbtHorQuadAllow ) || ( !sbtQuadFlag && sbtVerHalfAllow && sbtHorHalfAllow ) ) //both direction allowed
   {
     uint8_t ctxIdx = ( cuWidth == cuHeight ) ? 0 : ( cuWidth < cuHeight ? 1 : 2 );
-    m_BinEncoder.encodeBin( sbtHorFlag, Ctx::SbtHorFlag( ctxIdx ) );
+    m_binEncoder.encodeBin(sbtHorFlag, Ctx::SbtHorFlag(ctxIdx));
   }
   else
   {
@@ -1411,7 +1412,7 @@ void CABACWriter::sbt_mode( const CodingUnit& cu )
   }
 
   //bin - pos
-  m_BinEncoder.encodeBin( sbtPosFlag, Ctx::SbtPosFlag( 0 ) );
+  m_binEncoder.encodeBin(sbtPosFlag, Ctx::SbtPosFlag(0));
 
   DTRACE( g_trace_ctx, D_SYNTAX, "sbt_mode() pos=(%d,%d) sbtInfo=%d\n", cu.lx(), cu.ly(), (int)cu.sbtInfo );
 }
@@ -1460,13 +1461,13 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u
     {
       ComponentID compID = (ComponentID)comp;
       const int  channelBitDepth = sps.getBitDepth(toChannelType(compID));
-      m_BinEncoder.encodeBinsEP(cu.curPLT[comp][idx], channelBitDepth);
+      m_binEncoder.encodeBinsEP(cu.curPLT[comp][idx], channelBitDepth);
     }
   }
   uint32_t signalEscape = (cu.useEscape[compBegin]) ? 1 : 0;
   if (cu.curPLTSize[compBegin] > 0)
   {
-    m_BinEncoder.encodeBinEP(signalEscape);
+    m_binEncoder.encodeBinEP(signalEscape);
   }
   //encode index map
   uint32_t   height = cu.block(compBegin).height;
@@ -1552,7 +1553,7 @@ void CABACWriter::cuPaletteSubblockInfo(const CodingUnit& cu, ComponentID compBe
       int dist = curPos - prevRunPos - 1;
       const unsigned  ctxId = DeriveCtx::CtxPltCopyFlag(prevRunType, dist);
       runCopyFlag[curPos - minSubPos] = identityFlag;
-      m_BinEncoder.encodeBin( identityFlag, ctxSet( ctxId ) );
+      m_binEncoder.encodeBin(identityFlag, ctxSet(ctxId));
       DTRACE(g_trace_ctx, D_SYNTAX, "plt_copy_flag() bin=%d ctx=%d\n", identityFlag, ctxId);
     }
     // encode run_type
@@ -1570,7 +1571,7 @@ void CABACWriter::cuPaletteSubblockInfo(const CodingUnit& cu, ComponentID compBe
       }
       else
       {
-        m_BinEncoder.encodeBin(runType.at(posx, posy), Ctx::RunTypeFlag());
+        m_binEncoder.encodeBin(runType.at(posx, posy), Ctx::RunTypeFlag());
       }
       DTRACE(g_trace_ctx, D_SYNTAX, "plt_type_flag() bin=%d sp=%d\n", runType.at(posx, posy), curPos);
     }
@@ -1626,7 +1627,7 @@ void CABACWriter::cuPaletteSubblockInfo(const CodingUnit& cu, ComponentID compBe
 
 void CABACWriter::codeScanRotationModeFlag(const CodingUnit& cu, ComponentID compBegin)
 {
-  m_BinEncoder.encodeBin((cu.useRotation[compBegin]), Ctx::RotationFlag());
+  m_binEncoder.encodeBin((cu.useRotation[compBegin]), Ctx::RotationFlag());
 }
 
 void CABACWriter::xEncodePLTPredIndicator(const CodingUnit& cu, uint32_t maxPLTSize, ComponentID compBegin)
@@ -1845,7 +1846,7 @@ void CABACWriter::smvd_mode( const PredictionUnit& pu )
     return;
   }
 
-  m_BinEncoder.encodeBin( pu.cu->smvdMode ? 1 : 0, Ctx::SmvdFlag() );
+  m_binEncoder.encodeBin(pu.cu->smvdMode ? 1 : 0, Ctx::SmvdFlag());
 
   DTRACE( g_trace_ctx, D_SYNTAX, "symmvd_flag() symmvd=%d pos=(%d,%d) size=%dx%d\n", pu.cu->smvdMode ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height );
 }
@@ -1856,7 +1857,7 @@ void CABACWriter::subblock_merge_flag( const CodingUnit& cu )
   if ( !cu.cs->slice->isIntra() && (cu.slice->getPicHeader()->getMaxNumAffineMergeCand() > 0) && cu.lumaSize().width >= 8 && cu.lumaSize().height >= 8 )
   {
     unsigned ctxId = DeriveCtx::CtxAffineFlag( cu );
-    m_BinEncoder.encodeBin( cu.affine, Ctx::SubblockMergeFlag( ctxId ) );
+    m_binEncoder.encodeBin(cu.affine, Ctx::SubblockMergeFlag(ctxId));
     DTRACE( g_trace_ctx, D_SYNTAX, "subblock_merge_flag() subblock_merge_flag=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
   }
 }
@@ -1866,13 +1867,13 @@ void CABACWriter::affine_flag( const CodingUnit& cu )
   if ( !cu.cs->slice->isIntra() && cu.cs->sps->getUseAffine() && cu.lumaSize().width > 8 && cu.lumaSize().height > 8 )
   {
     unsigned ctxId = DeriveCtx::CtxAffineFlag( cu );
-    m_BinEncoder.encodeBin( cu.affine, Ctx::AffineFlag( ctxId ) );
+    m_binEncoder.encodeBin(cu.affine, Ctx::AffineFlag(ctxId));
     DTRACE( g_trace_ctx, D_SYNTAX, "affine_flag() affine=%d ctx=%d pos=(%d,%d)\n", cu.affine ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
 
     if ( cu.affine && cu.cs->sps->getUseAffineType() )
     {
       unsigned ctxId = 0;
-      m_BinEncoder.encodeBin( cu.affineType, Ctx::AffineType( ctxId ) );
+      m_binEncoder.encodeBin(cu.affineType, Ctx::AffineType(ctxId));
       DTRACE( g_trace_ctx, D_SYNTAX, "affine_type() affine_type=%d ctx=%d pos=(%d,%d)\n", cu.affineType ? 1 : 0, ctxId, cu.Y().x, cu.Y().y );
     }
   }
@@ -1880,7 +1881,7 @@ void CABACWriter::affine_flag( const CodingUnit& cu )
 
 void CABACWriter::merge_flag( const PredictionUnit& pu )
 {
-  m_BinEncoder.encodeBin( pu.mergeFlag, Ctx::MergeFlag() );
+  m_binEncoder.encodeBin(pu.mergeFlag, Ctx::MergeFlag());
 
   DTRACE( g_trace_ctx, D_SYNTAX, "merge_flag() merge=%d pos=(%d,%d) size=%dx%d\n", pu.mergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height );
 
@@ -1907,13 +1908,13 @@ void CABACWriter::merge_data(const PredictionUnit& pu)
                                                                     && pu.cu->lwidth() < 8 * pu.cu->lheight() && pu.cu->lheight() < 8 * pu.cu->lwidth();
   if (geoAvailable || ciipAvailable)
   {
-    m_BinEncoder.encodeBin(pu.regularMergeFlag, Ctx::RegularMergeFlag(pu.cu->skip ? 0 : 1));
+    m_binEncoder.encodeBin(pu.regularMergeFlag, Ctx::RegularMergeFlag(pu.cu->skip ? 0 : 1));
   }
   if (pu.regularMergeFlag)
   {
     if (pu.cs->sps->getUseMMVD())
     {
-      m_BinEncoder.encodeBin(pu.mmvdMergeFlag, Ctx::MmvdFlag(0));
+      m_binEncoder.encodeBin(pu.mmvdMergeFlag, Ctx::MmvdFlag(0));
       DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_merge_flag() mmvd_merge=%d pos=(%d,%d) size=%dx%d\n", pu.mmvdMergeFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height);
     }
     if (pu.mmvdMergeFlag || pu.cu->mmvdSkip)
@@ -1955,19 +1956,19 @@ void CABACWriter::imv_mode( const CodingUnit& cu )
   }
 
   if (CU::isIBC(cu) == false)
-    m_BinEncoder.encodeBin( (cu.imv > 0), Ctx::ImvFlag( 0 ) );
+    m_binEncoder.encodeBin((cu.imv > 0), Ctx::ImvFlag(0));
   DTRACE( g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", (cu.imv > 0), 0 );
 
   if( sps->getAMVREnabledFlag() && cu.imv > 0 )
   {
     if (!CU::isIBC(cu))
     {
-      m_BinEncoder.encodeBin(cu.imv < IMV_HPEL, Ctx::ImvFlag(4));
+      m_binEncoder.encodeBin(cu.imv < IMV_HPEL, Ctx::ImvFlag(4));
       DTRACE(g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", cu.imv < 3, 4);
     }
     if (cu.imv < IMV_HPEL)
     {
-      m_BinEncoder.encodeBin((cu.imv > 1), Ctx::ImvFlag(1));
+      m_binEncoder.encodeBin((cu.imv > 1), Ctx::ImvFlag(1));
       DTRACE(g_trace_ctx, D_SYNTAX, "imv_mode() value=%d ctx=%d\n", (cu.imv > 1), 1);
     }
   }
@@ -1989,12 +1990,12 @@ void CABACWriter::affine_amvr_mode( const CodingUnit& cu )
     return;
   }
 
-  m_BinEncoder.encodeBin( (cu.imv > 0), Ctx::ImvFlag( 2 ) );
+  m_binEncoder.encodeBin((cu.imv > 0), Ctx::ImvFlag(2));
   DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() value=%d ctx=%d\n", (cu.imv > 0), 2 );
 
   if( cu.imv > 0 )
   {
-    m_BinEncoder.encodeBin( (cu.imv > 1), Ctx::ImvFlag( 3 ) );
+    m_binEncoder.encodeBin((cu.imv > 1), Ctx::ImvFlag(3));
     DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() value=%d ctx=%d\n", (cu.imv > 1), 3 );
   }
   DTRACE( g_trace_ctx, D_SYNTAX, "affine_amvr_mode() IMVFlag=%d\n", cu.imv );
@@ -2009,16 +2010,16 @@ void CABACWriter::merge_idx( const PredictionUnit& pu )
     {
       if ( pu.mergeIdx == 0 )
       {
-        m_BinEncoder.encodeBin( 0, Ctx::AffMergeIdx() );
+        m_binEncoder.encodeBin(0, Ctx::AffMergeIdx());
         DTRACE( g_trace_ctx, D_SYNTAX, "aff_merge_idx() aff_merge_idx=%d\n", pu.mergeIdx );
         return;
       }
       else
       {
-        m_BinEncoder.encodeBin( 1, Ctx::AffMergeIdx() );
+        m_binEncoder.encodeBin(1, Ctx::AffMergeIdx());
         for ( unsigned idx = 1; idx < numCandminus1; idx++ )
         {
-          m_BinEncoder.encodeBinEP(pu.mergeIdx == idx ? 0 : 1);
+          m_binEncoder.encodeBinEP(pu.mergeIdx == idx ? 0 : 1);
           if ( pu.mergeIdx == idx )
           {
             break;
@@ -2045,14 +2046,14 @@ void CABACWriter::merge_idx( const PredictionUnit& pu )
       CHECK(candIdx0 >= maxNumGeoCand, "Incorrect candIdx0");
       CHECK(candIdx1 >= maxNumGeoCand, "Incorrect candIdx1");
       int numCandminus2 = maxNumGeoCand - 2;
-      m_BinEncoder.encodeBin( candIdx0 == 0 ? 0 : 1, Ctx::MergeIdx() );
+      m_binEncoder.encodeBin(candIdx0 == 0 ? 0 : 1, Ctx::MergeIdx());
       if( candIdx0 > 0 )
       {
         unary_max_eqprob(candIdx0 - 1, numCandminus2);
       }
       if (numCandminus2 > 0)
       {
-        m_BinEncoder.encodeBin(candIdx1 == 0 ? 0 : 1, Ctx::MergeIdx());
+        m_binEncoder.encodeBin(candIdx1 == 0 ? 0 : 1, Ctx::MergeIdx());
         if (candIdx1 > 0)
         {
           unary_max_eqprob(candIdx1 - 1, numCandminus2 - 1);
@@ -2073,16 +2074,16 @@ void CABACWriter::merge_idx( const PredictionUnit& pu )
     {
       if (pu.mergeIdx == 0)
       {
-        m_BinEncoder.encodeBin(0, Ctx::MergeIdx());
+        m_binEncoder.encodeBin(0, Ctx::MergeIdx());
         DTRACE(g_trace_ctx, D_SYNTAX, "merge_idx() merge_idx=%d\n", pu.mergeIdx);
         return;
       }
       else
       {
-        m_BinEncoder.encodeBin(1, Ctx::MergeIdx());
+        m_binEncoder.encodeBin(1, Ctx::MergeIdx());
         for (unsigned idx = 1; idx < numCandminus1; idx++)
         {
-          m_BinEncoder.encodeBinEP(pu.mergeIdx == idx ? 0 : 1);
+          m_binEncoder.encodeBinEP(pu.mergeIdx == idx ? 0 : 1);
           if (pu.mergeIdx == idx)
           {
             break;
@@ -2104,7 +2105,7 @@ void CABACWriter::mmvd_merge_idx(const PredictionUnit& pu)
   {
     static_assert(MMVD_BASE_MV_NUM == 2, "");
     assert(var0 < 2);
-    m_BinEncoder.encodeBin(var0, Ctx::MmvdMergeIdx());
+    m_binEncoder.encodeBin(var0, Ctx::MmvdMergeIdx());
   }
   DTRACE(g_trace_ctx, D_SYNTAX, "base_mvp_idx() base_mvp_idx=%d\n", var0);
 
@@ -2113,14 +2114,14 @@ void CABACWriter::mmvd_merge_idx(const PredictionUnit& pu)
   {
     if (var1 == 0)
     {
-      m_BinEncoder.encodeBin(0, Ctx::MmvdStepMvpIdx());
+      m_binEncoder.encodeBin(0, Ctx::MmvdStepMvpIdx());
     }
     else
     {
-      m_BinEncoder.encodeBin(1, Ctx::MmvdStepMvpIdx());
+      m_binEncoder.encodeBin(1, Ctx::MmvdStepMvpIdx());
       for (unsigned idx = 1; idx < numCandminus1_step; idx++)
       {
-        m_BinEncoder.encodeBinEP(var1 == idx ? 0 : 1);
+        m_binEncoder.encodeBinEP(var1 == idx ? 0 : 1);
         if (var1 == idx)
         {
           break;
@@ -2130,7 +2131,7 @@ void CABACWriter::mmvd_merge_idx(const PredictionUnit& pu)
   }
   DTRACE(g_trace_ctx, D_SYNTAX, "MmvdStepMvpIdx() MmvdStepMvpIdx=%d\n", var1);
 
-  m_BinEncoder.encodeBinsEP(var2, 2);
+  m_binEncoder.encodeBinsEP(var2, 2);
 
   DTRACE(g_trace_ctx, D_SYNTAX, "pos() pos=%d\n", var2);
   DTRACE(g_trace_ctx, D_SYNTAX, "mmvd_merge_idx() mmvd_merge_idx=%d\n", pu.mmvdMergeIdx);
@@ -2147,16 +2148,16 @@ void CABACWriter::inter_pred_idc( const PredictionUnit& pu )
     unsigned ctxId = DeriveCtx::CtxInterDir(pu);
     if( pu.interDir == 3 )
     {
-      m_BinEncoder.encodeBin( 1, Ctx::InterDir(ctxId) );
+      m_binEncoder.encodeBin(1, Ctx::InterDir(ctxId));
       DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=%d value=%d pos=(%d,%d)\n", ctxId, pu.interDir, pu.lumaPos().x, pu.lumaPos().y );
       return;
     }
     else
     {
-      m_BinEncoder.encodeBin( 0, Ctx::InterDir(ctxId) );
+      m_binEncoder.encodeBin(0, Ctx::InterDir(ctxId));
     }
   }
-  m_BinEncoder.encodeBin( ( pu.interDir == 2 ), Ctx::InterDir( 5 ) );
+  m_binEncoder.encodeBin((pu.interDir == 2), Ctx::InterDir(5));
   DTRACE( g_trace_ctx, D_SYNTAX, "inter_pred_idc() ctx=5 value=%d pos=(%d,%d)\n", pu.interDir, pu.lumaPos().x, pu.lumaPos().y );
 }
 
@@ -2183,13 +2184,13 @@ void CABACWriter::ref_idx( const PredictionUnit& pu, RefPicList eRefList )
     return;
   }
   int refIdx  = pu.refIdx[eRefList];
-  m_BinEncoder.encodeBin( (refIdx > 0), Ctx::RefPic() );
+  m_binEncoder.encodeBin((refIdx > 0), Ctx::RefPic());
   if( numRef <= 2 || refIdx == 0 )
   {
     DTRACE( g_trace_ctx, D_SYNTAX, "ref_idx() value=%d pos=(%d,%d)\n", refIdx, pu.lumaPos().x, pu.lumaPos().y );
     return;
   }
-  m_BinEncoder.encodeBin( (refIdx > 1), Ctx::RefPic(1) );
+  m_binEncoder.encodeBin((refIdx > 1), Ctx::RefPic(1));
   if( numRef <= 3 || refIdx == 1 )
   {
     DTRACE( g_trace_ctx, D_SYNTAX, "ref_idx() value=%d pos=(%d,%d)\n", refIdx, pu.lumaPos().x, pu.lumaPos().y );
@@ -2199,11 +2200,11 @@ void CABACWriter::ref_idx( const PredictionUnit& pu, RefPicList eRefList )
   {
     if( refIdx > idx - 1 )
     {
-      m_BinEncoder.encodeBinEP( 1 );
+      m_binEncoder.encodeBinEP(1);
     }
     else
     {
-      m_BinEncoder.encodeBinEP( 0 );
+      m_binEncoder.encodeBinEP(0);
       break;
     }
   }
@@ -2212,7 +2213,7 @@ void CABACWriter::ref_idx( const PredictionUnit& pu, RefPicList eRefList )
 
 void CABACWriter::mvp_flag( const PredictionUnit& pu, RefPicList eRefList )
 {
-  m_BinEncoder.encodeBin( pu.mvpIdx[eRefList], Ctx::MVPIdx() );
+  m_binEncoder.encodeBin(pu.mvpIdx[eRefList], Ctx::MVPIdx());
   DTRACE( g_trace_ctx, D_SYNTAX, "mvp_flag() value=%d pos=(%d,%d)\n", pu.mvpIdx[eRefList], pu.lumaPos().x, pu.lumaPos().y );
   DTRACE( g_trace_ctx, D_SYNTAX, "mvpIdx(refList:%d)=%d\n", eRefList, pu.mvpIdx[eRefList] );
 }
@@ -2229,7 +2230,7 @@ void CABACWriter::Ciip_flag(const PredictionUnit& pu)
     CHECK(pu.ciipFlag == true, "invalid Ciip and skip");
     return;
   }
-  m_BinEncoder.encodeBin(pu.ciipFlag, Ctx::CiipFlag());
+  m_binEncoder.encodeBin(pu.ciipFlag, Ctx::CiipFlag());
   DTRACE(g_trace_ctx, D_SYNTAX, "Ciip_flag() Ciip=%d pos=(%d,%d) size=%dx%d\n", pu.ciipFlag ? 1 : 0, pu.lumaPos().x, pu.lumaPos().y, pu.lumaSize().width, pu.lumaSize().height);
 }
 
@@ -2324,11 +2325,11 @@ void CABACWriter::cbf_comp( const CodingStructure& cs, bool cbf, const CompArea&
     {
       ctxId = 2;
     }
-    m_BinEncoder.encodeBin(cbf, ctxSet(ctxId));
+    m_binEncoder.encodeBin(cbf, ctxSet(ctxId));
   }
   else
   {
-    m_BinEncoder.encodeBin(cbf, ctxSet(ctxId));
+    m_binEncoder.encodeBin(cbf, ctxSet(ctxId));
   }
   DTRACE( g_trace_ctx, D_SYNTAX, "cbf_comp() etype=%d pos=(%d,%d) ctx=%d cbf=%d\n", area.compID, area.x, area.y, ctxId, cbf );
 }
@@ -2365,17 +2366,17 @@ void CABACWriter::mvd_coding( const Mv &rMvd, int8_t imv )
 
 
   // abs_mvd_greater0_flag[ 0 | 1 ]
-  m_BinEncoder.encodeBin( (horAbs > 0), Ctx::Mvd() );
-  m_BinEncoder.encodeBin( (verAbs > 0), Ctx::Mvd() );
+  m_binEncoder.encodeBin((horAbs > 0), Ctx::Mvd());
+  m_binEncoder.encodeBin((verAbs > 0), Ctx::Mvd());
 
   // abs_mvd_greater1_flag[ 0 | 1 ]
   if( horAbs > 0 )
   {
-    m_BinEncoder.encodeBin( (horAbs > 1), Ctx::Mvd(1) );
+    m_binEncoder.encodeBin((horAbs > 1), Ctx::Mvd(1));
   }
   if( verAbs > 0 )
   {
-    m_BinEncoder.encodeBin( (verAbs > 1), Ctx::Mvd(1) );
+    m_binEncoder.encodeBin((verAbs > 1), Ctx::Mvd(1));
   }
 
   // abs_mvd_minus2[ 0 | 1 ] and mvd_sign_flag[ 0 | 1 ]
@@ -2383,17 +2384,17 @@ void CABACWriter::mvd_coding( const Mv &rMvd, int8_t imv )
   {
     if( horAbs > 1 )
     {
-      m_BinEncoder.encodeRemAbsEP(horAbs - 2, 1, 0, MV_BITS - 1);
+      m_binEncoder.encodeRemAbsEP(horAbs - 2, 1, 0, MV_BITS - 1);
     }
-    m_BinEncoder.encodeBinEP( (horMvd < 0) );
+    m_binEncoder.encodeBinEP((horMvd < 0));
   }
   if( verAbs > 0 )
   {
     if( verAbs > 1 )
     {
-      m_BinEncoder.encodeRemAbsEP(verAbs - 2, 1, 0, MV_BITS - 1);
+      m_binEncoder.encodeRemAbsEP(verAbs - 2, 1, 0, MV_BITS - 1);
     }
-    m_BinEncoder.encodeBinEP( (verMvd < 0) );
+    m_binEncoder.encodeBinEP((verMvd < 0));
   }
 }
 
@@ -2568,7 +2569,7 @@ void CABACWriter::cu_qp_delta( const CodingUnit& cu, int predQP, const int8_t qp
   }
   if( absDQP > 0 )
   {
-    m_BinEncoder.encodeBinEP( DQp < 0 );
+    m_binEncoder.encodeBinEP(DQp < 0);
   }
 
   DTRACE_COND( ( isEncoding() ), g_trace_ctx, D_DQP, "x=%d, y=%d, d=%d, pred_qp=%d, DQp=%d, qp=%d\n", cu.blocks[cu.chType].lumaPos().x, cu.blocks[cu.chType].lumaPos().y, cu.qtDepth, predQP, DQp, qp );
@@ -2581,11 +2582,11 @@ void CABACWriter::cu_chroma_qp_offset( const CodingUnit& cu )
   unsigned qpAdj = cu.chromaQpAdj;
   if( qpAdj == 0 )
   {
-    m_BinEncoder.encodeBin( 0, Ctx::ChromaQpAdjFlag() );
+    m_binEncoder.encodeBin(0, Ctx::ChromaQpAdjFlag());
   }
   else
   {
-    m_BinEncoder.encodeBin( 1, Ctx::ChromaQpAdjFlag() );
+    m_binEncoder.encodeBin(1, Ctx::ChromaQpAdjFlag());
     int length = cu.cs->pps->getChromaQpOffsetListLen();
     if( length > 1 )
     {
@@ -2613,7 +2614,7 @@ void CABACWriter::joint_cb_cr( const TransformUnit& tu, const int cbfMask )
   CHECK( tu.jointCbCr && tu.jointCbCr != cbfMask, "wrong value of jointCbCr (" << (int)tu.jointCbCr << " vs " << (int)cbfMask << ")" );
   if( ( CU::isIntra( *tu.cu ) && cbfMask ) || ( cbfMask == 3 ) )
   {
-    m_BinEncoder.encodeBin( tu.jointCbCr ? 1 : 0, Ctx::JointCbCrFlag( cbfMask - 1 ) );
+    m_binEncoder.encodeBin(tu.jointCbCr ? 1 : 0, Ctx::JointCbCrFlag(cbfMask - 1));
   }
 }
 
@@ -2683,12 +2684,12 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID,
   int ctxBinSampleRatio = (compID == COMPONENT_Y) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA;
   cctx.regBinLimit = (tu.getTbAreaAfterCoefZeroOut(compID) * ctxBinSampleRatio) >> 4;
 
-  int baseLevel = m_BinEncoder.getCtx().getBaseLevel();
+  int baseLevel = m_binEncoder.getCtx().getBaseLevel();
   cctx.setBaseLevel(baseLevel);
   if (tu.cs->slice->getSPS()->getSpsRangeExtension().getPersistentRiceAdaptationEnabledFlag())
   {
     cctx.setUpdateHist(1);
-    unsigned riceStats = m_BinEncoder.getCtx().getGRAdaptStats((unsigned)compID);
+    unsigned riceStats    = m_binEncoder.getCtx().getGRAdaptStats((unsigned) compID);
     TCoeff historyValue = (TCoeff)1 << riceStats;
     cctx.setHistValue(historyValue);
   }
@@ -2721,7 +2722,7 @@ void CABACWriter::ts_flag( const TransformUnit& tu, ComponentID compID )
 
   if( TU::isTSAllowed ( tu, compID ) )
   {
-    m_BinEncoder.encodeBin( tsFlag, Ctx::TransformSkipFlag(ctxIdx));
+    m_binEncoder.encodeBin(tsFlag, Ctx::TransformSkipFlag(ctxIdx));
   }
   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 );
 }
@@ -2737,7 +2738,7 @@ void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx* cuCtx )
     int symbol = mtsIdx != MTS_DCT2_DCT2 ? 1 : 0;
     int ctxIdx = 0;
 
-    m_BinEncoder.encodeBin( symbol, Ctx::MTSIdx(ctxIdx));
+    m_binEncoder.encodeBin(symbol, Ctx::MTSIdx(ctxIdx));
 
     if( symbol )
     {
@@ -2745,7 +2746,7 @@ void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx* cuCtx )
       for( int i = 0; i < 3; i++, ctxIdx++ )
       {
         symbol = mtsIdx > i + MTS_DST7_DST7 ? 1 : 0;
-        m_BinEncoder.encodeBin( symbol, Ctx::MTSIdx(ctxIdx));
+        m_binEncoder.encodeBin(symbol, Ctx::MTSIdx(ctxIdx));
 
         if( !symbol )
         {
@@ -2766,12 +2767,12 @@ void CABACWriter::isp_mode( const CodingUnit& cu )
   }
   if ( cu.ispMode == NOT_INTRA_SUBPARTITIONS )
   {
-    m_BinEncoder.encodeBin( 0, Ctx::ISPMode( 0 ) );
+    m_binEncoder.encodeBin(0, Ctx::ISPMode(0));
   }
   else
   {
-    m_BinEncoder.encodeBin( 1, Ctx::ISPMode( 0 ) );
-    m_BinEncoder.encodeBin( cu.ispMode - 1, Ctx::ISPMode( 1 ) );
+    m_binEncoder.encodeBin(1, Ctx::ISPMode(0));
+    m_binEncoder.encodeBin(cu.ispMode - 1, Ctx::ISPMode(1));
   }
   DTRACE( g_trace_ctx, D_SYNTAX, "intra_subPartitions() etype=%d pos=(%d,%d) ispIdx=%d\n", cu.chType, cu.blocks[cu.chType].x, cu.blocks[cu.chType].y, (int)cu.ispMode );
 }
@@ -2825,11 +2826,11 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx )
 
   const uint32_t idxLFNST = cu.lfnstIdx;
   assert( idxLFNST < 3 );
-  m_BinEncoder.encodeBin( idxLFNST ? 1 : 0, Ctx::LFNSTIdx( cctx ) );
+  m_binEncoder.encodeBin(idxLFNST ? 1 : 0, Ctx::LFNSTIdx(cctx));
 
   if( idxLFNST )
   {
-    m_BinEncoder.encodeBin( (idxLFNST - 1) ? 1 : 0, Ctx::LFNSTIdx(2));
+    m_binEncoder.encodeBin((idxLFNST - 1) ? 1 : 0, Ctx::LFNSTIdx(2));
   }
 
   DTRACE( g_trace_ctx, D_SYNTAX, "residual_lfnst_mode() etype=%d pos=(%d,%d) mode=%d\n", COMPONENT_Y, cu.lx(), cu.ly(), ( int ) cu.lfnstIdx );
@@ -2884,26 +2885,26 @@ void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx, const TransformUnit&
 
   for( CtxLast = 0; CtxLast < GroupIdxX; CtxLast++ )
   {
-    m_BinEncoder.encodeBin( 1, cctx.lastXCtxId( CtxLast ) );
+    m_binEncoder.encodeBin(1, cctx.lastXCtxId(CtxLast));
   }
   if( GroupIdxX < maxLastPosX )
   {
-    m_BinEncoder.encodeBin( 0, cctx.lastXCtxId( CtxLast ) );
+    m_binEncoder.encodeBin(0, cctx.lastXCtxId(CtxLast));
   }
   for( CtxLast = 0; CtxLast < GroupIdxY; CtxLast++ )
   {
-    m_BinEncoder.encodeBin( 1, cctx.lastYCtxId( CtxLast ) );
+    m_binEncoder.encodeBin(1, cctx.lastYCtxId(CtxLast));
   }
   if( GroupIdxY < maxLastPosY )
   {
-    m_BinEncoder.encodeBin( 0, cctx.lastYCtxId( CtxLast ) );
+    m_binEncoder.encodeBin(0, cctx.lastYCtxId(CtxLast));
   }
   if( GroupIdxX > 3 )
   {
     posX -= g_minInGroup[GroupIdxX];
     for (int i = ( ( GroupIdxX - 2 ) >> 1 ) - 1 ; i >= 0; i-- )
     {
-      m_BinEncoder.encodeBinEP( ( posX >> i ) & 1 );
+      m_binEncoder.encodeBinEP((posX >> i) & 1);
     }
   }
   if( GroupIdxY > 3 )
@@ -2911,7 +2912,7 @@ void CABACWriter::last_sig_coeff( CoeffCodingContext& cctx, const TransformUnit&
     posY -= g_minInGroup[GroupIdxY];
     for ( int i = ( ( GroupIdxY - 2 ) >> 1 ) - 1 ; i >= 0; i-- )
     {
-      m_BinEncoder.encodeBinEP( ( posY >> i ) & 1 );
+      m_binEncoder.encodeBinEP((posY >> i) & 1);
     }
   }
 }
@@ -2931,11 +2932,11 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
   {
     if( cctx.isSigGroup() )
     {
-      m_BinEncoder.encodeBin( 1, cctx.sigGroupCtxId() );
+      m_binEncoder.encodeBin(1, cctx.sigGroupCtxId());
     }
     else
     {
-      m_BinEncoder.encodeBin( 0, cctx.sigGroupCtxId() );
+      m_binEncoder.encodeBin(0, cctx.sigGroupCtxId());
       return;
     }
   }
@@ -2959,7 +2960,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
     if( numNonZero || nextSigPos != inferSigPos )
     {
       const unsigned sigCtxId = cctx.sigCtxIdAbs( nextSigPos, coeff, state );
-      m_BinEncoder.encodeBin( sigFlag, sigCtxId );
+      m_binEncoder.encodeBin(sigFlag, sigCtxId);
       DTRACE( g_trace_ctx, D_SYNTAX_RESI, "sig_bin() bin=%d ctx=%d\n", sigFlag, sigCtxId );
       remRegBins--;
     }
@@ -2987,20 +2988,20 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
       }
 
       unsigned gt1 = !!remAbsLevel;
-      m_BinEncoder.encodeBin( gt1, cctx.greater1CtxIdAbs(ctxOff) );
+      m_binEncoder.encodeBin(gt1, cctx.greater1CtxIdAbs(ctxOff));
       DTRACE( g_trace_ctx, D_SYNTAX_RESI, "gt1_flag() bin=%d ctx=%d\n", gt1, cctx.greater1CtxIdAbs(ctxOff) );
       remRegBins--;
 
       if( gt1 )
       {
         remAbsLevel  -= 1;
-        m_BinEncoder.encodeBin( remAbsLevel&1, cctx.parityCtxIdAbs( ctxOff ) );
+        m_binEncoder.encodeBin(remAbsLevel & 1, cctx.parityCtxIdAbs(ctxOff));
         DTRACE( g_trace_ctx, D_SYNTAX_RESI, "par_flag() bin=%d ctx=%d\n", remAbsLevel&1, cctx.parityCtxIdAbs( ctxOff ) );
         remAbsLevel >>= 1;
 
         remRegBins--;
         unsigned gt2 = !!remAbsLevel;
-        m_BinEncoder.encodeBin(gt2, cctx.greater2CtxIdAbs(ctxOff));
+        m_binEncoder.encodeBin(gt2, cctx.greater2CtxIdAbs(ctxOff));
         DTRACE(g_trace_ctx, D_SYNTAX_RESI, "gt2_flag() bin=%d ctx=%d\n", gt2, cctx.greater2CtxIdAbs(ctxOff));
         remRegBins--;
       }
@@ -3022,11 +3023,11 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
     if( absLevel >= 4 )
     {
       unsigned rem      = ( absLevel - 4 ) >> 1;
-      m_BinEncoder.encodeRemAbsEP( rem, ricePar, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange() );
+      m_binEncoder.encodeRemAbsEP(rem, ricePar, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange());
       DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, ricePar );
       if ((updateHistory) && (rem > 0))
       {
-        unsigned &riceStats = m_BinEncoder.getCtx().getGRAdaptStats((unsigned)(cctx.compID()));
+        unsigned &riceStats = m_binEncoder.getCtx().getGRAdaptStats((unsigned) (cctx.compID()));
         cctx.updateRiceStat(riceStats, rem, 1);
         cctx.setUpdateHist(0);
         updateHistory = 0;
@@ -3042,12 +3043,12 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
     int rice = (cctx.*(cctx.deriveRiceRRC))(scanPos, coeff, 0);
     int         pos0      = g_goRicePosCoeff0(state, rice);
     unsigned  rem       = ( absLevel == 0 ? pos0 : absLevel <= pos0 ? absLevel-1 : absLevel );
-    m_BinEncoder.encodeRemAbsEP( rem, rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange() );
+    m_binEncoder.encodeRemAbsEP(rem, rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange());
     DTRACE( g_trace_ctx, D_SYNTAX_RESI, "rem_val() bin=%d ctx=%d\n", rem, rice );
     state = ( stateTransTable >> ((state<<2)+((absLevel&1)<<1)) ) & 3;
     if ((updateHistory) && (rem > 0))
     {
-      unsigned &riceStats = m_BinEncoder.getCtx().getGRAdaptStats((unsigned)cctx.compID());
+      unsigned &riceStats = m_binEncoder.getCtx().getGRAdaptStats((unsigned) cctx.compID());
       cctx.updateRiceStat(riceStats, rem, 0);
       cctx.setUpdateHist(0);
       updateHistory = 0;
@@ -3072,7 +3073,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
     numSigns    --;
     signPattern >>= 1;
   }
-  m_BinEncoder.encodeBinsEP( signPattern, numSigns );
+  m_binEncoder.encodeBinsEP(signPattern, numSigns);
 }
 
 void CABACWriter::residual_codingTS( const TransformUnit& tu, ComponentID compID )
@@ -3138,12 +3139,12 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
   {
     if( cctx.isSigGroup() )
     {
-      m_BinEncoder.encodeBin(1, cctx.sigGroupCtxId(true));
+      m_binEncoder.encodeBin(1, cctx.sigGroupCtxId(true));
       DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() bin=%d ctx=%d\n", 1, cctx.sigGroupCtxId());
     }
     else
     {
-      m_BinEncoder.encodeBin(0, cctx.sigGroupCtxId(true));
+      m_binEncoder.encodeBin(0, cctx.sigGroupCtxId(true));
       DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_sigGroup() bin=%d ctx=%d\n", 0, cctx.sigGroupCtxId());
       return;
     }
@@ -3165,7 +3166,7 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
     if( numNonZero || nextSigPos != inferSigPos )
     {
       const unsigned sigCtxId = cctx.sigCtxIdAbsTS(nextSigPos, coeff);
-      m_BinEncoder.encodeBin(sigFlag, sigCtxId);
+      m_binEncoder.encodeBin(sigFlag, sigCtxId);
       DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_sig_bin() bin=%d ctx=%d\n", sigFlag, sigCtxId);
       cctx.decimateNumCtxBins(1);
     }
@@ -3175,7 +3176,7 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
       //===== encode sign's =====
       int            sign      = coeffVal < 0;
       const unsigned signCtxId = cctx.signCtxIdAbsTS(nextSigPos, coeff, cctx.bdpcm());
-      m_BinEncoder.encodeBin(sign, signCtxId);
+      m_binEncoder.encodeBin(sign, signCtxId);
       cctx.decimateNumCtxBins(1);
       numNonZero++;
       cctx.neighTS(rightPixel, belowPixel, nextSigPos, coeff);
@@ -3184,16 +3185,16 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
 
       unsigned gt1 = !!remAbsLevel;
       const unsigned gt1CtxId = cctx.lrg1CtxIdAbsTS(nextSigPos, coeff, cctx.bdpcm());
-      m_BinEncoder.encodeBin(gt1, gt1CtxId);
+      m_binEncoder.encodeBin(gt1, gt1CtxId);
       DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt1_flag() bin=%d ctx=%d\n", gt1, gt1CtxId);
       cctx.decimateNumCtxBins(1);
 
       if( gt1 )
       {
         remAbsLevel  -= 1;
-          m_BinEncoder.encodeBin( remAbsLevel&1, cctx.parityCtxIdAbsTS() );
-          DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_par_flag() bin=%d ctx=%d\n", remAbsLevel&1, cctx.parityCtxIdAbsTS() );
-          cctx.decimateNumCtxBins(1);
+        m_binEncoder.encodeBin(remAbsLevel & 1, cctx.parityCtxIdAbsTS());
+        DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_par_flag() bin=%d ctx=%d\n", remAbsLevel & 1, cctx.parityCtxIdAbsTS());
+        cctx.decimateNumCtxBins(1);
       }
     }
     lastScanPosPass1 = nextSigPos;
@@ -3212,10 +3213,10 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
       if (absLevel >= cutoffVal)
       {
         unsigned gt2 = (absLevel >= (cutoffVal + 2));
-          m_BinEncoder.encodeBin(gt2, cctx.greaterXCtxIdAbsTS(cutoffVal >> 1));
-          DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() bin=%d ctx=%d sp=%d coeff=%d\n", i, gt2,
-                 cctx.greaterXCtxIdAbsTS(cutoffVal >> 1), scanPos, std::min<int>(absLevel, cutoffVal + 2));
-          cctx.decimateNumCtxBins(1);
+        m_binEncoder.encodeBin(gt2, cctx.greaterXCtxIdAbsTS(cutoffVal >> 1));
+        DTRACE(g_trace_ctx, D_SYNTAX_RESI, "ts_gt%d_flag() bin=%d ctx=%d sp=%d coeff=%d\n", i, gt2,
+               cctx.greaterXCtxIdAbsTS(cutoffVal >> 1), scanPos, std::min<int>(absLevel, cutoffVal + 2));
+        cctx.decimateNumCtxBins(1);
       }
       cutoffVal += 2;
     }
@@ -3234,7 +3235,7 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
     {
       int       rice = riceParam;
       unsigned  rem = scanPos <= lastScanPosPass1 ? (absLevel - cutoffVal) >> 1 : absLevel;
-      m_BinEncoder.encodeRemAbsEP( rem, rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange() );
+      m_binEncoder.encodeRemAbsEP(rem, rice, COEF_REMAIN_BIN_REDUCTION, cctx.maxLog2TrDRange());
       DTRACE( g_trace_ctx, D_SYNTAX_RESI, "ts_rem_val() bin=%d ctx=%d sp=%d\n", rem, rice, scanPos );
       if ( ricePresentFlag && (isEncoding()) && (cctx.compID() == COMPONENT_Y))
       {
@@ -3263,7 +3264,7 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
       if (absLevel && scanPos > lastScanPosPass1)
       {
         const int sign = coeff[cctx.blockPos(scanPos)] < 0 ? 1 : 0;
-        m_BinEncoder.encodeBinEP(sign);
+        m_binEncoder.encodeBinEP(sign);
       }
     }
   }
@@ -3284,7 +3285,7 @@ void CABACWriter::unary_max_symbol( unsigned symbol, unsigned ctxId0, unsigned c
   for( unsigned binsWritten = 0; binsWritten < totalBinsToWrite; ++binsWritten )
   {
     const unsigned nextBin = symbol > binsWritten;
-    m_BinEncoder.encodeBin( nextBin, binsWritten == 0 ? ctxId0 : ctxIdN );
+    m_binEncoder.encodeBin(nextBin, binsWritten == 0 ? ctxId0 : ctxIdN);
   }
 }
 
@@ -3310,7 +3311,7 @@ void CABACWriter::unary_max_eqprob( unsigned symbol, unsigned maxSymbol )
     numBins++;
   }
   CHECK(!( numBins <= 32 ), "Unspecified error");
-  m_BinEncoder.encodeBinsEP( bins, numBins );
+  m_binEncoder.encodeBinsEP(bins, numBins);
 }
 
 void CABACWriter::exp_golomb_eqprob( unsigned symbol, unsigned count )
@@ -3328,8 +3329,8 @@ void CABACWriter::exp_golomb_eqprob( unsigned symbol, unsigned count )
   bins <<= 1;
   numBins++;
   //CHECK(!( numBins + count <= 32 ), "Unspecified error");
-  m_BinEncoder.encodeBinsEP(bins, numBins);
-  m_BinEncoder.encodeBinsEP(symbol, count);
+  m_binEncoder.encodeBinsEP(bins, numBins);
+  m_binEncoder.encodeBinsEP(symbol, count);
 }
 
 void CABACWriter::codeAlfCtuEnableFlags( CodingStructure& cs, ChannelType channel, AlfParam* alfParam)
@@ -3387,7 +3388,7 @@ void CABACWriter::codeAlfCtuEnableFlag( CodingStructure& cs, uint32_t ctuRsAddr,
     int ctx = 0;
     ctx += leftCTUAddr > -1 ? ( ctbAlfFlag[leftCTUAddr] ? 1 : 0 ) : 0;
     ctx += aboveCTUAddr > -1 ? ( ctbAlfFlag[aboveCTUAddr] ? 1 : 0 ) : 0;
-    m_BinEncoder.encodeBin( ctbAlfFlag[ctuRsAddr], Ctx::ctbAlfFlag( compIdx * 3 + ctx ) );
+    m_binEncoder.encodeBin(ctbAlfFlag[ctuRsAddr], Ctx::ctbAlfFlag(compIdx * 3 + ctx));
   }
 }
 
@@ -3415,18 +3416,18 @@ void CABACWriter::codeCcAlfFilterControlIdc(uint8_t idcVal, CodingStructure &cs,
   }
   ctxt += ( compID == COMPONENT_Cr ) ? 3 : 0;
 
-  m_BinEncoder.encodeBin( ( idcVal == 0 ) ? 0 : 1, Ctx::CcAlfFilterControlFlag( ctxt ) ); // ON/OFF flag is context coded
+  m_binEncoder.encodeBin((idcVal == 0) ? 0 : 1, Ctx::CcAlfFilterControlFlag(ctxt));   // ON/OFF flag is context coded
   if ( idcVal > 0 )
   {
     int val = (idcVal - 1);
     while ( val )
     {
-      m_BinEncoder.encodeBinEP( 1 );
+      m_binEncoder.encodeBinEP(1);
       val--;
     }
     if ( idcVal < filterCount )
     {
-      m_BinEncoder.encodeBinEP( 0 );
+      m_binEncoder.encodeBinEP(0);
     }
   }
   DTRACE( g_trace_ctx, D_SYNTAX, "ccAlfFilterControlIdc() compID=%d pos=(%d,%d) ctxt=%d, filterCount=%d, idcVal=%d\n", compID, lumaPos.x, lumaPos.y, ctxt, filterCount, idcVal );
@@ -3435,14 +3436,14 @@ void CABACWriter::codeCcAlfFilterControlIdc(uint8_t idcVal, CodingStructure &cs,
 void CABACWriter::code_unary_fixed( unsigned symbol, unsigned ctxId, unsigned unary_max, unsigned fixed )
 {
   bool unary = (symbol <= unary_max);
-  m_BinEncoder.encodeBin( unary, ctxId );
+  m_binEncoder.encodeBin(unary, ctxId);
   if( unary )
   {
     unary_max_eqprob( symbol, unary_max );
   }
   else
   {
-    m_BinEncoder.encodeBinsEP( symbol - unary_max - 1, fixed );
+    m_binEncoder.encodeBinsEP(symbol - unary_max - 1, fixed);
   }
 }
 
@@ -3458,7 +3459,7 @@ void CABACWriter::mip_flag( const CodingUnit& cu )
   }
 
   unsigned ctxId = DeriveCtx::CtxMipFlag( cu );
-  m_BinEncoder.encodeBin( cu.mipFlag, Ctx::MipFlag( ctxId ) );
+  m_binEncoder.encodeBin(cu.mipFlag, Ctx::MipFlag(ctxId));
   DTRACE( g_trace_ctx, D_SYNTAX, "mip_flag() pos=(%d,%d) mode=%d\n", cu.lumaPos().x, cu.lumaPos().y, cu.mipFlag ? 1 : 0 );
 }
 
@@ -3476,7 +3477,7 @@ void CABACWriter::mip_pred_modes( const CodingUnit& cu )
 
 void CABACWriter::mip_pred_mode( const PredictionUnit& pu )
 {
-  m_BinEncoder.encodeBinEP( (pu.mipTransposedFlag ? 1 : 0) );
+  m_binEncoder.encodeBinEP((pu.mipTransposedFlag ? 1 : 0));
 
   const int numModes = getNumModesMip( pu.Y() );
   CHECKD( pu.intraDir[CHANNEL_TYPE_LUMA] < 0 || pu.intraDir[CHANNEL_TYPE_LUMA] >= numModes, "Invalid MIP mode" );
@@ -3505,7 +3506,7 @@ void CABACWriter::codeAlfCtuFilterIndex(CodingStructure& cs, uint32_t ctuRsAddr,
   if (numAvailableFiltSets > NUM_FIXED_FILTER_SETS)
   {
     int useTemporalFilt = (filterSetIdx >= NUM_FIXED_FILTER_SETS) ? 1 : 0;
-    m_BinEncoder.encodeBin(useTemporalFilt, Ctx::AlfUseTemporalFilt());
+    m_binEncoder.encodeBin(useTemporalFilt, Ctx::AlfUseTemporalFilt());
     if (useTemporalFilt)
     {
       CHECK((filterSetIdx - NUM_FIXED_FILTER_SETS) >= (numAvailableFiltSets - NUM_FIXED_FILTER_SETS), "temporal non-latest set");
@@ -3581,11 +3582,11 @@ void CABACWriter::codeAlfCtuAlternative( CodingStructure& cs, uint32_t ctuRsAddr
       assert( ctbAlfAlternative[ctuRsAddr] < numAlts );
       for( int i = 0; i < numOnes; ++i )
       {
-        m_BinEncoder.encodeBin( 1, Ctx::ctbAlfAlternative( compIdx-1 ) );
+        m_binEncoder.encodeBin(1, Ctx::ctbAlfAlternative(compIdx - 1));
       }
       if( numOnes < numAlts-1 )
       {
-        m_BinEncoder.encodeBin( 0, Ctx::ctbAlfAlternative( compIdx-1 ) );
+        m_binEncoder.encodeBin(0, Ctx::ctbAlfAlternative(compIdx - 1));
       }
     }
   }
diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h
index 3634ba571..ce4672378 100644
--- a/source/Lib/EncoderLib/CABACWriter.h
+++ b/source/Lib/EncoderLib/CABACWriter.h
@@ -51,27 +51,31 @@ class EncCu;
 class CABACWriter
 {
 public:
-  CABACWriter(BinEncIf &binEncoder) : m_BinEncoder(binEncoder), m_Bitstream(0)
+  CABACWriter(BinEncIf &binEncoder) : m_binEncoder(binEncoder), m_bitstream(nullptr)
   {
-    m_TestCtx = m_BinEncoder.getCtx();
-    m_EncCu   = nullptr;
+    m_testCtx = m_binEncoder.getCtx();
+    m_encCu   = nullptr;
   }
   virtual ~CABACWriter() {}
 
 public:
   void        initCtxModels             ( const Slice&                  slice );
-  void        setEncCu(EncCu* pcEncCu) { m_EncCu = pcEncCu; }
+  void        setEncCu(EncCu *pcEncCu) { m_encCu = pcEncCu; }
   SliceType   getCtxInitId              ( const Slice&                  slice );
-  void        initBitstream             ( OutputBitstream*              bitstream )           { m_Bitstream = bitstream; m_BinEncoder.init( m_Bitstream ); }
+  void        initBitstream(OutputBitstream *bitstream)
+  {
+    m_bitstream = bitstream;
+    m_binEncoder.init(m_bitstream);
+  }
 
-  const Ctx&  getCtx                    ()                                            const   { return m_BinEncoder.getCtx();  }
-  Ctx&        getCtx                    ()                                                    { return m_BinEncoder.getCtx();  }
+  const Ctx &getCtx() const { return m_binEncoder.getCtx(); }
+  Ctx       &getCtx() { return m_binEncoder.getCtx(); }
 
-  void        start                     ()                                                    { m_BinEncoder.start(); }
-  void        resetBits                 ()                                                    { m_BinEncoder.resetBits(); }
-  uint64_t    getEstFracBits            ()                                            const   { return m_BinEncoder.getEstFracBits(); }
-  uint32_t    getNumBins                ()                                                    { return m_BinEncoder.getNumBins(); }
-  bool        isEncoding                ()                                                    { return m_BinEncoder.isEncoding(); }
+  void     start() { m_binEncoder.start(); }
+  void     resetBits() { m_binEncoder.resetBits(); }
+  uint64_t getEstFracBits() const { return m_binEncoder.getEstFracBits(); }
+  uint32_t getNumBins() { return m_binEncoder.getNumBins(); }
+  bool     isEncoding() { return m_binEncoder.isEncoding(); }
 
 public:
   // slice segment data (clause 7.3.8.1)
@@ -175,17 +179,14 @@ private:
   void        exp_golomb_eqprob         ( unsigned symbol, unsigned count );
   void        code_unary_fixed          ( unsigned symbol, unsigned ctxId, unsigned unary_max, unsigned fixed );
 
-  // statistic
-  unsigned    get_num_written_bits()    { return m_BinEncoder.getNumWrittenBits(); }
-
   void  xWriteTruncBinCode(uint32_t uiSymbol, uint32_t uiMaxSymbol);
   void        codeScanRotationModeFlag   ( const CodingUnit& cu,     ComponentID compBegin);
   void        xEncodePLTPredIndicator    ( const CodingUnit& cu,     uint32_t    maxPltSize, ComponentID compBegin);
 private:
-  BinEncIf&         m_BinEncoder;
-  OutputBitstream*  m_Bitstream;
-  Ctx               m_TestCtx;
-  EncCu*            m_EncCu;
+  BinEncIf         &m_binEncoder;
+  OutputBitstream  *m_bitstream;
+  Ctx               m_testCtx;
+  EncCu            *m_encCu;
   ScanElement*      m_scanOrder;
 };
 
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index 781b65ef5..c4c0ec3e9 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -151,7 +151,7 @@ void EncCu::create( EncCfg* encCfg )
     m_acGeoWeightedBuffer[ui].create( chromaFormat, Area( 0, 0, uiMaxWidth, uiMaxHeight ) );
   }
 
-  m_CtxBuffer.resize( maxDepth );
+  m_ctxBuffer.resize(maxDepth);
   m_CurrCtx = 0;
 }
 
@@ -302,7 +302,7 @@ void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsign
     }
   }
   // init current context pointer
-  m_CurrCtx = m_CtxBuffer.data();
+  m_CurrCtx = m_ctxBuffer.data();
 
   CodingStructure *tempCS = m_pTempCS[gp_sizeIdxInfo->idxFrom( area.lumaSize().width )][gp_sizeIdxInfo->idxFrom( area.lumaSize().height )];
   CodingStructure *bestCS = m_pBestCS[gp_sizeIdxInfo->idxFrom( area.lumaSize().width )][gp_sizeIdxInfo->idxFrom( area.lumaSize().height )];
diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h
index e5babfdd4..71e4c90d4 100644
--- a/source/Lib/EncoderLib/EncCu.h
+++ b/source/Lib/EncoderLib/EncCu.h
@@ -159,7 +159,7 @@ private:
     Ctx best;
   };
 
-  std::vector<CtxPair>  m_CtxBuffer;
+  std::vector<CtxPair>  m_ctxBuffer;
   CtxPair*              m_CurrCtx;
   CtxCache*             m_CtxCache;
 
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index 571140bb8..fad715a62 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -336,7 +336,7 @@ void EncGOP::init ( EncLib* pcEncLib )
 int EncGOP::xWriteOPI (AccessUnit &accessUnit, const OPI *opi)
 {
   OutputNALUnit nalu(NAL_UNIT_OPI);
-  m_HLSWriter->setBitstream( &nalu.m_Bitstream );
+  m_HLSWriter->setBitstream(&nalu.m_bitstream);
   CHECK( nalu.m_temporalId, "The value of TemporalId of OPI NAL units shall be equal to 0" );
   m_HLSWriter->codeOPI( opi );
   accessUnit.push_back(new NALUnitEBSP(nalu));
@@ -346,7 +346,7 @@ int EncGOP::xWriteOPI (AccessUnit &accessUnit, const OPI *opi)
 int EncGOP::xWriteVPS (AccessUnit &accessUnit, const VPS *vps)
 {
   OutputNALUnit nalu(NAL_UNIT_VPS);
-  m_HLSWriter->setBitstream( &nalu.m_Bitstream );
+  m_HLSWriter->setBitstream(&nalu.m_bitstream);
   CHECK( nalu.m_temporalId, "The value of TemporalId of VPS NAL units shall be equal to 0" );
   m_HLSWriter->codeVPS( vps );
   accessUnit.push_back(new NALUnitEBSP(nalu));
@@ -355,7 +355,7 @@ int EncGOP::xWriteVPS (AccessUnit &accessUnit, const VPS *vps)
 int EncGOP::xWriteDCI(AccessUnit& accessUnit, const DCI* dci)
 {
   OutputNALUnit nalu(NAL_UNIT_DCI);
-  m_HLSWriter->setBitstream(&nalu.m_Bitstream);
+  m_HLSWriter->setBitstream(&nalu.m_bitstream);
   CHECK(nalu.m_temporalId, "The value of TemporalId of DCI NAL units shall be equal to 0");
   m_HLSWriter->codeDCI(dci);
   accessUnit.push_back(new NALUnitEBSP(nalu));
@@ -365,7 +365,7 @@ int EncGOP::xWriteDCI(AccessUnit& accessUnit, const DCI* dci)
 int EncGOP::xWriteSPS( AccessUnit &accessUnit, const SPS *sps, const int layerId )
 {
   OutputNALUnit nalu(NAL_UNIT_SPS);
-  m_HLSWriter->setBitstream( &nalu.m_Bitstream );
+  m_HLSWriter->setBitstream(&nalu.m_bitstream);
   nalu.m_nuhLayerId = layerId;
   CHECK( nalu.m_temporalId, "The value of TemporalId of SPS NAL units shall be equal to 0" );
   m_HLSWriter->codeSPS( sps );
@@ -377,7 +377,7 @@ int EncGOP::xWriteSPS( AccessUnit &accessUnit, const SPS *sps, const int layerId
 int EncGOP::xWritePPS( AccessUnit &accessUnit, const PPS *pps, const int layerId )
 {
   OutputNALUnit nalu(NAL_UNIT_PPS);
-  m_HLSWriter->setBitstream( &nalu.m_Bitstream );
+  m_HLSWriter->setBitstream(&nalu.m_bitstream);
   nalu.m_nuhLayerId = layerId;
   nalu.m_temporalId = accessUnit.temporalId;
   CHECK( nalu.m_temporalId < accessUnit.temporalId, "TemporalId shall be greater than or equal to the TemporalId of the layer access unit containing the NAL unit" );
@@ -389,7 +389,7 @@ int EncGOP::xWritePPS( AccessUnit &accessUnit, const PPS *pps, const int layerId
 int EncGOP::xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId, const bool isPrefixNUT )
 {
   OutputNALUnit nalu( isPrefixNUT ? NAL_UNIT_PREFIX_APS : NAL_UNIT_SUFFIX_APS );
-  m_HLSWriter->setBitstream(&nalu.m_Bitstream);
+  m_HLSWriter->setBitstream(&nalu.m_bitstream);
   nalu.m_nuhLayerId = layerId;
   nalu.m_temporalId = aps->getTemporalId();
   aps->setLayerId( layerId );
@@ -444,7 +444,7 @@ int EncGOP::xWriteParameterSets(AccessUnit &accessUnit, Slice *slice, const bool
 int EncGOP::xWritePicHeader( AccessUnit &accessUnit, PicHeader *picHeader )
 {
   OutputNALUnit nalu(NAL_UNIT_PH);
-  m_HLSWriter->setBitstream( &nalu.m_Bitstream );
+  m_HLSWriter->setBitstream(&nalu.m_bitstream);
   nalu.m_temporalId = accessUnit.temporalId;
   nalu.m_nuhLayerId = m_pcEncLib->getLayerId();
   m_HLSWriter->codePictureHeader( picHeader, true );
@@ -468,7 +468,7 @@ void EncGOP::xWriteAccessUnitDelimiter (AccessUnit &accessUnit, Slice *slice)
   }
   CHECK( nalu.m_temporalId != accessUnit.temporalId, "TemporalId shall be equal to the TemporalId of the AU containing the NAL unit" );
   int picType = slice->isIntra() ? 0 : (slice->isInterP() ? 1 : 2);
-  audWriter.codeAUD(nalu.m_Bitstream, m_audIrapOrGdrAuFlag, picType);
+  audWriter.codeAUD(nalu.m_bitstream, m_audIrapOrGdrAuFlag, picType);
   accessUnit.push_front(new NALUnitEBSP(nalu));
 }
 
@@ -487,7 +487,7 @@ void EncGOP::xWriteFillerData (AccessUnit &accessUnit, Slice *slice, uint32_t &f
     nalu.m_nuhLayerId = slice->getVPS()->getLayerId(0);
   }
   CHECK( nalu.m_temporalId != accessUnit.temporalId, "TemporalId shall be equal to the TemporalId of the AU containing the NAL unit" );
-  fdWriter.codeFD(nalu.m_Bitstream, fdSize);
+  fdWriter.codeFD(nalu.m_bitstream, fdSize);
   accessUnit.push_back(new NALUnitEBSP(nalu));
 }
 
@@ -500,7 +500,7 @@ void EncGOP::xWriteSEI (NalUnitType naluType, SEIMessages& seiMessages, AccessUn
     return;
   }
   OutputNALUnit nalu( naluType, m_pcEncLib->getLayerId(), temporalId );
-  m_seiWriter.writeSEImessages(nalu.m_Bitstream, seiMessages, *m_HRD, false, temporalId);
+  m_seiWriter.writeSEImessages(nalu.m_bitstream, seiMessages, *m_HRD, false, temporalId);
   auPos = accessUnit.insert(auPos, new NALUnitEBSP(nalu));
   auPos++;
 }
@@ -520,7 +520,7 @@ uint32_t EncGOP::xWriteSEISeparately (NalUnitType naluType, SEIMessages& seiMess
     SEIMessages tmpMessages;
     tmpMessages.push_back(*sei);
     OutputNALUnit nalu( naluType, m_pcEncLib->getLayerId(), temporalId );
-    numBits += m_seiWriter.writeSEImessages(nalu.m_Bitstream, tmpMessages, *m_HRD, false, temporalId);
+    numBits += m_seiWriter.writeSEImessages(nalu.m_bitstream, tmpMessages, *m_HRD, false, temporalId);
     auPos = accessUnit.insert(auPos, new NALUnitEBSP(nalu));
     auPos++;
   }
@@ -3960,7 +3960,7 @@ void EncGOP::compressGOP(int pocLast, int numPicRcvd, PicList &rcListPic, std::l
 
         /* start slice NALunit */
         OutputNALUnit nalu( pcSlice->getNalUnitType(), m_pcEncLib->getLayerId(), pcSlice->getTLayer() );
-        m_HLSWriter->setBitstream( &nalu.m_Bitstream );
+        m_HLSWriter->setBitstream(&nalu.m_bitstream);
 
         tmpBitsBeforeWriting = m_HLSWriter->getNumberOfWrittenBits();
         m_HLSWriter->codeSliceHeader( pcSlice );
@@ -3995,9 +3995,9 @@ void EncGOP::compressGOP(int pocLast, int numPicRcvd, PicList &rcListPic, std::l
         }
         {
           // Construct the final bitstream by concatenating substreams.
-          // The final bitstream is either nalu.m_Bitstream or pcBitstreamRedirect;
+          // The final bitstream is either nalu.m_bitstream or pcBitstreamRedirect;
           // Complete the slice header info.
-          m_HLSWriter->setBitstream( &nalu.m_Bitstream );
+          m_HLSWriter->setBitstream(&nalu.m_bitstream);
           m_HLSWriter->codeTilesWPPEntryPoint( pcSlice );
 
           // Append substreams...
@@ -4022,7 +4022,7 @@ void EncGOP::compressGOP(int pocLast, int numPicRcvd, PicList &rcListPic, std::l
 
         if (!bNALUAlignedWrittenToList)
         {
-          nalu.m_Bitstream.writeAlignZero();
+          nalu.m_bitstream.writeAlignZero();
           accessUnit.push_back(new NALUnitEBSP(nalu));
         }
 
@@ -5739,12 +5739,12 @@ double EncGOP::xCalculateRVM()
 void EncGOP::xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, OutputBitstream* codedSliceData)
 {
   // Byte-align
-  rNalu.m_Bitstream.writeByteAlignment();   // Slice header byte-alignment
+  rNalu.m_bitstream.writeByteAlignment();   // Slice header byte-alignment
 
   // Perform bitstream concatenation
   if (codedSliceData->getNumberOfWrittenBits() > 0)
   {
-    rNalu.m_Bitstream.addSubstream(codedSliceData);
+    rNalu.m_bitstream.addSubstream(codedSliceData);
   }
   codedSliceData->clear();
 }
diff --git a/source/Lib/EncoderLib/NALwrite.cpp b/source/Lib/EncoderLib/NALwrite.cpp
index e248b97bf..3e4887ef2 100644
--- a/source/Lib/EncoderLib/NALwrite.cpp
+++ b/source/Lib/EncoderLib/NALwrite.cpp
@@ -87,7 +87,7 @@ void writeNaluContent(ostream& out, OutputNALUnit& nalu)
    *  - 0x00000302
    *  - 0x00000303
    */
-  vector<uint8_t>& rbsp   = nalu.m_Bitstream.getFIFO();
+  vector<uint8_t> &rbsp = nalu.m_bitstream.getFIFO();
 
   vector<uint8_t> outputBuffer;
   outputBuffer.resize(rbsp.size()*2+1); //there can never be enough emulation_prevention_three_bytes to require this much space
diff --git a/source/Lib/EncoderLib/NALwrite.h b/source/Lib/EncoderLib/NALwrite.h
index 0e9d2c3ce..ea7a46c13 100644
--- a/source/Lib/EncoderLib/NALwrite.h
+++ b/source/Lib/EncoderLib/NALwrite.h
@@ -56,23 +56,19 @@ struct OutputNALUnit : public NALUnit
    * storage for a bitstream.  Upon construction the NALunit header is
    * written to the bitstream.
    */
-  OutputNALUnit(
-    NalUnitType nalUnitType,
-    uint32_t layerId = 0,
-    uint32_t temporalID = 0,
-    uint32_t reserved_zero_6bits = 0)
-  : NALUnit( nalUnitType, temporalID, reserved_zero_6bits, 0, layerId )
-  , m_Bitstream()
+  OutputNALUnit(NalUnitType nalUnitType, uint32_t layerId = 0, uint32_t temporalID = 0,
+                uint32_t reserved_zero_6bits = 0)
+    : NALUnit(nalUnitType, temporalID, reserved_zero_6bits, 0, layerId), m_bitstream()
   {}
 
   OutputNALUnit& operator=(const NALUnit& src)
   {
-    m_Bitstream.clear();
+    m_bitstream.clear();
     static_cast<NALUnit*>(this)->operator=(src);
     return *this;
   }
 
-  OutputBitstream m_Bitstream;
+  OutputBitstream m_bitstream;
 };
 
 void writeNaluWithHeader(std::ostream& out, OutputNALUnit& nalu);
-- 
GitLab