diff --git a/source/Lib/Utilities/VideoIOYuv.cpp b/source/Lib/Utilities/VideoIOYuv.cpp index 018b5574841ae914fb949becb870f004f3cdc080..0385c0dfb29627ccdc422b2e282092a6f8a895e1 100644 --- a/source/Lib/Utilities/VideoIOYuv.cpp +++ b/source/Lib/Utilities/VideoIOYuv.cpp @@ -980,7 +980,7 @@ bool VideoIOYuv::read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSp bool VideoIOYuv::write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf& pic, const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, - int confLeft, int confRight, int confTop, int confBottom, ChromaFormat format, const bool bClipToRec709 ) + int confLeft, int confRight, int confTop, int confBottom, ChromaFormat format, const bool bClipToRec709, const bool subtractConfWindowOffsets ) { PelStorage interm; @@ -1038,6 +1038,12 @@ bool VideoIOYuv::write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf const uint32_t width444 = areaY.width - confLeft - confRight; const uint32_t height444 = areaY.height - confTop - confBottom; + if( subtractConfWindowOffsets ) + { + orgWidth -= confLeft + confRight; + orgHeight -= confTop + confBottom; + } + if ((width444 == 0) || (height444 == 0)) { msg( WARNING, "\nWarning: writing %d x %d luma sample output picture!", width444, height444); @@ -1286,7 +1292,7 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe confFullResolution.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), confFullResolution.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), confFullResolution.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), - NUM_CHROMA_FORMAT, bClipToRec709 ); + NUM_CHROMA_FORMAT, bClipToRec709, false ); } else { @@ -1299,7 +1305,7 @@ bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPe conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), - NUM_CHROMA_FORMAT, bClipToRec709 ); + NUM_CHROMA_FORMAT, bClipToRec709, false ); } } else diff --git a/source/Lib/Utilities/VideoIOYuv.h b/source/Lib/Utilities/VideoIOYuv.h index 27504973ee54b0f2248b64a08d54927e89ce78e8..52656b5f184ecc5c2db19d3901a1765ab627a29b 100644 --- a/source/Lib/Utilities/VideoIOYuv.h +++ b/source/Lib/Utilities/VideoIOYuv.h @@ -83,7 +83,7 @@ public: bool write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf& pic, const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, - int confLeft = 0, int confRight = 0, int confTop = 0, int confBottom = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false ); ///< write one YUV frame with padding parameter + int confLeft = 0, int confRight = 0, int confTop = 0, int confBottom = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false, const bool subtractConfWindowOffsets = true ); ///< write one YUV frame with padding parameter // If fileFormat=NUM_CHROMA_FORMAT, use the format defined by pPicYuvTop and pPicYuvBottom bool write( const CPelUnitBuf& picTop, const CPelUnitBuf& picBot,