Index: branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 288)
@@ -345,8 +345,14 @@
 #endif
 #if SCALED_REF_LAYER_OFFSETS
-  Int*    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
-  Int*    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
-  Int*    cfg_scaledRefLayerRightOffset [MAX_LAYERS];
-  Int*    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
+  string    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
+  string    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
+  string    cfg_scaledRefLayerRightOffset [MAX_LAYERS];
+  string    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
+  Int*      cfg_numScaledRefLayerOffsets[MAX_LAYERS];
+
+  string*    cfg_scaledRefLayerLeftOffsetPtr   [MAX_LAYERS];
+  string*    cfg_scaledRefLayerTopOffsetPtr    [MAX_LAYERS];
+  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
+  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
 #endif
 #if RC_SHVC_HARMONIZATION
@@ -376,8 +382,12 @@
 #endif
 #if SCALED_REF_LAYER_OFFSETS
-    cfg_scaledRefLayerLeftOffset  [layer] = &m_acLayerCfg[layer].m_scaledRefLayerLeftOffset;
-    cfg_scaledRefLayerTopOffset   [layer] = &m_acLayerCfg[layer].m_scaledRefLayerTopOffset;
-    cfg_scaledRefLayerRightOffset [layer] = &m_acLayerCfg[layer].m_scaledRefLayerRightOffset;
-    cfg_scaledRefLayerBottomOffset[layer] = &m_acLayerCfg[layer].m_scaledRefLayerBottomOffset;
+    cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets;
+    for(Int i = 0; i < MAX_LAYERS; i++)
+    {
+      cfg_scaledRefLayerLeftOffsetPtr  [layer] = &cfg_scaledRefLayerLeftOffset[layer]  ;
+      cfg_scaledRefLayerTopOffsetPtr   [layer] = &cfg_scaledRefLayerTopOffset[layer]   ;
+      cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer] ;
+      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
+    }
 #endif
 #if RC_SHVC_HARMONIZATION
@@ -452,11 +462,12 @@
   ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
 #if SCALED_REF_LAYER_OFFSETS
-  ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffset,  0, MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
+  ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
+  ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
                                                                  " top-left luma sample of the EL picture, in units of two luma samples")
-  ("ScaledRefLayerTopOffset%d",    cfg_scaledRefLayerTopOffset,   0, MAX_LAYERS,   "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
+  ("ScaledRefLayerTopOffset%d",    cfg_scaledRefLayerTopOffsetPtr,   string(""), MAX_LAYERS,   "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
                                                                  " top-left luma sample of the EL picture, in units of two luma samples")
-  ("ScaledRefLayerRightOffset%d",  cfg_scaledRefLayerRightOffset, 0, MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
+  ("ScaledRefLayerRightOffset%d",  cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
                                                                  " bottom-right luma sample of the EL picture, in units of two luma samples")
-  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffset,0, MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
+  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
                                                                  " bottom-right luma sample of the EL picture, in units of two luma samples")
 #endif
@@ -892,4 +903,75 @@
     m_pRowHeight = NULL;
   }
+#if SCALED_REF_LAYER_OFFSETS
+  for(Int layer = 0; layer < MAX_LAYERS; layer++)
+  {
+    // If number of scaled ref. layer offsets is non-zero, at least one of the offsets should be specified
+    if(m_acLayerCfg[layer].m_numScaledRefLayerOffsets)
+    {
+      assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  "") ||
+              strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") ||
+              strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),   "") ||
+              strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"")
+            ); 
+    }
+
+    Int *tempArray = NULL;   // Contain the value 
+    // Left offset //
+    if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  ""))
+    {
+      cfgStringToArray( &tempArray, cfg_scaledRefLayerLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "LeftOffset");
+      if(tempArray)
+      {
+        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
+        {
+          m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i] = tempArray[i];
+        }
+        delete [] tempArray; tempArray = NULL;
+      }
+    }
+
+    // Top offset //
+    if(strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),  ""))
+    {
+      cfgStringToArray( &tempArray, cfg_scaledRefLayerTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "TopOffset");
+      if(tempArray)
+      {
+        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
+        {
+          m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i] = tempArray[i];
+        }
+        delete [] tempArray; tempArray = NULL;
+      }
+    }
+
+    // Right offset //
+    if(strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(),  ""))
+    {
+      cfgStringToArray( &tempArray, cfg_scaledRefLayerRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RightOffset");
+      if(tempArray)
+      {
+        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
+        {
+          m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i] = tempArray[i];
+        }
+        delete [] tempArray; tempArray = NULL;
+      }
+    }
+
+    // Bottom offset //
+    if(strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),  ""))
+    {
+      cfgStringToArray( &tempArray, cfg_scaledRefLayerBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "BottomOffset");
+      if(tempArray)
+      {
+        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
+        {
+          m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i] = tempArray[i];
+        }
+        delete [] tempArray; tempArray = NULL;
+      }
+    }
+  }
+#endif
 #if VPS_EXTN_DIRECT_REF_LAYERS
   for(Int layer = 0; layer < MAX_LAYERS; layer++)
@@ -2096,3 +2178,37 @@
 }
 
+#if SCALED_REF_LAYER_OFFSETS
+Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString)
+{
+  Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str());
+  if( numEntries > 0 )
+  {
+    Char *arrayEntry;
+    Int i = 0;
+    *arr = new Int[numEntries];
+
+    arrayEntry = strtok( tempChar, " ,");
+    while(arrayEntry != NULL)
+    {
+      if( i >= numEntries )
+      {
+        printf( "%c: The number of entries specified is larger than the allowed number.\n", logString );
+        exit( EXIT_FAILURE );
+      }
+      *( *arr + i ) = atoi( arrayEntry );
+      arrayEntry = strtok(NULL, " ,");
+      i++;
+    }
+    if( i < numEntries )
+    {
+      printf( "%c: Some entries are not specified.\n", logString );
+      exit( EXIT_FAILURE );
+    }
+  }
+  else
+  {
+    *arr = NULL;
+  }
+}
+#endif
 //! \}
Index: branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 287)
+++ branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.h	(revision 288)
@@ -390,4 +390,7 @@
   Char* getBLSyntaxFile()           { return m_BLSyntaxFile;      }
 #endif
+#if SCALED_REF_LAYER_OFFSETS
+  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
+#endif
 #endif
 };// END CLASS DEFINITION TAppEncCfg
Index: branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp
===================================================================
--- branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 288)
@@ -35,4 +35,11 @@
   m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
   m_aiPad[1] = m_aiPad[0] = 0;
+#if SCALED_REF_LAYER_OFFSETS
+  m_numScaledRefLayerOffsets = 0;
+  ::memset(m_scaledRefLayerLeftOffset,   0, sizeof(m_scaledRefLayerLeftOffset));
+  ::memset(m_scaledRefLayerTopOffset,    0, sizeof(m_scaledRefLayerTopOffset));
+  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
+  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
+#endif
 }
 
Index: branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
===================================================================
--- branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.h	(revision 287)
+++ branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.h	(revision 288)
@@ -68,8 +68,9 @@
   TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
 #if SCALED_REF_LAYER_OFFSETS
-  Int       m_scaledRefLayerLeftOffset;
-  Int       m_scaledRefLayerTopOffset;
-  Int       m_scaledRefLayerRightOffset;
-  Int       m_scaledRefLayerBottomOffset;
+  Int       m_numScaledRefLayerOffsets  ;
+  Int       m_scaledRefLayerLeftOffset  [MAX_LAYERS];
+  Int       m_scaledRefLayerTopOffset   [MAX_LAYERS];
+  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
+  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
 #endif  
 public:
Index: branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 288)
@@ -451,6 +451,10 @@
     if( layer > 0 )
     {
-      m_acTEncTop[layer].getScaledRefLayerWindow().setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset, 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset,
-                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset, 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset);  
+      m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
+      for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
+      {
+        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
+                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);  
+      }
     }
 #endif
Index: branches/SHM-2.1-dev/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 288)
@@ -4270,6 +4270,6 @@
 #if SIMPLIFIED_MV_POS_SCALING
 #if SCALED_REF_LAYER_OFFSETS
-  Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowLeftOffset();
-  Int topStartL  = this->getSlice()->getSPS()->getScaledRefLayerWindow().getWindowTopOffset();
+  Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset();
+  Int topStartL  = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
   Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
   Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
Index: branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 288)
@@ -580,5 +580,5 @@
     {
       Int numResampler = 0;
-      const Window &scalEL = getSPS()->getScaledRefLayerWindow();
+      const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]);
       Int scalingOffset = ((scalEL.getWindowLeftOffset()   == 0 ) && 
                            (scalEL.getWindowRightOffset()  == 0 ) && 
@@ -1765,4 +1765,7 @@
 #if SVC_EXTENSION
 , m_layerId(0)
+#endif
+#if SCALED_REF_LAYER_OFFSETS
+, m_numScaledRefLayerOffsets  (0)
 #endif
 {
Index: branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 288)
@@ -1029,5 +1029,6 @@
 #endif
 #if SCALED_REF_LAYER_OFFSETS
-  Window      m_scaledRefLayerWindow;
+  UInt        m_numScaledRefLayerOffsets;
+  Window      m_scaledRefLayerWindow[MAX_LAYERS];
 #endif
 public:
@@ -1171,5 +1172,7 @@
 #endif
 #if SCALED_REF_LAYER_OFFSETS
-  Window&  getScaledRefLayerWindow(     )   { return m_scaledRefLayerWindow; }
+  UInt     getNumScaledRefLayerOffsets()  { return m_numScaledRefLayerOffsets; }
+  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x; }
+  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
 #endif
 };
Index: branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 288)
@@ -45,5 +45,5 @@
 #if SVC_EXTENSION
 #define SPS_EXTENSION                    1      ///< Define sps_extension() syntax structure
-#define SCALED_REF_LAYER_OFFSET_FLAG     1      ///< M0309: Signal scaled reference layer offsets in SPS
+#define SCALED_REF_LAYER_OFFSET_FLAG     0      ///< M0309: Signal scaled reference layer offsets in SPS
 #define SCALED_REF_LAYER_OFFSETS         1      ///< M0309: Signal scaled reference layer offsets in SPS
 #define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
Index: branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 288)
@@ -764,10 +764,14 @@
 #endif
   {
-    Int iCode;
-    Window& scaledWindow = pcSPS->getScaledRefLayerWindow();
-    READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
-    READ_SVLC( iCode, "scaled_ref_layer_top_offset" );     scaledWindow.setWindowTopOffset   (iCode << 1);
-    READ_SVLC( iCode, "scaled_ref_layer_right_offset" );   scaledWindow.setWindowRightOffset (iCode << 1);
-    READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" );  scaledWindow.setWindowBottomOffset(iCode << 1);
+    Int iCode; 
+    READ_UVLC( uiCode,      "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets(uiCode);
+    for(Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets(); i++)
+    {
+      Window& scaledWindow = pcSPS->getScaledRefLayerWindow(i);
+      READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
+      READ_SVLC( iCode, "scaled_ref_layer_top_offset" );     scaledWindow.setWindowTopOffset   (iCode << 1);
+      READ_SVLC( iCode, "scaled_ref_layer_right_offset" );   scaledWindow.setWindowRightOffset (iCode << 1);
+      READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" );  scaledWindow.setWindowBottomOffset(iCode << 1);
+    }
   }
 #endif
Index: branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 288)
@@ -255,5 +255,5 @@
       for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ )
       {
-        const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow();
+        const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(i);
         Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
 
@@ -865,5 +865,5 @@
 #if SIMPLIFIED_MV_POS_SCALING
 #if SCALED_REF_LAYER_OFFSETS
-        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow();
+        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
 
         Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
@@ -893,5 +893,5 @@
         {    
 #if SCALED_REF_LAYER_OFFSETS
-          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() );
+          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
 #else
           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() );
Index: branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 288)
@@ -584,9 +584,13 @@
 #endif
   {
-    Window scaledWindow = pcSPS->getScaledRefLayerWindow();
-    WRITE_SVLC( scaledWindow.getWindowLeftOffset()   >> 1, "scaled_ref_layer_left_offset" );
-    WRITE_SVLC( scaledWindow.getWindowTopOffset()    >> 1, "scaled_ref_layer_top_offset" );
-    WRITE_SVLC( scaledWindow.getWindowRightOffset()  >> 1, "scaled_ref_layer_right_offset" );
-    WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" );
+    WRITE_UVLC( pcSPS->getNumScaledRefLayerOffsets(),      "num_scaled_ref_layer_offsets" );
+    for(Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets(); i++)
+    {
+      Window scaledWindow = pcSPS->getScaledRefLayerWindow(i);
+      WRITE_SVLC( scaledWindow.getWindowLeftOffset()   >> 1, "scaled_ref_layer_left_offset" );
+      WRITE_SVLC( scaledWindow.getWindowTopOffset()    >> 1, "scaled_ref_layer_top_offset" );
+      WRITE_SVLC( scaledWindow.getWindowRightOffset()  >> 1, "scaled_ref_layer_right_offset" );
+      WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" );
+    }
   }
 #endif
Index: branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 288)
@@ -547,5 +547,5 @@
 #if SIMPLIFIED_MV_POS_SCALING
 #if SCALED_REF_LAYER_OFFSETS
-        const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow();
+        const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(refLayerIdc);
 
         Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
@@ -575,5 +575,5 @@
         { 
 #if SCALED_REF_LAYER_OFFSETS
-          m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() );
+          m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
 #else
           m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() );
Index: branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 288)
@@ -89,4 +89,7 @@
   m_bMFMEnabledFlag = false;
 #endif
+#if SCALED_REF_LAYER_OFFSETS
+  m_numScaledRefLayerOffsets = 0;
+#endif
 }
 
@@ -509,5 +512,5 @@
         for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ )
         {
-          const Window scalEL = getSPS()->getScaledRefLayerWindow();
+          const Window scalEL = getSPS()->getScaledRefLayerWindow(i);
           Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
 
@@ -546,5 +549,5 @@
         for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ )
         {
-          const Window scalEL = getSPS()->getScaledRefLayerWindow();
+          const Window scalEL = getSPS()->getScaledRefLayerWindow(i);
           Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
 
@@ -599,5 +602,9 @@
 #endif
 #if SCALED_REF_LAYER_OFFSETS
-  m_cSPS.getScaledRefLayerWindow() = m_scaledRefLayerWindow;
+  m_cSPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets);
+  for(Int i = 0; i < m_cSPS.getNumScaledRefLayerOffsets(); i++)
+  {
+    m_cSPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i];
+  }
 #endif
   ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL();
Index: branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.h	(revision 287)
+++ branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.h	(revision 288)
@@ -140,5 +140,6 @@
 #endif
 #if SCALED_REF_LAYER_OFFSETS
-  Window                  m_scaledRefLayerWindow;
+  UInt                    m_numScaledRefLayerOffsets;
+  Window                  m_scaledRefLayerWindow[MAX_LAYERS];
 #endif
 protected:
@@ -207,5 +208,7 @@
 #endif
 #if SCALED_REF_LAYER_OFFSETS
-  Window&  getScaledRefLayerWindow()            { return m_scaledRefLayerWindow; }
+  Void                    setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; }
+  UInt                    getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; }
+  Window&  getScaledRefLayerWindow(Int x)            { return m_scaledRefLayerWindow[x]; }
 #endif
 
