From 5688bc0c694c28471b7a2037532af55f0f017b2c Mon Sep 17 00:00:00 2001
From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de>
Date: Sun, 26 Apr 2020 20:11:08 +0200
Subject: [PATCH] remove macro JVET_Q0751_MIXED_NAL_UNIT_TYPES

---
 source/Lib/CommonLib/Slice.cpp   | 27 --------------------------
 source/Lib/CommonLib/Slice.h     |  8 --------
 source/Lib/CommonLib/TypeDef.h   |  1 -
 source/Lib/DecoderLib/DecLib.cpp | 33 --------------------------------
 source/Lib/EncoderLib/EncGOP.cpp |  4 ----
 5 files changed, 73 deletions(-)

diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index 5188deea9..7f97bbcb4 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -1121,18 +1121,13 @@ bool Slice::isStepwiseTemporalLayerSwitchingPointCandidate(PicList& rcListPic) c
 }
 
 
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
 void Slice::checkLeadingPictureRestrictions(PicList& rcListPic, const PPS& pps) const
-#else
-void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const
-#endif
 {
   int nalUnitType = this->getNalUnitType();
 
   // When a picture is a leading picture, it shall be a RADL or RASL picture.
   if(this->getAssociatedIRAPPOC() > this->getPOC())
   {
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
     //check this only when mixed_nalu_types_in_pic_flag is equal to 0
     if (pps.getMixedNaluTypesInPicFlag() == 0)
     {
@@ -1144,31 +1139,17 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const
               nalUnitType != NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type");
       }
     }
-#else
-    // Do not check IRAP pictures since they may get a POC lower than their associated IRAP
-    if (nalUnitType < NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
-        nalUnitType > NAL_UNIT_CODED_SLICE_CRA)
-    {
-      CHECK(nalUnitType != NAL_UNIT_CODED_SLICE_RASL &&
-            nalUnitType != NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type");
-    }
-#endif
   }
 
   // When a picture is a trailing picture, it shall not be a RADL or RASL picture.
   if(this->getAssociatedIRAPPOC() < this->getPOC())
   {
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
       //check this only when mixed_nalu_types_in_pic_flag is equal to 0
     if (pps.getMixedNaluTypesInPicFlag() == 0)
     {
       CHECK(nalUnitType == NAL_UNIT_CODED_SLICE_RASL ||
             nalUnitType == NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type");
     }
-#else
-    CHECK(nalUnitType == NAL_UNIT_CODED_SLICE_RASL ||
-          nalUnitType == NAL_UNIT_CODED_SLICE_RADL, "Invalid NAL unit type");
-#endif
 
   }
 
@@ -1289,18 +1270,10 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic) const
 
 
 //Function for applying picture marking based on the Reference Picture List
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
 void Slice::applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId, const PPS& pps ) const
-#else
-void Slice::applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId ) const
-#endif
 {
   int i, isReference;
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
   checkLeadingPictureRestrictions(rcListPic, pps);
-#else
-  checkLeadingPictureRestrictions(rcListPic);
-#endif
 
   bool isNeedToCheck = (this->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL) ? false : true;
 
diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h
index 87f75851d..68e208d2c 100644
--- a/source/Lib/CommonLib/Slice.h
+++ b/source/Lib/CommonLib/Slice.h
@@ -2899,17 +2899,9 @@ public:
   uint32_t                        getTLayer() const                                      { return m_uiTLayer;                                            }
   void                        setTLayer( uint32_t uiTLayer )                             { m_uiTLayer = uiTLayer;                                        }
 
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
   void                        checkLeadingPictureRestrictions( PicList& rcListPic, const PPS& pps)                                         const;
-#else
-  void                        checkLeadingPictureRestrictions( PicList& rcListPic )                                         const;
-#endif
   int                         checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList* pRPL, int rplIdx, bool printErrors, int* refPicIndex, int numActiveRefPics) const;
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
   void                        applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId, const PPS& pps )  const;
-#else
-  void                        applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, const int layerId )  const;
-#endif
   bool                        isTemporalLayerSwitchingPoint( PicList& rcListPic )                                           const;
   bool                        isStepwiseTemporalLayerSwitchingPointCandidate( PicList& rcListPic )                          const;
   int                         checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList *pRPL, int rplIdx, bool printErrors)                const;
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 765f80b43..c98d85f73 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -119,7 +119,6 @@
 
 
 
-#define JVET_Q0751_MIXED_NAL_UNIT_TYPES                   1 // JVET-Q0751: Constraints and properties of mixed nal unit types
 
 #define JVET_Q0353_ACT_SW_FIX                             1 // JVET-Q0353: Bug fix of ACT 
 
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index a36480e6d..4494eb0a7 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -44,9 +44,7 @@
 #include "CommonLib/UnitTools.h"
 
 #include <fstream>
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
 #include <set>
-#endif
 #include <stdio.h>
 #include <fcntl.h>
 #include "AnnexBread.h"
@@ -1200,11 +1198,7 @@ void DecLib::xActivateParameterSets( const int layerId )
     //  Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use.
     m_pcPic = xGetNewPicBuffer( *sps, *pps, m_apcSlicePilot->getTLayer(), layerId );
 
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
     m_apcSlicePilot->applyReferencePictureListBasedMarking( m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1(), layerId, *pps);
-#else
-    m_apcSlicePilot->applyReferencePictureListBasedMarking( m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1(), layerId );
-#endif
     m_pcPic->finalInit( vps, *sps, *pps, &m_picHeader, apss, lmcsAPS, scalinglistAPS );
     m_pcPic->createTempBuffers( m_pcPic->cs->pps->pcv->maxCUWidth );
     m_pcPic->cs->createCoeffs((bool)m_pcPic->cs->sps->getPLTMode());
@@ -2507,12 +2501,8 @@ void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu)
             break;
           }
         }
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
         if (latestIRAPNalUnit != nullptr && ((latestIRAPNalUnit->m_nalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && latestIRAPNalUnit->m_nalUnitType <= NAL_UNIT_CODED_SLICE_IDR_N_LP)
             || (latestIRAPNalUnit->m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA && pcSlice->getPOC() > latestIRAPNalUnit->m_POC)))
-#else
-        if (latestIRAPNalUnit != nullptr)
-#endif
         {
           // clear the nalu unit before the latest IRAP slice
           m_nalUnitInfo[nalu.m_nuhLayerId].erase(m_nalUnitInfo[nalu.m_nuhLayerId].begin(), m_nalUnitInfo[nalu.m_nuhLayerId].begin() + naluIdx);
@@ -2557,7 +2547,6 @@ void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu)
     // if this is the last slice of the picture, check whether the nalu type of the slices meet the nal unit type constraints
     if (pcSlice->getPPS()->getNumSlicesInPic() == (m_uiSliceSegmentIdx + 1))
     {
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
       std::set<NalUnitType> firstSet = { NAL_UNIT_CODED_SLICE_STSA, NAL_UNIT_CODED_SLICE_RADL,
         NAL_UNIT_CODED_SLICE_RASL, NAL_UNIT_CODED_SLICE_IDR_W_RADL, NAL_UNIT_CODED_SLICE_IDR_N_LP, NAL_UNIT_CODED_SLICE_CRA };
       std::set<NalUnitType> secondSet = { NAL_UNIT_CODED_SLICE_TRAIL, NAL_UNIT_CODED_SLICE_RADL, NAL_UNIT_CODED_SLICE_RASL };
@@ -2621,28 +2610,6 @@ void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu)
         }
         CHECK(!allNalsOK || !foundNalInOtherSet, "disallowed mix of nal unit types");
       }
-#else
-      int num1stSetSlice = 0;
-      int num2ndSetSlice = 0;
-      int num3rdSetSlice = 0;
-      for (int i = 0; i < pcSlice->getPPS()->getNumSlicesInPic(); i++)
-      {
-        NalUnitType naluType = pcSlice->getNalUnitType();
-        if (naluType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && naluType <= NAL_UNIT_CODED_SLICE_CRA)
-        {
-          num1stSetSlice++;
-        }
-        else if ((naluType >= NAL_UNIT_CODED_SLICE_TRAIL && naluType <= NAL_UNIT_RESERVED_VCL_6) || naluType == NAL_UNIT_CODED_SLICE_GDR)
-        {
-          num2ndSetSlice++;
-        }
-        else
-        {
-          num3rdSetSlice++;
-        }
-      }
-      CHECK((num1stSetSlice + num2ndSetSlice) != pcSlice->getPPS()->getNumSlicesInPic() || num3rdSetSlice != 0, "mixed nal unit picture contain more than two nal unit types");
-#endif
     }
   }
   else // all slices shall have the same nal unit type
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index d29078078..c126ffe3d 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -2215,11 +2215,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
       xCreateExplicitReferencePictureSetFromReference( pcSlice, rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1() );
     }
 
-#if JVET_Q0751_MIXED_NAL_UNIT_TYPES
     pcSlice->applyReferencePictureListBasedMarking( rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1(), pcSlice->getPic()->layerId, *(pcSlice->getPPS()));
-#else
-    pcSlice->applyReferencePictureListBasedMarking( rcListPic, pcSlice->getRPL0(), pcSlice->getRPL1(), pcSlice->getPic()->layerId );
-#endif
 
     if(pcSlice->getTLayer() > 0
       && !(pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL     // Check if not a leading picture
-- 
GitLab