diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index e2fa972b0dd4baf0415b43d515d7e872c6a34ae2..85f63bb0f7d1d9c9318edc79ceedd42835236ae1 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -325,6 +325,17 @@ uint32_t DecApp::decode() m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].open( reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode } } + // 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 fileBitdepth = m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].getFileBitdepth(channelType); + int bitdepthShift = m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].getBitdepthShift(channelType); + if( fileBitdepth + bitdepthShift != reconBitdepth ) + { + m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].setBitdepthShift(channelType, reconBitdepth - fileBitdepth); + } + } // write reconstruction to file if( bNewPicture ) { diff --git a/source/Lib/Utilities/VideoIOYuv.h b/source/Lib/Utilities/VideoIOYuv.h index 52656b5f184ecc5c2db19d3901a1765ab627a29b..bf2c470560dae8a67de69bb9c914d55799ac3103 100644 --- a/source/Lib/Utilities/VideoIOYuv.h +++ b/source/Lib/Utilities/VideoIOYuv.h @@ -96,6 +96,9 @@ public: bool isEof (); ///< check for end-of-file bool isFail(); ///< check for failure bool isOpen() { return m_cHandle.is_open(); } + void setBitdepthShift( int ch, int bd ) { m_bitdepthShift[ch] = bd; } + int getBitdepthShift( int ch ) { return m_bitdepthShift[ch]; } + int getFileBitdepth( int ch ) { return m_fileBitdepth[ch]; } bool writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPelUnitBuf& pic, const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int outputChoice = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false ); ///< write one upsaled YUV frame