From f9a9ec4f7a875115417b4f09436deedcf2c3cc22 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 09:41:33 +0800
Subject: [PATCH 01/10] JVET_R0052: Remove separate colour plane coding from
 VVC version 1

---
 source/Lib/CommonLib/Slice.cpp      |  6 ++++++
 source/Lib/CommonLib/Slice.h        |  8 ++++++++
 source/Lib/CommonLib/TypeDef.h      |  2 ++
 source/Lib/DecoderLib/VLCReader.cpp | 12 ++++++++++--
 source/Lib/EncoderLib/EncLib.cpp    |  4 ++++
 source/Lib/EncoderLib/VLCWriter.cpp |  7 ++++++-
 6 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index ee5f5678ee..ad9012c26d 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -61,7 +61,9 @@ Slice::Slice()
 #endif
 , m_rpl0Idx                       ( -1 )
 , m_rpl1Idx                       ( -1 )
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
 , m_colourPlaneId                 ( 0 )
+#endif
 , m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
 , m_pictureHeaderInSliceHeader   ( false )
 , m_eSliceType                    ( I_SLICE )
@@ -167,7 +169,9 @@ void Slice::initSlice()
     m_aiNumRefIdx[i]      = 0;
   }
   m_colFromL0Flag = true;
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
   m_colourPlaneId = 0;
+#endif
   m_colRefIdx = 0;
   m_lmcsEnabledFlag = 0;
   m_explicitScalingListUsed = 0;
@@ -2922,7 +2926,9 @@ SPS::SPS()
 , m_SBT                       ( false )
 , m_ISP                       ( false )
 , m_chromaFormatIdc           (CHROMA_420)
+#if !JVET_R0052_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 5a259fd6f8..392d3be2df 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1348,7 +1348,9 @@ private:
   bool              m_SBT;
   bool              m_ISP;
   ChromaFormat      m_chromaFormatIdc;
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
   bool              m_separateColourPlaneFlag;     //!< separate colour plane flag
+#endif
 
   uint32_t              m_uiMaxTLayers;           // maximum number of temporal layers
 
@@ -1546,8 +1548,10 @@ public:
 #endif
   ChromaFormat            getChromaFormatIdc () const                                                     { return m_chromaFormatIdc;                                            }
   void                    setChromaFormatIdc (ChromaFormat i)                                             { m_chromaFormatIdc = i;                                               }
+#if !JVET_R0052_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]; }
@@ -2695,7 +2699,9 @@ private:
   ReferencePictureList        m_localRPL1;            //< 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_R0052_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
@@ -2954,8 +2960,10 @@ public:
   bool                        isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder );
   bool                        isPOCInRefPicList( const ReferencePictureList *rpl, int poc );
   void                        checkConformanceForDRAP( uint32_t temporalId );
+#if !JVET_R0052_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 69afb445b3..0bfd8ecb2b 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -52,6 +52,8 @@
 
 
 //########### place macros to be removed in next cycle below this line ###############
+#define JVET_R0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET_R0052: Remove separate colour plane coding from VVC version 1
+
 #define JVET_Q0280_CONSTRAINT_ON_VPS_ID                   1 // JVET-Q0280: Same VPS ID value across layers
 
 #define JVET_R0042_SUBPIC_CHECK                           1 // JVET_R0042: SubPicture types related constraints
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 3a928b838a..4fdc326f9b 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1441,11 +1441,13 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   pcSPS->setGDREnabledFlag(uiCode);
   READ_CODE(2, uiCode, "chroma_format_idc");                     pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
 
+#if !JVET_R0052_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
 
 #if JVET_R0058
   READ_FLAG(uiCode, "ref_pic_resampling_enabled_flag");          pcSPS->setRprEnabledFlag(uiCode);
@@ -1477,7 +1479,11 @@ 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_R0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int) pcSPS->getSeparateColourPlaneFlag() ? 0 : pcSPS->getChromaFormatIdc();
+#else
+  const uint32_t chromaArrayType = (int) pcSPS->getChromaFormatIdc();
+#endif
 
   READ_CODE(2, uiCode, "sps_log2_ctu_size_minus5");              pcSPS->setCTUSize(1 << (uiCode + 5));
   CHECK(uiCode > 2, "sps_log2_ctu_size_minus5 must be less than or equal to 2");
@@ -3878,7 +3884,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
 #endif
 #if JVET_R0202_WHEN_PH_IN_SH_NO_SUBPIC_SEPARATE_COLOR
   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_R0052_RM_SEPARATE_COLOUR_PLANE
   CHECK(pcSlice->getPictureHeaderInSliceHeader() && sps->getSeparateColourPlaneFlag() == 1, "when separate_colour_plane_flag is equal to 1, the value of picture_header_in_slice_header_flag shall be equal to 0");
+#endif
 #endif
 
   const ChromaFormat chFmt = sps->getChromaFormatIdc();
@@ -4193,6 +4201,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
   }
 #endif
 
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
     // 4:4:4 colour plane ID
     if( sps->getSeparateColourPlaneFlag() )
     {
@@ -4203,8 +4212,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
     {
       pcSlice->setColourPlaneId( 0 );
     }
-
-
+#endif
     if( pps->getRplInfoInPhFlag() )
     {
       pcSlice->setRPL0(picHeader->getRPL0());
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 7c6f71f8d3..be1c060e67 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1823,7 +1823,11 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
   {
     chromaDbfOffsetNotSameAsLuma = false;
   }
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
+#else
+  const uint32_t chromaArrayType = (int)sps.getChromaFormatIdc();
+#endif
   if( ( chromaArrayType != CHROMA_400 ) && ( chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma ) )
   {
     pps.setPPSChromaToolFlag(true);
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index da56449d9b..6389ad2912 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -886,6 +886,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc");
 
   const ChromaFormat format                = pcSPS->getChromaFormatIdc();
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t  separate_colour_plane_flag = pcSPS->getSeparateColourPlaneFlag();
   if( format == CHROMA_444 )
   {
@@ -894,6 +895,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   }
 
   const uint32_t chromaArrayType = separate_colour_plane_flag ? 0 : format;
+#else
+  const uint32_t chromaArrayType = format;
+#endif
 
 #if JVET_R0058
   WRITE_FLAG(pcSPS->getRprEnabledFlag(), "ref_pic_resampling_enabled_flag");
@@ -2521,12 +2525,13 @@ void HLSWriter::codeSliceHeader         ( Slice* pcSlice )
   }
 #endif
 
+#if !JVET_R0052_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


From 7873c1d5b6e9e49143927835c26869d018b93d61 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 20:56:09 +0800
Subject: [PATCH 02/10] change R0052 to S0052

---
 source/Lib/CommonLib/Slice.cpp      | 6 +++---
 source/Lib/CommonLib/Slice.h        | 8 ++++----
 source/Lib/CommonLib/TypeDef.h      | 2 +-
 source/Lib/DecoderLib/VLCReader.cpp | 8 ++++----
 source/Lib/EncoderLib/EncLib.cpp    | 2 +-
 source/Lib/EncoderLib/VLCWriter.cpp | 4 ++--
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index ad9012c26d..b7c3cc10a2 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -61,7 +61,7 @@ Slice::Slice()
 #endif
 , m_rpl0Idx                       ( -1 )
 , m_rpl1Idx                       ( -1 )
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
 , m_colourPlaneId                 ( 0 )
 #endif
 , m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
@@ -169,7 +169,7 @@ void Slice::initSlice()
     m_aiNumRefIdx[i]      = 0;
   }
   m_colFromL0Flag = true;
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   m_colourPlaneId = 0;
 #endif
   m_colRefIdx = 0;
@@ -2926,7 +2926,7 @@ SPS::SPS()
 , m_SBT                       ( false )
 , m_ISP                       ( false )
 , m_chromaFormatIdc           (CHROMA_420)
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
 , m_separateColourPlaneFlag   ( 0 )
 #endif
 , m_uiMaxTLayers              (  1)
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index 392d3be2df..7e58f9c266 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1348,7 +1348,7 @@ private:
   bool              m_SBT;
   bool              m_ISP;
   ChromaFormat      m_chromaFormatIdc;
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   bool              m_separateColourPlaneFlag;     //!< separate colour plane flag
 #endif
 
@@ -1548,7 +1548,7 @@ public:
 #endif
   ChromaFormat            getChromaFormatIdc () const                                                     { return m_chromaFormatIdc;                                            }
   void                    setChromaFormatIdc (ChromaFormat i)                                             { m_chromaFormatIdc = i;                                               }
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   void                    setSeparateColourPlaneFlag ( bool b )                                           { m_separateColourPlaneFlag = b;                                       }
   bool                    getSeparateColourPlaneFlag () const                                             { return m_separateColourPlaneFlag;                                    }
 #endif
@@ -2699,7 +2699,7 @@ private:
   ReferencePictureList        m_localRPL1;            //< 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_R0052_RM_SEPARATE_COLOUR_PLANE
+#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
@@ -2960,7 +2960,7 @@ public:
   bool                        isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder );
   bool                        isPOCInRefPicList( const ReferencePictureList *rpl, int poc );
   void                        checkConformanceForDRAP( uint32_t temporalId );
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   void                        setColourPlaneId( int id )                             { m_colourPlaneId = id;                                         }
   int                         getColourPlaneId() const                               { return m_colourPlaneId;                                       }
 #endif
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 0bfd8ecb2b..da09b059f8 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -52,7 +52,7 @@
 
 
 //########### place macros to be removed in next cycle below this line ###############
-#define JVET_R0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET_R0052: Remove separate colour plane coding from VVC version 1
+#define JVET_S0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
 
 #define JVET_Q0280_CONSTRAINT_ON_VPS_ID                   1 // JVET-Q0280: Same VPS ID value across layers
 
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 4fdc326f9b..73a5709c7a 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1441,7 +1441,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   pcSPS->setGDREnabledFlag(uiCode);
   READ_CODE(2, uiCode, "chroma_format_idc");                     pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
 
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#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");
@@ -1479,7 +1479,7 @@ 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_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int) pcSPS->getSeparateColourPlaneFlag() ? 0 : pcSPS->getChromaFormatIdc();
 #else
   const uint32_t chromaArrayType = (int) pcSPS->getChromaFormatIdc();
@@ -3884,7 +3884,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
 #endif
 #if JVET_R0202_WHEN_PH_IN_SH_NO_SUBPIC_SEPARATE_COLOR
   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_R0052_RM_SEPARATE_COLOUR_PLANE
+#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 picture_header_in_slice_header_flag shall be equal to 0");
 #endif
 #endif
@@ -4201,7 +4201,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
   }
 #endif
 
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
     // 4:4:4 colour plane ID
     if( sps->getSeparateColourPlaneFlag() )
     {
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index be1c060e67..1cb8811aa5 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1823,7 +1823,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
   {
     chromaDbfOffsetNotSameAsLuma = false;
   }
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
 #else
   const uint32_t chromaArrayType = (int)sps.getChromaFormatIdc();
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 6389ad2912..aafb047807 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -886,7 +886,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc");
 
   const ChromaFormat format                = pcSPS->getChromaFormatIdc();
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t  separate_colour_plane_flag = pcSPS->getSeparateColourPlaneFlag();
   if( format == CHROMA_444 )
   {
@@ -2525,7 +2525,7 @@ void HLSWriter::codeSliceHeader         ( Slice* pcSlice )
   }
 #endif
 
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
     // 4:4:4 colour plane ID
     if( pcSlice->getSPS()->getSeparateColourPlaneFlag() )
     {
-- 
GitLab


From fe7a9e493b3a7e0e0eebca41a11112cba2c6f738 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 09:41:33 +0800
Subject: [PATCH 03/10] JVET_R0052: Remove separate colour plane coding from
 VVC version 1

---
 source/Lib/CommonLib/Slice.cpp      |  6 ++++++
 source/Lib/CommonLib/Slice.h        |  8 ++++++++
 source/Lib/CommonLib/TypeDef.h      |  6 +++---
 source/Lib/DecoderLib/VLCReader.cpp | 12 ++++++++++--
 source/Lib/EncoderLib/EncLib.cpp    |  4 ++++
 source/Lib/EncoderLib/VLCWriter.cpp |  7 ++++++-
 6 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index 9a4a634f8c..258edc80d1 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -57,7 +57,9 @@ Slice::Slice()
 , m_prevIRAPSubpicType            ( NAL_UNIT_INVALID )
 , m_rpl0Idx                       ( -1 )
 , m_rpl1Idx                       ( -1 )
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
 , m_colourPlaneId                 ( 0 )
+#endif
 , m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
 , m_pictureHeaderInSliceHeader   ( false )
 , m_eSliceType                    ( I_SLICE )
@@ -161,7 +163,9 @@ void Slice::initSlice()
     m_aiNumRefIdx[i]      = 0;
   }
   m_colFromL0Flag = true;
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
   m_colourPlaneId = 0;
+#endif
   m_colRefIdx = 0;
   m_lmcsEnabledFlag = 0;
   m_explicitScalingListUsed = 0;
@@ -2691,7 +2695,9 @@ SPS::SPS()
 , m_SBT                       ( false )
 , m_ISP                       ( false )
 , m_chromaFormatIdc           (CHROMA_420)
+#if !JVET_R0052_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 0cfaca12b0..d6d790a890 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1274,7 +1274,9 @@ private:
   bool              m_SBT;
   bool              m_ISP;
   ChromaFormat      m_chromaFormatIdc;
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
   bool              m_separateColourPlaneFlag;     //!< separate colour plane flag
+#endif
 
   uint32_t              m_uiMaxTLayers;           // maximum number of temporal layers
 
@@ -1451,8 +1453,10 @@ public:
   int                     getLayerId() const                                                              { return m_layerId;                                                    }
   ChromaFormat            getChromaFormatIdc () const                                                     { return m_chromaFormatIdc;                                            }
   void                    setChromaFormatIdc (ChromaFormat i)                                             { m_chromaFormatIdc = i;                                               }
+#if !JVET_R0052_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]; }
@@ -2528,7 +2532,9 @@ private:
   ReferencePictureList        m_localRPL1;            //< 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_R0052_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
@@ -2777,8 +2783,10 @@ public:
   bool                        isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder );
   bool                        isPOCInRefPicList( const ReferencePictureList *rpl, int poc );
   void                        checkConformanceForDRAP( uint32_t temporalId );
+#if !JVET_R0052_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 acde677519..fbd68aa7e7 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -51,11 +51,11 @@
 #include <cassert>
 
 
-//########### place macros to be removed in next cycle below this line ###############
-
+//########### place macros to be be kept below this line ###############
+#define JVET_R0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET_R0052: Remove separate colour plane coding from VVC version 1
 
+#define JVET_Q0280_CONSTRAINT_ON_VPS_ID                   1 // JVET-Q0280: Same VPS ID value across layers
 
-//########### place macros to be be kept below this line ###############
 #define JVET_R0351_HIGH_BIT_DEPTH_SUPPORT                 1 // JVET-R0351: high bit depth coding support (syntax changes, no mathematical differences for CTCs)
 #define JVET_R0351_HIGH_BIT_DEPTH_ENABLED                 0 // JVET-R0351: high bit depth coding enabled (increases accuracies of some calculations, e.g. transforms)
 
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 276c3fd506..be9bf7eaa0 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1306,11 +1306,13 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   pcSPS->setGDREnabledFlag(uiCode);
   READ_CODE(2, uiCode, "chroma_format_idc");                     pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
 
+#if !JVET_R0052_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, "ref_pic_resampling_enabled_flag");          pcSPS->setRprEnabledFlag(uiCode);
   if (uiCode)
@@ -1338,7 +1340,11 @@ 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_R0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int) pcSPS->getSeparateColourPlaneFlag() ? 0 : pcSPS->getChromaFormatIdc();
+#else
+  const uint32_t chromaArrayType = (int) pcSPS->getChromaFormatIdc();
+#endif
 
   READ_CODE(2, uiCode, "sps_log2_ctu_size_minus5");              pcSPS->setCTUSize(1 << (uiCode + 5));
   CHECK(uiCode > 2, "sps_log2_ctu_size_minus5 must be less than or equal to 2");
@@ -3247,7 +3253,9 @@ 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_R0052_RM_SEPARATE_COLOUR_PLANE
   CHECK(pcSlice->getPictureHeaderInSliceHeader() && sps->getSeparateColourPlaneFlag() == 1, "when separate_colour_plane_flag is equal to 1, the value of picture_header_in_slice_header_flag shall be equal to 0");
+#endif
 
   const ChromaFormat chFmt = sps->getChromaFormatIdc();
   const uint32_t numValidComp=getNumberValidComponents(chFmt);
@@ -3510,6 +3518,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
     pcSlice->setExplicitScalingListUsed(pcSlice->getPictureHeaderInSliceHeader() ? picHeader->getExplicitScalingListEnabledFlag() : false);
   }
 
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
     // 4:4:4 colour plane ID
     if( sps->getSeparateColourPlaneFlag() )
     {
@@ -3520,8 +3529,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
     {
       pcSlice->setColourPlaneId( 0 );
     }
-
-
+#endif
     if( pps->getRplInfoInPhFlag() )
     {
       pcSlice->setRPL0(picHeader->getRPL0());
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 9a51e592af..f1a772e568 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1718,7 +1718,11 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
   {
     chromaDbfOffsetNotSameAsLuma = false;
   }
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
+#else
+  const uint32_t chromaArrayType = (int)sps.getChromaFormatIdc();
+#endif
   if( ( chromaArrayType != CHROMA_400 ) && ( chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma ) )
   {
     pps.setPPSChromaToolFlag(true);
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 88afee44dc..794eb27382 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -779,6 +779,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc");
 
   const ChromaFormat format                = pcSPS->getChromaFormatIdc();
+#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t  separate_colour_plane_flag = pcSPS->getSeparateColourPlaneFlag();
   if( format == CHROMA_444 )
   {
@@ -787,6 +788,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   }
 
   const uint32_t chromaArrayType = separate_colour_plane_flag ? 0 : format;
+#else
+  const uint32_t chromaArrayType = format;
+#endif
 
   WRITE_FLAG(pcSPS->getRprEnabledFlag(), "ref_pic_resampling_enabled_flag");
   if (pcSPS->getRprEnabledFlag())
@@ -2101,12 +2105,13 @@ void HLSWriter::codeSliceHeader         ( Slice* pcSlice )
     WRITE_FLAG(pcSlice->getExplicitScalingListUsed(), "slice_explicit_scaling_list_used_flag");
   }
 
+#if !JVET_R0052_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


From a2b46b154176635d7da330b1af675f71a0e19bdc Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 20:56:09 +0800
Subject: [PATCH 04/10] change R0052 to S0052

---
 source/Lib/CommonLib/Slice.cpp      | 6 +++---
 source/Lib/CommonLib/Slice.h        | 8 ++++----
 source/Lib/CommonLib/TypeDef.h      | 4 ++--
 source/Lib/DecoderLib/VLCReader.cpp | 8 ++++----
 source/Lib/EncoderLib/EncLib.cpp    | 2 +-
 source/Lib/EncoderLib/VLCWriter.cpp | 4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index 258edc80d1..d3be888c8f 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -57,7 +57,7 @@ Slice::Slice()
 , m_prevIRAPSubpicType            ( NAL_UNIT_INVALID )
 , m_rpl0Idx                       ( -1 )
 , m_rpl1Idx                       ( -1 )
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
 , m_colourPlaneId                 ( 0 )
 #endif
 , m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
@@ -163,7 +163,7 @@ void Slice::initSlice()
     m_aiNumRefIdx[i]      = 0;
   }
   m_colFromL0Flag = true;
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   m_colourPlaneId = 0;
 #endif
   m_colRefIdx = 0;
@@ -2695,7 +2695,7 @@ SPS::SPS()
 , m_SBT                       ( false )
 , m_ISP                       ( false )
 , m_chromaFormatIdc           (CHROMA_420)
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
 , m_separateColourPlaneFlag   ( 0 )
 #endif
 , m_uiMaxTLayers              (  1)
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index d6d790a890..a21b3195f5 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -1274,7 +1274,7 @@ private:
   bool              m_SBT;
   bool              m_ISP;
   ChromaFormat      m_chromaFormatIdc;
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   bool              m_separateColourPlaneFlag;     //!< separate colour plane flag
 #endif
 
@@ -1453,7 +1453,7 @@ public:
   int                     getLayerId() const                                                              { return m_layerId;                                                    }
   ChromaFormat            getChromaFormatIdc () const                                                     { return m_chromaFormatIdc;                                            }
   void                    setChromaFormatIdc (ChromaFormat i)                                             { m_chromaFormatIdc = i;                                               }
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   void                    setSeparateColourPlaneFlag ( bool b )                                           { m_separateColourPlaneFlag = b;                                       }
   bool                    getSeparateColourPlaneFlag () const                                             { return m_separateColourPlaneFlag;                                    }
 #endif
@@ -2532,7 +2532,7 @@ private:
   ReferencePictureList        m_localRPL1;            //< 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_R0052_RM_SEPARATE_COLOUR_PLANE
+#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
@@ -2783,7 +2783,7 @@ public:
   bool                        isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder );
   bool                        isPOCInRefPicList( const ReferencePictureList *rpl, int poc );
   void                        checkConformanceForDRAP( uint32_t temporalId );
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   void                        setColourPlaneId( int id )                             { m_colourPlaneId = id;                                         }
   int                         getColourPlaneId() const                               { return m_colourPlaneId;                                       }
 #endif
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index fbd68aa7e7..2714274ef8 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -51,8 +51,8 @@
 #include <cassert>
 
 
-//########### place macros to be be kept below this line ###############
-#define JVET_R0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET_R0052: Remove separate colour plane coding from VVC version 1
+//########### place macros to be removed in next cycle below this line ###############
+#define JVET_S0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
 
 #define JVET_Q0280_CONSTRAINT_ON_VPS_ID                   1 // JVET-Q0280: Same VPS ID value across layers
 
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index be9bf7eaa0..c80109f57c 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1306,7 +1306,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   pcSPS->setGDREnabledFlag(uiCode);
   READ_CODE(2, uiCode, "chroma_format_idc");                     pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
 
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#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");
@@ -1340,7 +1340,7 @@ 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_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int) pcSPS->getSeparateColourPlaneFlag() ? 0 : pcSPS->getChromaFormatIdc();
 #else
   const uint32_t chromaArrayType = (int) pcSPS->getChromaFormatIdc();
@@ -3253,7 +3253,7 @@ 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_R0052_RM_SEPARATE_COLOUR_PLANE
+#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 picture_header_in_slice_header_flag shall be equal to 0");
 #endif
 
@@ -3518,7 +3518,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
     pcSlice->setExplicitScalingListUsed(pcSlice->getPictureHeaderInSliceHeader() ? picHeader->getExplicitScalingListEnabledFlag() : false);
   }
 
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
     // 4:4:4 colour plane ID
     if( sps->getSeparateColourPlaneFlag() )
     {
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index f1a772e568..ed7e96630f 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1718,7 +1718,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
   {
     chromaDbfOffsetNotSameAsLuma = false;
   }
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
 #else
   const uint32_t chromaArrayType = (int)sps.getChromaFormatIdc();
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 794eb27382..f1573a1cf1 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -779,7 +779,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc");
 
   const ChromaFormat format                = pcSPS->getChromaFormatIdc();
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t  separate_colour_plane_flag = pcSPS->getSeparateColourPlaneFlag();
   if( format == CHROMA_444 )
   {
@@ -2105,7 +2105,7 @@ void HLSWriter::codeSliceHeader         ( Slice* pcSlice )
     WRITE_FLAG(pcSlice->getExplicitScalingListUsed(), "slice_explicit_scaling_list_used_flag");
   }
 
-#if !JVET_R0052_RM_SEPARATE_COLOUR_PLANE
+#if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
     // 4:4:4 colour plane ID
     if( pcSlice->getSPS()->getSeparateColourPlaneFlag() )
     {
-- 
GitLab


From de04f62b4733025bb22f6abe274fd050dc39add4 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 21:52:12 +0800
Subject: [PATCH 05/10] rebase

---
 source/Lib/CommonLib/TypeDef.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 2714274ef8..8f5b94c8c8 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -51,7 +51,7 @@
 #include <cassert>
 
 
-//########### place macros to be removed in next cycle below this line ###############
+//########### place macros to be be kept below this line ###############
 #define JVET_S0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
 
 #define JVET_Q0280_CONSTRAINT_ON_VPS_ID                   1 // JVET-Q0280: Same VPS ID value across layers
-- 
GitLab


From ebe99bdf9264174213c568b57b5ea80d16379bb4 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 21:59:32 +0800
Subject: [PATCH 06/10] rebase

---
 source/Lib/CommonLib/TypeDef.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 40b9ceb53c..8c5d60701c 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -77,7 +77,6 @@
 #define JVET_R0041                                        1 // JVET-R0041: Picture types related constraints
 
 #define JVET_R0064                                        1 // JVET-R0064, aspect 2: Move the flag scaling_matrix_for_lfnst_disabled_flag from the scaling_list_data( ) syntax to the SPS.
->>>>>>> 7873c1d5b6e9e49143927835c26869d018b93d61
 
 #define JVET_Q0280_CONSTRAINT_ON_VPS_ID                   1 // JVET-Q0280: Same VPS ID value across layers
 
-- 
GitLab


From 7fac2fcb8ef76148d3bbca7d05299ab534dcf387 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 22:01:44 +0800
Subject: [PATCH 07/10] rebase

---
 source/Lib/DecoderLib/VLCReader.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index bb4b996116..c80109f57c 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -3255,7 +3255,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
   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 picture_header_in_slice_header_flag shall be equal to 0");
-#endif
 #endif
 
   const ChromaFormat chFmt = sps->getChromaFormatIdc();
-- 
GitLab


From 8daa2ee88dab5a0ca268c6f16d633c4773a9666c Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 22:09:37 +0800
Subject: [PATCH 08/10] rebase

---
 source/Lib/CommonLib/TypeDef.h | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 8c5d60701c..5d959fc710 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -50,35 +50,13 @@
 #include <assert.h>
 #include <cassert>
 
-//########### place macros to be be kept below this line ###############
-#define JVET_S0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
 
 //########### place macros to be removed in next cycle below this line ###############
-#define JVET_Q0280_CONSTRAINT_ON_VPS_ID                   1 // JVET-Q0280: Same VPS ID value across layers
-
-#define JVET_R0042_SUBPIC_CHECK                           1 // JVET_R0042: SubPicture types related constraints
-
-#define JVET_R0066_DPB_NO_OUTPUT_PRIOR_PIC_FLAG           1 // JVET-R0066: Signal the maximum values of chroma_format_idc and bit_depth_minus8 for all pictures of all layers in the VPS
-                                                            //             The value of no_output_of_prior_pics_flag, when present, is required to be the same for all pictures in an AU
-
-#define JVET_R0068_ASPECT1_ASPECT6                        1 // JVET-R0068 aspect 1: On slice_type constraint; JVET-R0068 aspect 6: On signalling of conformance window parameters
-
-#define JVET_R0067_PICTURE_OUTPUT_FLAG                    1 // JVET-R0067: Update the derivation of PictureOutputFlag
 
-#define JVET_R0080                                        1 // JVET-R0080: Change the syntax condition for pps_tile_idx_delta_present_flag. When the value of pps_num_slices_in_pic_minus1 is greater than 1 instead of 0, the syntax element of pps_tile_idx_delta_present_flag is signalled.
 
-#define JVET_R0118_PH_IN_SH_CONSTRAINT_FLAG               1 // JVET0R0118: Add a general constraint flag pic_header_in_slice_header_constraint_flag
 
-#define JVET_R0122_PIC_OUTPUT_FLAG_CLEANUP                1 // JVET-R0122: pic_output_flag is not signalled in picture header and inferred to be equal to 1, when the value of non_reference_picture_flag is equal to 1.
-
-#define JVET_R0065                                        1 //JVET-R0065: Each picture in an AU in a CVS shall have nuh_layer_id equal to the nuh_layer_id of one of the pictures present in the first AU of the CVS
-                                                            //            Add a flag aud_irap_or_gdr_au_flag to the AUD, and mandate the presence of AUD in each IRAP or GDR AU when vps_max_layers_minus1 is greater than 0
-
-#define JVET_R0041                                        1 // JVET-R0041: Picture types related constraints
-
-#define JVET_R0064                                        1 // JVET-R0064, aspect 2: Move the flag scaling_matrix_for_lfnst_disabled_flag from the scaling_list_data( ) syntax to the SPS.
-
-#define JVET_Q0280_CONSTRAINT_ON_VPS_ID                   1 // JVET-Q0280: Same VPS ID value across layers
+//########### place macros to be be kept below this line ###############
+#define JVET_S0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
 
 #define JVET_R0351_HIGH_BIT_DEPTH_SUPPORT                 1 // JVET-R0351: high bit depth coding support (syntax changes, no mathematical differences for CTCs)
 #define JVET_R0351_HIGH_BIT_DEPTH_ENABLED                 0 // JVET-R0351: high bit depth coding enabled (increases accuracies of some calculations, e.g. transforms)
-- 
GitLab


From 5b3206ab36957f462d817edac558a85887c4aafa Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Mon, 6 Jul 2020 22:10:57 +0800
Subject: [PATCH 09/10] rebase

---
 source/Lib/CommonLib/TypeDef.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 5d959fc710..162e6cf70f 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -52,12 +52,10 @@
 
 
 //########### place macros to be removed in next cycle below this line ###############
-
+#define JVET_S0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
 
 
 //########### place macros to be be kept below this line ###############
-#define JVET_S0052_RM_SEPARATE_COLOUR_PLANE               1 // JVET-S0052: Remove separate colour plane coding from VVC version 1
-
 #define JVET_R0351_HIGH_BIT_DEPTH_SUPPORT                 1 // JVET-R0351: high bit depth coding support (syntax changes, no mathematical differences for CTCs)
 #define JVET_R0351_HIGH_BIT_DEPTH_ENABLED                 0 // JVET-R0351: high bit depth coding enabled (increases accuracies of some calculations, e.g. transforms)
 
-- 
GitLab


From 2e638a3984760788c0f524c03daf40a0e33929f4 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Fri, 10 Jul 2020 23:45:49 +0800
Subject: [PATCH 10/10] remove legacy chromaArrayType

---
 source/Lib/DecoderLib/VLCReader.cpp | 10 ++++++++--
 source/Lib/EncoderLib/EncLib.cpp    |  4 ++--
 source/Lib/EncoderLib/VLCWriter.cpp |  8 +++++---
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index ac47b50e6a..292ae6e91a 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1358,8 +1358,6 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   }
 #if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int) pcSPS->getSeparateColourPlaneFlag() ? 0 : pcSPS->getChromaFormatIdc();
-#else
-  const uint32_t chromaArrayType = (int) pcSPS->getChromaFormatIdc();
 #endif
 
   READ_CODE(2, uiCode, "sps_log2_ctu_size_minus5");              pcSPS->setCTUSize(1 << (uiCode + 5));
@@ -1638,7 +1636,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   READ_FLAG(uiCode, "sps_lfnst_enabled_flag");                    pcSPS->setUseLFNST(uiCode != 0);
 #endif
 
+#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;
@@ -1874,7 +1876,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
   }
 #endif
   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);
   }
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index a45df1920a..7b60e0c3f0 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -1724,10 +1724,10 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
   }
 #if !JVET_S0052_RM_SEPARATE_COLOUR_PLANE
   const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
+  if( ( chromaArrayType != CHROMA_400 ) && ( chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma ) )
 #else
-  const uint32_t chromaArrayType = (int)sps.getChromaFormatIdc();
+  if ((sps.getChromaFormatIdc() != CHROMA_400) && (chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma))
 #endif
-  if( ( chromaArrayType != CHROMA_400 ) && ( chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma ) )
   {
     pps.setPPSChromaToolFlag(true);
   }
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 35037bc5fe..253545e619 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -788,8 +788,8 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   WRITE_FLAG(pcSPS->getGDREnabledFlag(), "gdr_enabled_flag");
   WRITE_CODE(int(pcSPS->getChromaFormatIdc ()), 2, "chroma_format_idc");
 
-  const ChromaFormat format                = pcSPS->getChromaFormatIdc();
 #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 )
   {
@@ -798,8 +798,6 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   }
 
   const uint32_t chromaArrayType = separate_colour_plane_flag ? 0 : format;
-#else
-  const uint32_t chromaArrayType = format;
 #endif
 
   WRITE_FLAG(pcSPS->getRprEnabledFlag(), "ref_pic_resampling_enabled_flag");
@@ -971,7 +969,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
   WRITE_FLAG(pcSPS->getUseLFNST() ? 1 : 0, "sps_lfnst_enabled_flag");
 #endif
 
+#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();
-- 
GitLab