Index: branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 704)
+++ branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 705)
@@ -1223,5 +1223,5 @@
         if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers )
         {
-          printf( "NumSamplePredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
+          printf( "NumSamplePredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
           exit( EXIT_FAILURE );
         }
@@ -1232,5 +1232,5 @@
       if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers )
       {
-        printf( "NumSamplePredRefLayers: The width of some columns is not defined.\n" );
+        printf( "NumSamplePredRefLayers%d: The width of some columns is not defined.\n", layer );
         exit( EXIT_FAILURE );
       }
@@ -1254,5 +1254,5 @@
         if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers )
         {
-          printf( "NumMotionPredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
+          printf( "NumMotionPredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
           exit( EXIT_FAILURE );
         }
@@ -1263,5 +1263,5 @@
       if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers )
       {
-        printf( "NumMotionPredRefLayers: The width of some columns is not defined.\n" );
+        printf( "NumMotionPredRefLayers%d: The width of some columns is not defined.\n", layer );
         exit( EXIT_FAILURE );
       }
@@ -1293,5 +1293,5 @@
         if( i >= m_acLayerCfg[layer].m_numActiveRefLayers )
         {
-          printf( "NumActiveRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
+          printf( "NumActiveRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
           exit( EXIT_FAILURE );
         }
@@ -1302,5 +1302,5 @@
       if( i < m_acLayerCfg[layer].m_numActiveRefLayers )
       {
-        printf( "NumActiveRefLayers: The width of some columns is not defined.\n" );
+        printf( "NumActiveRefLayers%d: The width of some columns is not defined.\n", layer );
         exit( EXIT_FAILURE );
       }
Index: branches/SHM-6-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp
===================================================================
--- branches/SHM-6-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 704)
+++ branches/SHM-6-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 705)
@@ -171,5 +171,9 @@
   }
 #endif
+#if REPN_FORMAT_IN_VPS
+  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - ( m_confLeft + m_confRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confTop + m_confBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate );
+#else
   printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
+#endif
   printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
 #if O0194_DIFFERENT_BITDEPTH_EL_BL
@@ -229,4 +233,7 @@
         m_aiPad[0] = m_confRight  = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;
         m_iSourceWidth  += m_confRight;
+#if REPN_FORMAT_IN_VPS
+        m_confRight /= TComSPS::getWinUnitX( m_chromaFormatIDC );
+#endif
       }
       if (m_iSourceHeight % minCuSize)
@@ -239,4 +246,7 @@
           m_aiPad[1] = m_confBottom << 1;
         }
+#if REPN_FORMAT_IN_VPS
+        m_confBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC );
+#endif
       }
       break;
@@ -249,4 +259,8 @@
       m_confRight  = m_aiPad[0];
       m_confBottom = m_aiPad[1];
+#if REPN_FORMAT_IN_VPS
+      m_confRight /= TComSPS::getWinUnitX( m_chromaFormatIDC );
+      m_confBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC );
+#endif
       break;
     }
@@ -331,8 +345,10 @@
   xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
 
+#if !REPN_FORMAT_IN_VPS
   xConfirmPara( m_confLeft   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
   xConfirmPara( m_confRight  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
   xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
   xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
+#endif
 
 #if LAYER_CTB  
Index: branches/SHM-6-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/SHM-6-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 704)
+++ branches/SHM-6-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 705)
@@ -1326,5 +1326,5 @@
   if(vps->getMaxLayers() > MAX_REF_LAYERS)
   {
-    for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
+    for(UInt layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     {
       assert( vps->getNumRefLayers(vps->getLayerIdInNuh(layerCtr)) <= MAX_REF_LAYERS);
Index: branches/SHM-6-dev/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 704)
+++ branches/SHM-6-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 705)
@@ -3504,6 +3504,7 @@
   Int topStartL  = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowTopOffset();
 #if Q0200_CONFORMANCE_BL_SIZE
-  leftStartL += baseColPic->getConformanceWindow().getWindowLeftOffset();
-  topStartL  += baseColPic->getConformanceWindow().getWindowTopOffset();
+  Int chromaFormatIdc = baseColPic->getSlice(0)->getChromaFormatIdc();
+  leftStartL += baseColPic->getConformanceWindow().getWindowLeftOffset() * TComSPS::getWinUnitX( chromaFormatIdc );
+  topStartL  += baseColPic->getConformanceWindow().getWindowTopOffset() * TComSPS::getWinUnitY( chromaFormatIdc );
 #endif
 #else
Index: branches/SHM-6-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp	(revision 704)
+++ branches/SHM-6-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp	(revision 705)
@@ -137,7 +137,11 @@
 
 #if Q0200_CONFORMANCE_BL_SIZE
+  Int chromaFormatIdc = currSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
   const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
-  widthBL  -= confBL.getWindowLeftOffset() + confBL.getWindowRightOffset();
-  heightBL -= confBL.getWindowBottomOffset() + confBL.getWindowTopOffset();
+  Int xScal = TComSPS::getWinUnitX( chromaFormatIdc );
+  Int yScal = TComSPS::getWinUnitY( chromaFormatIdc );
+
+  widthBL  -= ( confBL.getWindowLeftOffset() + confBL.getWindowRightOffset() ) * xScal;
+  heightBL -= ( confBL.getWindowBottomOffset() + confBL.getWindowTopOffset() ) * yScal;
 #endif
 #if P0312_VERT_PHASE_ADJ
@@ -301,23 +305,23 @@
     Int   addY = ( ( phaseY * scaleY + 2 ) >> 2 ) + ( 1 << ( shiftY - 5 ) );
 #else
-    Int   addX       = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
-    Int   addY       = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
+    Int   addX = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
+    Int   addY = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
 #endif
 
 #if Q0120_PHASE_CALCULATION
-    Int   deltaX     = (Int)phaseAlignFlag <<3;
-    Int   deltaY     = (((Int)phaseAlignFlag <<3)>>(Int)vertPhasePositionEnableFlag) + ((Int)vertPhasePositionFlag<<3);
-#else
-    Int   deltaX     = 4 * phaseX;
-    Int   deltaY     = 4 * phaseY;
+    Int   deltaX = (Int)phaseAlignFlag <<3;
+    Int   deltaY = (((Int)phaseAlignFlag <<3)>>(Int)vertPhasePositionEnableFlag) + ((Int)vertPhasePositionFlag<<3);
+#else
+    Int   deltaX = 4 * phaseX;
+    Int   deltaY = 4 * phaseY;
 #endif
     Int shiftXM4 = shiftX - 4;
     Int shiftYM4 = shiftY - 4;
 
-    widthEL   = pcUsPic->getWidth ();
-    heightEL  = pcUsPic->getHeight();
-
-    widthBL   = pcBasePic->getWidth ();
-    heightBL  = min<Int>( pcBasePic->getHeight(), heightEL );
+    widthEL  = pcUsPic->getWidth ();
+    heightEL = pcUsPic->getHeight();
+
+    widthBL  = pcBasePic->getWidth ();
+    heightBL = min<Int>( pcBasePic->getHeight(), heightEL );
 
     Int leftStartL = scalEL.getWindowLeftOffset();
@@ -327,6 +331,6 @@
     Int leftOffset = leftStartL > 0 ? leftStartL : 0;
 #if Q0200_CONFORMANCE_BL_SIZE
-    leftStartL += confBL.getWindowLeftOffset() << 4;
-    topStartL  += confBL.getWindowTopOffset() << 4;
+    leftStartL += ( confBL.getWindowLeftOffset() * xScal ) << 4;
+    topStartL  += ( confBL.getWindowTopOffset() * yScal ) << 4;
 #endif
 #if N0214_INTERMEDIATE_BUFFER_16BITS
@@ -424,6 +428,6 @@
     heightBL  = pcBasePic->getHeight();
 #if Q0200_CONFORMANCE_BL_SIZE
-    widthBL  -= confBL.getWindowLeftOffset() + confBL.getWindowRightOffset();
-    heightBL -= confBL.getWindowBottomOffset() + confBL.getWindowTopOffset();
+    widthBL  -= ( confBL.getWindowLeftOffset() + confBL.getWindowRightOffset() ) * xScal;
+    heightBL -= ( confBL.getWindowBottomOffset() + confBL.getWindowTopOffset() ) * yScal;
 #endif
     widthEL   = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
@@ -447,6 +451,6 @@
     leftOffset = leftStartC > 0 ? leftStartC : 0;
 #if Q0200_CONFORMANCE_BL_SIZE
-    leftStartC += ( confBL.getWindowLeftOffset() >> 1 ) << 4;
-    topStartC  += ( confBL.getWindowTopOffset() >> 1 ) << 4;
+    leftStartC += ( ( confBL.getWindowLeftOffset() * xScal ) >> 1 ) << 4;
+    topStartC  += ( ( confBL.getWindowTopOffset() * yScal ) >> 1 ) << 4;
 #endif
     shiftX = 16;
Index: branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 704)
+++ branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 705)
@@ -1556,16 +1556,8 @@
         Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
 #if Q0200_CONFORMANCE_BL_SIZE
-        Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
-#if REPN_FORMAT_IN_VPS 
-UInt chromaFormatIdc =  pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
-Int xScal = TComSPS::getWinUnitX( chromaFormatIdc );
-Int yScal = TComSPS::getWinUnitY( chromaFormatIdc );
-confBL.setWindowBottomOffset(confBL.getWindowBottomOffset()*yScal);
-confBL.setWindowTopOffset(confBL.getWindowTopOffset()*yScal);
-confBL.setWindowLeftOffset(confBL.getWindowLeftOffset()*xScal);
-confBL.setWindowRightOffset(confBL.getWindowRightOffset()*xScal);
-#endif
-        widthBL  -= confBL.getWindowLeftOffset() + confBL.getWindowRightOffset();
-        heightBL -= confBL.getWindowTopOffset() + confBL.getWindowBottomOffset();
+        Int chromaFormatIdc = pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
+        const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getConformanceWindow(); 
+        widthBL  -= ( confBL.getWindowLeftOffset() + confBL.getWindowRightOffset() ) * TComSPS::getWinUnitX( chromaFormatIdc );
+        heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc );
 #endif
         Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
@@ -1628,10 +1620,4 @@
         }
         pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );
-#if REPN_FORMAT_IN_VPS && Q0200_CONFORMANCE_BL_SIZE
-confBL.setWindowBottomOffset(confBL.getWindowBottomOffset()/yScal);
-confBL.setWindowTopOffset(confBL.getWindowTopOffset()/yScal);
-confBL.setWindowLeftOffset(confBL.getWindowLeftOffset()/xScal);
-confBL.setWindowRightOffset(confBL.getWindowRightOffset()/xScal);
-#endif
 #endif
       }
Index: branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 704)
+++ branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 705)
@@ -509,8 +509,15 @@
   if (conf.getWindowEnabledFlag())
   {
+#if REPN_FORMAT_IN_VPS
+    WRITE_UVLC( conf.getWindowLeftOffset(),   "conf_win_left_offset"   );
+    WRITE_UVLC( conf.getWindowRightOffset(),  "conf_win_right_offset"  );
+    WRITE_UVLC( conf.getWindowTopOffset(),    "conf_win_top_offset"    );
+    WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_bottom_offset" );
+#else
     WRITE_UVLC( conf.getWindowLeftOffset()   / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_left_offset" );
     WRITE_UVLC( conf.getWindowRightOffset()  / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_right_offset" );
     WRITE_UVLC( conf.getWindowTopOffset()    / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_top_offset" );
     WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" );
+#endif
   }
 
Index: branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 704)
+++ branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 705)
@@ -1049,7 +1049,8 @@
         Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
 #if Q0200_CONFORMANCE_BL_SIZE
-        const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getConformanceWindow(); 
-        widthBL  -= confBL.getWindowLeftOffset() + confBL.getWindowRightOffset();
-        heightBL -= confBL.getWindowTopOffset() + confBL.getWindowBottomOffset();
+        Int chromaFormatIdc = pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
+        const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
+        widthBL  -= ( confBL.getWindowLeftOffset() + confBL.getWindowRightOffset() ) * TComSPS::getWinUnitX( chromaFormatIdc );
+        heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc );
 #endif
         Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
