diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index d12915c569377cefc983e253be5d16dd5d3af7c7..0b447f32f4a1754ccb83401777929aecfb3dab61 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -50,7 +50,7 @@ Slice::Slice() : m_iPOC ( 0 ) , m_iLastIDR ( 0 ) #if JVET_R0041 -, m_prevGDRInSameLayerPOC ( 0 ) +, m_prevGDRInSameLayerPOC ( MAX_INT ) #endif , m_iAssociatedIRAP ( 0 ) , m_iAssociatedIRAPType ( NAL_UNIT_INVALID ) @@ -721,9 +721,9 @@ void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureLi #endif { #if JVET_R0041 - CHECK(refPicPOC < irapPOC || refPicDecodingOrderNumber < associatedIRAPDecodingOrderNumber, "When the current picture follows an IRAP picture having the same value " - "of nuh_layer_id in both decoding order and output order, there shall be no picture referred to by an active entry in RefPicList[ 0 ] or RefPicList[ 1 ] that " - "precedes that IRAP picture in output order or decoding order."); + CHECK(refPicPOC < irapPOC || refPicDecodingOrderNumber < associatedIRAPDecodingOrderNumber, "When the current picture, with nuh_layer_id equal to a particular value layerId, " + "is an IRAP picture, there shall be no picture referred to by an entry in RefPicList[ 0 ] that precedes, in output order or decoding order, any preceding IRAP picture " + "with nuh_layer_id equal to layerId in decoding order (when present)."); #else CHECK(refPicPOC < irapPOC || refPicDecodingOrderNumber < associatedIRAPDecodingOrderNumber, "IRAP picture detected that violate the rule that no entry in RefPicList[] shall precede, in output order or decoding order, any preceding IRAP picture in decoding order (when present)."); #endif @@ -804,9 +804,9 @@ void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureLi #if JVET_R0041 if ((m_eNalUnitType == NAL_UNIT_CODED_SLICE_CRA || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP)) { - CHECK(refPicPOC < irapPOC || refPicDecodingOrderNumber < associatedIRAPDecodingOrderNumber, "When the current picture follows an IRAP picture having the same value of " - "nuh_layer_id in both decoding order and output order, there shall be no picture referred to by an active entry in RefPicList[ 0 ] or RefPicList[ 1 ] that " - "precedes that IRAP picture in output order or decoding order."); + CHECK(refPicPOC < irapPOC || refPicDecodingOrderNumber < associatedIRAPDecodingOrderNumber, "When the current picture, with nuh_layer_id equal to a particular value layerId, " + "is an IRAP picture, there shall be no picture referred to by an entry in RefPicList[ 1 ] that precedes, in output order or decoding order, any preceding IRAP picture " + "with nuh_layer_id equal to layerId in decoding order (when present)."); } #else if (m_eNalUnitType == NAL_UNIT_CODED_SLICE_CRA) @@ -1319,7 +1319,8 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic, const PPS& pps) #endif #if JVET_R0041 - if (pcSlice->getPicHeader()->getPicOutputFlag() == 1 && !this->getPicHeader()->getNoOutputBeforeRecoveryFlag() && pcPic->layerId == this->m_nuhLayerId) + if (pcSlice->getPicHeader()->getPicOutputFlag() == 1 && !this->getPicHeader()->getNoOutputBeforeRecoveryFlag() && pcPic->layerId == this->m_nuhLayerId + && nalUnitType != NAL_UNIT_CODED_SLICE_GDR && this->getPicHeader()->getRecoveryPocCnt() != -1) { if (this->getPOC() == this->getPicHeader()->getRecoveryPocCnt() + this->getPrevGDRInSameLayerPOC()) { @@ -2365,7 +2366,7 @@ PicHeader::PicHeader() , m_nonReferencePictureFlag ( 0 ) , m_gdrPicFlag ( 0 ) , m_noOutputOfPriorPicsFlag ( 0 ) -, m_recoveryPocCnt ( 0 ) +, m_recoveryPocCnt ( -1 ) , m_noOutputBeforeRecoveryFlag ( false ) , m_handleCraAsCvsStartFlag ( false ) , m_handleGdrAsCvsStartFlag ( false ) @@ -2462,7 +2463,7 @@ void PicHeader::initPicHeader() m_nonReferencePictureFlag = 0; m_gdrPicFlag = 0; m_noOutputOfPriorPicsFlag = 0; - m_recoveryPocCnt = 0; + m_recoveryPocCnt = -1; m_spsId = -1; m_ppsId = -1; m_pocMsbPresentFlag = 0; diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 4b94fd718de53c7e0c86168386e4cafb09276479..5eb49c23e6c599deb198b401f4541ebe325778a1 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -2436,7 +2436,7 @@ public: void setNoOutputOfPriorPicsFlag( bool b ) { m_noOutputOfPriorPicsFlag = b; } bool getNoOutputOfPriorPicsFlag() const { return m_noOutputOfPriorPicsFlag; } void setRecoveryPocCnt( uint32_t u ) { m_recoveryPocCnt = u; } - bool getRecoveryPocCnt() const { return m_recoveryPocCnt; } + uint32_t getRecoveryPocCnt() const { return m_recoveryPocCnt; } void setSPSId( uint32_t u ) { m_spsId = u; } uint32_t getSPSId() const { return m_spsId; } void setPPSId( uint32_t u ) { m_ppsId = u; } diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 619cfb9f617b7aad0b1f7c805a087078a04a738d..f6cec4810a20485fc6266ea54c2c55af96adde39 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -393,8 +393,8 @@ DecLib::DecLib() , m_isFirstGeneralHrd(true) , m_prevGeneralHrdParams() #if JVET_R0041 - , m_prevGDRInSameLayerPOC{ 0 } - , m_pocCRA{ 0 } + , m_prevGDRInSameLayerPOC{ MAX_INT } + , m_pocCRA{ MAX_INT } , m_associatedIRAPDecodingOrderNumber{ 0 } #else , m_associatedIRAPType(NAL_UNIT_INVALID) @@ -2668,8 +2668,8 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay, i case NAL_UNIT_EOS: #if JVET_R0041 m_associatedIRAPType[nalu.m_nuhLayerId] = NAL_UNIT_INVALID; - m_pocCRA[nalu.m_nuhLayerId] = 0; - m_prevGDRInSameLayerPOC[nalu.m_nuhLayerId] = 0; + m_pocCRA[nalu.m_nuhLayerId] = MAX_INT; + m_prevGDRInSameLayerPOC[nalu.m_nuhLayerId] = MAX_INT; #else m_associatedIRAPType = NAL_UNIT_INVALID; m_pocCRA = 0; diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 2f420468239749cd16f30d755bac1aeb7609337b..bef1f8b86f5fb3187091b8eb9392e806a99d8ab7 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -2838,7 +2838,7 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag } else { - picHeader->setRecoveryPocCnt( 0 ); + picHeader->setRecoveryPocCnt( -1 ); } std::vector<bool> phExtraBitsPresent = sps->getExtraPHBitPresentFlags(); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 3e9a0af0966c53db42494e6a3622223388983a28..38672edfcbbd39f1dcb3f7568213c8ce9b5562cc 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -1770,7 +1770,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB } else { - picHeader->setRecoveryPocCnt( 0 ); + picHeader->setRecoveryPocCnt( -1 ); } // PH extra bits are not written in the reference encoder // as these bits are reserved for future extensions