From b94587eeae2b679be1d629916f62d2a09fd37326 Mon Sep 17 00:00:00 2001
From: spaluri <seethal.paluri@lge.com>
Date: Thu, 30 Jul 2020 12:58:49 -0700
Subject: [PATCH] JVET_S0203 Aspects 1 and 2

---
 source/Lib/CommonLib/TypeDef.h      | 1 +
 source/Lib/DecoderLib/VLCReader.cpp | 8 ++++++++
 source/Lib/EncoderLib/VLCWriter.cpp | 8 ++++++++
 3 files changed, 17 insertions(+)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index fd0795154..bd38706a9 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -51,6 +51,7 @@
 #include <cassert>
 
 //########### place macros to be removed in next cycle below this line ###############
+#define JVET_S0203                                        1 // JVET-S0203 (aspects 1 & 2): change the siganlling of sublayer_level_idc[ i ] and ptl_sublayer_level_present_flag[ i ] to be in descending order
 
 #define JVET_S0193_NO_OUTPUT_PRIOR_PIC                    1 // JVET-S0193: Move ph_no_output_of_prior_pics_flag to SH                       
 
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 78304d80f..6b6499ab5 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -4820,7 +4820,11 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, bool profileTi
     }
   }
 
+#if JVET_S0203
+  for (int i = maxNumSubLayersMinus1 - 1; i >= 0; i--)
+#else
   for (int i = 0; i < maxNumSubLayersMinus1; i++)
+#endif
   {
     READ_FLAG( symbol, "sub_layer_level_present_flag[i]"   ); ptl->setSubLayerLevelPresentFlag  (i, symbol);
   }
@@ -4830,7 +4834,11 @@ void HLSyntaxReader::parseProfileTierLevel(ProfileTierLevel *ptl, bool profileTi
     READ_FLAG(    symbol,   "ptl_alignment_zero_bit"        ); CHECK (symbol != 0, "ptl_alignment_zero_bit not equal to zero");
   }
 
+#if JVET_S0203
+  for (int i = maxNumSubLayersMinus1 - 1; i >= 0; i--)
+#else
   for (int i = 0; i < maxNumSubLayersMinus1; i++)
+#endif
   {
     if (ptl->getSubLayerLevelPresentFlag(i))
     {
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index 06d14092c..1bf0eab34 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -2779,7 +2779,11 @@ void  HLSWriter::codeProfileTierLevel    ( const ProfileTierLevel* ptl, bool pro
     }
   }
 
+#if JVET_S0203
+  for (int i = maxNumSubLayersMinus1 - 1; i >= 0; i--)
+#else
   for (int i = 0; i < maxNumSubLayersMinus1; i++)
+#endif
   {
     WRITE_FLAG( ptl->getSubLayerLevelPresentFlag(i),   "sub_layer_level_present_flag[i]" );
   }
@@ -2789,7 +2793,11 @@ void  HLSWriter::codeProfileTierLevel    ( const ProfileTierLevel* ptl, bool pro
     WRITE_FLAG(0, "ptl_alignment_zero_bit");
   }
 
+#if JVET_S0203
+  for (int i = maxNumSubLayersMinus1 - 1; i >= 0; i--)
+#else
   for(int i = 0; i < maxNumSubLayersMinus1; i++)
+#endif
   {
     if( ptl->getSubLayerLevelPresentFlag(i) )
     {
-- 
GitLab