From d9722413a82cf8db1f6c9cd645fb834c27a3a8bd Mon Sep 17 00:00:00 2001
From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de>
Date: Wed, 21 Oct 2020 17:09:30 +0200
Subject: [PATCH] remove macro JVET_S0052_RM_SEPARATE_COLOUR_PLANE

---
 source/Lib/CommonLib/Slice.cpp      |  9 --------
 source/Lib/CommonLib/Slice.h        | 14 ------------
 source/Lib/CommonLib/TypeDef.h      |  1 -
 source/Lib/DecoderLib/VLCReader.cpp | 33 -----------------------------
 source/Lib/EncoderLib/EncLib.cpp    |  5 -----
 source/Lib/EncoderLib/VLCWriter.cpp | 22 -------------------
 6 files changed, 84 deletions(-)

diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index 977244b534..49ced14208 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -57,9 +57,6 @@ Slice::Slice()
 , m_prevIRAPSubpicType            ( NAL_UNIT_INVALID )
 , m_rpl0Idx                       ( -1 )
 , m_rpl1Idx                       ( -1 )
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-, m_colourPlaneId                 ( 0 )
-#endif
 , m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
 , m_pictureHeaderInSliceHeader   ( false )
 , m_eSliceType                    ( I_SLICE )
@@ -164,9 +161,6 @@ void Slice::initSlice()
     m_aiNumRefIdx[i]      = 0;
   }
   m_colFromL0Flag = true;
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  m_colourPlaneId = 0;
-#endif
   m_colRefIdx = 0;
   m_lmcsEnabledFlag = 0;
   m_explicitScalingListUsed = 0;
@@ -2865,9 +2859,6 @@ SPS::SPS()
 , m_SBT                       ( false )
 , m_ISP                       ( false )
 , m_chromaFormatIdc           (CHROMA_420)
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-, m_separateColourPlaneFlag   ( 0 )
-#endif
 , m_uiMaxTLayers              (  1)
 , m_ptlDpbHrdParamsPresentFlag (1)
 , m_SubLayerDpbParamsFlag      (0)
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index ed19650473..4bceb289ad 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1380,9 +1380,6 @@ private:
   bool              m_SBT;
   bool              m_ISP;
   ChromaFormat      m_chromaFormatIdc;
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  bool              m_separateColourPlaneFlag;     //!< separate colour plane flag
-#endif
 
   uint32_t              m_uiMaxTLayers;           // maximum number of temporal layers
 
@@ -1564,10 +1561,6 @@ public:
   int                     getLayerId() const                                                              { return m_layerId;                                                    }
   ChromaFormat            getChromaFormatIdc () const                                                     { return m_chromaFormatIdc;                                            }
   void                    setChromaFormatIdc (ChromaFormat i)                                             { m_chromaFormatIdc = i;                                               }
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  void                    setSeparateColourPlaneFlag ( bool b )                                           { m_separateColourPlaneFlag = b;                                       }
-  bool                    getSeparateColourPlaneFlag () const                                             { return m_separateColourPlaneFlag;                                    }
-#endif
 
   static int              getWinUnitX (int chromaFormatIdc)                                               { CHECK(chromaFormatIdc < 0 || chromaFormatIdc >= NUM_CHROMA_FORMAT, "Invalid chroma format parameter"); return m_winUnitX[chromaFormatIdc]; }
   static int              getWinUnitY (int chromaFormatIdc)                                               { CHECK(chromaFormatIdc < 0 || chromaFormatIdc >= NUM_CHROMA_FORMAT, "Invalid chroma format parameter"); return m_winUnitY[chromaFormatIdc]; }
@@ -2648,9 +2641,6 @@ private:
   ReferencePictureList        m_RPL1;            //< RPL for L1 when present in slice header
   int                         m_rpl0Idx;              //< index of used RPL in the SPS or -1 for local RPL in the slice header
   int                         m_rpl1Idx;              //< index of used RPL in the SPS or -1 for local RPL in the slice header
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  int                        m_colourPlaneId;                         //!< 4:4:4 colour plane ID
-#endif
   NalUnitType                m_eNalUnitType;         ///< Nal unit type for the slice
   bool                       m_pictureHeaderInSliceHeader;
   uint32_t                   m_nuhLayerId;           ///< Nal unit layer id
@@ -2898,10 +2888,6 @@ public:
   bool                        isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder );
   bool                        isPOCInRefPicList( const ReferencePictureList *rpl, int poc );
   void                        checkConformanceForDRAP( uint32_t temporalId );
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  void                        setColourPlaneId( int id )                             { m_colourPlaneId = id;                                         }
-  int                         getColourPlaneId() const                               { return m_colourPlaneId;                                       }
-#endif
 
   void                        setLambdas( const double lambdas[MAX_NUM_COMPONENT] )  { for (int component = 0; component < MAX_NUM_COMPONENT; component++) m_lambdas[component] = lambdas[component]; }
   const double*               getLambdas() const                                     { return m_lambdas;                                             }
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 4c17548484..cea0d5e435 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -88,7 +88,6 @@
 
 
 
-#define JVET_S0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
 
 #define JVET_S0123_IDR_UNAVAILABLE_REFERENCE              1 // JVET-S0123: Invoke the generation of unavailable reference picture for an IDR picture that has RPLs.
                                                             //             Change the process for deriving empty RPLs when sps_idr_rpl_present_flag is equal to 0 and nal_unit_type is equal to IDR_W_RADL or IDR_N_LP to involve pps_rpl_info_in_ph_flag.
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 4971dc5900..6847192cc9 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1363,13 +1363,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   READ_CODE(2, uiCode, "sps_chroma_format_idc");                     pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
 #endif
 
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  if( pcSPS->getChromaFormatIdc() == CHROMA_444 )
-  {
-    READ_FLAG(     uiCode, "separate_colour_plane_flag");        CHECK(uiCode != 0, "separate_colour_plane_flag shall be equal to 0");
-    pcSPS->setSeparateColourPlaneFlag( uiCode != 0 );
-  }
-#endif
 
   READ_FLAG(uiCode, "sps_ref_pic_resampling_enabled_flag");          pcSPS->setRprEnabledFlag(uiCode);
 #if JVET_Q0114_ASPECT5_GCI_FLAG
@@ -1403,9 +1396,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
     READ_UVLC(uiCode, "sps_conf_win_top_offset");                conf.setWindowTopOffset(uiCode);
     READ_UVLC(uiCode, "sps_conf_win_bottom_offset");             conf.setWindowBottomOffset(uiCode);
   }
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  const uint32_t chromaArrayType = (int) pcSPS->getSeparateColourPlaneFlag() ? 0 : pcSPS->getChromaFormatIdc();
-#endif
 
 #if !JVET_S0186_SPS_CLEANUP
   READ_CODE(2, uiCode, "sps_log2_ctu_size_minus5");              pcSPS->setCTUSize(1 << (uiCode + 5));
@@ -1757,11 +1747,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   }
   READ_FLAG(uiCode, "sps_lfnst_enabled_flag");                    pcSPS->setUseLFNST(uiCode != 0);
 
-#if JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   if (pcSPS->getChromaFormatIdc() != CHROMA_400)
-#else
-  if (chromaArrayType != CHROMA_400)
-#endif
   {
     READ_FLAG(uiCode, "sps_joint_cbcr_enabled_flag");                pcSPS->setJointCbCrEnabledFlag(uiCode ? true : false);
     ChromaQpMappingTableParams chromaQpMappingTableParams;
@@ -2002,11 +1988,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
     pcSPS->setVerCollocatedChromaFlag(true);
   }
   READ_FLAG( uiCode,  "sps_palette_enabled_flag");                                pcSPS->setPLTMode                ( uiCode != 0 );
-#if JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   if (pcSPS->getChromaFormatIdc() == CHROMA_444 && pcSPS->getLog2MaxTbSize() != 6)
-#else
-  if (chromaArrayType == CHROMA_444 && pcSPS->getLog2MaxTbSize() != 6)
-#endif
   {
     READ_FLAG(uiCode, "sps_act_enabled_flag");                                pcSPS->setUseColorTrans(uiCode != 0);
   }
@@ -3570,9 +3552,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
   CHECK(pcSlice->getPictureHeaderInSliceHeader() && pps->getWpInfoInPhFlag() == 1, "When sh_picture_header_in_slice_header_flag is equal to 1, wp_info_in_ph_flag shall be equal to 0");
   CHECK(pcSlice->getPictureHeaderInSliceHeader() && pps->getQpDeltaInfoInPhFlag() == 1, "When sh_picture_header_in_slice_header_flag is equal to 1, qp_delta_info_in_ph_flag shall be equal to 0");
   CHECK(pcSlice->getPictureHeaderInSliceHeader() && sps->getSubPicInfoPresentFlag() == 1, "When sps_subpic_info_present_flag is equal to 1, the value of sh_picture_header_in_slice_header_flag shall be equal to 0");
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  CHECK(pcSlice->getPictureHeaderInSliceHeader() && sps->getSeparateColourPlaneFlag() == 1, "when separate_colour_plane_flag is equal to 1, the value of sh_picture_header_in_slice_header_flag shall be equal to 0");
-#endif
 #if JVET_S0184_VIRTUAL_BOUNDARY_CONSTRAINT
   CHECK(sps->getSubPicInfoPresentFlag() == 1 && sps->getVirtualBoundariesEnabledFlag() == 1 && sps->getVirtualBoundariesPresentFlag() == 0,
         "when sps_subpic_info_present_flag is equal to 1 and sps_virtual_boundaries_enabled_flag is equal to 1, sps_virtual_boundaries_present_flag shall be equal 1");
@@ -3835,18 +3814,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
     pcSlice->setExplicitScalingListUsed(pcSlice->getPictureHeaderInSliceHeader() ? picHeader->getExplicitScalingListEnabledFlag() : false);
   }
 
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-    // 4:4:4 colour plane ID
-    if( sps->getSeparateColourPlaneFlag() )
-    {
-      READ_CODE( 2, uiCode, "colour_plane_id" ); pcSlice->setColourPlaneId( uiCode );
-      CHECK( uiCode > 2, "colour_plane_id exceeds valid range" );
-    }
-    else
-    {
-      pcSlice->setColourPlaneId( 0 );
-    }
-#endif
     if( pps->getRplInfoInPhFlag() )
     {
       *pcSlice->getRPL0() = *picHeader->getRPL0();
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 88d900c428..3cc38e7eea 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1857,12 +1857,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
   {
     chromaDbfOffsetNotSameAsLuma = false;
   }
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
-  if( ( chromaArrayType != CHROMA_400 ) && ( chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma ) )
-#else
   if ((sps.getChromaFormatIdc() != CHROMA_400) && (chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma))
-#endif
   {
     pps.setPPSChromaToolFlag(true);
   }
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 1613dc1fcc..a1f7aa6c58 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -823,17 +823,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc");
 #endif
 
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-  const ChromaFormat format                = pcSPS->getChromaFormatIdc();
-  const uint32_t  separate_colour_plane_flag = pcSPS->getSeparateColourPlaneFlag();
-  if( format == CHROMA_444 )
-  {
-     CHECK(separate_colour_plane_flag != 0,         "separate_colour_plane_flag is not '0'");
-     WRITE_FLAG( separate_colour_plane_flag,        "separate_colour_plane_flag");
-  }
-
-  const uint32_t chromaArrayType = separate_colour_plane_flag ? 0 : format;
-#endif
 
   WRITE_FLAG(pcSPS->getRprEnabledFlag(), "sps_ref_pic_resampling_enabled_flag");
   if (pcSPS->getRprEnabledFlag())
@@ -1028,11 +1017,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   }
   WRITE_FLAG(pcSPS->getUseLFNST() ? 1 : 0, "sps_lfnst_enabled_flag");
 
-#if JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   if (pcSPS->getChromaFormatIdc() != CHROMA_400)
-#else
-  if (chromaArrayType != CHROMA_400)
-#endif
   {
     WRITE_FLAG(pcSPS->getJointCbCrEnabledFlag(), "sps_joint_cbcr_enabled_flag");
     const ChromaQpMappingTable& chromaQpMappingTable = pcSPS->getChromaQpMappingTable();
@@ -2310,13 +2295,6 @@ void HLSWriter::codeSliceHeader         ( Slice* pcSlice, PicHeader *picHeader )
     WRITE_FLAG(pcSlice->getExplicitScalingListUsed(), "sh_explicit_scaling_list_used_flag");
   }
 
-#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
-    // 4:4:4 colour plane ID
-    if( pcSlice->getSPS()->getSeparateColourPlaneFlag() )
-    {
-      WRITE_CODE( pcSlice->getColourPlaneId(), 2, "colour_plane_id" );
-    }
-#endif
   if( !pcSlice->getPPS()->getRplInfoInPhFlag() && (!pcSlice->getIdrPicFlag() || pcSlice->getSPS()->getIDRRefParamListPresent()))
     {
       //Write L0 related syntax elements
-- 
GitLab