Index: branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 505)
+++ branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 506)
@@ -471,5 +471,9 @@
     WRITE_FLAG( pcSPS->getUpdateRepFormatFlag(), "update_rep_format_flag" );
   }
+#if O0096_REP_FORMAT_INDEX
+  if( pcSPS->getLayerId() == 0 ) 
+#else
   if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 
+#endif
   {
 #endif
@@ -486,4 +490,10 @@
 #if REPN_FORMAT_IN_VPS
   }
+#if O0096_REP_FORMAT_INDEX
+  else if (pcSPS->getUpdateRepFormatFlag())
+  {
+    WRITE_CODE( pcSPS->getUpdateRepFormatIndex(), 8,   "update_rep_format_index");
+  }
+#endif
 #endif
   Window conf = pcSPS->getConformanceWindow();
@@ -499,5 +509,9 @@
 
 #if REPN_FORMAT_IN_VPS
+#if O0096_REP_FORMAT_INDEX
+  if( pcSPS->getLayerId() == 0 ) 
+#else
   if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 
+#endif  
   {
     assert( pcSPS->getBitDepthY() >= 8 );
@@ -987,5 +1001,9 @@
   if( vps->getRepFormatIdxPresentFlag() )
   {
+#if O0096_REP_FORMAT_INDEX
+    WRITE_CODE( vps->getVpsNumRepFormats() - 1, 8, "vps_num_rep_formats_minus1" );
+#else
     WRITE_CODE( vps->getVpsNumRepFormats() - 1, 4, "vps_num_rep_formats_minus1" );
+#endif
   }
   for(i = 0; i < vps->getVpsNumRepFormats(); i++)
@@ -1001,5 +1019,9 @@
       if( vps->getVpsNumRepFormats() > 1 )
       {
+#if O0096_REP_FORMAT_INDEX
+        WRITE_CODE( vps->getVpsRepFormatIdx(i), 8, "vps_rep_format_idx[i]" );
+#else
         WRITE_CODE( vps->getVpsRepFormatIdx(i), 4, "vps_rep_format_idx[i]" );
+#endif
       }
     }
@@ -1027,4 +1049,24 @@
 #if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
   WRITE_UVLC( vps->getDirectDepTypeLen()-2,                           "direct_dep_type_len_minus2");
+#if O0096_DEFAULT_DEPENDENCY_TYPE
+  WRITE_FLAG(vps->getDefaultDirectDependencyTypeFlag(), "default_direct_dependency_flag");
+  if (vps->getDefaultDirectDependencyTypeFlag())
+  {
+    WRITE_CODE( vps->getDefaultDirectDependencyType(), vps->getDirectDepTypeLen(), "default_direct_dependency_type" );
+  }
+  else
+  {
+    for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      for(j = 0; j < i; j++)
+      {
+        if (vps->getDirectDependencyFlag(i, j))
+        {
+          WRITE_CODE( vps->getDirectDependencyType(i, j), vps->getDirectDepTypeLen(), "direct_dependency_type[i][j]" );
+        }
+      }
+    }
+  }
+#else
   for(i = 1; i < vps->getMaxLayers(); i++)
   {
@@ -1037,4 +1079,5 @@
     }
   }
+#endif
 
 #if IL_SL_SIGNALLING_N0371
Index: branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 505)
+++ branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 506)
@@ -1753,4 +1753,7 @@
         pcSlice->getSPS()->getVuiParameters()->setHrdParametersPresentFlag( true );
       }
+#if O0092_0094_DEPENDENCY_CONSTRAINT
+      assert( pcSlice->getSPS()->getSPSId() == 0 || pcSlice->getSPS()->getSPSId() == m_layerId || m_pcEncTop->getVPS()->getRecursiveRefLayerFlag(m_layerId, pcSlice->getSPS()->getSPSId()) );
+#endif
       m_pcEntropyCoder->encodeSPS(pcSlice->getSPS());
       writeRBSPTrailingBits(nalu.m_Bitstream);
@@ -1766,4 +1769,7 @@
 #endif
       m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
+#if O0092_0094_DEPENDENCY_CONSTRAINT
+      assert( pcSlice->getPPS()->getPPSId() == 0 || pcSlice->getPPS()->getPPSId() == m_layerId || m_pcEncTop->getVPS()->getRecursiveRefLayerFlag(m_layerId, pcSlice->getPPS()->getPPSId()) );
+#endif
       m_pcEntropyCoder->encodePPS(pcSlice->getPPS());
       writeRBSPTrailingBits(nalu.m_Bitstream);
Index: branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 505)
+++ branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 506)
@@ -1072,4 +1072,14 @@
 #if REPN_FORMAT_IN_VPS
   Int lowestQP;
+#if O0096_REP_FORMAT_INDEX
+  if( m_layerId == 0 )
+  {
+    lowestQP = - m_cSPS.getQpBDOffsetY();
+  }
+  else
+  {
+    lowestQP = - (m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cSPS.getUpdateRepFormatFlag() ? m_cSPS.getUpdateRepFormatIndex() : m_layerId ) )->getBitDepthVpsLuma() - 8) * 6;
+  }
+#else
   if( m_layerId == 0 || m_cSPS.getUpdateRepFormatFlag() )
   {
@@ -1080,4 +1090,5 @@
     lowestQP = - (m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) )->getBitDepthVpsLuma() - 8) * 6;
   }
+#endif
 #else
   Int lowestQP = - m_cSPS.getQpBDOffsetY();
@@ -1607,7 +1618,17 @@
 Void TEncTop::xInitILRP()
 {
+#if O0096_REP_FORMAT_INDEX
+  RepFormat *repFormat = m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cSPS.getUpdateRepFormatFlag() ? m_cSPS.getUpdateRepFormatIndex() : m_layerId ) );
+#else
   RepFormat *repFormat = m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) );
+#endif
   Int bitDepthY,bitDepthC,picWidth,picHeight;
 
+#if O0096_REP_FORMAT_INDEX
+  bitDepthY   = repFormat->getBitDepthVpsLuma();
+  bitDepthC   = repFormat->getBitDepthVpsChroma();
+  picWidth    = repFormat->getPicWidthVpsInLumaSamples();
+  picHeight   = repFormat->getPicHeightVpsInLumaSamples();
+#else
   if( m_cSPS.getUpdateRepFormatFlag() )
   {
@@ -1624,4 +1645,5 @@
     picHeight   = repFormat->getPicHeightVpsInLumaSamples();
   }
+#endif
   
   if(m_layerId > 0)
