diff --git a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
index 79ef112d1f1d8f8e4280f0f60529a9361ae9e835..058abb47525e3011220c65524cf4b3b8912cb201 100644
--- a/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
+++ b/source/App/BitstreamExtractorApp/BitstreamExtractorApp.cpp
@@ -242,7 +242,7 @@ void BitstreamExtractorApp::xRewritePPS(PPS &targetPPS, const PPS &sourcePPS, co
   targetPPS.setPicWidthInLumaSamples(subPic.getSubPicWidthInLumaSample());
   targetPPS.setPicHeightInLumaSamples(subPic.getSubPicHeightInLumaSample());
   // todo: Conformance window (conf window rewriting is not needed per JVET-S0117)
-  if (sourcePPS.getScalingWindow().getWindowEnabledFlag())
+  if (!sourcePPS.getScalingWindow().isZero())
   {
   int subWidthC = SPS::getWinUnitX(sourceSPS.getChromaFormatIdc());
   int subHeightC = SPS::getWinUnitY(sourceSPS.getChromaFormatIdc());
@@ -252,8 +252,8 @@ void BitstreamExtractorApp::xRewritePPS(PPS &targetPPS, const PPS &sourcePPS, co
   int subpicScalWinTopOffset = sourcePPS.getScalingWindow().getWindowTopOffset() - (int)subPic.getSubPicCtuTopLeftY() * sourceSPS.getCTUSize() / subHeightC;
   int botSubpicBd = (subPic.getSubPicCtuTopLeftY() + subPic.getSubPicHeightInCTUs()) * sourceSPS.getCTUSize();
   int subpicScalWinBotOffset = botSubpicBd >= sourceSPS.getMaxPicHeightInLumaSamples() ? sourcePPS.getScalingWindow().getWindowBottomOffset() : sourcePPS.getScalingWindow().getWindowBottomOffset() - (int)(sourceSPS.getMaxPicHeightInLumaSamples() - botSubpicBd) / subHeightC;
-  Window scalingWindow;
-  scalingWindow.setWindow(subpicScalWinLeftOffset, subpicScalWinRightOffset, subpicScalWinTopOffset, subpicScalWinBotOffset);
+  Window scalingWindow(subpicScalWinLeftOffset, subpicScalWinRightOffset, subpicScalWinTopOffset,
+                       subpicScalWinBotOffset);
   targetPPS.setScalingWindow(scalingWindow);
   }
   // Tiles
diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index 064736a835ea452b62e6e10950934be57160ed73..20075288d7dd7409b9b86dd884ea9994326f0a6a 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -1761,9 +1761,8 @@ bool EncApp::encodePrep( bool& eos )
     int xScale = ((w0 << ScalingRatio::BITS) + (w1 >> 1)) / w1;
     int yScale = ((h0 << ScalingRatio::BITS) + (h1 >> 1)) / h1;
     ScalingRatio scalingRatio = { xScale, yScale };
-    Window conformanceWindow1;
-    conformanceWindow1.setWindow(m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom);
-    
+    Window       conformanceWindow1(m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom);
+
     bool downsampling = (m_sourceWidthBeforeScale > m_sourceWidth) || (m_sourceHeightBeforeScale > m_sourceHeight);
     bool useLumaFilter = downsampling;
     Picture::rescalePicture(scalingRatio, *m_orgPicBeforeScale, Window(), *m_orgPic, conformanceWindow1,
diff --git a/source/App/SubpicMergeApp/SubpicMergeApp.cpp b/source/App/SubpicMergeApp/SubpicMergeApp.cpp
index 2b678e4d172909f74f806eca72f1e2b3f33914c6..36925ecd363d4a7cf9f2c4e8120e3ac6eb9a8ebf 100644
--- a/source/App/SubpicMergeApp/SubpicMergeApp.cpp
+++ b/source/App/SubpicMergeApp/SubpicMergeApp.cpp
@@ -645,7 +645,8 @@ void SubpicMergeApp::generateMergedStreamPPSes(ParameterSetManager &psManager, s
   {
     for (auto ppsId : subpic.ppsIds)
     {
-      CHECK(subpic.psManager.getPPS(ppsId)->getScalingWindow().getWindowEnabledFlag(), "Scaling window in input streams not supported")
+      CHECK(!subpic.psManager.getPPS(ppsId)->getScalingWindow().isZero(),
+            "Scaling window in input streams not supported")
     }
   }
 
diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h
index 224e96293e21b1cf8cc3f317ea18d65b22eb016c..7aa9f38cc8b5a4832ed0500d64742f3937d4fea0 100644
--- a/source/Lib/CommonLib/Picture.h
+++ b/source/Lib/CommonLib/Picture.h
@@ -271,12 +271,14 @@ public:
   const Window&      getConformanceWindow() const                                    { return  m_conformanceWindow; }
   Window&            getScalingWindow()                                              { return  m_scalingWindow; }
   const Window&      getScalingWindow()                                        const { return  m_scalingWindow; }
-  bool               isRefScaled( const PPS* pps ) const                             { return  unscaledPic->getPicWidthInLumaSamples()    != pps->getPicWidthInLumaSamples()                ||
-                                                                                               unscaledPic->getPicHeightInLumaSamples()   != pps->getPicHeightInLumaSamples()               ||
-                                                                                               unscaledPic->getScalingWindow().getWindowLeftOffset()   != pps->getScalingWindow().getWindowLeftOffset()  ||
-                                                                                               unscaledPic->getScalingWindow().getWindowRightOffset()  != pps->getScalingWindow().getWindowRightOffset() ||
-                                                                                               unscaledPic->getScalingWindow().getWindowTopOffset()    != pps->getScalingWindow().getWindowTopOffset()   ||
-                                                                                               unscaledPic->getScalingWindow().getWindowBottomOffset() != pps->getScalingWindow().getWindowBottomOffset(); }
+
+  bool isRefScaled(const PPS* pps) const
+  {
+    return unscaledPic->getPicWidthInLumaSamples() != pps->getPicWidthInLumaSamples()
+           || unscaledPic->getPicHeightInLumaSamples() != pps->getPicHeightInLumaSamples()
+           || unscaledPic->getScalingWindow() != pps->getScalingWindow();
+  }
+
   bool               isWrapAroundEnabled( const PPS* pps ) const                     { return  pps->getWrapAroundEnabledFlag() && !isRefScaled( pps ); }
 
   void         allocateNewSlice();
diff --git a/source/Lib/CommonLib/SequenceParameterSet.h b/source/Lib/CommonLib/SequenceParameterSet.h
index 6f1da3449277e8778320741fde03167bbf991827..4a6a55e762e28c9b5afbb6b46f0a809cddf3b843 100644
--- a/source/Lib/CommonLib/SequenceParameterSet.h
+++ b/source/Lib/CommonLib/SequenceParameterSet.h
@@ -229,38 +229,37 @@ public:
 class Window
 {
 private:
-  bool m_enabledFlag;
-  int  m_winLeftOffset;
-  int  m_winRightOffset;
-  int  m_winTopOffset;
-  int  m_winBottomOffset;
+  int m_leftOffset   = 0;
+  int m_rightOffset  = 0;
+  int m_topOffset    = 0;
+  int m_bottomOffset = 0;
+
 public:
-  Window()
-  : m_enabledFlag    (false)
-  , m_winLeftOffset  (0)
-  , m_winRightOffset (0)
-  , m_winTopOffset   (0)
-  , m_winBottomOffset(0)
-  { }
-
-  bool getWindowEnabledFlag() const   { return m_enabledFlag;                          }
-  int  getWindowLeftOffset() const    { return m_enabledFlag ? m_winLeftOffset : 0;    }
-  void setWindowLeftOffset(int val)   { m_winLeftOffset = val; m_enabledFlag |=  (val!=0);   }
-  int  getWindowRightOffset() const   { return m_enabledFlag ? m_winRightOffset : 0;   }
-  void setWindowRightOffset(int val)  { m_winRightOffset = val; m_enabledFlag |= (val!=0);  }
-  int  getWindowTopOffset() const     { return m_enabledFlag ? m_winTopOffset : 0;     }
-  void setWindowTopOffset(int val)    { m_winTopOffset = val; m_enabledFlag |= (val!=0);    }
-  int  getWindowBottomOffset() const  { return m_enabledFlag ? m_winBottomOffset: 0;   }
-  void setWindowBottomOffset(int val) { m_winBottomOffset = val; m_enabledFlag |= (val!=0); }
-
-  void setWindow(int offsetLeft, int offsetRight, int offsetTop, int offsetBottom)
+  Window() = default;
+  Window(int offsetLeft, int offsetRight, int offsetTop, int offsetBottom)
+    : m_leftOffset(offsetLeft), m_rightOffset(offsetRight), m_topOffset(offsetTop), m_bottomOffset(offsetBottom)
+  {}
+  Window(const Window& w) = default;
+
+  bool operator==(const Window& w) const
   {
-    m_enabledFlag     = (offsetLeft || offsetRight || offsetTop || offsetBottom);
-    m_winLeftOffset   = offsetLeft;
-    m_winRightOffset  = offsetRight;
-    m_winTopOffset    = offsetTop;
-    m_winBottomOffset = offsetBottom;
+    return m_leftOffset == w.m_leftOffset && m_rightOffset == w.m_rightOffset && m_topOffset == w.m_topOffset
+           && m_bottomOffset == w.m_bottomOffset;
   }
+
+  bool operator!=(const Window& w) const { return !(*this == w); }
+
+  bool isZero() const { return m_leftOffset == 0 && m_rightOffset == 0 && m_topOffset == 0 && m_bottomOffset == 0; }
+
+  int getWindowLeftOffset() const { return m_leftOffset; }
+  int getWindowRightOffset() const { return m_rightOffset; }
+  int getWindowTopOffset() const { return m_topOffset; }
+  int getWindowBottomOffset() const { return m_bottomOffset; }
+
+  void setWindowLeftOffset(int val) { m_leftOffset = val; }
+  void setWindowRightOffset(int val) { m_rightOffset = val; }
+  void setWindowTopOffset(int val) { m_topOffset = val; }
+  void setWindowBottomOffset(int val) { m_bottomOffset = val; }
 };
 
 struct ChromaQpMappingTableParams
diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp
index 9ca8e06bad74e3873f5f77bf455ecb51153688d1..410d1bbc77a159d878592d67c97694cb224b44d7 100644
--- a/source/Lib/CommonLib/UnitTools.cpp
+++ b/source/Lib/CommonLib/UnitTools.cpp
@@ -1681,19 +1681,16 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu)
 {
   if (pu.cs->sps->getUseDMVR() && !pu.cs->picHeader->getDmvrDisabledFlag())
   {
-    const int refIdx0 = pu.refIdx[REF_PIC_LIST_0];
-    const int refIdx1 = pu.refIdx[REF_PIC_LIST_1];
-
-    const bool ref0IsScaled = refIdx0 < 0 || refIdx0 >= MAX_NUM_ACTIVE_REF
-                                ? false
-                                : pu.cu->slice->getRefPic(REF_PIC_LIST_0, refIdx0)->isRefScaled(pu.cs->pps);
-    const bool ref1IsScaled = refIdx1 < 0 || refIdx1 >= MAX_NUM_ACTIVE_REF
-                                ? false
-                                : pu.cu->slice->getRefPic(REF_PIC_LIST_1, refIdx1)->isRefScaled(pu.cs->pps);
+    auto isScaledRef = [&](RefPicList listIdx)
+    {
+      const int refIdx = pu.refIdx[listIdx];
+      return refIdx >= 0 && refIdx < MAX_NUM_ACTIVE_REF
+             && pu.cu->slice->getRefPic(listIdx, refIdx)->isRefScaled(pu.cs->pps);
+    };
 
     return pu.mergeFlag && pu.mergeType == MergeType::DEFAULT_N && !pu.ciipFlag && !pu.cu->affine && !pu.mmvdMergeFlag
-           && !pu.cu->mmvdSkip && PU::isSimpleSymmetricBiPred(pu) && PU::dmvrBdofSizeCheck(pu) && !ref0IsScaled
-           && !ref1IsScaled;
+           && !pu.cu->mmvdSkip && PU::isSimpleSymmetricBiPred(pu) && PU::dmvrBdofSizeCheck(pu)
+           && !isScaledRef(REF_PIC_LIST_0) && !isScaledRef(REF_PIC_LIST_1);
   }
   else
   {
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index d9e7ff5351c1f0883144cb0868293a27cebde367..91235415dcb3aed17a5a715e3d750a8fdca6db61 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -458,12 +458,7 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
   }
   else
   {
-    Window &scalingWindow = pcPPS->getScalingWindow();
-    Window& conf = pcPPS->getConformanceWindow();
-    scalingWindow.setWindowLeftOffset( conf.getWindowLeftOffset() );
-    scalingWindow.setWindowRightOffset( conf.getWindowRightOffset() );
-    scalingWindow.setWindowTopOffset( conf.getWindowTopOffset() );
-    scalingWindow.setWindowBottomOffset( conf.getWindowBottomOffset() );
+    pcPPS->getScalingWindow() = pcPPS->getConformanceWindow();
   }
 
   xReadFlag( uiCode, "pps_output_flag_present_flag" );                    pcPPS->setOutputFlagPresentFlag( uiCode==1 );
diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h
index 150aa0109793927aa80da4205be970eaa75b7be8..c253b1d582317e03982ba7fa91d911058c37cdfa 100644
--- a/source/Lib/EncoderLib/EncCfg.h
+++ b/source/Lib/EncoderLib/EncCfg.h
@@ -1221,9 +1221,15 @@ public:
   void      setSourceHeight                 ( int   i )      { m_sourceHeight = i; }
 
   Window   &getConformanceWindow()                           { return m_conformanceWindow; }
-  void      setConformanceWindow (int confLeft, int confRight, int confTop, int confBottom ) { m_conformanceWindow.setWindow (confLeft, confRight, confTop, confBottom); }
+  void      setConformanceWindow(int confLeft, int confRight, int confTop, int confBottom)
+  {
+    m_conformanceWindow = Window(confLeft, confRight, confTop, confBottom);
+  }
   void      setExplicitScalingWindowEnabled(bool enabled)    { m_explicitScalingWindowEnabled = enabled; }
-  void      setScalingWindow (int scalingLeft, int scalingRight, int scalingTop, int scalingBottom ) { m_scalingWindow.setWindow (scalingLeft, scalingRight, scalingTop, scalingBottom); }
+  void      setScalingWindow(int scalingLeft, int scalingRight, int scalingTop, int scalingBottom)
+  {
+    m_scalingWindow = Window(scalingLeft, scalingRight, scalingTop, scalingBottom);
+  }
 
   void      setFramesToBeEncoded            ( int   i )      { m_framesToBeEncoded = i; }
 
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index c539859893ac28d378e75251390ace0bf0e3fbec..e41bbe047a6ce61e4c9550ec3c88562e2c7f5120 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -5222,8 +5222,8 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni
       {
         const CPelUnitBuf& pub1 = org;
         const CPelUnitBuf& pub0 = picRefLayer->getRecoBuf();
-        Window& wScaling0 = picRefLayer->getScalingWindow();
-        Window& wScaling1 = pcPic->getScalingWindow();
+        const Window&      wScaling0 = picRefLayer->getScalingWindow();
+        const Window&      wScaling1 = pcPic->getScalingWindow();
         int w0 = pub0.get(COMPONENT_Y).width - SPS::getWinUnitX( sps.getChromaFormatIdc() ) * ( wScaling0.getWindowLeftOffset() + wScaling0.getWindowRightOffset() );
         int h0 = pub0.get(COMPONENT_Y).height - SPS::getWinUnitY( sps.getChromaFormatIdc() ) * ( wScaling0.getWindowTopOffset()  + wScaling0.getWindowBottomOffset() );
         int w1 = pub1.get(COMPONENT_Y).width - SPS::getWinUnitX( sps.getChromaFormatIdc() ) * ( wScaling1.getWindowLeftOffset() + wScaling1.getWindowRightOffset() );
@@ -5260,7 +5260,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni
     // get per picture padding from the conformance window, in this case if conformance window is set not equal to the padding then PSNR results may be inaccurate
     if (m_pcEncLib->isResChangeInClvsEnabled())
     {
-      Window& conf = pcPic->getConformanceWindow();
+      const Window& conf = pcPic->getConformanceWindow();
       padX = conf.getWindowRightOffset() * SPS::getWinUnitX( format );
       padY = conf.getWindowBottomOffset() * SPS::getWinUnitY( format );
     }
diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index ff66b9a572807c8aef6c81ceadcc4d4ea4adbc63..a3ff50517198bb7c57f4fda31e0733f06c33e96a 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -197,7 +197,7 @@ void EncLib::init(AUWriterIf *auWriterIf)
   else
   {
     pps0.setConformanceWindow( m_conformanceWindow );
-    pps0.setConformanceWindowFlag( m_conformanceWindow.getWindowEnabledFlag() );
+    pps0.setConformanceWindowFlag(!m_conformanceWindow.isZero());
   }
   if (m_explicitScalingWindowEnabled)
   {
@@ -215,7 +215,7 @@ void EncLib::init(AUWriterIf *auWriterIf)
   if (m_resChangeInClvsEnabled)
   {
     PPS& pps = *(m_ppsMap.allocatePS(ENC_PPS_ID_RPR + m_layerId));
-    Window& inputScalingWindow = pps0.getScalingWindow();
+    const Window& inputScalingWindow = pps0.getScalingWindow();
     int scaledWidth = int( ( pps0.getPicWidthInLumaSamples() - SPS::getWinUnitX( sps0.getChromaFormatIdc() ) * ( inputScalingWindow.getWindowLeftOffset() + inputScalingWindow.getWindowRightOffset() ) ) / m_scalingRatioHor );
     int minSizeUnit = std::max(8, 1 << sps0.getLog2MinCodingBlockSize());
     int temp = scaledWidth / minSizeUnit;
@@ -228,8 +228,8 @@ void EncLib::init(AUWriterIf *auWriterIf)
     pps.setPicWidthInLumaSamples( width );
     pps.setPicHeightInLumaSamples( height );
     pps.setSliceChromaQpFlag(true);
-    Window conformanceWindow;
-    conformanceWindow.setWindow( 0, ( width - scaledWidth ) / SPS::getWinUnitX( sps0.getChromaFormatIdc() ), 0, ( height - scaledHeight ) / SPS::getWinUnitY( sps0.getChromaFormatIdc() ) );
+    Window conformanceWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0,
+                             (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
     if (pps.getPicWidthInLumaSamples() == sps0.getMaxPicWidthInLumaSamples() && pps.getPicHeightInLumaSamples() == sps0.getMaxPicHeightInLumaSamples())
     {
       pps.setConformanceWindow( sps0.getConformanceWindow() );
@@ -238,13 +238,13 @@ void EncLib::init(AUWriterIf *auWriterIf)
     else
     {
       pps.setConformanceWindow( conformanceWindow );
-      pps.setConformanceWindowFlag( pps.getConformanceWindow().getWindowEnabledFlag() );
+      pps.setConformanceWindowFlag(!pps.getConformanceWindow().isZero());
     }
 
-    Window scalingWindow;
-    scalingWindow.setWindow( 0, ( width - scaledWidth ) / SPS::getWinUnitX( sps0.getChromaFormatIdc() ), 0, ( height - scaledHeight ) / SPS::getWinUnitY( sps0.getChromaFormatIdc() ) );
+    Window scalingWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0,
+                         (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
     pps.setScalingWindow( scalingWindow );
-    pps.setExplicitScalingWindowFlag(scalingWindow.getWindowEnabledFlag());
+    pps.setExplicitScalingWindowFlag(!scalingWindow.isZero());
 
     //register the width/height of the current pic into reference SPS
     if (!sps0.getPPSValidFlag(pps.getPPSId()))
@@ -308,8 +308,8 @@ void EncLib::init(AUWriterIf *auWriterIf)
     pps.setPicHeightInLumaSamples(height);
     pps.setSliceChromaQpFlag(true);
 
-    Window conformanceWindow;
-    conformanceWindow.setWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0, (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
+    Window conformanceWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0,
+                             (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
     if (pps.getPicWidthInLumaSamples() == sps0.getMaxPicWidthInLumaSamples() && pps.getPicHeightInLumaSamples() == sps0.getMaxPicHeightInLumaSamples())
     {
       pps.setConformanceWindow(sps0.getConformanceWindow());
@@ -318,11 +318,11 @@ void EncLib::init(AUWriterIf *auWriterIf)
     else
     {
       pps.setConformanceWindow(conformanceWindow);
-      pps.setConformanceWindowFlag(pps.getConformanceWindow().getWindowEnabledFlag());
+      pps.setConformanceWindowFlag(!pps.getConformanceWindow().isZero());
     }
 
-    Window scalingWindow;
-    scalingWindow.setWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0, (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
+    Window scalingWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0,
+                         (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
     pps.setScalingWindow(scalingWindow);
 
     //register the width/height of the current pic into reference SPS
@@ -383,8 +383,8 @@ void EncLib::init(AUWriterIf *auWriterIf)
     pps.setPicHeightInLumaSamples(height);
     pps.setSliceChromaQpFlag(true);
 
-    Window conformanceWindow;
-    conformanceWindow.setWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0, (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
+    Window conformanceWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0,
+                             (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
     if (pps.getPicWidthInLumaSamples() == sps0.getMaxPicWidthInLumaSamples() && pps.getPicHeightInLumaSamples() == sps0.getMaxPicHeightInLumaSamples())
     {
       pps.setConformanceWindow(sps0.getConformanceWindow());
@@ -393,11 +393,11 @@ void EncLib::init(AUWriterIf *auWriterIf)
     else
     {
       pps.setConformanceWindow(conformanceWindow);
-      pps.setConformanceWindowFlag(pps.getConformanceWindow().getWindowEnabledFlag());
+      pps.setConformanceWindowFlag(!pps.getConformanceWindow().isZero());
     }
 
-    Window scalingWindow;
-    scalingWindow.setWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0, (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
+    Window scalingWindow(0, (width - scaledWidth) / SPS::getWinUnitX(sps0.getChromaFormatIdc()), 0,
+                         (height - scaledHeight) / SPS::getWinUnitY(sps0.getChromaFormatIdc()));
     pps.setScalingWindow(scalingWindow);
 
     //register the width/height of the current pic into reference SPS
diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp
index ccd3e1f651ec9fa62308d7a6129f9845255b1ac2..914817bf118d89cbaa4523981bb48360a796c9dc 100644
--- a/source/Lib/EncoderLib/VLCWriter.cpp
+++ b/source/Lib/EncoderLib/VLCWriter.cpp
@@ -305,7 +305,7 @@ void HLSWriter::codePPS( const PPS* pcPPS )
   xWriteUvlc( pcPPS->getPicWidthInLumaSamples(), "pps_pic_width_in_luma_samples" );
   xWriteUvlc( pcPPS->getPicHeightInLumaSamples(), "pps_pic_height_in_luma_samples" );
 
-  Window conf = pcPPS->getConformanceWindow();
+  const Window& conf = pcPPS->getConformanceWindow();
   xWriteFlag(pcPPS->getConformanceWindowFlag(), "pps_conformance_window_flag");
   if (pcPPS->getConformanceWindowFlag())
   {
@@ -314,7 +314,7 @@ void HLSWriter::codePPS( const PPS* pcPPS )
     xWriteUvlc(conf.getWindowTopOffset(), "pps_conf_win_top_offset");
     xWriteUvlc(conf.getWindowBottomOffset(), "pps_conf_win_bottom_offset");
   }
-  Window scalingWindow = pcPPS->getScalingWindow();
+  const Window& scalingWindow = pcPPS->getScalingWindow();
   xWriteFlag( pcPPS->getExplicitScalingWindowFlag(), "pps_scaling_window_explicit_signalling_flag");
   if ( pcPPS->getExplicitScalingWindowFlag() )
   {
@@ -858,9 +858,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
 
   xWriteUvlc( pcSPS->getMaxPicWidthInLumaSamples(), "sps_pic_width_max_in_luma_samples" );
   xWriteUvlc( pcSPS->getMaxPicHeightInLumaSamples(), "sps_pic_height_max_in_luma_samples" );
-  Window conf = pcSPS->getConformanceWindow();
-  xWriteFlag(conf.getWindowEnabledFlag(), "sps_conformance_window_flag");
-  if (conf.getWindowEnabledFlag())
+  const Window& conf = pcSPS->getConformanceWindow();
+  xWriteFlag(!conf.isZero(), "sps_conformance_window_flag");
+  if (!conf.isZero())
   {
     xWriteUvlc(conf.getWindowLeftOffset(), "sps_conf_win_left_offset");
     xWriteUvlc(conf.getWindowRightOffset(), "sps_conf_win_right_offset");