Index: branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 282)
+++ 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 282)
+++ 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 282)
+++ 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 282)
+++ 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 282)
+++ 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
