diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 477738a9769b1cde3b64e502d6a775e79b7c3b5f..a0d06527851020545b789b95914f8168af532349 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -464,7 +464,7 @@ uint32_t DecApp::decode() // update file bitdepth shift if recon bitdepth changed between sequences for( uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++ ) { - int reconBitdepth = pcListPic->front()->cs->sps->getBitDepth((ChannelType)channelType); + int reconBitdepth = pcListPic->front()->m_bitDepths[(ChannelType)channelType]; int fileBitdepth = m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].getFileBitdepth(channelType); int bitdepthShift = m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].getBitdepthShift(channelType); if( fileBitdepth + bitdepthShift != reconBitdepth ) @@ -475,7 +475,7 @@ uint32_t DecApp::decode() if (!m_SEIFGSFileName.empty() && !m_videoIOYuvSEIFGSFile[nalu.m_nuhLayerId].isOpen()) { - const BitDepths &bitDepths = pcListPic->front()->cs->sps->getBitDepths(); // use bit depths of first reconstructed picture. + const BitDepths &bitDepths = pcListPic->front()->m_bitDepths; // use bit depths of first reconstructed picture. for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) { if (m_outputBitDepth[channelType] == 0) @@ -513,7 +513,7 @@ uint32_t DecApp::decode() { for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) { - int reconBitdepth = pcListPic->front()->cs->sps->getBitDepth((ChannelType) channelType); + int reconBitdepth = pcListPic->front()->m_bitDepths[(ChannelType)channelType]; int fileBitdepth = m_videoIOYuvSEIFGSFile[nalu.m_nuhLayerId].getFileBitdepth(channelType); int bitdepthShift = m_videoIOYuvSEIFGSFile[nalu.m_nuhLayerId].getBitdepthShift(channelType); if (fileBitdepth + bitdepthShift != reconBitdepth) @@ -525,7 +525,7 @@ uint32_t DecApp::decode() if (!m_SEICTIFileName.empty() && !m_cVideoIOYuvSEICTIFile[nalu.m_nuhLayerId].isOpen()) { - const BitDepths& bitDepths = pcListPic->front()->cs->sps->getBitDepths(); // use bit depths of first reconstructed picture. + const BitDepths& bitDepths = pcListPic->front()->m_bitDepths; // use bit depths of first reconstructed picture. for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) { if (m_outputBitDepth[channelType] == 0) @@ -712,7 +712,7 @@ uint32_t DecApp::decode() if ((!m_shutterIntervalPostFileName.empty()) && (!openedPostFile) && getShutterFilterFlag()) { - const BitDepths &bitDepths = pcListPic->front()->cs->sps->getBitDepths(); + const BitDepths &bitDepths = pcListPic->front()->m_bitDepths; for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) { if (m_outputBitDepth[channelType] == 0) @@ -933,21 +933,24 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) PicList::iterator iterPic = pcListPic->begin(); int numPicsNotYetDisplayed = 0; int dpbFullness = 0; - const SPS* activeSPS = (pcListPic->front()->cs->sps); uint32_t maxNumReorderPicsHighestTid; uint32_t maxDecPicBufferingHighestTid; - uint32_t maxNrSublayers = activeSPS->getMaxTLayers(); - const VPS* referredVPS = pcListPic->front()->cs->vps; - const int temporalId = ( m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= maxNrSublayers ) ? maxNrSublayers - 1 : m_iMaxTemporalLayer; if( referredVPS == nullptr || referredVPS->m_numLayersInOls[referredVPS->m_targetOlsIdx] == 1 ) { + const SPS* activeSPS = (pcListPic->front()->cs->sps); + const int temporalId = (m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= activeSPS->getMaxTLayers()) + ? activeSPS->getMaxTLayers() - 1 + : m_iMaxTemporalLayer; maxNumReorderPicsHighestTid = activeSPS->getMaxNumReorderPics( temporalId ); maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering( temporalId ); } else { + const int temporalId = (m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= referredVPS->getMaxSubLayers()) + ? referredVPS->getMaxSubLayers() - 1 + : m_iMaxTemporalLayer; maxNumReorderPicsHighestTid = referredVPS->getMaxNumReorderPics( temporalId ); maxDecPicBufferingHighestTid = referredVPS->getMaxDecPicBuffering( temporalId ); } @@ -1054,10 +1057,10 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) if (!m_reconFileName.empty()) { const Window &conf = pcPic->getConformanceWindow(); - const SPS* sps = pcPic->cs->sps; - ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc(); + ChromaFormat chromaFormatIDC = pcPic->m_chromaFormatIDC; if( m_upscaledOutput ) { + const SPS* sps = pcPic->cs->sps; m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); } else diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 5ed255e89daf382747be85a565c65888f1f0b9ae..28beae0dcb11b275e67b251c4bbc75dbc79794e7 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -282,6 +282,7 @@ void Picture::finalInit( const VPS* vps, const SPS& sps, const PPS& pps, PicHead mixedNaluTypesInPicFlag = pps.getMixedNaluTypesInPicFlag(); nonReferencePictureFlag = picHeader->getNonReferencePictureFlag(); m_chromaFormatIDC = sps.getChromaFormatIdc(); + m_bitDepths = sps.getBitDepths(); if (m_spliceIdx == nullptr) { diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index 48db0b981903c6e50dd828f3464e60e31f2adacf..88389982229dc0f0d0a80064e56c54ce22c0b336 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -271,6 +271,7 @@ public: std::vector<AQpLayer*> aqlayer; ChromaFormat m_chromaFormatIDC; + BitDepths m_bitDepths; #if !KEEP_PRED_AND_RESI_SIGNALS private: diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index f19d1146e1618c31612f6faa9e49126d7fe9742f..f6f11b93603f2744a85ab484c7e3929ddd464036 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1052,6 +1052,8 @@ void DecLib::xCreateUnavailablePicture( const PPS *pps, const int iUnavailableP cFillPic->cs->vps = m_parameterSetManager.getVPS(sps->getVPSId()); cFillPic->cs->create(cFillPic->cs->sps->getChromaFormatIdc(), Area(0, 0, cFillPic->cs->pps->getPicWidthInLumaSamples(), cFillPic->cs->pps->getPicHeightInLumaSamples()), true, (bool)(cFillPic->cs->sps->getPLTMode())); cFillPic->allocateNewSlice(); + cFillPic->m_chromaFormatIDC = sps->getChromaFormatIdc(); + cFillPic->m_bitDepths = sps->getBitDepths(); cFillPic->slices[0]->initSlice();