From 7a5c87a88e8349841858ccf2c16564d142b3df59 Mon Sep 17 00:00:00 2001 From: Karsten Suehring <karsten.suehring@hhi.fraunhofer.de> Date: Mon, 6 Jul 2020 15:11:59 +0200 Subject: [PATCH] remove macro JVET_R0042_SUBPIC_CHECK --- source/App/DecoderApp/DecApp.cpp | 2 - source/Lib/CommonLib/Picture.cpp | 2 - source/Lib/CommonLib/Picture.h | 2 - source/Lib/CommonLib/Slice.cpp | 4 -- source/Lib/CommonLib/Slice.h | 4 -- source/Lib/CommonLib/TypeDef.h | 1 - source/Lib/DecoderLib/DecLib.cpp | 88 -------------------------------- source/Lib/DecoderLib/DecLib.h | 4 -- 8 files changed, 107 deletions(-) diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index b24907f1d..474e05491 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -213,9 +213,7 @@ uint32_t DecApp::decode() #if JVET_R0041 m_cDecLib.updatePrevGDRInSameLayer(); #endif -#if JVET_R0042_SUBPIC_CHECK m_cDecLib.updatePrevIRAPAndGDRSubpic(); -#endif } else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && m_cDecLib.getFirstSliceInSequence(nalu.m_nuhLayerId)) diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 03b8d74b0..f65579e90 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -198,9 +198,7 @@ Picture::Picture() #if JVET_R0058 numSubpics = 1; #endif -#if JVET_R0042_SUBPIC_CHECK numSlices = 1; -#endif } void Picture::create( const ChromaFormat &_chromaFormat, const Size &size, const unsigned _maxCUSize, const unsigned _margin, const bool _decoder, const int _layerId ) diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index 12bddbd7c..8d7317ff0 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -231,10 +231,8 @@ public: std::vector<int> subpicCtuTopLeftX; std::vector<int> subpicCtuTopLeftY; #endif -#if JVET_R0042_SUBPIC_CHECK int numSlices; std::vector<int> sliceSubpicIdx; -#endif bool subLayerNonReferencePictureDueToSTSA; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index ee5f5678e..bbe82d8a7 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -54,11 +54,9 @@ Slice::Slice() #endif , m_iAssociatedIRAP ( 0 ) , m_iAssociatedIRAPType ( NAL_UNIT_INVALID ) -#if JVET_R0042_SUBPIC_CHECK , m_prevGDRSubpicPOC ( MAX_INT ) , m_prevIRAPSubpicPOC ( 0 ) , m_prevIRAPSubpicType ( NAL_UNIT_INVALID ) -#endif , m_rpl0Idx ( -1 ) , m_rpl1Idx ( -1 ) , m_colourPlaneId ( 0 ) @@ -1421,7 +1419,6 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic, const PPS& pps) } } -#if JVET_R0042_SUBPIC_CHECK void Slice::checkSubpicTypeConstraints(PicList& rcListPic, const ReferencePictureList* pRPL0, const ReferencePictureList* pRPL1, const int prevIRAPSubpicDecOrderNo) { int curSubpicIdx = getPPS()->getSubPicIdxFromSubPicId(getSliceSubPicId()); @@ -1706,7 +1703,6 @@ void Slice::checkSubpicTypeConstraints(PicList& rcListPic, const ReferencePictur } } } -#endif //Function for applying picture marking based on the Reference Picture List diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 5a259fd6f..57cc41900 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -2680,11 +2680,9 @@ private: #endif int m_iAssociatedIRAP; NalUnitType m_iAssociatedIRAPType; -#if JVET_R0042_SUBPIC_CHECK int m_prevGDRSubpicPOC; int m_prevIRAPSubpicPOC; NalUnitType m_prevIRAPSubpicType; -#endif bool m_enableDRAPSEI; bool m_useLTforDRAP; bool m_isDRAP; @@ -2837,7 +2835,6 @@ public: int getAssociatedIRAPPOC() const { return m_iAssociatedIRAP; } void setAssociatedIRAPType(NalUnitType associatedIRAPType) { m_iAssociatedIRAPType = associatedIRAPType; } NalUnitType getAssociatedIRAPType() const { return m_iAssociatedIRAPType; } -#if JVET_R0042_SUBPIC_CHECK void setPrevGDRSubpicPOC(int poc) { m_prevGDRSubpicPOC = poc; } int getPrevGDRSubpicPOC() const { return m_prevGDRSubpicPOC; } void setPrevIRAPSubpicPOC(int poc) { m_prevIRAPSubpicPOC = poc; } @@ -2845,7 +2842,6 @@ public: void setPrevIRAPSubpicType(NalUnitType type) { m_prevIRAPSubpicType = type; } NalUnitType getPrevIRAPSubpicType() const { return m_prevIRAPSubpicType; } void checkSubpicTypeConstraints(PicList& rcListPic, const ReferencePictureList* pRPL0, const ReferencePictureList* pRPL1, const int prevIRAPSubpicDecOrderNo); -#endif SliceType getSliceType() const { return m_eSliceType; } int getPOC() const { return m_iPOC; } int getSliceQp() const { return m_iSliceQp; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 97c1ba535..e19753dfe 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -53,7 +53,6 @@ //########### place macros to be removed in next cycle below this line ############### -#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 diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index a0ac4755d..fd64b7627 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -471,12 +471,10 @@ DecLib::DecLib() for (int i = 0; i < MAX_VPS_LAYERS; i++) { m_associatedIRAPType[i] = NAL_UNIT_INVALID; -#if JVET_R0042_SUBPIC_CHECK std::fill_n(m_prevGDRSubpicPOC[i], MAX_NUM_SUB_PICS, MAX_INT); memset(m_prevIRAPSubpicPOC[i], 0, sizeof(int)*MAX_NUM_SUB_PICS); memset(m_prevIRAPSubpicDecOrderNo[i], 0, sizeof(int)*MAX_NUM_SUB_PICS); std::fill_n(m_prevIRAPSubpicType[i], MAX_NUM_SUB_PICS, NAL_UNIT_INVALID); -#endif } #endif } @@ -2337,27 +2335,21 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl pcSlice->getPic()->subpicCtuTopLeftY.push_back(pps->getSubPic(subPicIdx).getSubPicCtuTopLeftY()); } #endif -#if JVET_R0042_SUBPIC_CHECK pcSlice->getPic()->numSlices = pps->getNumSlicesInPic(); pcSlice->getPic()->sliceSubpicIdx.clear(); -#endif } -#if JVET_R0042_SUBPIC_CHECK pcSlice->getPic()->sliceSubpicIdx.push_back(pps->getSubPicIdxFromSubPicId(pcSlice->getSliceSubPicId())); -#endif #if JVET_R0041 pcSlice->checkCRA(pcSlice->getRPL0(), pcSlice->getRPL1(), m_pocCRA[nalu.m_nuhLayerId], m_cListPic); #else pcSlice->checkCRA(pcSlice->getRPL0(), pcSlice->getRPL1(), m_pocCRA, m_cListPic); #endif pcSlice->constructRefPicList(m_cListPic); -#if JVET_R0042_SUBPIC_CHECK pcSlice->setPrevGDRSubpicPOC(m_prevGDRSubpicPOC[nalu.m_nuhLayerId][currSubPicIdx]); pcSlice->setPrevIRAPSubpicPOC(m_prevIRAPSubpicPOC[nalu.m_nuhLayerId][currSubPicIdx]); pcSlice->setPrevIRAPSubpicType(m_prevIRAPSubpicType[nalu.m_nuhLayerId][currSubPicIdx]); pcSlice->setPrevIRAPSubpicType(m_prevIRAPSubpicType[nalu.m_nuhLayerId][currSubPicIdx]); pcSlice->checkSubpicTypeConstraints(m_cListPic, pcSlice->getRPL0(), pcSlice->getRPL1(), m_prevIRAPSubpicDecOrderNo[nalu.m_nuhLayerId][currSubPicIdx]); -#endif #if JVET_R0041 pcSlice->checkRPL(pcSlice->getRPL0(), pcSlice->getRPL1(), m_associatedIRAPDecodingOrderNumber[nalu.m_nuhLayerId], m_cListPic); #else @@ -2720,7 +2712,6 @@ void DecLib::updateAssociatedIRAP() } } -#if JVET_R0042_SUBPIC_CHECK void DecLib::updatePrevIRAPAndGDRSubpic() { for (int j = 0; j < m_uiSliceSegmentIdx; j++) @@ -2743,7 +2734,6 @@ void DecLib::updatePrevIRAPAndGDRSubpic() } } } -#endif void DecLib::xDecodeVPS( InputNALUnit& nalu ) { @@ -2916,12 +2906,10 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay, i m_associatedIRAPType = NAL_UNIT_INVALID; m_pocCRA = 0; #endif -#if JVET_R0042_SUBPIC_CHECK std::fill_n(m_prevGDRSubpicPOC[nalu.m_nuhLayerId], MAX_NUM_SUB_PICS, MAX_INT); memset(m_prevIRAPSubpicPOC[nalu.m_nuhLayerId], 0, sizeof(int)*MAX_NUM_SUB_PICS); memset(m_prevIRAPSubpicDecOrderNo[nalu.m_nuhLayerId], 0, sizeof(int)*MAX_NUM_SUB_PICS); std::fill_n(m_prevIRAPSubpicType[nalu.m_nuhLayerId], MAX_NUM_SUB_PICS, NAL_UNIT_INVALID); -#endif m_pocRandomAccess = MAX_INT; m_prevLayerID = MAX_INT; m_prevPOC = MAX_INT; @@ -3090,82 +3078,6 @@ void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu) } #endif -#if !JVET_R0042_SUBPIC_CHECK - const unsigned ctuRsAddr = pcSlice->getCtuAddrInSlice(0); - const unsigned ctuXPosInCtus = ctuRsAddr % pcSlice->getPPS()->getPicWidthInCtu(); - const unsigned ctuYPosInCtus = ctuRsAddr / pcSlice->getPPS()->getPicWidthInCtu(); - const unsigned maxCUSize = sps->getMaxCUWidth(); - Position pos(ctuXPosInCtus*maxCUSize, ctuYPosInCtus*maxCUSize); - const SubPic &curSubPic = pcSlice->getPPS()->getSubPicFromPos(pos); - - // check subpicture constraints - if ((pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) - { - CHECK(curSubPic.getTreatedAsPicFlag() != true, "a slice of IDR_W_RADL to CRA_NUT shall have its subpic's sub_pic_treated_as_pic_flag equal to 1"); - } - else - { - // check reference list constraint - if (!m_nalUnitInfo[nalu.m_nuhLayerId].empty()) - { - //find out the closest IRAP nal unit that are in the same layer and in the corresponding subpicture - NalUnitInfo *latestIRAPNalUnit = nullptr; - int size = (int)m_nalUnitInfo[nalu.m_nuhLayerId].size(); - int naluIdx; - for (naluIdx = size - 1; naluIdx >= 0; naluIdx--) - { - NalUnitInfo *iterNalu = &m_nalUnitInfo[nalu.m_nuhLayerId][naluIdx]; - bool isIRAPSlice = iterNalu->m_nalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && iterNalu->m_nalUnitType <= NAL_UNIT_CODED_SLICE_CRA; - if (isIRAPSlice) - { - latestIRAPNalUnit = iterNalu; - break; - } - } - 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))) - { - // 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); - - const unsigned ctuRsAddrIRAP = latestIRAPNalUnit->m_firstCTUinSlice; - const unsigned ctuXPosInCtusIRAP = ctuRsAddrIRAP % pcSlice->getPPS()->getPicWidthInCtu(); - const unsigned ctuYPosInCtusIRAP = ctuRsAddrIRAP / pcSlice->getPPS()->getPicWidthInCtu(); - Position posIRAP(ctuXPosInCtusIRAP*maxCUSize, ctuYPosInCtusIRAP*maxCUSize); - bool isInCorrespondingSubpic = curSubPic.isContainingPos(posIRAP); - if (isInCorrespondingSubpic) - { - // check RefPicList[0] - for (int refIdx = 0; refIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_0); refIdx++) - { - int POC = pcSlice->getRefPOC(REF_PIC_LIST_0, refIdx); - bool notInPOCAfterIRAP = true; - // check all ref pics of the current slice are from poc after the IRAP slice - for (auto iterNalu : m_nalUnitInfo[nalu.m_nuhLayerId]) - { - if (POC == iterNalu.m_POC) - notInPOCAfterIRAP = false; - } - CHECK(notInPOCAfterIRAP, "all reference pictures of a slice after the IRAP picture are from pictures after the IRAP"); - } - // check RefPicList[1] - for (int refIdx = 0; refIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_1); refIdx++) - { - int POC = pcSlice->getRefPOC(REF_PIC_LIST_1, refIdx); - bool notInPOCAfterIRAP = true; - // check all ref pics of the current slice are from poc after the IRAP slice - for (auto iterNalu : m_nalUnitInfo[nalu.m_nuhLayerId]) - { - if (POC == iterNalu.m_POC) - notInPOCAfterIRAP = false; - } - CHECK(notInPOCAfterIRAP, "all reference pictures of a slice after the IRAP picture are from pictures after the IRAP"); - } - } - } - } - } -#endif #if !JVET_R0203_IRAP_LEADING_CONSTRAINT // 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)) diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index ee3e77beb..0a43ddb47 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -89,12 +89,10 @@ private: #if !JVET_R0041 int m_pocCRA; ///< POC number of the latest CRA picture #endif -#if JVET_R0042_SUBPIC_CHECK int m_prevGDRSubpicPOC[MAX_VPS_LAYERS][MAX_NUM_SUB_PICS]; int m_prevIRAPSubpicPOC[MAX_VPS_LAYERS][MAX_NUM_SUB_PICS]; NalUnitType m_prevIRAPSubpicType[MAX_VPS_LAYERS][MAX_NUM_SUB_PICS]; int m_prevIRAPSubpicDecOrderNo[MAX_VPS_LAYERS][MAX_NUM_SUB_PICS]; -#endif int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) int m_lastRasPoc; @@ -238,9 +236,7 @@ public: #if JVET_R0041 void updatePrevGDRInSameLayer(); #endif -#if JVET_R0042_SUBPIC_CHECK void updatePrevIRAPAndGDRSubpic(); -#endif bool getNoOutputPriorPicsFlag () const { return m_isNoOutputPriorPics; } void setNoOutputPriorPicsFlag (bool val) { m_isNoOutputPriorPics = val; } -- GitLab