From 0d2917bd838005296f40ac63a2b8ba2df68e5d35 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Thu, 4 Jun 2020 19:34:00 +0800
Subject: [PATCH 1/6] JVET-R0067: Update the derivation of PictureOutputFlag

---
 source/Lib/CommonLib/TypeDef.h   |  2 ++
 source/Lib/DecoderLib/DecLib.cpp | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 1e61cb22d9..bfc9ee0d93 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -51,6 +51,8 @@
 #include <cassert>
 
 //########### place macros to be removed in next cycle below this line ###############
+#define JVET_R0067                                        1 // JVET-R0067: Update the derivation of PictureOutputFlag
+
 #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 RETRAIN_CABAC                                     1 // CABAC initial values retrained on VTM-9.0rc1
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index b58dfdfa82..33949ac0e9 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -1923,7 +1923,21 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
     {
       VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
       CHECK(vps == 0, "No VPS present");
+#if JVET_R0067
+      bool isCurLayerNotOutput = true;
+      for (int i = 0; i < vps->getNumLayersInOls(vps->m_targetOlsIdx); i++)
+      {
+        if( vps->getLayerIdInOls(vps->m_targetOlsIdx, i) == nalu.m_nuhLayerId )
+        {
+            isCurLayerNotOutput = false;
+            break;
+        }
+      }
+
+      if(isCurLayerNotOutput)
+#else
       if ((vps->getOlsModeIdc() == 0 && vps->getGeneralLayerIdx(nalu.m_nuhLayerId) < (vps->getMaxLayers() - 1) && vps->getOlsOutputLayerFlag(vps->m_targetOlsIdx, vps->getMaxLayers() - 1) == 1) || (vps->getOlsModeIdc() == 2 && vps->getOlsOutputLayerFlag(vps->m_targetOlsIdx, vps->getGeneralLayerIdx(nalu.m_nuhLayerId)) == 0))
+#endif
       {
         m_picHeader.setPicOutputFlag(false);
       }
-- 
GitLab


From be9a1f084d0183ad48d279c189127b7005b66f4d Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Thu, 4 Jun 2020 19:34:00 +0800
Subject: [PATCH 2/6] JVET-R0067: Update the derivation of PictureOutputFlag

---
 source/Lib/CommonLib/TypeDef.h   |  2 ++
 source/Lib/DecoderLib/DecLib.cpp | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index a6fe87cf98..4768a2ddcb 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -51,6 +51,8 @@
 #include <cassert>
 
 //########### place macros to be removed in next cycle below this line ###############
+#define JVET_R0067                                        1 // JVET-R0067: Update the derivation of PictureOutputFlag
+
 #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.
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index 619cfb9f61..bba423640a 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -1963,7 +1963,21 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
     {
       VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
       CHECK(vps == 0, "No VPS present");
+#if JVET_R0067
+      bool isCurLayerNotOutput = true;
+      for (int i = 0; i < vps->getNumLayersInOls(vps->m_targetOlsIdx); i++)
+      {
+        if( vps->getLayerIdInOls(vps->m_targetOlsIdx, i) == nalu.m_nuhLayerId )
+        {
+            isCurLayerNotOutput = false;
+            break;
+        }
+      }
+
+      if(isCurLayerNotOutput)
+#else
       if ((vps->getOlsModeIdc() == 0 && vps->getGeneralLayerIdx(nalu.m_nuhLayerId) < (vps->getMaxLayers() - 1) && vps->getOlsOutputLayerFlag(vps->m_targetOlsIdx, vps->getMaxLayers() - 1) == 1) || (vps->getOlsModeIdc() == 2 && vps->getOlsOutputLayerFlag(vps->m_targetOlsIdx, vps->getGeneralLayerIdx(nalu.m_nuhLayerId)) == 0))
+#endif
       {
         m_picHeader.setPicOutputFlag(false);
       }
-- 
GitLab


From 5db4102e5da20a26c01910908d320add8f2ff94e Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Thu, 4 Jun 2020 19:34:00 +0800
Subject: [PATCH 3/6] JVET-R0067: Update the derivation of PictureOutputFlag

---
 source/Lib/CommonLib/TypeDef.h   |  2 ++
 source/Lib/DecoderLib/DecLib.cpp | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 013b045e5e..5e71d97d4b 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -51,6 +51,8 @@
 #include <cassert>
 
 //########### place macros to be removed in next cycle below this line ###############
+#define JVET_R0067                                        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
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index 417fe4d837..c979a263b0 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -1997,7 +1997,21 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
     {
       VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
       CHECK(vps == 0, "No VPS present");
+#if JVET_R0067
+      bool isCurLayerNotOutput = true;
+      for (int i = 0; i < vps->getNumLayersInOls(vps->m_targetOlsIdx); i++)
+      {
+        if( vps->getLayerIdInOls(vps->m_targetOlsIdx, i) == nalu.m_nuhLayerId )
+        {
+            isCurLayerNotOutput = false;
+            break;
+        }
+      }
+
+      if(isCurLayerNotOutput)
+#else
       if ((vps->getOlsModeIdc() == 0 && vps->getGeneralLayerIdx(nalu.m_nuhLayerId) < (vps->getMaxLayers() - 1) && vps->getOlsOutputLayerFlag(vps->m_targetOlsIdx, vps->getMaxLayers() - 1) == 1) || (vps->getOlsModeIdc() == 2 && vps->getOlsOutputLayerFlag(vps->m_targetOlsIdx, vps->getGeneralLayerIdx(nalu.m_nuhLayerId)) == 0))
+#endif
       {
         m_picHeader.setPicOutputFlag(false);
       }
-- 
GitLab


From fd6928809b985ced3fe419b6547c95a3d1115372 Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Thu, 4 Jun 2020 19:34:00 +0800
Subject: [PATCH 4/6] JVET-R0067: Update the derivation of PictureOutputFlag

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

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 5e71d97d4b..4f8dc92598 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -64,6 +64,8 @@
 
 #define JVET_R0041                                        1 // JVET-R0041: Picture types related constraints
 
+=======
+>>>>>>> JVET-R0067: Update the derivation of PictureOutputFlag
 #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 RETRAIN_CABAC                                     1 // CABAC initial values retrained on VTM-9.0rc1
-- 
GitLab


From aff959213d6d64fed675a1b52e223216bbd0a66e Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Thu, 18 Jun 2020 12:17:31 +0800
Subject: [PATCH 5/6] rebase

---
 source/Lib/CommonLib/TypeDef.h   | 4 +---
 source/Lib/DecoderLib/DecLib.cpp | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 4f8dc92598..24908c52a6 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 ###############
-#define JVET_R0067                                        1 // JVET-R0067: Update the derivation of PictureOutputFlag
+#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.
 
@@ -64,8 +64,6 @@
 
 #define JVET_R0041                                        1 // JVET-R0041: Picture types related constraints
 
-=======
->>>>>>> JVET-R0067: Update the derivation of PictureOutputFlag
 #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 RETRAIN_CABAC                                     1 // CABAC initial values retrained on VTM-9.0rc1
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index c979a263b0..aa3d15aca3 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -1997,7 +1997,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
     {
       VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
       CHECK(vps == 0, "No VPS present");
-#if JVET_R0067
+#if JVET_R0067_PICTURE_OUTPUT_FLAG
       bool isCurLayerNotOutput = true;
       for (int i = 0; i < vps->getNumLayersInOls(vps->m_targetOlsIdx); i++)
       {
-- 
GitLab


From c5b8a43f0df1d28e11c662c856646e20e5cdef4d Mon Sep 17 00:00:00 2001
From: zhipin <zhipin.deng@bytedance.com>
Date: Thu, 18 Jun 2020 12:22:53 +0800
Subject: [PATCH 6/6] rebase

---
 source/Lib/DecoderLib/DecLib.cpp | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index 705e1f47d0..aa3d15aca3 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -1997,11 +1997,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
     {
       VPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
       CHECK(vps == 0, "No VPS present");
-<<<<<<< HEAD
 #if JVET_R0067_PICTURE_OUTPUT_FLAG
-=======
-#if JVET_R0067
->>>>>>> 2723f083fa4de092dc9cde951c3caf1e756356d2
       bool isCurLayerNotOutput = true;
       for (int i = 0; i < vps->getNumLayersInOls(vps->m_targetOlsIdx); i++)
       {
-- 
GitLab