diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 1adb20f99b11427316ec6569f9a1d3caf78964fc..5c8b386478e0dc791f54c764fccdc76e58322324 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -3203,6 +3203,7 @@ PPS::PPS() , m_conformanceWindowFlag (false) , m_picWidthInLumaSamples(352) , m_picHeightInLumaSamples( 288 ) +, m_explicitScalingWindowFlag (false) , m_wrapAroundEnabledFlag (false) , m_picWidthMinusWrapAroundOffset (0) , m_wrapAroundOffset (0) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 2a7e90bfd149f8756d829eb7675d856d6b3c22cd..e56a459eb5739ad05506295a3e285476ad334c60 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -2023,6 +2023,7 @@ private: uint32_t m_picWidthInLumaSamples; uint32_t m_picHeightInLumaSamples; Window m_conformanceWindow; + bool m_explicitScalingWindowFlag; Window m_scalingWindow; bool m_wrapAroundEnabledFlag; //< reference wrap around enabled or not @@ -2265,6 +2266,8 @@ public: const Window& getConformanceWindow() const { return m_conformanceWindow; } void setConformanceWindow( Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } + void setExplicitScalingWindowFlag(bool flag) { m_explicitScalingWindowFlag = flag; } + bool getExplicitScalingWindowFlag() const { return m_explicitScalingWindowFlag; } Window& getScalingWindow() { return m_scalingWindow; } const Window& getScalingWindow() const { return m_scalingWindow; } void setScalingWindow( Window& scalingWindow ) { m_scalingWindow = scalingWindow; } diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 743947e0b07817084fb62de9d7d54cdcc57b7e9f..83ccbe070079e5f635018b89ae808a6ec391d7dd 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -443,6 +443,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_UVLC(uiCode, "pps_conf_win_bottom_offset"); conf.setWindowBottomOffset(uiCode); } READ_FLAG( uiCode, "pps_scaling_window_explicit_signalling_flag" ); + pcPPS->setExplicitScalingWindowFlag( uiCode ); if( uiCode != 0 ) { Window &scalingWindow = pcPPS->getScalingWindow(); @@ -2765,7 +2766,12 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag pps->getConformanceWindow().setWindowRightOffset(sps->getConformanceWindow().getWindowRightOffset()); pps->getConformanceWindow().setWindowTopOffset(sps->getConformanceWindow().getWindowTopOffset()); pps->getConformanceWindow().setWindowBottomOffset(sps->getConformanceWindow().getWindowBottomOffset()); + if (!pps->getExplicitScalingWindowFlag()) + { + pps->setScalingWindow(pps->getConformanceWindow()); + } } + CHECK(!sps->getRprEnabledFlag() && pps->getExplicitScalingWindowFlag(), "When sps_ref_pic_resampling_enabled_flag is equal to 0, the value of pps_scaling_window_explicit_signalling_flag shall be equal to 0"); // initialize tile/slice info for no partitioning case diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index c7ca3b1667c9af14de9ea2416549255469df5330..b1f63f766f02795f5d22dee651944272152a195f 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -196,6 +196,10 @@ void EncLib::init(AUWriterIf *auWriterIf) pps0.setConformanceWindow( m_conformanceWindow ); pps0.setConformanceWindowFlag( m_conformanceWindow.getWindowEnabledFlag() ); } + if (!pps0.getExplicitScalingWindowFlag()) + { + pps0.setScalingWindow(pps0.getConformanceWindow()); + } xInitPPS(pps0, sps0); // initialize APS xInitRPL(sps0); @@ -232,6 +236,7 @@ void EncLib::init(AUWriterIf *auWriterIf) Window scalingWindow; scalingWindow.setWindow( 0, ( width - scaledWidth ) / SPS::getWinUnitX( sps0.getChromaFormatIdc() ), 0, ( height - scaledHeight ) / SPS::getWinUnitY( sps0.getChromaFormatIdc() ) ); pps.setScalingWindow( scalingWindow ); + pps.setExplicitScalingWindowFlag(scalingWindow.getWindowEnabledFlag()); //register the width/height of the current pic into reference SPS if (!sps0.getPPSValidFlag(pps.getPPSId())) diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 7a0846f2bed096bfb2a2570513cdb20ca4c6cfc4..389e69af44907518046ad6e818170f85e4a42046 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -284,9 +284,8 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_UVLC(conf.getWindowBottomOffset(), "pps_conf_win_bottom_offset"); } Window scalingWindow = pcPPS->getScalingWindow(); - - WRITE_FLAG( scalingWindow.getWindowEnabledFlag(), "pps_scaling_window_explicit_signalling_flag" ); - if( scalingWindow.getWindowEnabledFlag() ) + WRITE_FLAG( pcPPS->getExplicitScalingWindowFlag(), "pps_scaling_window_explicit_signalling_flag"); + if ( pcPPS->getExplicitScalingWindowFlag() ) { WRITE_SVLC( scalingWindow.getWindowLeftOffset(), "pps_scaling_win_left_offset" ); WRITE_SVLC( scalingWindow.getWindowRightOffset(), "pps_scaling_win_right_offset" );