From 907af4384b65f46f5a80ea237fd0f7b49f3f619f Mon Sep 17 00:00:00 2001
From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de>
Date: Sun, 26 Apr 2020 20:08:35 +0200
Subject: [PATCH] remove macro JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE

---
 source/App/EncoderApp/EncApp.cpp      |  4 --
 source/App/EncoderApp/EncAppCfg.cpp   | 14 ----
 source/App/EncoderApp/EncAppCfg.h     |  4 --
 source/Lib/CommonLib/Slice.cpp        | 24 -------
 source/Lib/CommonLib/Slice.h          | 30 ---------
 source/Lib/CommonLib/TypeDef.h        |  1 -
 source/Lib/CommonLib/UnitTools.cpp    | 19 ------
 source/Lib/DecoderLib/CABACReader.cpp | 32 ---------
 source/Lib/DecoderLib/DecCu.cpp       |  4 --
 source/Lib/DecoderLib/VLCReader.cpp   | 97 ---------------------------
 source/Lib/EncoderLib/CABACWriter.cpp | 30 ---------
 source/Lib/EncoderLib/EncCfg.h        |  9 ---
 source/Lib/EncoderLib/EncCu.cpp       | 24 -------
 source/Lib/EncoderLib/EncLib.cpp      | 13 ----
 source/Lib/EncoderLib/InterSearch.cpp |  4 --
 source/Lib/EncoderLib/VLCWriter.cpp   | 66 ------------------
 16 files changed, 375 deletions(-)

diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index 52ff9f6ab..1f6e6862a 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -608,11 +608,7 @@ void EncApp::xInitLibCfg()
   m_cEncLib.setMaxNumMergeCand                                   ( m_maxNumMergeCand );
   m_cEncLib.setMaxNumAffineMergeCand                             ( m_maxNumAffineMergeCand );
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   m_cEncLib.setMaxNumGeoCand(m_maxNumGeoCand);
-#else
-  m_cEncLib.setMaxNumTriangleCand                                ( m_maxNumTriangleCand );
-#endif
 #else
   m_cEncLib.setMaxNumGeoCand                                     ( m_maxNumGeoCand );
 #endif
diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp
index 2a7a548c4..257b540f4 100644
--- a/source/App/EncoderApp/EncAppCfg.cpp
+++ b/source/App/EncoderApp/EncAppCfg.cpp
@@ -1168,11 +1168,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
   ("MaxNumMergeCand",                                 m_maxNumMergeCand,                                   5u, "Maximum number of merge candidates")
   ("MaxNumAffineMergeCand",                           m_maxNumAffineMergeCand,                             5u, "Maximum number of affine merge candidates")
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   ("MaxNumGeoCand", m_maxNumGeoCand, 5u, "Maximum number of geometric partitioning mode candidates")
-#else
-  ("MaxNumTriangleCand",                              m_maxNumTriangleCand,                                5u, "Maximum number of triangle candidates")
-#endif
 #else
   ("MaxNumGeoCand",                                   m_maxNumGeoCand,                                     5u, "Maximum number of geometric partitioning mode candidates")
 #endif
@@ -2800,15 +2796,9 @@ bool EncAppCfg::xCheckParameter()
   xConfirmPara( m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
   xConfirmPara( m_maxNumMergeCand > MRG_MAX_NUM_CANDS, "MaxNumMergeCand must be no more than MRG_MAX_NUM_CANDS." );
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   xConfirmPara(m_maxNumGeoCand > TRIANGLE_MAX_NUM_UNI_CANDS, "MaxNumTriangleCand must be no more than TRIANGLE_MAX_NUM_UNI_CANDS.");
   xConfirmPara(m_maxNumGeoCand > m_maxNumMergeCand, "MaxNumTriangleCand must be no more than MaxNumMergeCand.");
   xConfirmPara(0 < m_maxNumGeoCand && m_maxNumGeoCand < 2, "MaxNumTriangleCand must be no less than 2 unless MaxNumTriangleCand is 0.");
-#else
-  xConfirmPara( m_maxNumTriangleCand > TRIANGLE_MAX_NUM_UNI_CANDS, "MaxNumTriangleCand must be no more than TRIANGLE_MAX_NUM_UNI_CANDS." );
-  xConfirmPara( m_maxNumTriangleCand > m_maxNumMergeCand, "MaxNumTriangleCand must be no more than MaxNumMergeCand." );
-  xConfirmPara( 0 < m_maxNumTriangleCand && m_maxNumTriangleCand < 2, "MaxNumTriangleCand must be no less than 2 unless MaxNumTriangleCand is 0." );
-#endif
 #else
   xConfirmPara( m_maxNumGeoCand > GEO_MAX_NUM_UNI_CANDS, "MaxNumGeoCand must be no more than GEO_MAX_NUM_UNI_CANDS." );
   xConfirmPara( m_maxNumGeoCand > m_maxNumMergeCand, "MaxNumGeoCand must be no more than MaxNumMergeCand." );
@@ -3923,11 +3913,7 @@ void EncAppCfg::xPrintParameter()
   msg( DETAILS, "Max Num Merge Candidates               : %d\n", m_maxNumMergeCand );
   msg( DETAILS, "Max Num Affine Merge Candidates        : %d\n", m_maxNumAffineMergeCand );
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE 
   msg(DETAILS, "Max Num Triangle Merge Candidates      : %d\n", m_maxNumGeoCand);
-#else
-  msg( DETAILS, "Max Num Triangle Merge Candidates      : %d\n", m_maxNumTriangleCand );
-#endif
 #else
   msg( DETAILS, "Max Num Geo Merge Candidates           : %d\n", m_maxNumGeoCand );
 #endif
diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h
index 0a82b669b..8527ce975 100644
--- a/source/App/EncoderApp/EncAppCfg.h
+++ b/source/App/EncoderApp/EncAppCfg.h
@@ -655,11 +655,7 @@ protected:
   uint32_t      m_maxNumMergeCand;                                ///< Max number of merge candidates
   uint32_t      m_maxNumAffineMergeCand;                          ///< Max number of affine merge candidates
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   uint32_t      m_maxNumGeoCand;
-#else
-  uint32_t      m_maxNumTriangleCand;
-#endif
 #else
   uint32_t      m_maxNumGeoCand;
 #endif
diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index 84d8c42bc..a1ba5a7f4 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -2328,22 +2328,11 @@ PicHeader::PicHeader()
 , m_picColFromL0Flag                              ( true )
 #endif
 , m_mvdL1ZeroFlag                                 ( 0 )
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-, m_maxNumMergeCand                               ( MRG_MAX_NUM_CANDS )
-#endif
 , m_maxNumAffineMergeCand                         ( AFFINE_MRG_MAX_NUM_CANDS )
 , m_disFracMMVD                                   ( 0 )
 , m_disBdofFlag                                   ( 0 )
 , m_disDmvrFlag                                   ( 0 )
 , m_disProfFlag                                   ( 0 )
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE 
-#if !JVET_Q0806
-, m_maxNumTriangleCand                            ( 0 )
-#else
-, m_maxNumGeoCand                                 ( 0 )
-#endif
-, m_maxNumIBCMergeCand                            ( IBC_MRG_MAX_NUM_CANDS )
-#endif
 , m_jointCbCrSignFlag                             ( 0 )
 #if JVET_Q0819_PH_CHANGES 
 , m_qpDelta                                       ( 0 )
@@ -2470,22 +2459,11 @@ void PicHeader::initPicHeader()
   m_picColFromL0Flag                              = true;
 #endif
   m_mvdL1ZeroFlag                                 = 0;
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE 
-  m_maxNumMergeCand                               = MRG_MAX_NUM_CANDS;
-#endif
   m_maxNumAffineMergeCand                         = AFFINE_MRG_MAX_NUM_CANDS;
   m_disFracMMVD                                   = 0;
   m_disBdofFlag                                   = 0;
   m_disDmvrFlag                                   = 0;
   m_disProfFlag                                   = 0;
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE 
-#if !JVET_Q0806
-  m_maxNumTriangleCand                            = 0;
-#else
-  m_maxNumGeoCand                                 = 0;
-#endif
-  m_maxNumIBCMergeCand                            = IBC_MRG_MAX_NUM_CANDS;
-#endif
   m_jointCbCrSignFlag                             = 0;
 #if JVET_Q0819_PH_CHANGES 
   m_qpDelta                                       = 0;
@@ -2747,12 +2725,10 @@ SPS::SPS()
 , m_GDREnabledFlag            ( true )
 , m_SubLayerCbpParametersPresentFlag ( true )
 , m_rprEnabledFlag            ( false )
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
 , m_maxNumMergeCand(MRG_MAX_NUM_CANDS)
 , m_maxNumAffineMergeCand(AFFINE_MRG_MAX_NUM_CANDS)
 , m_maxNumIBCMergeCand(IBC_MRG_MAX_NUM_CANDS)
 , m_maxNumGeoCand(0)
-#endif
 {
   for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
   {
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index e22acac3f..188549c50 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1529,12 +1529,10 @@ private:
   bool              m_ppsValidFlag[64];
   Size              m_scalingWindowSizeInPPS[64];
 #endif
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   uint32_t          m_maxNumMergeCand;
   uint32_t          m_maxNumAffineMergeCand;
   uint32_t          m_maxNumIBCMergeCand;
   uint32_t          m_maxNumGeoCand;
-#endif
 public:
 
   SPS();
@@ -1832,7 +1830,6 @@ void                    setCCALFEnabledFlag( bool b )
   void                    setMaxDecPicBuffering( uint32_t ui, uint32_t tlayer )                           { CHECK(tlayer >= MAX_TLAYER, "Invalid T-layer"); m_uiMaxDecPicBuffering[tlayer] = ui;    }
   uint32_t                getMaxLatencyIncreasePlus1(uint32_t tlayer) const                               { return m_uiMaxLatencyIncreasePlus1[tlayer];                          }
   void                    setMaxLatencyIncreasePlus1( uint32_t ui , uint32_t tlayer)                      { m_uiMaxLatencyIncreasePlus1[tlayer] = ui;                            }
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   uint32_t                getMaxNumMergeCand() const { return m_maxNumMergeCand; }
   void                    setMaxNumMergeCand(uint32_t u) { m_maxNumMergeCand = u; }
   uint32_t                getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; }
@@ -1841,7 +1838,6 @@ void                    setCCALFEnabledFlag( bool b )
   void                    setMaxNumIBCMergeCand(uint32_t u) { m_maxNumIBCMergeCand = u; }
   uint32_t                getMaxNumGeoCand() const { return m_maxNumGeoCand; }
   void                    setMaxNumGeoCand(uint32_t u) { m_maxNumGeoCand = u; }
-#endif
   void                    setAffineAmvrEnabledFlag( bool val )                                            { m_affineAmvrEnabledFlag = val;                                       }
   bool                    getAffineAmvrEnabledFlag() const                                                { return m_affineAmvrEnabledFlag;                                      }
 #if !JVET_P0118_HRD_ASPECTS
@@ -2574,22 +2570,11 @@ private:
   uint32_t                    m_colRefIdx;
 #endif
   bool                        m_mvdL1ZeroFlag;                                          //!< L1 MVD set to zero flag  
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-  uint32_t                    m_maxNumMergeCand;                                        //!< max number of merge candidates
-#endif
   uint32_t                    m_maxNumAffineMergeCand;                                  //!< max number of sub-block merge candidates
   bool                        m_disFracMMVD;                                            //!< fractional MMVD offsets disabled flag
   bool                        m_disBdofFlag;                                            //!< picture level BDOF disable flag
   bool                        m_disDmvrFlag;                                            //!< picture level DMVR disable flag
   bool                        m_disProfFlag;                                            //!< picture level PROF disable flag
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE 
-#if !JVET_Q0806
-  uint32_t                    m_maxNumTriangleCand;                                     //!< max number of triangle merge candidates
-#else
-  uint32_t                    m_maxNumGeoCand;                                          //!< max number of geometric merge candidates
-#endif
-  uint32_t                    m_maxNumIBCMergeCand;                                     //!< max number of IBC merge candidates
-#endif
   bool                        m_jointCbCrSignFlag;                                      //!< joint Cb/Cr residual sign flag  
 #if JVET_Q0819_PH_CHANGES 
   int                         m_qpDelta;                                                //!< value of Qp delta
@@ -2758,10 +2743,6 @@ public:
 #endif
   void                        setMvdL1ZeroFlag( bool b )                                { m_mvdL1ZeroFlag = b;                                                                         }
   bool                        getMvdL1ZeroFlag() const                                  { return m_mvdL1ZeroFlag;                                                                      }  
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-  void                        setMaxNumMergeCand(uint32_t val )                         { m_maxNumMergeCand = val;                                                                     }
-  uint32_t                    getMaxNumMergeCand() const                                { return m_maxNumMergeCand;                                                                    }  
-#endif
   void                        setMaxNumAffineMergeCand( uint32_t val )                  { m_maxNumAffineMergeCand = val;                                                               }
   uint32_t                    getMaxNumAffineMergeCand() const                          { return m_maxNumAffineMergeCand;                                                              }
   void                        setDisFracMMVD( bool val )                                { m_disFracMMVD = val;                                                                         }
@@ -2772,17 +2753,6 @@ public:
   bool                        getDisDmvrFlag() const                                    { return m_disDmvrFlag;                                                                        }
   void                        setDisProfFlag( bool val )                                { m_disProfFlag = val;                                                                         }
   bool                        getDisProfFlag() const                                    { return m_disProfFlag;                                                                        }
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-#if !JVET_Q0806
-  void                        setMaxNumTriangleCand(uint32_t b)                         { m_maxNumTriangleCand = b;                                                                    }
-  uint32_t                    getMaxNumTriangleCand() const                             { return m_maxNumTriangleCand;                                                                 }
-#else
-  void                        setMaxNumGeoCand(uint32_t b)                              { m_maxNumGeoCand = b; }
-  uint32_t                    getMaxNumGeoCand() const                                  { return m_maxNumGeoCand; }
-#endif
-  void                        setMaxNumIBCMergeCand( uint32_t b )                       { m_maxNumIBCMergeCand = b;                                                                    }
-  uint32_t                    getMaxNumIBCMergeCand() const                             { return m_maxNumIBCMergeCand;                                                                 } 
-#endif
   void                        setJointCbCrSignFlag( bool b )                            { m_jointCbCrSignFlag = b;                                                                     }
   bool                        getJointCbCrSignFlag() const                              { return m_jointCbCrSignFlag;                                                                  }
 #if JVET_Q0819_PH_CHANGES 
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 7c24843a0..38dd88a14 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -52,7 +52,6 @@
 
 
 
-#define JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE             1 // JVET-Q0798: signal the number of merge candidates in SPS
 
 #define JVET_Q0157_SUBPICTURE_REORDERING_CONSTRAINT       1 //JVET-Q0157: subpicture reordering constraint
 
diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index bab812f74..f131d448c 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -753,12 +753,7 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx& mrgCtx, const int
 void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const int& mrgCandIdx)
 {
   const CodingStructure &cs = *pu.cs;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumIBCMergeCand();
-#else
-  const Slice &slice = *pu.cs->slice;
-  const uint32_t maxNumMergeCand = slice.getPicHeader()->getMaxNumIBCMergeCand();
-#endif
   for (uint32_t ui = 0; ui < maxNumMergeCand; ++ui)
   {
     mrgCtx.BcwIdx[ui] = BCW_DEFAULT;
@@ -877,11 +872,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
 #endif
   const CodingStructure &cs  = *pu.cs;
   const Slice &slice         = *pu.cs->slice;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand();
-#else
-  const uint32_t maxNumMergeCand = slice.getPicHeader()->getMaxNumMergeCand();
-#endif
   for (uint32_t ui = 0; ui < maxNumMergeCand; ++ui)
   {
     mrgCtx.BcwIdx[ui] = BCW_DEFAULT;
@@ -3340,12 +3331,7 @@ void PU::getTriangleMergeCandidates( const PredictionUnit &pu, MergeCtx& triangl
 {
   MergeCtx tmpMergeCtx;
 
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand();
-#else
-  const Slice &slice = *pu.cs->slice;
-  const uint32_t maxNumMergeCand = slice.getPicHeader()->getMaxNumMergeCand();
-#endif
 
   triangleMrgCtx.numValidMergeCand = 0;
 
@@ -3502,12 +3488,7 @@ void PU::getGeoMergeCandidates( const PredictionUnit &pu, MergeCtx& geoMrgCtx )
   MergeCtx tmpMergeCtx;
 
 
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand();
-#else
-  const Slice &slice = *pu.cs->slice;
-  const uint32_t maxNumMergeCand = slice.getPicHeader()->getMaxNumMergeCand();
-#endif
   geoMrgCtx.numValidMergeCand = 0;
 
   for (int32_t i = 0; i < GEO_MAX_NUM_UNI_CANDS; i++)
diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index 34474fbc0..617c386c0 100644
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -2121,11 +2121,7 @@ void CABACReader::prediction_unit( PredictionUnit& pu, MergeCtx& mrgCtx )
     pu.cu->affine = false;
     pu.refIdx[REF_PIC_LIST_0] = MAX_NUM_REF;
     mvd_coding(pu.mvd[REF_PIC_LIST_0]);
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     if (pu.cs->sps->getMaxNumIBCMergeCand() == 1)
-#else
-    if ( pu.cu->slice->getPicHeader()->getMaxNumIBCMergeCand() == 1 )
-#endif
     {
       pu.mvpIdx[REF_PIC_LIST_0] = 0;
     }
@@ -2302,22 +2298,14 @@ void CABACReader::merge_data( PredictionUnit& pu )
 #if JVET_Q0806
     const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE && pu.cu->lwidth() * pu.cu->lheight() >= 64;
     const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() && 
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
       pu.cs->sps->getMaxNumGeoCand() > 1
-#else
-      pu.cu->cs->picHeader->getMaxNumGeoCand() > 1
-#endif
                                                                       && pu.cu->lwidth() >= GEO_MIN_CU_SIZE && pu.cu->lheight() >= GEO_MIN_CU_SIZE
                                                                       && pu.cu->lwidth() <= GEO_MAX_CU_SIZE && pu.cu->lheight() <= GEO_MAX_CU_SIZE
                                                                       && pu.cu->lwidth() < 8 * pu.cu->lheight() && pu.cu->lheight() < 8 * pu.cu->lwidth();
     if (geoAvailable || ciipAvailable)
 #else
     const bool triangleAvailable = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() &&
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
       pu.cs->sps->getMaxNumGeoCand() > 1;
-#else
-      pu.cu->cs->picHeader->getMaxNumTriangleCand() > 1;
-#endif
     const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE;
     if (pu.cu->lwidth() * pu.cu->lheight() >= 64
       && (triangleAvailable || ciipAvailable))
@@ -2432,11 +2420,7 @@ void CABACReader::merge_idx( PredictionUnit& pu )
   }
   else
   {
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     int numCandminus1 = int(pu.cs->sps->getMaxNumMergeCand()) - 1;
-#else
-  int numCandminus1 = int( pu.cs->picHeader->getMaxNumMergeCand() ) - 1;
-#endif
   pu.mergeIdx       = 0;
 
 #if !JVET_Q0806
@@ -2464,11 +2448,7 @@ void CABACReader::merge_idx( PredictionUnit& pu )
       }
       return decIdx;
     };
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     const int maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand();
-#else
-    const int maxNumTriangleCand = pu.cs->picHeader->getMaxNumTriangleCand();
-#endif
     CHECK(maxNumTriangleCand < 2, "Incorrect max number of triangle candidates");
     candIdx0 = decodeOneIdx(maxNumTriangleCand - 1);
     candIdx1 = decodeOneIdx(maxNumTriangleCand - 2);
@@ -2488,11 +2468,7 @@ void CABACReader::merge_idx( PredictionUnit& pu )
     uint32_t splitDir  = 0;
     xReadTruncBinCode(splitDir, GEO_NUM_PARTITION_MODE);
     pu.geoSplitDir = splitDir;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     const int maxNumGeoCand = pu.cs->sps->getMaxNumGeoCand();
-#else
-    const int maxNumGeoCand = pu.cs->picHeader->getMaxNumGeoCand();
-#endif
     CHECK(maxNumGeoCand < 2, "Incorrect max number of geo candidates");
     CHECK(pu.cu->lheight() > 64 || pu.cu->lwidth() > 64, "Incorrect block size of geo flag");
     int numCandminus2 = maxNumGeoCand - 2;
@@ -2522,11 +2498,7 @@ void CABACReader::merge_idx( PredictionUnit& pu )
 
   if (pu.cu->predMode == MODE_IBC)
   {
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     numCandminus1 = int(pu.cs->sps->getMaxNumIBCMergeCand()) - 1;
-#else
-    numCandminus1 = int(pu.cs->picHeader->getMaxNumIBCMergeCand()) - 1;
-#endif
   }
   if( numCandminus1 > 0 )
   {
@@ -2551,11 +2523,7 @@ void CABACReader::mmvd_merge_idx(PredictionUnit& pu)
   RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET(STATS__CABAC_BITS__MERGE_INDEX);
 
   int var0 = 0;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (pu.cs->sps->getMaxNumMergeCand() > 1)
-#else
-  if (pu.cs->picHeader->getMaxNumMergeCand() > 1)
-#endif
   {
     static_assert(MMVD_BASE_MV_NUM == 2, "");
     var0 = m_BinDecoder.decodeBin(Ctx::MmvdMergeIdx());
diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp
index e77a5737a..35677c7d9 100644
--- a/source/Lib/DecoderLib/DecCu.cpp
+++ b/source/Lib/DecoderLib/DecCu.cpp
@@ -1123,11 +1123,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
           {
             mvd.changeIbcPrecAmvr2Internal(pu.cu->imv);
           }
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
           if (pu.cs->sps->getMaxNumIBCMergeCand() == 1)
-#else
-          if ( pu.cu->slice->getPicHeader()->getMaxNumIBCMergeCand() == 1 )
-#endif
           {
             CHECK( pu.mvpIdx[REF_PIC_LIST_0], "mvpIdx for IBC mode should be 0" );
           }
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 9d0dfc8d7..6cd77eade 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -2180,20 +2180,16 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
     READ_FLAG( uiCode,    "sps_explicit_mts_intra_enabled_flag" );               pcSPS->setUseIntraMTS            ( uiCode != 0 );
     READ_FLAG( uiCode,    "sps_explicit_mts_inter_enabled_flag" );               pcSPS->setUseInterMTS            ( uiCode != 0 );
   }
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   READ_UVLC(uiCode, "six_minus_max_num_merge_cand");
   CHECK(MRG_MAX_NUM_CANDS <= uiCode, "Incorrrect max number of merge candidates!");
   pcSPS->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);
-#endif
   READ_FLAG(uiCode, "sps_sbt_enabled_flag");                        pcSPS->setUseSBT                 ( uiCode != 0 );
   READ_FLAG( uiCode,    "sps_affine_enabled_flag" );                            pcSPS->setUseAffine              ( uiCode != 0 );
   if ( pcSPS->getUseAffine() )
   {
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     READ_UVLC(uiCode, "five_minus_max_num_subblock_merge_cand");
     CHECK(AFFINE_MRG_MAX_NUM_CANDS < uiCode, "Incorrrect max number of affine merge candidates!");
     pcSPS->setMaxNumAffineMergeCand(AFFINE_MRG_MAX_NUM_CANDS - uiCode);
-#endif
     READ_FLAG( uiCode,  "sps_affine_type_flag" );                       pcSPS->setUseAffineType          ( uiCode != 0 );
 #if JVET_Q0444_AMVR_SIGNALLING
     if( pcSPS->getAMVREnabledFlag())
@@ -2263,7 +2259,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
 #endif
   READ_FLAG( uiCode,    "sps_bcw_enabled_flag" );                   pcSPS->setUseBcw( uiCode != 0 );
   READ_FLAG(uiCode, "sps_ibc_enabled_flag");                                    pcSPS->setIBCFlag(uiCode);
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (pcSPS->getIBCFlag())
   {
     READ_UVLC(uiCode, "six_minus_max_num_ibc_merge_cand");
@@ -2272,7 +2267,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   }
   else
     pcSPS->setMaxNumIBCMergeCand(0);
-#endif
   // KJS: sps_ciip_enabled_flag
   READ_FLAG( uiCode,     "sps_ciip_enabled_flag" );                           pcSPS->setUseCiip             ( uiCode != 0 );
 
@@ -2282,7 +2276,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   }
 
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (pcSPS->getMaxNumMergeCand() >= 2)
   {
     READ_FLAG(uiCode, "triangle_flag");
@@ -2302,10 +2295,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
     pcSPS->setMaxNumGeoCand(0);
   }
 #else
-  READ_FLAG( uiCode,    "triangle_flag" );                          pcSPS->setUseTriangle            ( uiCode != 0 );
-#endif
-#else
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (pcSPS->getMaxNumMergeCand() >= 2)
   {
     READ_FLAG(uiCode, "sps_gpm_enabled_flag");
@@ -2324,9 +2313,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
     pcSPS->setUseGeo(0);
     pcSPS->setMaxNumGeoCand(0);
   }
-#else
-  READ_FLAG( uiCode,    "sps_gpm_enabled_flag" );                               pcSPS->setUseGeo                 ( uiCode != 0 );
-#endif
 #endif
   READ_FLAG(uiCode, "sps_lmcs_enable_flag");                   pcSPS->setUseLmcs(uiCode == 1);
   READ_FLAG( uiCode, "sps_lfnst_enabled_flag" );                    pcSPS->setUseLFNST( uiCode != 0 );
@@ -3643,32 +3629,10 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
     picHeader->setMvdL1ZeroFlag( uiCode != 0 );
      
   // merge candidate list size
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS
-    if (!pps->getPPSSixMinusMaxNumMergeCandPlus1())
-    {
-      READ_UVLC(uiCode, "pic_six_minus_max_num_merge_cand");
-    }
-    else
-    {
-      uiCode = pps->getPPSSixMinusMaxNumMergeCandPlus1() - 1;
-    }
-#else
-    READ_UVLC(uiCode, "pic_six_minus_max_num_merge_cand");
-#endif
-    CHECK(MRG_MAX_NUM_CANDS <= uiCode, "Incorrrect max number of merge candidates!");
-    picHeader->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);
-#endif
   // subblock merge candidate list size
     if ( sps->getUseAffine() )
     {
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE 
       picHeader->setMaxNumAffineMergeCand(sps->getMaxNumAffineMergeCand());
-#else
-      READ_UVLC(uiCode, "pic_five_minus_max_num_subblock_merge_cand");
-      CHECK(AFFINE_MRG_MAX_NUM_CANDS < uiCode, "Incorrrect max number of affine merge candidates!");
-      picHeader->setMaxNumAffineMergeCand( AFFINE_MRG_MAX_NUM_CANDS - uiCode );
-#endif
     }
     else
     {
@@ -3722,55 +3686,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
       parsePredWeightTable(picHeader, sps);
     }
 #endif
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-#if !JVET_Q0806
-  // triangle merge candidate list size
-    if (sps->getUseTriangle() && picHeader->getMaxNumMergeCand() >= 2)
-    {
-#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS
-      if (!pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1())
-      {
-        READ_UVLC(uiCode, "pic_max_num_merge_cand_minus_max_num_triangle_cand");
-      }
-      else
-      {
-        uiCode = pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1() - 1;
-      }
-#else
-    READ_UVLC(uiCode, "pic_max_num_merge_cand_minus_max_num_triangle_cand");
-#endif
-      CHECK(picHeader->getMaxNumMergeCand() < uiCode, "Incorrrect max number of triangle candidates!");
-      picHeader->setMaxNumTriangleCand((uint32_t)(picHeader->getMaxNumMergeCand() - uiCode));
-    }
-    else
-    {
-      picHeader->setMaxNumTriangleCand(0);
-    }
-#else
-  // geometric merge candidate list size
-    if (sps->getUseGeo() && picHeader->getMaxNumMergeCand() >= 2)
-    {
-#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS
-      if (!pps->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1())
-      {
-        READ_UVLC(uiCode, "pic_max_num_merge_cand_minus_max_num_gpm_cand");
-      }
-      else
-      {
-        uiCode = pps->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1() - 1;
-      }
-#else
-      READ_UVLC(uiCode, "pic_max_num_merge_cand_minus_max_num_gpm_cand");
-#endif
-      CHECK(picHeader->getMaxNumMergeCand() < uiCode, "Incorrrect max number of gpm candidates!");
-      picHeader->setMaxNumGeoCand((uint32_t)(picHeader->getMaxNumMergeCand() - uiCode));
-    }
-    else
-    {
-      picHeader->setMaxNumGeoCand(0);
-    }
-#endif
-#endif
 #if JVET_Q0819_PH_CHANGES
   }
   // inherit constraint values from SPS
@@ -3790,18 +3705,6 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
   }
 #endif
   // ibc merge candidate list size
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-  if (sps->getIBCFlag())
-  {
-    READ_UVLC(uiCode, "pic_six_minus_max_num_ibc_merge_cand");
-    CHECK(IBC_MRG_MAX_NUM_CANDS <= uiCode, "Incorrrect max number of IBC merge candidates!");
-    picHeader->setMaxNumIBCMergeCand(IBC_MRG_MAX_NUM_CANDS - uiCode);
-  }
-  else 
-   {
-    picHeader->setMaxNumIBCMergeCand(0);
-  }
-#endif
 #if JVET_Q0819_PH_CHANGES
   if (pps->getQpDeltaInfoInPhFlag())
   {
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index c777dae6a..fef8da310 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -1843,11 +1843,7 @@ void CABACWriter::prediction_unit( const PredictionUnit& pu )
     Mv mvd = pu.mvd[REF_PIC_LIST_0];
     mvd.changeIbcPrecInternal2Amvr(pu.cu->imv);
     mvd_coding(mvd, 0); // already changed to signaling precision
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     if (pu.cs->sps->getMaxNumIBCMergeCand() == 1)
-#else
-    if ( pu.cu->slice->getPicHeader()->getMaxNumIBCMergeCand() == 1 )
-#endif
     {
       CHECK( pu.mvpIdx[REF_PIC_LIST_0], "mvpIdx for IBC mode should be 0" );
     }
@@ -1989,22 +1985,14 @@ void CABACWriter::merge_data(const PredictionUnit& pu)
 #if JVET_Q0806
   const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE && pu.cu->lwidth() * pu.cu->lheight() >= 64;
   const bool geoAvailable = pu.cu->cs->slice->getSPS()->getUseGeo() && pu.cu->cs->slice->isInterB() && 
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     pu.cs->sps->getMaxNumGeoCand() > 1
-#else
-    pu.cu->cs->picHeader->getMaxNumGeoCand() > 1
-#endif
                                                                     && pu.cu->lwidth() >= GEO_MIN_CU_SIZE && pu.cu->lheight() >= GEO_MIN_CU_SIZE
                                                                     && pu.cu->lwidth() <= GEO_MAX_CU_SIZE && pu.cu->lheight() <= GEO_MAX_CU_SIZE
                                                                     && pu.cu->lwidth() < 8 * pu.cu->lheight() && pu.cu->lheight() < 8 * pu.cu->lwidth();
   if (geoAvailable || ciipAvailable)
 #else
   const bool triangleAvailable = pu.cu->cs->slice->getSPS()->getUseTriangle() && pu.cu->cs->slice->isInterB() &&
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     pu.cs->sps->getMaxNumGeoCand() > 1;
-#else
-    pu.cu->cs->picHeader->getMaxNumTriangleCand() > 1;
-#endif
   const bool ciipAvailable = pu.cs->sps->getUseCiip() && !pu.cu->skip && pu.cu->lwidth() < MAX_CU_SIZE && pu.cu->lheight() < MAX_CU_SIZE;
   if (pu.cu->lwidth() * pu.cu->lheight() >= 64
     && (triangleAvailable || ciipAvailable))
@@ -2177,11 +2165,7 @@ void CABACWriter::merge_idx( const PredictionUnit& pu )
         }
       };
       m_BinEncoder.encodeBinEP(splitDir);
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
       const int maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand();
-#else
-      const int maxNumTriangleCand = pu.cs->picHeader->getMaxNumTriangleCand();
-#endif
       CHECK(maxNumTriangleCand < 2, "Incorrect max number of triangle candidates");
       CHECK(candIdx0 >= maxNumTriangleCand, "Incorrect candIdx0");
       CHECK(candIdx1 >= maxNumTriangleCand, "Incorrect candIdx1");
@@ -2200,11 +2184,7 @@ void CABACWriter::merge_idx( const PredictionUnit& pu )
       DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() geo_idx1=%d\n", candIdx1 );
       xWriteTruncBinCode(splitDir, GEO_NUM_PARTITION_MODE);
       candIdx1 -= candIdx1 < candIdx0 ? 0 : 1;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
       const int maxNumGeoCand = pu.cs->sps->getMaxNumGeoCand();
-#else
-      const int maxNumGeoCand = pu.cs->picHeader->getMaxNumGeoCand();
-#endif
       CHECK(maxNumGeoCand < 2, "Incorrect max number of geo candidates");
       CHECK(candIdx0 >= maxNumGeoCand, "Incorrect candIdx0");
       CHECK(candIdx1 >= maxNumGeoCand, "Incorrect candIdx1");
@@ -2227,15 +2207,9 @@ void CABACWriter::merge_idx( const PredictionUnit& pu )
 #endif
     int numCandminus1;
     if (pu.cu->predMode == MODE_IBC)
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
       numCandminus1 = int(pu.cs->sps->getMaxNumIBCMergeCand()) - 1;
     else
       numCandminus1 = int(pu.cs->sps->getMaxNumMergeCand()) - 1;
-#else
-      numCandminus1 = int(pu.cs->picHeader->getMaxNumIBCMergeCand()) - 1;
-    else
-      numCandminus1 = int(pu.cs->picHeader->getMaxNumMergeCand()) - 1;
-#endif
   if( numCandminus1 > 0 )
   {
     if( pu.mergeIdx == 0 )
@@ -2267,11 +2241,7 @@ void CABACWriter::mmvd_merge_idx(const PredictionUnit& pu)
   var0 = mvpIdx / MMVD_MAX_REFINE_NUM;
   var1 = (mvpIdx - (var0 * MMVD_MAX_REFINE_NUM)) / 4;
   var2 = mvpIdx - (var0 * MMVD_MAX_REFINE_NUM) - var1 * 4;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (pu.cs->sps->getMaxNumMergeCand() > 1)
-#else
-  if (pu.cs->picHeader->getMaxNumMergeCand() > 1)
-#endif
   {
     static_assert(MMVD_BASE_MV_NUM == 2, "");
     assert(var0 < 2);
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index f06b1c0eb..6596269b5 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -681,11 +681,7 @@ protected:
   uint32_t      m_maxNumMergeCand;                    ///< Maximum number of merge candidates
   uint32_t      m_maxNumAffineMergeCand;              ///< Maximum number of affine merge candidates
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   uint32_t      m_maxNumGeoCand;
-#else
-  uint32_t      m_maxNumTriangleCand;
-#endif
 #else
   uint32_t      m_maxNumGeoCand;
 #endif
@@ -1799,13 +1795,8 @@ public:
   void         setMaxNumAffineMergeCand          ( uint32_t u )      { m_maxNumAffineMergeCand = u;    }
   uint32_t     getMaxNumAffineMergeCand          ()                  { return m_maxNumAffineMergeCand; }
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   void         setMaxNumGeoCand(uint32_t u) { m_maxNumGeoCand = u; }
   uint32_t     getMaxNumGeoCand() { return m_maxNumGeoCand; }
-#else
-  void         setMaxNumTriangleCand             ( uint32_t u )      { m_maxNumTriangleCand = u;    }
-  uint32_t     getMaxNumTriangleCand             ()                  { return m_maxNumTriangleCand; }
-#endif
 #else
   void         setMaxNumGeoCand                  ( uint32_t u )      { m_maxNumGeoCand = u;    }
   uint32_t     getMaxNumGeoCand                  ()                  { return m_maxNumGeoCand; }
diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp
index a402f18d9..b021b12e9 100644
--- a/source/Lib/EncoderLib/EncCu.cpp
+++ b/source/Lib/EncoderLib/EncCu.cpp
@@ -152,11 +152,7 @@ void EncCu::create( EncCfg* encCfg )
     m_acMergeTmpBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight));
   }
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   const unsigned maxNumTriangleCand = encCfg->getMaxNumGeoCand();
-#else
-  const unsigned maxNumTriangleCand = encCfg->getMaxNumTriangleCand();
-#endif
   for (unsigned i = 0; i < maxNumTriangleCand; i++)
   {
     for (unsigned j = 0; j < maxNumTriangleCand; j++)
@@ -2989,11 +2985,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
 {
   const Slice &slice = *tempCS->slice;
   const SPS &sps = *tempCS->sps;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (sps.getMaxNumGeoCand() < 2)
-#else
-  if (slice.getPicHeader()->getMaxNumTriangleCand() < 2)
-#endif
     return;
 
   CHECK( slice.getSliceType() != B_SLICE, "Triangle mode is only applied to B-slices" );
@@ -3013,11 +3005,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
   PelUnitBuf                                      triangleWeightedBuffer[TRIANGLE_MAX_NUM_CANDS];
   static_vector<uint8_t, TRIANGLE_MAX_NUM_CANDS> triangleRdModeList;
   static_vector<double,  TRIANGLE_MAX_NUM_CANDS> tianglecandCostList;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   uint8_t                                         numTriangleCandComb = sps.getMaxNumGeoCand() * (sps.getMaxNumGeoCand() - 1) * 2;
-#else
-  uint8_t                                         numTriangleCandComb = slice.getPicHeader()->getMaxNumTriangleCand() * (slice.getPicHeader()->getMaxNumTriangleCand() - 1) * 2;
-#endif
 
   DistParam distParam;
   const bool useHadamard = !tempCS->slice->getDisableSATDForRD();
@@ -3044,11 +3032,7 @@ void EncCu::xCheckRDCostMergeTriangle2Nx2N( CodingStructure *&tempCS, CodingStru
     pu.regularMergeFlag = false;
 
     PU::getTriangleMergeCandidates( pu, triangleMrgCtx );
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     const uint8_t maxNumTriangleCand = pu.cs->sps->getMaxNumGeoCand();
-#else
-    const uint8_t maxNumTriangleCand = pu.cs->picHeader->getMaxNumTriangleCand();
-#endif
     for (uint8_t mergeCand = 0; mergeCand < maxNumTriangleCand; mergeCand++)
     {
       triangleBuffer[mergeCand] = m_acMergeBuffer[mergeCand].getBuf(localUnitArea);
@@ -3270,11 +3254,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure
 
   const UnitArea localUnitArea(tempCS->area.chromaFormat, Area(0, 0, tempCS->area.Y().width, tempCS->area.Y().height));
   const double sqrtLambdaForFirstPass = m_pcRdCost->getMotionLambda();
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   uint8_t maxNumMergeCandidates = cu.cs->sps->getMaxNumGeoCand();
-#else
-  uint8_t maxNumMergeCandidates = cu.cs->picHeader->getMaxNumGeoCand();
-#endif
   DistParam distParamWholeBlk;
   m_pcRdCost->setDistParam(distParamWholeBlk, tempCS->getOrgBuf().Y(), m_acMergeBuffer[0].Y().buf, m_acMergeBuffer[0].Y().stride, sps.getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y);
   Distortion bestWholeBlkSad = MAX_UINT64;
@@ -3921,11 +3901,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct
 
         Distortion sad = distParam.distFunc(distParam);
         unsigned int bitsCand = mergeCand + 1;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
         if (mergeCand == tempCS->sps->getMaxNumMergeCand() - 1)
-#else
-        if (mergeCand == tempCS->picHeader->getMaxNumMergeCand() - 1)
-#endif
         {
           bitsCand--;
         }
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index c0d54c80c..c10e48cd7 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1334,12 +1334,10 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps )
   sps.setSBTMVPEnabledFlag                  ( m_SubPuMvpMode );
   sps.setAMVREnabledFlag                ( m_ImvMode != IMV_OFF );
   sps.setBDOFEnabledFlag                    ( m_BIO );
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   sps.setMaxNumMergeCand(getMaxNumMergeCand());
   sps.setMaxNumAffineMergeCand(getMaxNumAffineMergeCand());
   sps.setMaxNumIBCMergeCand(getMaxNumIBCMergeCand());
   sps.setMaxNumGeoCand(getMaxNumGeoCand());
-#endif
   sps.setUseAffine             ( m_Affine );
   sps.setUseAffineType         ( m_AffineType );
   sps.setUsePROF               ( m_PROF );
@@ -2025,18 +2023,7 @@ void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps
   picHeader.setPPSId( pps.getPPSId() );  
   
   // merge list sizes
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   picHeader.setMaxNumAffineMergeCand(getMaxNumAffineMergeCand());
-#else
-  picHeader.setMaxNumMergeCand      ( getMaxNumMergeCand()       );
-  picHeader.setMaxNumAffineMergeCand( getMaxNumAffineMergeCand() );
-#if !JVET_Q0806
-  picHeader.setMaxNumTriangleCand   ( getMaxNumTriangleCand()    );
-#else
-  picHeader.setMaxNumGeoCand        ( getMaxNumGeoCand()         );
-#endif
-  picHeader.setMaxNumIBCMergeCand   ( getMaxNumIBCMergeCand()    );
-#endif
   // copy partitioning constraints from SPS
   picHeader.setSplitConsOverrideFlag(false);
   picHeader.setMinQTSizes( sps.getMinQTSizes() );
diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp
index aa95e566d..58d83b251 100644
--- a/source/Lib/EncoderLib/InterSearch.cpp
+++ b/source/Lib/EncoderLib/InterSearch.cpp
@@ -1464,11 +1464,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const
     int bvpIdxBest = 0;
     cMv.setZero();
     Distortion cost = 0;
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     if (pu.cs->sps->getMaxNumIBCMergeCand() == 1)
-#else
-    if ( pu.cu->slice->getPicHeader()->getMaxNumIBCMergeCand() == 1 )
-#endif
     {
       iBvpNum = 1;
       cMvPred[1] = cMvPred[0];
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 106576273..b80cb7969 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -1433,17 +1433,13 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
     WRITE_FLAG( pcSPS->getUseIntraMTS() ? 1 : 0,                                               "sps_explicit_mts_intra_enabled_flag" );
     WRITE_FLAG( pcSPS->getUseInterMTS() ? 1 : 0,                                               "sps_explicit_mts_inter_enabled_flag" );
   }
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   CHECK(pcSPS->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported");
   WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSPS->getMaxNumMergeCand(), "six_minus_max_num_merge_cand");
-#endif
   WRITE_FLAG( pcSPS->getUseSBT() ? 1 : 0,                                                      "sps_sbt_enabled_flag");
   WRITE_FLAG( pcSPS->getUseAffine() ? 1 : 0,                                                   "sps_affine_enabled_flag" );
   if ( pcSPS->getUseAffine() )
   {
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
     WRITE_UVLC(AFFINE_MRG_MAX_NUM_CANDS - pcSPS->getMaxNumAffineMergeCand(), "five_minus_max_num_subblock_merge_cand");
-#endif
     WRITE_FLAG( pcSPS->getUseAffineType() ? 1 : 0,                                             "sps_affine_type_flag" );
 #if JVET_Q0444_AMVR_SIGNALLING
     if (pcSPS->getAMVREnabledFlag())
@@ -1487,13 +1483,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
 #endif
   WRITE_FLAG( pcSPS->getUseBcw() ? 1 : 0,                                                      "sps_bcw_enabled_flag" );
   WRITE_FLAG(pcSPS->getIBCFlag() ? 1 : 0,                                                      "sps_ibc_enabled_flag");
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (pcSPS->getIBCFlag())
   {
     CHECK(pcSPS->getMaxNumIBCMergeCand() > IBC_MRG_MAX_NUM_CANDS, "More IBC merge candidates signalled than supported");
     WRITE_UVLC(IBC_MRG_MAX_NUM_CANDS - pcSPS->getMaxNumIBCMergeCand(), "six_minus_max_num_ibc_merge_cand");
   }
-#endif
   // KJS: sps_ciip_enabled_flag
   WRITE_FLAG( pcSPS->getUseCiip() ? 1 : 0,                                                  "sps_ciip_enabled_flag" );
 
@@ -1503,7 +1497,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   }
 
 #if !JVET_Q0806
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (pcSPS->getMaxNumMergeCand() >= 2)
   {
     WRITE_FLAG(pcSPS->getUseTriangle() ? 1 : 0, "sps_triangle_enabled_flag");
@@ -1514,10 +1507,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
     }
   }
 #else
-  WRITE_FLAG( pcSPS->getUseTriangle() ? 1: 0,                                                  "sps_triangle_enabled_flag" );
-#endif
-#else
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
   if (pcSPS->getMaxNumMergeCand() >= 2)
   {
     WRITE_FLAG(pcSPS->getUseGeo() ? 1 : 0, "sps_gpm_enabled_flag");
@@ -1527,9 +1516,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
       WRITE_UVLC(pcSPS->getMaxNumMergeCand() - pcSPS->getMaxNumGeoCand(), "max_num_merge_cand_minus_max_num_gpm_cand");
     }
   }
-#else
-  WRITE_FLAG( pcSPS->getUseGeo() ? 1: 0,                                                       "sps_gpm_enabled_flag" );
-#endif
 #endif
   WRITE_FLAG(pcSPS->getUseLmcs() ? 1 : 0, "sps_lmcs_enable_flag");
   WRITE_FLAG( pcSPS->getUseLFNST() ? 1 : 0,                                                    "sps_lfnst_enabled_flag" );
@@ -2513,10 +2499,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader )
     if (!pps->getPPSSixMinusMaxNumMergeCandPlus1())
     {
 #endif
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE 
-      CHECK(picHeader->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported");
-      WRITE_UVLC(MRG_MAX_NUM_CANDS - picHeader->getMaxNumMergeCand(), "pic_six_minus_max_num_merge_cand");
-#endif
 #if !JVET_Q0482_REMOVE_CONSTANT_PARAMS
     }
     else
@@ -2527,12 +2509,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader )
   // subblock merge candidate list size
     if ( sps->getUseAffine() )
     {
-#if JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
       picHeader->setMaxNumAffineMergeCand(sps->getMaxNumAffineMergeCand());
-#else
-      CHECK( picHeader->getMaxNumAffineMergeCand() > AFFINE_MRG_MAX_NUM_CANDS, "More affine merge candidates signalled than supported" );
-      WRITE_UVLC(AFFINE_MRG_MAX_NUM_CANDS - picHeader->getMaxNumAffineMergeCand(), "pic_five_minus_max_num_subblock_merge_cand");
-#endif
     }
     else
     {
@@ -2585,42 +2562,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader )
       xCodePredWeightTable(picHeader, sps);
     }
 #endif
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-#if !JVET_Q0806
-  // triangle merge candidate list size
-    if (sps->getUseTriangle() && picHeader->getMaxNumMergeCand() >= 2)
-    {
-      if (!pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1())
-      {
-        CHECK(picHeader->getMaxNumMergeCand() < picHeader->getMaxNumTriangleCand(), "Incorrrect max number of triangle candidates!");
-        WRITE_UVLC(picHeader->getMaxNumMergeCand() - picHeader->getMaxNumTriangleCand(), "pic_max_num_merge_cand_minus_max_num_triangle_cand");
-      }
-      else
-      {
-        picHeader->setMaxNumTriangleCand((uint32_t)(picHeader->getMaxNumMergeCand() - (pps->getPPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1() - 1)));
-      }    
-    }
-
-#else
-  // geometric merge candidate list size
-    if (sps->getUseGeo() && picHeader->getMaxNumMergeCand() >= 2)
-    {
-#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS
-      if (!pps->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1())
-      {
-#endif
-        CHECK(picHeader->getMaxNumMergeCand() < picHeader->getMaxNumGeoCand(), "Incorrrect max number of gpm candidates!");
-        WRITE_UVLC(picHeader->getMaxNumMergeCand() - picHeader->getMaxNumGeoCand(), "pic_max_num_merge_cand_minus_max_num_gpm_cand");
-#if !JVET_Q0482_REMOVE_CONSTANT_PARAMS
-      }
-      else
-      {
-      picHeader->setMaxNumGeoCand((uint32_t)(picHeader->getMaxNumMergeCand() - (pps->getPPSMaxNumMergeCandMinusMaxNumGeoCandPlus1() - 1)));
-      }
-#endif
-    }
-#endif
-#endif
 #if JVET_Q0819_PH_CHANGES
   }
   // inherit constraint values from SPS
@@ -2633,13 +2574,6 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader )
   }
 #endif
   // ibc merge candidate list size
-#if !JVET_Q0798_SPS_NUMBER_MERGE_CANDIDATE
-  if (sps->getIBCFlag())
-  {
-    CHECK( picHeader->getMaxNumIBCMergeCand() > IBC_MRG_MAX_NUM_CANDS, "More IBC merge candidates signalled than supported" );
-    WRITE_UVLC(IBC_MRG_MAX_NUM_CANDS - picHeader->getMaxNumIBCMergeCand(), "pic_six_minus_max_num_ibc_merge_cand");
-  }
-#endif
 #if JVET_Q0819_PH_CHANGES
   if (pps->getQpDeltaInfoInPhFlag())
   {
-- 
GitLab