From 7d53fbc90ee47909f435f0b7d9db2edb1a5e06b4 Mon Sep 17 00:00:00 2001
From: Frank Bossen <fbossen@gmail.com>
Date: Sat, 21 Oct 2023 19:16:06 -0400
Subject: [PATCH] remove macro JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG

---
 source/App/DecoderApp/DecApp.cpp              |  2 --
 source/App/EncoderApp/EncApp.cpp              |  2 --
 source/App/EncoderApp/EncAppCfg.cpp           |  2 --
 source/App/EncoderApp/EncAppCfg.h             |  2 --
 source/Lib/CommonLib/Picture.cpp              |  2 --
 source/Lib/CommonLib/Picture.h                |  2 --
 source/Lib/CommonLib/SEI.cpp                  |  2 --
 source/Lib/CommonLib/SEI.h                    |  4 ---
 .../SEINeuralNetworkPostFiltering.cpp         | 33 -------------------
 .../CommonLib/SEINeuralNetworkPostFiltering.h |  4 ---
 source/Lib/CommonLib/TypeDef.h                |  1 -
 source/Lib/DecoderLib/DecLib.h                |  2 --
 source/Lib/DecoderLib/SEIread.cpp             |  2 --
 source/Lib/EncoderLib/EncCfg.h                |  4 ---
 source/Lib/EncoderLib/SEIEncoder.cpp          |  2 --
 source/Lib/EncoderLib/SEIwrite.cpp            |  2 --
 16 files changed, 68 deletions(-)

diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp
index b24b8fef6..591ac9c1e 100644
--- a/source/App/DecoderApp/DecApp.cpp
+++ b/source/App/DecoderApp/DecApp.cpp
@@ -340,9 +340,7 @@ uint32_t DecApp::decode()
       {
         isEosPresentInPu = true;
         m_newCLVS[nalu.m_nuhLayerId] = true;  //The presence of EOS means that the next picture is the beginning of new CLVS
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
         m_cDecLib.setEosPresentInPu(true);
-#endif
       }
       // within the current PU, only EOS and EOB are allowed to be sent after an EOS nal unit
       if(isEosPresentInPu)
diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index d8dc56286..f55300716 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -1309,9 +1309,7 @@ void EncApp::xInitLibCfg( int layerIdx )
   m_cEncLib.setNnPostFilterSEIActivationTargetId(m_nnPostFilterSEIActivationTargetId);
   m_cEncLib.setNnPostFilterSEIActivationCancelFlag               (m_nnPostFilterSEIActivationCancelFlag);
   m_cEncLib.setNnPostFilterSEIActivationTargetBaseFlag           (m_nnPostFilterSEIActivationTargetBaseFlag);
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   m_cEncLib.setNnPostFilterSEIActivationNoPrevCLVSFlag           (m_nnPostFilterSEIActivationNoPrevCLVSFlag);
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
   m_cEncLib.setNnPostFilterSEIActivationNoFollCLVSFlag           (m_nnPostFilterSEIActivationNoFollCLVSFlag);
 #endif
diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp
index a658a83ef..e9bdde0d3 100644
--- a/source/App/EncoderApp/EncAppCfg.cpp
+++ b/source/App/EncoderApp/EncAppCfg.cpp
@@ -1978,9 +1978,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
     opts.addOptions()("SEINNPostFilterActivationTargetId", m_nnPostFilterSEIActivationTargetId, 0u, "Target id of the Neural Network Post Filter on current picture");
     opts.addOptions()("SEINNPostFilterActivationCancelFlag", m_nnPostFilterSEIActivationCancelFlag, false, "Control use of the target neural network post filter established by any previous NNPFA SEI message");
     opts.addOptions()("SEINNPostFilterActivationTargetBaseFlag", m_nnPostFilterSEIActivationTargetBaseFlag, false, "Specifies that the target NNPF is the base NNPF");
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
     opts.addOptions()("SEINNPostFilterActivationNoPrevCLVSFlag", m_nnPostFilterSEIActivationNoPrevCLVSFlag, false, "Specifies whether input pictures cannot (1) or can (0) originate from a previous CLVS");
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
     opts.addOptions()("SEINNPostFilterActivationNoFollCLVSFlag", m_nnPostFilterSEIActivationNoFollCLVSFlag, false, "Specifies whether input pictures cannot (1) or can (0) originate from a following CLVS");
 #endif
diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h
index c8e47d936..73844edf7 100644
--- a/source/App/EncoderApp/EncAppCfg.h
+++ b/source/App/EncoderApp/EncAppCfg.h
@@ -798,9 +798,7 @@ protected:
   bool                  m_nnPostFilterSEICharacteristicsAbsentInputPicZeroFlag[MAX_NUM_NN_POST_FILTERS];
   bool                    m_nnPostFilterSEIActivationCancelFlag;
   bool                    m_nnPostFilterSEIActivationTargetBaseFlag;
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   bool                    m_nnPostFilterSEIActivationNoPrevCLVSFlag;
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
   bool                    m_nnPostFilterSEIActivationNoFollCLVSFlag;
 #endif
diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp
index 2e713a129..8e3ffa911 100644
--- a/source/Lib/CommonLib/Picture.cpp
+++ b/source/Lib/CommonLib/Picture.cpp
@@ -65,9 +65,7 @@ Picture::Picture()
   edrapRapId           = -1;
   m_colourTranfParams     = nullptr;
   nonReferencePictureFlag = false;
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   isEosPresentInPic    = false;
-#endif
 
   m_prevQP.fill(-1);
   m_spliceIdx           = nullptr;
diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h
index aeb4147cf..19c74f05a 100644
--- a/source/Lib/CommonLib/Picture.h
+++ b/source/Lib/CommonLib/Picture.h
@@ -248,9 +248,7 @@ public:
   std::vector<bool> m_lossylosslessSliceArray;
   bool interLayerRefPicFlag;
   bool mixedNaluTypesInPicFlag;
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   bool isEosPresentInPic;
-#endif
 
   PelStorage m_bufs[NUM_PIC_TYPES];
   const Picture*           unscaledPic;
diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp
index 80f18d292..1b6580522 100644
--- a/source/Lib/CommonLib/SEI.cpp
+++ b/source/Lib/CommonLib/SEI.cpp
@@ -1201,9 +1201,7 @@ SEINeuralNetworkPostFilterActivation::SEINeuralNetworkPostFilterActivation(
   m_cancelFlag = sei.m_cancelFlag;
   m_persistenceFlag = sei.m_persistenceFlag;
   m_targetBaseFlag = sei.m_targetBaseFlag;
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   m_noPrevCLVSFlag = sei.m_noPrevCLVSFlag;
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
   m_noFollCLVSFlag = sei.m_noFollCLVSFlag;
 #endif
diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h
index 1fc1b8e86..f2fbf0df2 100644
--- a/source/Lib/CommonLib/SEI.h
+++ b/source/Lib/CommonLib/SEI.h
@@ -1354,9 +1354,7 @@ public:
     : m_targetId(0)
     , m_cancelFlag(false)
     , m_targetBaseFlag(false)
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
     , m_noPrevCLVSFlag(false)
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
     , m_noFollCLVSFlag(false)
 #endif
@@ -1369,9 +1367,7 @@ public:
   uint32_t       m_targetId;
   bool           m_cancelFlag;
   bool           m_targetBaseFlag;
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   bool           m_noPrevCLVSFlag;
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
   bool           m_noFollCLVSFlag;
 #endif
diff --git a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp
index 3829a9692..3c6e2ee56 100644
--- a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp
+++ b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp
@@ -95,20 +95,13 @@ void SEINeuralNetworkPostFiltering::setPicActivatedNnpfc(Picture* picture)
 void SEINeuralNetworkPostFiltering::filterPictures(PicList& picList)
 {
   m_picList = PicVector(picList.begin(), picList.end());
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   bool prevPicIsLastInClvs = true;
-#endif
   for (Picture* currCodedPic: m_picList)
   {
     const NalUnitType picType = currCodedPic->getPictureType();
 
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
     if (picType == NAL_UNIT_CODED_SLICE_IDR_N_LP || picType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
         || ((picType == NAL_UNIT_CODED_SLICE_CRA || picType == NAL_UNIT_CODED_SLICE_GDR) && prevPicIsLastInClvs))
-#else
-    if (picType == NAL_UNIT_CODED_SLICE_IDR_N_LP || picType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
-        || picType == NAL_UNIT_CODED_SLICE_CRA || picType == NAL_UNIT_CODED_SLICE_GDR)
-#endif
     {
       m_clvsNnpfcSEIs = getSeisByType(currCodedPic->SEIs, SEI::PayloadType::NEURAL_NETWORK_POST_FILTER_CHARACTERISTICS);
 
@@ -130,7 +123,6 @@ void SEINeuralNetworkPostFiltering::filterPictures(PicList& picList)
 #endif
 
       m_isNnpfActiveForCLVS.clear();
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG || JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
       m_clvsPicList.clear();
       auto p = std::find(m_picList.begin(), m_picList.end(), currCodedPic);
       m_clvsPicList.push_back(*p);
@@ -146,15 +138,12 @@ void SEINeuralNetworkPostFiltering::filterPictures(PicList& picList)
         m_clvsPicList.push_back(*p);
         prevPic = *p;
       }
-#endif
     }
 
     setPicActivatedNnpfc(currCodedPic);
     if (currCodedPic->m_nnpfcActivated.empty())
     {
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
       prevPicIsLastInClvs = currCodedPic->isEosPresentInPic;
-#endif
       continue;
     }
 
@@ -206,9 +195,7 @@ void SEINeuralNetworkPostFiltering::filterPictures(PicList& picList)
       checkInputPics(currCodedPic, currNnpfc, sourceWidth, sourceHeight, croppedWidth, croppedHeight);
     }
 
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
     prevPicIsLastInClvs = currCodedPic->isEosPresentInPic;
-#endif
   }
 }
 
@@ -447,7 +434,6 @@ void SEINeuralNetworkPostFiltering::checkInputPics(
             }
           }
 
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
           if (pictureRateUpsamplingFlag && fpCurrPicArrangementTypeIsTemporalInterleave && prevPicWithTemporalInterleaveFramePacking != nullptr && (!nnpfa->m_noPrevCLVSFlag || isPicInCurrentClvs(prevPicWithTemporalInterleaveFramePacking)))
           {
             inputPic[i]         = prevPicWithTemporalInterleaveFramePacking;
@@ -463,23 +449,6 @@ void SEINeuralNetworkPostFiltering::checkInputPics(
             inputPic[i]         = prevPic;
             inputPresentFlag[i] = true;
           }
-#else
-          if (pictureRateUpsamplingFlag && fpCurrPicArrangementTypeIsTemporalInterleave && prevPicWithTemporalInterleaveFramePacking != nullptr)
-          {
-            inputPic[i]         = prevPicWithTemporalInterleaveFramePacking;
-            inputPresentFlag[i] = true;
-          }
-          else if (!pictureRateUpsamplingFlag && prevPic != nullptr)
-          {
-            inputPic[i]         = prevPicWithTemporalInterleaveFramePacking;
-            inputPresentFlag[i] = true;
-          }
-          else if (!fpCurrPicArrangementTypeIsTemporalInterleave && prevPic != nullptr)
-          {
-            inputPic[i]         = prevPicWithTemporalInterleaveFramePacking;
-            inputPresentFlag[i] = true;
-          }
-#endif
           else
           {
             inputPic[i]         = inputPic[i - 1];
@@ -497,7 +466,6 @@ void SEINeuralNetworkPostFiltering::checkInputPics(
 
 }
 
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
 bool SEINeuralNetworkPostFiltering::isPicInCurrentClvs(Picture* pic)
 {
   bool picInClvs = false;
@@ -513,4 +481,3 @@ bool SEINeuralNetworkPostFiltering::isPicInCurrentClvs(Picture* pic)
 
   return picInClvs;
 }
-#endif
diff --git a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.h b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.h
index f49301aeb..9238689aa 100644
--- a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.h
+++ b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.h
@@ -52,9 +52,7 @@ class SEINeuralNetworkPostFiltering
 {
 private:
   PicVector m_picList;
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   PicVector m_clvsPicList;
-#endif
   SEIMessages m_clvsNnpfcSEIs;
 
   std::map<uint32_t, bool> m_isNnpfActiveForCLVS;
@@ -68,9 +66,7 @@ public:
   void checkInputPics(
     Picture* currCodedPic, const SEINeuralNetworkPostFilterCharacteristics* currNnpfc,
     uint32_t sourceWidth, uint32_t sourceHeight, uint32_t croppedWidth, uint32_t croppedHeight);
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   bool isPicInCurrentClvs(Picture* pic);
-#endif
 };
 
 #endif
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 83bd4e8cb..11b2f35c4 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -60,7 +60,6 @@
 
 
 
-#define JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG               1 // JVET-AE0050 item 1: Add nnpfa_no_prev_clvs_flag to the NNPFA SEI message
 
 #define JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG               1 // JVET-AE0050 item 2: Add nnpfa_no_foll_clvs_flag to the NNPFA SEI message
 
diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h
index ea666648d..fa162e666 100644
--- a/source/Lib/DecoderLib/DecLib.h
+++ b/source/Lib/DecoderLib/DecLib.h
@@ -266,9 +266,7 @@ public:
   void  updatePrevGDRInSameLayer();
   void  updatePrevIRAPAndGDRSubpic();
   bool  getGDRRecoveryPocReached()          { return ( m_pcPic->getPOC() >= m_prevGDRInSameLayerRecoveryPOC[m_pcPic->layerId] ); }
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   void  setEosPresentInPu(bool eosPresent)  { m_pcPic->isEosPresentInPic = eosPresent; }
-#endif
 
   bool  getNoOutputPriorPicsFlag () const   { return m_isNoOutputPriorPics; }
   void  setNoOutputPriorPicsFlag (bool val) { m_isNoOutputPriorPics = val; }
diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp
index fe35470c8..467a1bf9b 100644
--- a/source/Lib/DecoderLib/SEIread.cpp
+++ b/source/Lib/DecoderLib/SEIread.cpp
@@ -3260,10 +3260,8 @@ void SEIReader::xParseSEINNPostFilterActivation(SEINeuralNetworkPostFilterActiva
     sei_read_flag( pDecodedMessageOutputStream, val, "nnpfa_target_base_flag" );
     sei.m_targetBaseFlag = val;
 
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
     sei_read_flag( pDecodedMessageOutputStream, val, "nnpfa_no_prev_clvs_flag" );
     sei.m_noPrevCLVSFlag = val;
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
     if (sei.m_persistenceFlag)
     {
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index 05262d157..36c6f13d9 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -758,9 +758,7 @@ protected:
   uint32_t                m_nnPostFilterSEIActivationTargetId;
   bool                    m_nnPostFilterSEIActivationCancelFlag;
   bool                    m_nnPostFilterSEIActivationTargetBaseFlag;
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   bool                    m_nnPostFilterSEIActivationNoPrevCLVSFlag;
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
   bool                    m_nnPostFilterSEIActivationNoFollCLVSFlag;
 #endif
@@ -2080,10 +2078,8 @@ public:
   bool getNnPostFilterSEIActivationCancelFlag() const                                                                   { return m_nnPostFilterSEIActivationCancelFlag;}
   void setNnPostFilterSEIActivationTargetBaseFlag(bool targetBaseFlag)                                                  { m_nnPostFilterSEIActivationTargetBaseFlag = targetBaseFlag; }
   bool getNnPostFilterSEIActivationTargetBaseFlag() const                                                               { return m_nnPostFilterSEIActivationTargetBaseFlag;}
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
   void setNnPostFilterSEIActivationNoPrevCLVSFlag(bool noPrevCLVSFlag)                                                  { m_nnPostFilterSEIActivationNoPrevCLVSFlag = noPrevCLVSFlag; }
   bool getNnPostFilterSEIActivationNoPrevCLVSFlag() const                                                               { return m_nnPostFilterSEIActivationNoPrevCLVSFlag;}
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
   void setNnPostFilterSEIActivationNoFollCLVSFlag(bool noFollCLVSFlag)                                                  { m_nnPostFilterSEIActivationNoFollCLVSFlag = noFollCLVSFlag; }
   bool getNnPostFilterSEIActivationNoFollCLVSFlag() const                                                               { return m_nnPostFilterSEIActivationNoFollCLVSFlag;}
diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp
index d1e46cdf8..7b319eaff 100644
--- a/source/Lib/EncoderLib/SEIEncoder.cpp
+++ b/source/Lib/EncoderLib/SEIEncoder.cpp
@@ -1591,9 +1591,7 @@ void SEIEncoder::initSEINeuralNetworkPostFilterActivation(SEINeuralNetworkPostFi
   {
     sei->m_persistenceFlag = m_pcCfg->getNnPostFilterSEIActivationPersistenceFlag();
     sei->m_targetBaseFlag = m_pcCfg->getNnPostFilterSEIActivationTargetBaseFlag();
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
     sei->m_noPrevCLVSFlag = m_pcCfg->getNnPostFilterSEIActivationNoPrevCLVSFlag();
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
     sei->m_noFollCLVSFlag = m_pcCfg->getNnPostFilterSEIActivationNoFollCLVSFlag();
 #endif
diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp
index 3a477f214..9c5422d85 100644
--- a/source/Lib/EncoderLib/SEIwrite.cpp
+++ b/source/Lib/EncoderLib/SEIwrite.cpp
@@ -1870,9 +1870,7 @@ void SEIWriter::xWriteSEINeuralNetworkPostFilterActivation(const SEINeuralNetwor
   {
     xWriteFlag(sei.m_persistenceFlag, "nnpfa_persistence_flag");
     xWriteFlag(sei.m_targetBaseFlag, "nnpfa_target_base_flag");
-#if JVET_AE0050_NNPFA_NO_PREV_CLVS_FLAG
     xWriteFlag(sei.m_noPrevCLVSFlag, "nnpfa_no_prev_clvs_flag");
-#endif
 #if JVET_AE0050_NNPFA_NO_FOLL_CLVS_FLAG
     if (sei.m_persistenceFlag)
     {
-- 
GitLab