diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 35534502401fc2287f763d4157f5fd25135ac681..5b9a174d50c36dfaf64188356795034257df000e 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -59,6 +59,12 @@ DecApp::DecApp() : m_iPOCLastDisplay(-MAX_INT) { +#if JVET_R0270 + for (int i = 0; i < MAX_NUM_LAYER_IDS; i++) + { + m_newCLVS[i] = true; + } +#endif } // ==================================================================================================================== @@ -161,8 +167,19 @@ uint32_t DecApp::decode() (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP)) { +#if JVET_R0270 + m_newCLVS[nalu.m_nuhLayerId] = true; // An IDR picture starts a new CLVS +#endif xFlushOutput(pcListPic, nalu.m_nuhLayerId); } +#if JVET_R0270 + if (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA) + { + // Once the picture has TRAIL or or STSA slice, no more special treatment for new CLVS picture for the rest of + // pictures until new CLVS picture is received. + m_newCLVS[nalu.m_nuhLayerId] = false; + } +#endif // parse NAL unit syntax if within target decoding layer if( ( m_iMaxTemporalLayer < 0 || nalu.m_temporalId <= m_iMaxTemporalLayer ) && xIsNaluWithinTargetDecLayerIdSet( &nalu ) ) @@ -203,6 +220,9 @@ uint32_t DecApp::decode() if (nalu.m_nalUnitType == NAL_UNIT_EOS) { isEosPresentInPu = true; +#if JVET_R0270 + m_newCLVS[nalu.m_nuhLayerId] = true; //The presence of EOS means that the next picture is the beginning of new CLVS +#endif } // within the current PU, only EOS and EOB are allowed to be sent after an EOS nal unit if(isEosPresentInPu) @@ -217,7 +237,11 @@ uint32_t DecApp::decode() if (!loopFiltered[nalu.m_nuhLayerId] || bitstreamFile) { m_cDecLib.executeLoopFilters(); +#if JVET_R0270 + m_cDecLib.finishPicture(poc, pcListPic, INFO, m_newCLVS[nalu.m_nuhLayerId]); +#else m_cDecLib.finishPicture( poc, pcListPic ); +#endif } loopFiltered[nalu.m_nuhLayerId] = (nalu.m_nalUnitType == NAL_UNIT_EOS); if (nalu.m_nalUnitType == NAL_UNIT_EOS) diff --git a/source/App/DecoderApp/DecApp.h b/source/App/DecoderApp/DecApp.h index 3749288d084dd013b1e61a750bedf14533d63744..593fac31bc77f29258880fdb8d4fea2e491fb976 100644 --- a/source/App/DecoderApp/DecApp.h +++ b/source/App/DecoderApp/DecApp.h @@ -68,6 +68,9 @@ private: std::ofstream m_oplFileStream; ///< Used to output log file for confomance testing +#if JVET_R0270 + bool m_newCLVS[MAX_NUM_LAYER_IDS]; ///< used to record a new CLVSS +#endif private: diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 8b8459fcd48a617fa15aeb2be7b663a5d77ab6a1..d0d582d1592b485d60efe9b625a54830d87a4728 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -52,6 +52,8 @@ //########### place macros to be removed in next cycle below this line ############### +#define JVET_R0270 1 // JVET-S0270: Treating picture with mixed RASL and RADL slices as RASL picture + #define JVET_S0081_NON_REFERENCED_PIC 1 // JVET-S0081: exclude non-referenced picture to be used as prevTid0 picture #define JVET_R0433 1 // JVET-R0433: APS signaling and semantics cleanup diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index ac9d073c34354e00df7afe5f6611782e80cea21a..f6d09e8dd82c11f57a2ad544526e0fa82c8e7eaf 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -691,7 +691,11 @@ void DecLib::finishPictureLight(int& poc, PicList*& rpcListPic ) m_puCounter++; } +#if JVET_R0270 +void DecLib::finishPicture(int &poc, PicList *&rpcListPic, MsgLevel msgl, bool associatedWithNewClvs) +#else void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl ) +#endif { #if RExt__DECODER_DEBUG_TOOL_STATISTICS CodingStatistics::StatTool& s = CodingStatistics::GetStatisticTool( STATS__TOOL_TOTAL_FRAME ); @@ -775,6 +779,30 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl ) #endif m_pcPic->neededForOutput = (pcSlice->getPicHeader()->getPicOutputFlag() ? true : false); +#if JVET_R0270 + if (associatedWithNewClvs && m_pcPic->neededForOutput) + { + if (!pcSlice->getPPS()->getMixedNaluTypesInPicFlag() && pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL) + { + m_pcPic->neededForOutput = false; + } + else if (pcSlice->getPPS()->getMixedNaluTypesInPicFlag()) + { + bool isRaslPic = true; + for (int i = 0; isRaslPic && i < m_pcPic->numSlices; i++) + { + if (!(pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL)) + { + isRaslPic = false; + } + } + if (isRaslPic) + { + m_pcPic->neededForOutput = false; + } + } + } +#endif m_pcPic->reconstructed = true; @@ -2256,6 +2284,9 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_firstSliceInBitstream = false; Slice* pcSlice = m_pcPic->slices[m_uiSliceSegmentIdx]; +#if JVET_R0270 + m_pcPic->numSlices = m_uiSliceSegmentIdx + 1; +#endif pcSlice->setPic( m_pcPic ); m_pcPic->poc = pcSlice->getPOC(); m_pcPic->referenced = true; diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index f15adb4486de172d0527de7d02e0c5f9653d1806..a0c0a7afa9a596fcddcbd04491a7f45ae4588d45 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -216,7 +216,11 @@ public: void deletePicBuffer(); void executeLoopFilters(); - void finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl = INFO); +#if JVET_R0270 + void finishPicture(int &poc, PicList *&rpcListPic, MsgLevel msgl = INFO, bool associatedWithNewClvs = false); +#else + void finishPicture(int &poc, PicList *&rpcListPic, MsgLevel msgl = INFO); +#endif void finishPictureLight(int& poc, PicList*& rpcListPic ); void checkNoOutputPriorPics (PicList* rpcListPic); void checkNalUnitConstraints( uint32_t naluType );