From 27b80ca8d22b1d81b4c6958c88ea726aa33bf1fb Mon Sep 17 00:00:00 2001
From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de>
Date: Sun, 26 Apr 2020 20:10:38 +0200
Subject: [PATCH] remove macro JVET_Q0042_VUI

---
 source/Lib/CommonLib/Slice.cpp      | 10 -----
 source/Lib/CommonLib/Slice.h        | 14 -------
 source/Lib/CommonLib/TypeDef.h      |  1 -
 source/Lib/DecoderLib/VLCReader.cpp | 57 -----------------------------
 source/Lib/EncoderLib/EncLib.cpp    |  5 ---
 source/Lib/EncoderLib/VLCWriter.cpp | 51 --------------------------
 6 files changed, 138 deletions(-)

diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index 034d79b71..1277781e4 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -663,11 +663,7 @@ void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureLi
   int numActiveEntriesL0 = getNumRefIdx(REF_PIC_LIST_0);
   int numActiveEntriesL1 = getNumRefIdx(REF_PIC_LIST_1);
 
-#if JVET_Q0042_VUI
   bool fieldSeqFlag = getSPS()->getFieldSeqFlag();
-#else
-  bool fieldSeqFlag = getSPS()->getVuiParameters() && getSPS()->getVuiParameters()->getFieldSeqFlag();
-#endif
 
   int currentPictureIsTrailing = 0;
   if (getPic()->getDecodingOrderNumber() > associatedIRAPDecodingOrderNumber)
@@ -1257,11 +1253,7 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const
       {
         numLeadingPicsFound++;
         int limitNonLP = 0;
-#if JVET_Q0042_VUI
         if (pcSlice->getSPS()->getFieldSeqFlag())
-#else
-        if (pcSlice->getSPS()->getVuiParameters() && pcSlice->getSPS()->getVuiParameters()->getFieldSeqFlag())
-#endif
           limitNonLP = 1;
         CHECK(pcPic->poc > this->getAssociatedIRAPPOC() && numLeadingPicsFound > limitNonLP, "Invalid POC");
       }
@@ -2601,9 +2593,7 @@ SPS::SPS()
 , m_numVerVirtualBoundaries(0)
 , m_numHorVirtualBoundaries(0)
 , m_generalHrdParametersPresentFlag(false)
-#if JVET_Q0042_VUI
 , m_fieldSeqFlag              (false)
-#endif
 , m_vuiParametersPresentFlag  (false)
 , m_vuiParameters             ()
 , m_wrapAroundEnabledFlag     (false)
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index ecc7bd5fe..0699c62d1 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1135,9 +1135,6 @@ private:
   int        m_colourPrimaries;
   int        m_transferCharacteristics;
   int        m_matrixCoefficients;
-#if !JVET_Q0042_VUI
-  bool       m_fieldSeqFlag;
-#endif
   bool       m_chromaLocInfoPresentFlag;
   int        m_chromaSampleLocTypeTopField;
   int        m_chromaSampleLocTypeBottomField;
@@ -1157,9 +1154,6 @@ public:
     , m_colourPrimaries                   (2)
     , m_transferCharacteristics           (2)
     , m_matrixCoefficients                (2)
-#if !JVET_Q0042_VUI
-    , m_fieldSeqFlag                      (false)
-#endif
     , m_chromaLocInfoPresentFlag          (false)
     , m_chromaSampleLocTypeTopField       (0)
     , m_chromaSampleLocTypeBottomField    (0)
@@ -1197,10 +1191,6 @@ public:
   int               getMatrixCoefficients() const                          { return m_matrixCoefficients;                   }
   void              setMatrixCoefficients(int i)                           { m_matrixCoefficients = i;                      }
 
-#if !JVET_Q0042_VUI
-  bool              getFieldSeqFlag() const                                { return m_fieldSeqFlag;                         }
-  void              setFieldSeqFlag(bool i)                                { m_fieldSeqFlag = i;                            }
-#endif
 
   bool              getChromaLocInfoPresentFlag() const                    { return m_chromaLocInfoPresentFlag;             }
   void              setChromaLocInfoPresentFlag(bool i)                    { m_chromaLocInfoPresentFlag = i;                }
@@ -1412,9 +1402,7 @@ private:
   GeneralHrdParams m_generalHrdParams;
   OlsHrdParams     m_olsHrdParams[MAX_TLAYER];
 
-#if JVET_Q0042_VUI
   bool              m_fieldSeqFlag;
-#endif
   bool              m_vuiParametersPresentFlag;
   VUI               m_vuiParameters;
 
@@ -1766,10 +1754,8 @@ void                    setCCALFEnabledFlag( bool b )
 
   GeneralHrdParams*          getGeneralHrdParameters() { return &m_generalHrdParams; }
   const GeneralHrdParams*    getGeneralHrdParameters() const { return &m_generalHrdParams; }
-#if JVET_Q0042_VUI
   bool                    getFieldSeqFlag() const                                                         { return m_fieldSeqFlag;                         }
   void                    setFieldSeqFlag(bool i)                                                         { m_fieldSeqFlag = i;                            }
-#endif
   bool                    getVuiParametersPresentFlag() const                                             { return m_vuiParametersPresentFlag;                                   }
   void                    setVuiParametersPresentFlag(bool b)                                             { m_vuiParametersPresentFlag = b;                                      }
   VUI*                    getVuiParameters()                                                              { return &m_vuiParameters;                                             }
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index ce9a3d520..27cdaae8f 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -109,7 +109,6 @@
 
 
 
-#define JVET_Q0042_VUI                                    1 // Modifications to VUI syntax
 
 #define JVET_Q0512_ENC_CHROMA_TS_ACT                      1 // JVET-Q0512: encoder-side improvement on enabling chroma transform-skip for ACT
 
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 42c2c9bac..1cd036e66 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1120,7 +1120,6 @@ void HLSyntaxReader::parseScalingListAps( APS* aps )
   parseScalingList( &info );
 }
 
-#if JVET_Q0042_VUI
 void  HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS)
 {
 #if ENABLE_TRACING
@@ -1173,60 +1172,6 @@ void  HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS)
   }
 
 }
-#else
-void  HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS)
-{
-#if ENABLE_TRACING
-  DTRACE( g_trace_ctx, D_HEADER, "----------- vui_parameters -----------\n");
-#endif
-
-
-  uint32_t  symbol;
-
-  READ_FLAG( symbol, "aspect_ratio_info_present_flag");           pcVUI->setAspectRatioInfoPresentFlag(symbol);
-  if (pcVUI->getAspectRatioInfoPresentFlag())
-  {
-    READ_FLAG( symbol, "aspect_ratio_constant_flag");           pcVUI->setAspectRatioConstantFlag(symbol);
-    READ_CODE(8, symbol, "aspect_ratio_idc");                         pcVUI->setAspectRatioIdc(symbol);
-    if (pcVUI->getAspectRatioIdc() == 255)
-    {
-      READ_CODE(16, symbol, "sar_width");                             pcVUI->setSarWidth(symbol);
-      READ_CODE(16, symbol, "sar_height");                            pcVUI->setSarHeight(symbol);
-    }
-  }
-
-  READ_FLAG(   symbol, "colour_description_present_flag");          pcVUI->setColourDescriptionPresentFlag(symbol);
-  if (pcVUI->getColourDescriptionPresentFlag())
-  {
-    READ_CODE(8, symbol, "colour_primaries");                       pcVUI->setColourPrimaries(symbol);
-    READ_CODE(8, symbol, "transfer_characteristics");               pcVUI->setTransferCharacteristics(symbol);
-    READ_CODE(8, symbol, "matrix_coeffs");                          pcVUI->setMatrixCoefficients(symbol);
-    READ_FLAG(   symbol, "video_full_range_flag");                    pcVUI->setVideoFullRangeFlag(symbol);
-  }
-
-  READ_FLAG(     symbol, "field_seq_flag");                           pcVUI->setFieldSeqFlag(symbol);
-
-  READ_FLAG(     symbol, "chroma_loc_info_present_flag");             pcVUI->setChromaLocInfoPresentFlag(symbol);
-  if (pcVUI->getChromaLocInfoPresentFlag())
-  {
-    if(pcVUI->getFieldSeqFlag())
-    {
-      READ_UVLC(   symbol, "chroma_sample_loc_type_top_field" );        pcVUI->setChromaSampleLocTypeTopField(symbol);
-      READ_UVLC(   symbol, "chroma_sample_loc_type_bottom_field" );     pcVUI->setChromaSampleLocTypeBottomField(symbol);
-    }
-    else
-    {
-      READ_UVLC(   symbol, "chroma_sample_loc_type" );        pcVUI->setChromaSampleLocType(symbol);
-    }
-  }
-
-  READ_FLAG(     symbol, "overscan_info_present_flag");               pcVUI->setOverscanInfoPresentFlag(symbol);
-  if (pcVUI->getOverscanInfoPresentFlag())
-  {
-    READ_FLAG(   symbol, "overscan_appropriate_flag");                pcVUI->setOverscanAppropriateFlag(symbol);
-  }
-}
-#endif
 
 void HLSyntaxReader::parseGeneralHrdParameters(GeneralHrdParams *hrd)
 {
@@ -2113,9 +2058,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   }
   }
 
-#if JVET_Q0042_VUI
   READ_FLAG(     uiCode, "field_seq_flag");                       pcSPS->setFieldSeqFlag(uiCode);
-#endif
 
   READ_FLAG( uiCode, "vui_parameters_present_flag" );             pcSPS->setVuiParametersPresentFlag(uiCode);
 
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 0dbbb5f00..2e17c352f 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1353,9 +1353,7 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps )
 #if JVET_Q0795_CCALF
   sps.setCCALFEnabledFlag( m_ccalf );
 #endif
-#if JVET_Q0042_VUI
   sps.setFieldSeqFlag(false);
-#endif
   sps.setVuiParametersPresentFlag(getVuiParametersPresentFlag());
 
   if (sps.getVuiParametersPresentFlag())
@@ -1370,9 +1368,6 @@ void EncLib::xInitSPS( SPS& sps, VPS& vps )
     pcVUI->setColourPrimaries(getColourPrimaries());
     pcVUI->setTransferCharacteristics(getTransferCharacteristics());
     pcVUI->setMatrixCoefficients(getMatrixCoefficients());
-#if !JVET_Q0042_VUI
-    pcVUI->setFieldSeqFlag(false);
-#endif
     pcVUI->setChromaLocInfoPresentFlag(getChromaLocInfoPresentFlag());
     pcVUI->setChromaSampleLocTypeTopField(getChromaSampleLocTypeTopField());
     pcVUI->setChromaSampleLocTypeBottomField(getChromaSampleLocTypeBottomField());
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 44d044ec3..a51e8d76a 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -711,7 +711,6 @@ void HLSWriter::codeScalingListAps( APS* pcAPS )
   codeScalingList( param );
 }
 
-#if JVET_Q0042_VUI
 void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS )
 {
 #if ENABLE_TRACING
@@ -758,54 +757,6 @@ void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS )
     }
   }
 }
-#else
-void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS )
-{
-#if ENABLE_TRACING
-  DTRACE( g_trace_ctx, D_HEADER, "----------- vui_parameters -----------\n");
-#endif
-
-
-  WRITE_FLAG(pcVUI->getAspectRatioInfoPresentFlag(),            "aspect_ratio_info_present_flag");
-  if (pcVUI->getAspectRatioInfoPresentFlag())
-  {
-    WRITE_FLAG(pcVUI->getAspectRatioConstantFlag(),             "aspect_ratio_constant_flag");
-    WRITE_CODE(pcVUI->getAspectRatioIdc(), 8,                   "aspect_ratio_idc" );
-    if (pcVUI->getAspectRatioIdc() == 255)
-    {
-      WRITE_CODE(pcVUI->getSarWidth(), 16,                      "sar_width");
-      WRITE_CODE(pcVUI->getSarHeight(), 16,                     "sar_height");
-    }
-  }
-  WRITE_FLAG(pcVUI->getColourDescriptionPresentFlag(),        "colour_description_present_flag");
-  if (pcVUI->getColourDescriptionPresentFlag())
-  {
-    WRITE_CODE(pcVUI->getColourPrimaries(), 8,                "colour_primaries");
-    WRITE_CODE(pcVUI->getTransferCharacteristics(), 8,        "transfer_characteristics");
-    WRITE_CODE(pcVUI->getMatrixCoefficients(), 8,             "matrix_coeffs");
-    WRITE_FLAG(pcVUI->getVideoFullRangeFlag(),                "video_full_range_flag");
-  }
-  WRITE_FLAG(pcVUI->getFieldSeqFlag(),                          "field_seq_flag");
-  WRITE_FLAG(pcVUI->getChromaLocInfoPresentFlag(),              "chroma_loc_info_present_flag");
-  if (pcVUI->getChromaLocInfoPresentFlag())
-  {
-    if(pcVUI->getFieldSeqFlag())
-    {
-      WRITE_UVLC(pcVUI->getChromaSampleLocTypeTopField(),         "chroma_sample_loc_type_top_field");
-      WRITE_UVLC(pcVUI->getChromaSampleLocTypeBottomField(),      "chroma_sample_loc_type_bottom_field");
-    }
-    else
-    {
-      WRITE_UVLC(pcVUI->getChromaSampleLocType(),         "chroma_sample_loc_type");
-    }
-  }
-  WRITE_FLAG(pcVUI->getOverscanInfoPresentFlag(),               "overscan_info_present_flag");
-  if (pcVUI->getOverscanInfoPresentFlag())
-  {
-    WRITE_FLAG(pcVUI->getOverscanAppropriateFlag(),             "overscan_appropriate_flag");
-  }
-}
-#endif
 
 void HLSWriter::codeGeneralHrdparameters(const GeneralHrdParams * hrd)
 {
@@ -1378,9 +1329,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   }
   }
 
-#if JVET_Q0042_VUI
   WRITE_FLAG(pcSPS->getFieldSeqFlag(),                          "field_seq_flag");
-#endif
   WRITE_FLAG( pcSPS->getVuiParametersPresentFlag(),            "vui_parameters_present_flag" );
   if (pcSPS->getVuiParametersPresentFlag())
   {
-- 
GitLab