From 61a985e698f66c5573af7f0d91ee56cd3a5016de Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Thu, 25 Aug 2022 15:46:46 -0400
Subject: [PATCH] Avoid "using namespace" in header files

---
 source/App/DecoderApp/DecApp.cpp              |  2 ++
 source/App/DecoderApp/DecApp.h                |  8 ++++--
 source/App/DecoderApp/decmain.cpp             |  2 ++
 source/App/EncoderApp/EncApp.h                |  4 +--
 source/App/EncoderApp/EncAppCfg.h             |  4 +--
 source/App/EncoderApp/encmain.cpp             |  4 +--
 .../App/SEIFilmGrainApp/SEIFilmGrainApp.cpp   |  2 ++
 source/App/SEIFilmGrainApp/SEIFilmGrainApp.h  |  2 --
 .../App/SEIFilmGrainApp/SEIFilmGrainMain.cpp  |  2 +-
 source/App/SEIRemovalApp/SEIRemovalApp.cpp    |  2 ++
 source/App/SEIRemovalApp/SEIRemovalApp.h      |  2 --
 source/App/SEIRemovalApp/seiremovalmain.cpp   |  2 +-
 source/App/StreamMergeApp/StreamMergeApp.cpp  | 12 +++++----
 source/App/StreamMergeApp/StreamMergeApp.h    | 18 +++++--------
 source/Lib/EncoderLib/Analyze.h               |  5 ++--
 source/Lib/EncoderLib/CABACWriter.cpp         |  3 ++-
 source/Lib/EncoderLib/EncCfg.h                | 26 +++++++++++++------
 source/Lib/EncoderLib/EncCu.cpp               |  2 +-
 source/Lib/EncoderLib/EncLib.cpp              |  2 ++
 source/Lib/EncoderLib/EncModeCtrl.cpp         |  2 ++
 source/Lib/EncoderLib/EncSlice.cpp            |  2 +-
 source/Lib/EncoderLib/EncTemporalFilter.cpp   |  6 +++--
 source/Lib/EncoderLib/InterSearch.cpp         |  5 ++--
 source/Lib/EncoderLib/RateCtrl.h              | 16 +++++-------
 source/Lib/EncoderLib/SEIEncoder.cpp          |  2 ++
 .../Lib/EncoderLib/SEIFilmGrainAnalyzer.cpp   |  1 +
 source/Lib/Utilities/VideoIOYuv.h             |  4 +--
 source/Lib/Utilities/program_options_lite.h   |  3 +--
 28 files changed, 82 insertions(+), 63 deletions(-)

diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp
index a0d065278..1bf0b0f24 100644
--- a/source/App/DecoderApp/DecApp.cpp
+++ b/source/App/DecoderApp/DecApp.cpp
@@ -48,6 +48,8 @@
 #endif
 #include "CommonLib/dtrace_codingstruct.h"
 
+using namespace std;
+
 //! \ingroup DecoderApp
 //! \{
 
diff --git a/source/App/DecoderApp/DecApp.h b/source/App/DecoderApp/DecApp.h
index 6d83fcb47..22e26063a 100644
--- a/source/App/DecoderApp/DecApp.h
+++ b/source/App/DecoderApp/DecApp.h
@@ -113,8 +113,12 @@ private:
   void  xDestroyDecLib    (); ///< destroy internal classes
   void  xWriteOutput      ( PicList* pcListPic , uint32_t tId); ///< write YUV to file
   void  xFlushOutput( PicList* pcListPic, const int layerId = NOT_VALID ); ///< flush all remaining decoded pictures to file
-  bool  isNewPicture(ifstream *bitstreamFile, class InputByteStream *bytestream);  ///< check if next NAL unit will be the first NAL unit from a new picture
-  bool  isNewAccessUnit(bool newPicture, ifstream *bitstreamFile, class InputByteStream *bytestream);  ///< check if next NAL unit will be the first NAL unit from a new access unit
+
+  // check if next NAL unit will be the first NAL unit from a new picture
+  bool isNewPicture(std::ifstream *bitstreamFile, class InputByteStream *bytestream);
+
+  // check if next NAL unit will be the first NAL unit from a new access unit
+  bool isNewAccessUnit(bool newPicture, std::ifstream *bitstreamFile, class InputByteStream *bytestream);
 
   void  writeLineToOutputLog(Picture * pcPic);
   void xOutputAnnotatedRegions(PicList* pcListPic);
diff --git a/source/App/DecoderApp/decmain.cpp b/source/App/DecoderApp/decmain.cpp
index 76d0b5242..7e2e55303 100644
--- a/source/App/DecoderApp/decmain.cpp
+++ b/source/App/DecoderApp/decmain.cpp
@@ -41,6 +41,8 @@
 #include "DecApp.h"
 #include "program_options_lite.h"
 
+using namespace std;
+
 //! \ingroup DecoderApp
 //! \{
 
diff --git a/source/App/EncoderApp/EncApp.h b/source/App/EncoderApp/EncApp.h
index 76f8cbd0f..af18f8b7e 100644
--- a/source/App/EncoderApp/EncApp.h
+++ b/source/App/EncoderApp/EncApp.h
@@ -77,7 +77,7 @@ private:
   int               m_iFrameRcvd;                 ///< number of received frames
   uint32_t          m_essentialBytes;
   uint32_t          m_totalBytes;
-  fstream&          m_bitstream;
+  std::fstream     &m_bitstream;
 #if JVET_O0756_CALCULATE_HDRMETRICS
   std::chrono::duration<long long, ratio<1, 1000000000>> m_metricTime;
 #endif
@@ -109,7 +109,7 @@ private:
   bool m_flush;
 
 public:
-  EncApp( fstream& bitStream, EncLibCommon* encLibCommon );
+  EncApp(std::fstream &bitStream, EncLibCommon *encLibCommon);
   virtual ~EncApp();
 
   int   getMaxLayers() const { return m_maxLayers; }
diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h
index 052dbda44..677166d99 100644
--- a/source/App/EncoderApp/EncAppCfg.h
+++ b/source/App/EncoderApp/EncAppCfg.h
@@ -728,7 +728,7 @@ protected:
   bool                 m_gcmpSEIGuardBandBoundaryExteriorFlag;
   uint32_t             m_gcmpSEIGuardBandSamplesMinus1;
 
-  CfgSEISubpictureLevel m_cfgSubpictureLevelInfoSEI;
+  EncCfgParam::CfgSEISubpictureLevel m_cfgSubpictureLevelInfoSEI;
 
   bool                  m_nnPostFilterSEICharacteristicsEnabled;
   int                   m_nnPostFilterSEICharacteristicsNumFilters;
@@ -943,7 +943,7 @@ protected:
 
   int         m_numPtlsInVps;
 
-  CfgVPSParameters m_cfgVPSParameters;
+  EncCfgParam::CfgVPSParameters m_cfgVPSParameters;
   Level::Name m_levelPtl[MAX_NUM_OLSS];
   int         m_olsPtlIdx[MAX_NUM_OLSS];
 
diff --git a/source/App/EncoderApp/encmain.cpp b/source/App/EncoderApp/encmain.cpp
index fb3345ece..1f391feac 100644
--- a/source/App/EncoderApp/encmain.cpp
+++ b/source/App/EncoderApp/encmain.cpp
@@ -91,9 +91,7 @@ int main(int argc, char* argv[])
 #if ENABLE_SIMD_OPT
   std::string SIMD;
   df::program_options_lite::Options opts;
-  opts.addOptions()
-    ( "SIMD", SIMD, string( "" ), "" )
-    ( "c", df::program_options_lite::parseConfigFile, "" );
+  opts.addOptions()("SIMD", SIMD, std::string(""), "")("c", df::program_options_lite::parseConfigFile, "");
   df::program_options_lite::SilentReporter err;
   df::program_options_lite::scanArgv( opts, argc, ( const char** ) argv, err );
   fprintf( stdout, "[SIMD=%s] ", read_x86_extension( SIMD ) );
diff --git a/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp b/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp
index 9c55401d8..acbb18c2e 100644
--- a/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp
+++ b/source/App/SEIFilmGrainApp/SEIFilmGrainApp.cpp
@@ -44,6 +44,8 @@
 #include "DecoderLib/AnnexBread.h"
 #include "EncoderLib/AnnexBwrite.h"
 
+using namespace std;
+
 //! \ingroup SEIFilmGrainApp
 //! \{
 
diff --git a/source/App/SEIFilmGrainApp/SEIFilmGrainApp.h b/source/App/SEIFilmGrainApp/SEIFilmGrainApp.h
index 4156e29a6..9383d0c52 100644
--- a/source/App/SEIFilmGrainApp/SEIFilmGrainApp.h
+++ b/source/App/SEIFilmGrainApp/SEIFilmGrainApp.h
@@ -54,8 +54,6 @@
 #include "DecoderLib/SEIread.h"
 #include "EncoderLib/SEIwrite.h"
 
-using namespace std;
-
 // ====================================================================================================================
 // Class definition
 // ====================================================================================================================
diff --git a/source/App/SEIFilmGrainApp/SEIFilmGrainMain.cpp b/source/App/SEIFilmGrainApp/SEIFilmGrainMain.cpp
index 8d50571a8..f66024dbe 100644
--- a/source/App/SEIFilmGrainApp/SEIFilmGrainMain.cpp
+++ b/source/App/SEIFilmGrainApp/SEIFilmGrainMain.cpp
@@ -60,7 +60,7 @@ int main(int argc, char* argv[])
 #if ENABLE_SIMD_OPT
   std::string SIMD;
   df::program_options_lite::Options optsSimd;
-  optsSimd.addOptions()( "SIMD", SIMD, string( "" ), "" );
+  optsSimd.addOptions()("SIMD", SIMD, std::string(""), "");
   df::program_options_lite::SilentReporter err;
   df::program_options_lite::scanArgv( optsSimd, argc, ( const char** ) argv, err );
   fprintf( stdout, "[SIMD=%s] ", read_x86_extension( SIMD ) );
diff --git a/source/App/SEIRemovalApp/SEIRemovalApp.cpp b/source/App/SEIRemovalApp/SEIRemovalApp.cpp
index 9d755f1fe..a9a585522 100644
--- a/source/App/SEIRemovalApp/SEIRemovalApp.cpp
+++ b/source/App/SEIRemovalApp/SEIRemovalApp.cpp
@@ -44,6 +44,8 @@
 #include "DecoderLib/AnnexBread.h"
 #include "DecoderLib/NALread.h"
 
+using namespace std;
+
 //! \ingroup DecoderApp
 //! \{
 
diff --git a/source/App/SEIRemovalApp/SEIRemovalApp.h b/source/App/SEIRemovalApp/SEIRemovalApp.h
index c49ffed84..964f4c213 100644
--- a/source/App/SEIRemovalApp/SEIRemovalApp.h
+++ b/source/App/SEIRemovalApp/SEIRemovalApp.h
@@ -49,8 +49,6 @@
 
 #include "SEIRemovalAppCfg.h"
 
-using namespace std;
-
 // ====================================================================================================================
 // Class definition
 // ====================================================================================================================
diff --git a/source/App/SEIRemovalApp/seiremovalmain.cpp b/source/App/SEIRemovalApp/seiremovalmain.cpp
index 94b000f4c..4173f15be 100644
--- a/source/App/SEIRemovalApp/seiremovalmain.cpp
+++ b/source/App/SEIRemovalApp/seiremovalmain.cpp
@@ -61,7 +61,7 @@ int main(int argc, char* argv[])
 #if ENABLE_SIMD_OPT
   std::string SIMD;
   df::program_options_lite::Options optsSimd;
-  optsSimd.addOptions()( "SIMD", SIMD, string( "" ), "" );
+  optsSimd.addOptions()("SIMD", SIMD, std::string(""), "");
   df::program_options_lite::SilentReporter err;
   df::program_options_lite::scanArgv( optsSimd, argc, ( const char** ) argv, err );
   fprintf( stdout, "[SIMD=%s] ", read_x86_extension( SIMD ) );
diff --git a/source/App/StreamMergeApp/StreamMergeApp.cpp b/source/App/StreamMergeApp/StreamMergeApp.cpp
index 131d4b6a0..27db563ee 100644
--- a/source/App/StreamMergeApp/StreamMergeApp.cpp
+++ b/source/App/StreamMergeApp/StreamMergeApp.cpp
@@ -47,12 +47,14 @@
 #include "CommonLib/CodingStatistics.h"
 #endif
 
- //! \ingroup DecoderApp
- //! \{
+using namespace std;
 
- // ====================================================================================================================
- // Constructor / destructor / initialization / destroy
- // ====================================================================================================================
+//! \ingroup DecoderApp
+//! \{
+
+// ====================================================================================================================
+// Constructor / destructor / initialization / destroy
+// ====================================================================================================================
 
 StreamMergeApp::StreamMergeApp()
 {
diff --git a/source/App/StreamMergeApp/StreamMergeApp.h b/source/App/StreamMergeApp/StreamMergeApp.h
index e649a135b..e8bc14535 100644
--- a/source/App/StreamMergeApp/StreamMergeApp.h
+++ b/source/App/StreamMergeApp/StreamMergeApp.h
@@ -53,13 +53,9 @@
 #include "VLCWriter.h"
 #include "StreamMergeAppCfg.h"
 
-using namespace std;
-
-
-
 struct MergeLayer;
 class SingleLayerStream;
-typedef map<uint32_t, uint32_t> OldToNewIdMapping;
+using OldToNewIdMapping = std::map<uint32_t, uint32_t>;
 
 // ====================================================================================================================
 // Class definition
@@ -95,16 +91,16 @@ struct MergeLayer
 {
   int id;
 
-  ifstream *                 fp;
+  std::ifstream             *fp;
   InputByteStream *          bs;
   bool                       firstSliceInPicture = true;
   bool                       doneReading = false;
-  vector<AnnexBStats>        stats;
+  std::vector<AnnexBStats>   stats;
   ParameterSetManager        oldIDsPsManager;
   ParameterSetManager        psManager;
-  vector<int>                vpsIds;
-  vector<int>                spsIds;
-  vector<int>                ppsIds;
+  std::vector<int>           vpsIds;
+  std::vector<int>           spsIds;
+  std::vector<int>           ppsIds;
 
   OldToNewIdMapping vpsIdMapping;
   OldToNewIdMapping spsIdMapping;
@@ -231,7 +227,7 @@ private:
   uint32_t m_futureBytes; /* bytes that have been peeked */
 };
 
-bool byteStreamNALUnit(SingleLayerStream& bs, std::istream& istream, vector<uint8_t>& nalUnit, AnnexBStats& stats);
+bool byteStreamNALUnit(SingleLayerStream &bs, std::istream &istream, std::vector<uint8_t> &nalUnit, AnnexBStats &stats);
 
 #endif // __STREAMMERGEAPP__
 
diff --git a/source/Lib/EncoderLib/Analyze.h b/source/Lib/EncoderLib/Analyze.h
index 126730528..22493546b 100644
--- a/source/Lib/EncoderLib/Analyze.h
+++ b/source/Lib/EncoderLib/Analyze.h
@@ -223,9 +223,8 @@ public:
 
     auto hexValue=[](double x) {
       uint64_t ui;
-      copy(reinterpret_cast<uint8_t *>(&x),
-           reinterpret_cast<uint8_t *>(&x) + sizeof(x),
-           reinterpret_cast<uint8_t *>(&ui));
+      std::copy(reinterpret_cast<uint8_t *>(&x), reinterpret_cast<uint8_t *>(&x) + sizeof(x),
+                reinterpret_cast<uint8_t *>(&ui));
       return ui;
     };
     //
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index 36be21ca6..da4551ab3 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -3213,7 +3213,8 @@ void CABACWriter::residual_coding_subblockTS( CoeffCodingContext& cctx, const TC
       {
         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, min<int>(absLevel, cutoffVal + 2));
+          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;
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index 0c9e6ba93..f705a6cab 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -49,8 +49,6 @@
 
 #include "EncCfgParam.h"
 
-using namespace EncCfgParam;
-
 #if JVET_O0756_CALCULATE_HDRMETRICS
 #include "HDRLib/inc/DistortionMetric.H"
 #endif
@@ -643,7 +641,7 @@ protected:
   uint8_t              m_gcmpSEIGuardBandType;
   bool                 m_gcmpSEIGuardBandBoundaryExteriorFlag;
   uint8_t              m_gcmpSEIGuardBandSamplesMinus1;
-  CfgSEISubpictureLevel m_cfgSubpictureLevelInfoSEI;
+  EncCfgParam::CfgSEISubpictureLevel m_cfgSubpictureLevelInfoSEI;
   bool                  m_sampleAspectRatioInfoSEIEnabled;
   bool                  m_sariCancelFlag;
   bool                  m_sariPersistenceFlag;
@@ -934,7 +932,7 @@ protected:
   int         m_debugCTU;                                     ///< dbg ctu
   bool        m_bs2ModPOCAndType;
 
-  CfgVPSParameters m_cfgVPSParameters;
+  EncCfgParam::CfgVPSParameters m_cfgVPSParameters;
 
   int         m_maxNumAlfAps;
   bool        m_constantJointCbCrSignFlag;
@@ -2042,8 +2040,14 @@ public:
   bool    getGcmpSEIGuardBandBoundaryExteriorFlag()                                                 { return m_gcmpSEIGuardBandBoundaryExteriorFlag; }
   void    setGcmpSEIGuardBandSamplesMinus1( uint8_t u )                                             { m_gcmpSEIGuardBandSamplesMinus1 = u; }
   uint8_t getGcmpSEIGuardBandSamplesMinus1()                                                        { return m_gcmpSEIGuardBandSamplesMinus1; }
-  const CfgSEISubpictureLevel& getSubpicureLevelInfoSEICfg() const                                  { return m_cfgSubpictureLevelInfoSEI; }
-  void     setSubpicureLevelInfoSEICfg(const CfgSEISubpictureLevel& cfg)                            { m_cfgSubpictureLevelInfoSEI = cfg; }
+  const EncCfgParam::CfgSEISubpictureLevel &getSubpicureLevelInfoSEICfg() const
+  {
+    return m_cfgSubpictureLevelInfoSEI;
+  }
+  void setSubpicureLevelInfoSEICfg(const EncCfgParam::CfgSEISubpictureLevel &cfg)
+  {
+    m_cfgSubpictureLevelInfoSEI = cfg;
+  }
   bool     getSampleAspectRatioInfoSEIEnabled() const                                                       { return m_sampleAspectRatioInfoSEIEnabled; }
   void     setSampleAspectRatioInfoSEIEnabled(const bool val)                                               { m_sampleAspectRatioInfoSEIEnabled = val; }
   bool     getSariCancelFlag() const                                                                        { return m_sariCancelFlag; }
@@ -2594,8 +2598,14 @@ public:
   void        setAvoidIntraInDepLayer(bool b)                        { m_avoidIntraInDepLayer = b; }
   bool        getAvoidIntraInDepLayer()                        const { return m_avoidIntraInDepLayer; }
 
-  const CfgVPSParameters& getVPSParameters() const                                  { return m_cfgVPSParameters; }
-  void                    setVPSParameters(const CfgVPSParameters& cfg)             { m_cfgVPSParameters = cfg; }
+  const EncCfgParam::CfgVPSParameters &getVPSParameters() const
+  {
+    return m_cfgVPSParameters;
+  }
+  void setVPSParameters(const EncCfgParam::CfgVPSParameters &cfg)
+  {
+    m_cfgVPSParameters = cfg;
+  }
 };
 
 //! \}
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index 0b14281bd..0b0d3c5b9 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -53,7 +53,7 @@
 #include <cmath>
 #include <algorithm>
 
-
+using namespace std;
 
 //! \ingroup EncoderLib
 //! \{
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index a847551ac..b89ba1fd5 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -46,6 +46,8 @@
 #include "EncLibCommon.h"
 #include "CommonLib/ProfileLevelTier.h"
 
+using namespace std;
+
 //! \ingroup EncoderLib
 //! \{
 
diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp
index f0268e5d4..4ef95008c 100644
--- a/source/Lib/EncoderLib/EncModeCtrl.cpp
+++ b/source/Lib/EncoderLib/EncModeCtrl.cpp
@@ -49,6 +49,8 @@
 
 #include <cmath>
 
+using namespace std;
+
 void EncModeCtrl::init( EncCfg *pCfg, RateCtrl *pRateCtrl, RdCost* pRdCost )
 {
   m_pcEncCfg      = pCfg;
diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp
index 3545b5d6a..49fe934b0 100644
--- a/source/Lib/EncoderLib/EncSlice.cpp
+++ b/source/Lib/EncoderLib/EncSlice.cpp
@@ -766,7 +766,7 @@ void EncSlice::initEncSlice(Picture *pcPic, const int pocLast, const int pocCurr
 
     int  offset = (curPoc < gdrPocStart) ? 0 : (((curPoc - gdrPocStart) / gdrPeriod) * gdrPeriod);
     int  actualGdrStart = gdrPocStart + offset;
-    int  actualGdrInterval = min(gdrInterval, (int)(pcPic->getPicWidthInLumaSamples() / 8));
+    int  actualGdrInterval = std::min(gdrInterval, (int) (pcPic->getPicWidthInLumaSamples() / 8));
     int  recoveryPocCnt = actualGdrInterval - 1;
     int  recoveryPicPoc = actualGdrStart + recoveryPocCnt;
 
diff --git a/source/Lib/EncoderLib/EncTemporalFilter.cpp b/source/Lib/EncoderLib/EncTemporalFilter.cpp
index a80c84db7..5360ed74f 100644
--- a/source/Lib/EncoderLib/EncTemporalFilter.cpp
+++ b/source/Lib/EncoderLib/EncTemporalFilter.cpp
@@ -139,7 +139,8 @@ bool EncTemporalFilter::filter(PelStorage *orgPic, int receivedPoc)
   bool isFilterThisFrame = false;
   if (m_QP >= 17)  // disable filter for QP < 17
   {
-    for (map<int, double>::iterator it = m_temporalFilterStrengths.begin(); it != m_temporalFilterStrengths.end(); ++it)
+    for (std::map<int, double>::iterator it = m_temporalFilterStrengths.begin(); it != m_temporalFilterStrengths.end();
+         ++it)
     {
       int filteredFrame = it->first;
       if (receivedPoc % filteredFrame == 0)
@@ -206,7 +207,8 @@ bool EncTemporalFilter::filter(PelStorage *orgPic, int receivedPoc)
     PelStorage newOrgPic;
     newOrgPic.create(m_chromaFormatIDC, m_area, 0, m_padding);
     double overallStrength = -1.0;
-    for (map<int, double>::iterator it = m_temporalFilterStrengths.begin(); it != m_temporalFilterStrengths.end(); ++it)
+    for (std::map<int, double>::iterator it = m_temporalFilterStrengths.begin(); it != m_temporalFilterStrengths.end();
+         ++it)
     {
       int frame = it->first;
       double strength = it->second;
diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp
index fab02f678..8d268226d 100644
--- a/source/Lib/EncoderLib/InterSearch.cpp
+++ b/source/Lib/EncoderLib/InterSearch.cpp
@@ -53,9 +53,10 @@
 #include <math.h>
 #include <limits>
 
+using namespace std;
 
- //! \ingroup EncoderLib
- //! \{
+//! \ingroup EncoderLib
+//! \{
 
 static const Mv s_acMvRefineH[9] =
 {
diff --git a/source/Lib/EncoderLib/RateCtrl.h b/source/Lib/EncoderLib/RateCtrl.h
index a5c1381c7..fcf5d8646 100644
--- a/source/Lib/EncoderLib/RateCtrl.h
+++ b/source/Lib/EncoderLib/RateCtrl.h
@@ -48,8 +48,6 @@
 #include <vector>
 #include <algorithm>
 
-using namespace std;
-
 //! \ingroup EncoderLib
 //! \{
 
@@ -233,13 +231,13 @@ public:
   ~EncRCPic();
 
 public:
-  void create( EncRCSeq* encRCSeq, EncRCGOP* encRCGOP, int frameLevel, list<EncRCPic*>& listPreviousPictures );
+  void create(EncRCSeq *encRCSeq, EncRCGOP *encRCGOP, int frameLevel, std::list<EncRCPic *> &listPreviousPictures);
   void destroy();
 
-  int    estimatePicQP    ( double lambda, list<EncRCPic*>& listPreviousPictures );
+  int    estimatePicQP(double lambda, std::list<EncRCPic *> &listPreviousPictures);
   int    getRefineBitsForIntra(int orgBits);
   double calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel);
-  double estimatePicLambda( list<EncRCPic*>& listPreviousPictures, bool isIRAP);
+  double estimatePicLambda(std::list<EncRCPic *> &listPreviousPictures, bool isIRAP);
 
   void   updateAlphaBetaIntra(double *alpha, double *beta);
 
@@ -253,13 +251,13 @@ public:
   double clipRcAlpha(const int bitdepth, const double alpha);
   double clipRcBeta(const double beta);
 
-  void addToPictureLsit( list<EncRCPic*>& listPreviousPictures );
+  void   addToPictureLsit(std::list<EncRCPic *> &listPreviousPictures);
   double calAverageQP();
   double calAverageLambda();
 
 private:
   int xEstPicTargetBits( EncRCSeq* encRCSeq, EncRCGOP* encRCGOP );
-  int xEstPicHeaderBits( list<EncRCPic*>& listPreviousPictures, int frameLevel );
+  int xEstPicHeaderBits(std::list<EncRCPic *> &listPreviousPictures, int frameLevel);
 #if V0078_ADAPTIVE_LOWER_BOUND
   int xEstPicLowerBound( EncRCSeq* encRCSeq, EncRCGOP* encRCGOP );
 #endif
@@ -362,7 +360,7 @@ public:
     CHECK(m_encRCPic == nullptr, "Object does not exist");
     return m_encRCPic;
   }
-  list<EncRCPic*>& getPicList() { return m_listRCPictures; }
+  std::list<EncRCPic *> &getPicList() { return m_listRCPictures; }
 #if U0132_TARGET_BITS_SATURATION
   bool       getCpbSaturationEnabled()  { return m_CpbSaturationEnabled;  }
   uint32_t       getCpbState()              { return m_cpbState;       }
@@ -376,7 +374,7 @@ private:
   EncRCSeq* m_encRCSeq;
   EncRCGOP* m_encRCGOP;
   EncRCPic* m_encRCPic;
-  list<EncRCPic*> m_listRCPictures;
+  std::list<EncRCPic *> m_listRCPictures;
   int        m_RCQP;
 #if U0132_TARGET_BITS_SATURATION
   bool       m_CpbSaturationEnabled;    // Enable target bits saturation to avoid CPB overflow and underflow
diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp
index 3c2d82597..76d96354c 100644
--- a/source/Lib/EncoderLib/SEIEncoder.cpp
+++ b/source/Lib/EncoderLib/SEIEncoder.cpp
@@ -37,6 +37,8 @@
 #include "EncLib.h"
 #include <fstream>
 
+using namespace std;
+
 uint32_t calcMD5(const CPelUnitBuf& pic, PictureHash &digest, const BitDepths &bitDepths);
 uint32_t calcCRC(const CPelUnitBuf& pic, PictureHash &digest, const BitDepths &bitDepths);
 uint32_t calcChecksum(const CPelUnitBuf& pic, PictureHash &digest, const BitDepths &bitDepths);
diff --git a/source/Lib/EncoderLib/SEIFilmGrainAnalyzer.cpp b/source/Lib/EncoderLib/SEIFilmGrainAnalyzer.cpp
index 1d1dc0969..ae383dfc7 100644
--- a/source/Lib/EncoderLib/SEIFilmGrainAnalyzer.cpp
+++ b/source/Lib/EncoderLib/SEIFilmGrainAnalyzer.cpp
@@ -37,6 +37,7 @@
 
 #include "SEIFilmGrainAnalyzer.h"
 
+using namespace std;
 
 // ====================================================================================================================
 // Edge detection - Canny
diff --git a/source/Lib/Utilities/VideoIOYuv.h b/source/Lib/Utilities/VideoIOYuv.h
index f874c7fdb..3a1ac57ce 100644
--- a/source/Lib/Utilities/VideoIOYuv.h
+++ b/source/Lib/Utilities/VideoIOYuv.h
@@ -44,8 +44,6 @@
 #include "CommonLib/CommonDef.h"
 #include "CommonLib/Unit.h"
 
-using namespace std;
-
 // ====================================================================================================================
 // Class definition
 // ====================================================================================================================
@@ -57,7 +55,7 @@ using namespace std;
 class VideoIOYuv
 {
 private:
-  fstream   m_cHandle;                                      ///< file handle
+  std::fstream m_cHandle;                            ///< file handle
   int       m_fileBitdepth[MAX_NUM_CHANNEL_TYPE]; ///< bitdepth of input/output video file
   int       m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE];  ///< bitdepth after addition of MSBs (with value 0)
   int       m_bitdepthShift[MAX_NUM_CHANNEL_TYPE];  ///< number of bits to increase or decrease image by before/after write/read
diff --git a/source/Lib/Utilities/program_options_lite.h b/source/Lib/Utilities/program_options_lite.h
index aceb0679d..2b1f4cfb1 100644
--- a/source/Lib/Utilities/program_options_lite.h
+++ b/source/Lib/Utilities/program_options_lite.h
@@ -45,7 +45,6 @@
 
 //! \ingroup TAppCommon
 //! \{
-using namespace std;
 
 template <class T>
 struct SMultiValueInput
@@ -68,7 +67,7 @@ struct SMultiValueInput
 
   T readValue(const char *&pStr, bool &bSuccess);
 
-  istream& readValues(std::istream &in);
+  std::istream &readValues(std::istream &in);
 };
 
 namespace df
-- 
GitLab