Index: /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 503)
+++ /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 504)
@@ -1834,4 +1834,14 @@
   TComVPS *vps = getVPS();
   UInt retVal, layerId = getLayerId();
+#if O0096_REP_FORMAT_INDEX
+  if ( layerId == 0 )
+  {
+    retVal = sps->getPicWidthInLumaSamples();
+  }
+  else
+  {
+    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getPicWidthVpsInLumaSamples();
+  }
+#else
   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
   {
@@ -1842,4 +1852,5 @@
     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getPicWidthVpsInLumaSamples();
   }
+#endif
   return retVal;
 }
@@ -1849,4 +1860,14 @@
   TComVPS *vps = getVPS();
   UInt retVal, layerId = getLayerId();
+#if O0096_REP_FORMAT_INDEX
+  if( layerId == 0 )
+  {
+    retVal = sps->getPicHeightInLumaSamples();
+  }
+  else
+  {
+    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getPicHeightVpsInLumaSamples();
+  }
+#else
   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
   {
@@ -1857,4 +1878,5 @@
     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getPicHeightVpsInLumaSamples();
   }
+#endif
   return retVal;
 }
@@ -1873,4 +1895,14 @@
   UInt retVal, layerId = getLayerId();
 #endif
+#if O0096_REP_FORMAT_INDEX
+  if( layerId == 0 )
+  {
+    retVal = sps->getChromaFormatIdc();
+  }
+  else
+  {
+    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getChromaFormatVpsIdc();
+  }
+#else
   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
   {
@@ -1881,4 +1913,5 @@
     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc();
   }
+#endif
   return retVal;
 }
@@ -1888,4 +1921,14 @@
   TComVPS *vps = getVPS();
   UInt retVal, layerId = getLayerId();
+#if O0096_REP_FORMAT_INDEX
+  if( layerId == 0 )
+  {
+    retVal = sps->getBitDepthY();
+  }
+  else
+  {
+    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getBitDepthVpsLuma();
+  }
+#else
   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
   {
@@ -1896,4 +1939,5 @@
     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma();
   }
+#endif
   return retVal;
 }
@@ -1903,4 +1947,14 @@
   TComVPS *vps = getVPS();
   UInt retVal, layerId = getLayerId();
+#if O0096_REP_FORMAT_INDEX
+  if( layerId == 0 )
+  {
+    retVal = sps->getBitDepthC();
+  }
+  else
+  {
+    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getBitDepthVpsChroma();
+  }
+#else
   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
   {
@@ -1911,4 +1965,5 @@
     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma();
   }
+#endif
   return retVal;
 }
@@ -2065,4 +2120,14 @@
   ::memset(m_viewIdVal, 0, sizeof(m_viewIdVal));
 #endif
+#if O0092_0094_DEPENDENCY_CONSTRAINT
+  for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++)
+  {
+    m_numberRefLayers[i] = 0;
+    for (Int j = 0; j < MAX_NUM_LAYER_IDS; j++)
+    {
+      m_recursiveRefLayerFlag[i][j] = 0;
+    }
+  }
+#endif
 }
 #else
@@ -2136,4 +2201,32 @@
   }
   return false;        
+}
+#endif
+
+#if O0092_0094_DEPENDENCY_CONSTRAINT
+Void TComVPS::setRefLayersFlags(Int currLayerId)
+{
+  for (Int i = 0; i < getNumDirectRefLayers(currLayerId); i++)
+  {
+    UInt refLayerId = getRefLayerId(currLayerId, i);
+    setRecursiveRefLayerFlag(currLayerId, refLayerId, true);
+    for (Int k = 0; k < MAX_NUM_LAYER_IDS; k++)
+    {
+      setRecursiveRefLayerFlag(currLayerId, k, (getRecursiveRefLayerFlag(currLayerId, k) | getRecursiveRefLayerFlag(refLayerId, k)));
+    }
+  }
+}
+
+Void TComVPS::setNumRefLayers(Int currLayerId)
+{
+  for (Int i = 0; i <= getMaxLayers(); i++)
+  {
+    UInt iNuhLId = getLayerIdInNuh(i);
+    setRefLayersFlags(iNuhLId);
+    for (UInt j = 0; j < MAX_NUM_LAYER_IDS; j++)
+    {
+      m_numberRefLayers[iNuhLId] += (getRecursiveRefLayerFlag(iNuhLId, j) == true ? 1 : 0);
+    }
+  }
 }
 #endif
@@ -2224,4 +2317,7 @@
 #if REPN_FORMAT_IN_VPS
 , m_updateRepFormatFlag       (false)
+#if O0096_REP_FORMAT_INDEX
+, m_updateRepFormatIndex      (0)
+#endif
 #endif
 #endif //SVC_EXTENSION
Index: /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 503)
+++ /branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 504)
@@ -563,4 +563,8 @@
 #if M0457_PREDICTION_INDICATIONS
   UInt       m_directDepTypeLen;
+#if O0096_DEFAULT_DEPENDENCY_TYPE
+  Bool       m_defaultDirectDependencyTypeFlag;
+  UInt       m_defaultDirectDependencyType;
+#endif
   UInt       m_directDependencyType[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
 #endif
@@ -626,4 +630,9 @@
   Bool       m_phaseAlignFlag;
 #endif
+
+#if O0092_0094_DEPENDENCY_CONSTRAINT
+  Int        m_numberRefLayers[MAX_NUM_LAYER_IDS];  // number of direct and indirect reference layers of a coding layer
+  Bool       m_recursiveRefLayerFlag[MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];  // flag to indicate if j-th layer is a direct or indirect reference layer of i-th layer
+#endif
 #endif //SVC_EXTENSION
 public:
@@ -698,4 +707,11 @@
 #endif
 
+#if O0092_0094_DEPENDENCY_CONSTRAINT
+  Void    setRefLayersFlags(Int currLayerId);
+  Bool    getRecursiveRefLayerFlag(Int currLayerId, Int refLayerId)              { return m_recursiveRefLayerFlag[currLayerId][refLayerId];}
+  Void    setRecursiveRefLayerFlag(Int currLayerId, Int refLayerId, Bool x)      { m_recursiveRefLayerFlag[currLayerId][refLayerId] = x;   }
+  Int     getNumRefLayers(Int currLayerId)                                       { return m_numberRefLayers[currLayerId];                  }
+  Void    setNumRefLayers(Int currLayerId);
+#endif
 #if VPS_RENAME
   UInt    getMaxLayerId()                                       { return m_maxLayerId; }
@@ -772,5 +788,10 @@
   UInt   getDirectDepTypeLen()                                                  { return m_directDepTypeLen;                              }
   Void   setDirectDepTypeLen(UInt x)                                            { m_directDepTypeLen = x;                                 }
-
+#if O0096_DEFAULT_DEPENDENCY_TYPE
+  Bool   getDefaultDirectDependencyTypeFlag()                                   { return m_defaultDirectDependencyTypeFlag;               }
+  Void   setDefaultDirectDependecyTypeFlag(Bool x)                              { m_defaultDirectDependencyTypeFlag = x;                  }
+  UInt   getDefaultDirectDependencyType()                                       { return m_defaultDirectDependencyType;                   }
+  Void   setDefaultDirectDependecyType(UInt x)                                  { m_defaultDirectDependencyType = x;                      }
+#endif
   UInt   getDirectDependencyType(Int currLayerId, Int refLayerId)               { return m_directDependencyType[currLayerId][refLayerId]; }
   Void   setDirectDependencyType(Int currLayerId, Int refLayerId, UInt x)       { m_directDependencyType[currLayerId][refLayerId] = x;    }
@@ -1209,4 +1230,7 @@
 #if REPN_FORMAT_IN_VPS
   Bool m_updateRepFormatFlag;
+#if O0096_REP_FORMAT_INDEX
+  UInt m_updateRepFormatIndex;
+#endif
 #endif
 #endif //SVC_EXTENSION
@@ -1392,4 +1416,8 @@
   Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
   Void     setUpdateRepFormatFlag(Bool x) { m_updateRepFormatFlag = x;    }
+#if O0096_REP_FORMAT_INDEX
+  Int      getUpdateRepFormatIndex()      { return m_updateRepFormatIndex; }
+  Void     setUpdateRepFormatIndex(UInt index)  { m_updateRepFormatIndex = index; }
+#endif
 #endif
 #endif //SVC_EXTENSION
Index: /branches/SHM-4.1-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-4.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 503)
+++ /branches/SHM-4.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 504)
@@ -168,4 +168,11 @@
 #define O0062_POC_LSB_NOT_PRESENT_FLAG   1      ///< JCTVC-O0062: signal poc_lsb_not_present_flag for each layer in VPS extension
 #define SHM_FIX7                         1      ///< fix for SHVC WD ticket #7
+
+#define O0092_0094_DEPENDENCY_CONSTRAINT 1      ///< JCTVC-O0092: constraint on the layer_id of SPS/PPS
+#if O0092_0094_DEPENDENCY_CONSTRAINT
+#define MAX_REF_LAYERS                   7
+#endif
+#define O0096_REP_FORMAT_INDEX           1      ///< JCTVC-O0096: identify SPS rep_format() with an index into the lists of formats in VPS extension.
+#define O0096_DEFAULT_DEPENDENCY_TYPE    1      ///< JCTVC-O0096: specify default dependency type for all direct reference layers
 
 #else
