diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index ae1d37e5e661d65bf5f8ce846a4f2f2a01073cf8..7892c5d0a2ddcd822d80d55d2a3f8799b65bc208 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -457,8 +457,10 @@ uint32_t DecApp::decode() } const auto pps = pcListPic->front()->cs->pps; auto confWindow = pps->getConformanceWindow(); - const int picWidth = pps->getPicWidthInLumaSamples() - confWindow.getWindowLeftOffset() - confWindow.getWindowRightOffset(); - const int picHeight = pps->getPicHeightInLumaSamples() - confWindow.getWindowTopOffset() - confWindow.getWindowBottomOffset(); + const auto sx = SPS::getWinUnitX(sps->getChromaFormatIdc()); + const auto sy = SPS::getWinUnitY(sps->getChromaFormatIdc()); + const int picWidth = pps->getPicWidthInLumaSamples() - (confWindow.getWindowLeftOffset() + confWindow.getWindowRightOffset()) * sx; + const int picHeight = pps->getPicHeightInLumaSamples() - (confWindow.getWindowTopOffset() + confWindow.getWindowBottomOffset()) * sy; m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].setOutputY4mInfo(picWidth, picHeight, frameRate, frameScale, m_outputBitDepth[0], sps->getChromaFormatIdc()); } m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].open( reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index e76a0cad6d967cbbe8e8ba0e54304e1100d3a2b6..650b41827acdd82a38c5c2628c457812c73655cd 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1432,8 +1432,10 @@ void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId ) } if (isY4mFileExt(reconFileName)) { - m_cVideoIOYuvReconFile.setOutputY4mInfo(m_sourceWidth - m_confWinLeft - m_confWinRight, - m_sourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate, 1, m_internalBitDepth[0], m_chromaFormatIDC); + const auto sx = SPS::getWinUnitX(m_chromaFormatIDC); + const auto sy = SPS::getWinUnitY(m_chromaFormatIDC); + m_cVideoIOYuvReconFile.setOutputY4mInfo(m_sourceWidth - (m_confWinLeft + m_confWinRight) * sx, + m_sourceHeight - (m_confWinTop + m_confWinBottom) * sy, m_iFrameRate, 1, m_internalBitDepth[0], m_chromaFormatIDC); } m_cVideoIOYuvReconFile.open( reconFileName, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth ); // write mode }