Index: branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 381)
+++ branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 382)
@@ -1671,4 +1671,13 @@
     m_maxSublayerForIlpPlus1[i] = m_uiMaxTLayers + 1;
   }
+#endif
+#if N0160_TILE_BOUNDARY_ALIGNED_FLAG
+   ::memset(m_tileBoundariesAlignedFlag,  0, sizeof(m_tileBoundariesAlignedFlag));
+#endif 
+#if N0160_VUI_EXT_ILP_REF
+   m_numIlpRestrictedRefLayers = false;
+   ::memset(m_minSpatialSegmentOffsetPlus1,  0, sizeof(m_minSpatialSegmentOffsetPlus1));
+   ::memset(m_ctuBasedOffsetEnabledFlag,     0, sizeof(m_ctuBasedOffsetEnabledFlag));
+   ::memset(m_minHorizontalCtuOffsetPlus1,   0, sizeof(m_minHorizontalCtuOffsetPlus1));
 #endif
 }
Index: branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 381)
+++ branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 382)
@@ -500,4 +500,13 @@
   Bool       m_singleLayerForNonIrapFlag;
 #endif
+#if N0160_TILE_BOUNDARY_ALIGNED_FLAG
+  Bool       m_tileBoundariesAlignedFlag[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
+#endif 
+#if N0160_VUI_EXT_ILP_REF    
+  Bool        m_numIlpRestrictedRefLayers;
+  Int         m_minSpatialSegmentOffsetPlus1[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
+  Bool        m_ctuBasedOffsetEnabledFlag   [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
+  Int         m_minHorizontalCtuOffsetPlus1 [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
+#endif 
 public:
   TComVPS();
@@ -671,4 +680,22 @@
   Void   setSingleLayerForNonIrapFlag(Bool x)                       { m_singleLayerForNonIrapFlag = x;    }
 #endif
+#if N0160_TILE_BOUNDARY_ALIGNED_FLAG  
+  Bool   getTileBoundariesAlignedFlag(Int currLayerId, Int refLayerId)           { return m_tileBoundariesAlignedFlag[currLayerId][refLayerId]; }
+  Void   setTileBoundariesAlignedFlag(Int currLayerId, Int refLayerId, Bool x)   { m_tileBoundariesAlignedFlag[currLayerId][refLayerId] = x; } 
+#endif 
+#if N0160_VUI_EXT_ILP_REF  
+  Bool  getNumIlpRestrictedRefLayers   ( )                                         { return m_numIlpRestrictedRefLayers        ;}
+  Void  setNumIlpRestrictedRefLayers   ( Int val )                                 { m_numIlpRestrictedRefLayers         = val;}
+  
+  Int  getMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId )          { return m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId];}
+  Void setMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId, Int val ) { m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId] = val;}
+  
+  Bool getCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId )            { return m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId];}
+  Void setCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId, Bool flag ) { m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId] = flag;}
+  
+  Int  getMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId )            { return m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId];}
+  Void setMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId, Int val )   { m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId] = val;}  
+#endif
+
 };
 
Index: branches/SHM-3.1-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 381)
+++ branches/SHM-3.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 382)
@@ -54,6 +54,6 @@
 #define EXTERNAL_USEDBYCURR_N0082        1      ///< N0082: final ref picture list change (encoder) //dev ver.
 #endif
-#define M0464_TILE_BOUNDARY_ALIGNED_FLAG 1      ///< VUI flag to indicate tile boundary alignment
-#define M0463_VUI_EXT_ILP_REF            1      ///< VUI extension inter-layer dependency offset signalling
+#define M0464_TILE_BOUNDARY_ALIGNED_FLAG 0      ///< VUI flag to indicate tile boundary alignment
+#define M0463_VUI_EXT_ILP_REF            0      ///< VUI extension inter-layer dependency offset signalling
 #define SPS_EXTENSION                    1      ///< Define sps_extension() syntax structure
 #define SCALED_REF_LAYER_OFFSET_FLAG     0      ///< M0309: Signal scaled reference layer offsets in SPS
@@ -78,4 +78,11 @@
 #define M0457_PREDICTION_INDICATIONS     1
 #define M0040_ADAPTIVE_RESOLUTION_CHANGE 1
+#define VPS_VUI                          1      ///< Include function structure for VPS VUI
+
+#if VPS_VUI
+#define N0160_TILE_BOUNDARY_ALIGNED_FLAG 1     ///< VPS VUI flag to indicate tile boundary alignment
+#define N0160_VUI_EXT_ILP_REF            1     ///< VUI extension inter-layer dependency offset signalling
+#endif //VPS_VUI
+
 #endif
 
Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 381)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 382)
@@ -1145,7 +1145,52 @@
   READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false);
 #endif
-}
-#endif
-
+
+  READ_FLAG( uiCode,  "vps_vui_present_flag" );
+  if (uiCode)
+  {
+#if VPS_VUI
+    parseVPSVUI(vps);
+#endif 
+  }
+}
+#endif
+
+#if VPS_VUI
+Void TDecCavlc::parseVPSVUI(TComVPS *vps)
+{
+  UInt i,j;
+  UInt uiCode;
+#if N0160_TILE_BOUNDARY_ALIGNED_FLAG
+  for(i = 1; i < vps->getMaxLayers(); i++)
+  {
+    for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
+    {
+      READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));      
+    }
+  }  
+#endif 
+#if N0160_VUI_EXT_ILP_REF
+    READ_FLAG( uiCode, "num_ilp_restricted_ref_layers" ); vps->setNumIlpRestrictedRefLayers( uiCode == 1 ); 
+  if( vps->getNumIlpRestrictedRefLayers())
+  {
+    for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
+      {
+        READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); 
+        if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 ) 
+        {  
+          READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 ); 
+          if(vps->getCtuBasedOffsetEnabledFlag(i,j))  
+          {
+            READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode ); 
+          }
+        }  
+      }  
+    }
+  }
+#endif 
+}
+#endif 
 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)
 {
Index: branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 381)
+++ branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 382)
@@ -75,4 +75,7 @@
   Void  parseVPSExtension   ( TComVPS* pcVPS );
 #endif
+#if VPS_VUI
+  Void  parseVPSVUI   ( TComVPS* pcVPS );
+#endif 
 #if SPS_SUB_LAYER_INFO
   Void  parseSPS            ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager );
Index: branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 381)
+++ branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 382)
@@ -886,4 +886,50 @@
   WRITE_FLAG(vps->getSingleLayerForNonIrapFlag(), "single_layer_for_non_irap_flag" );
 #endif
+
+#if !VPS_VUI
+  WRITE_FLAG( 0,                     "vps_vui_present_flag" );
+#else
+  WRITE_FLAG( 1,                     "vps_vui_present_flag" );
+  codeVPSVUI(vps);  
+#endif 
+}
+#endif
+
+#if VPS_VUI
+Void TEncCavlc::codeVPSVUI (TComVPS *vps)
+{
+  Int i,j;
+#if N0160_TILE_BOUNDARY_ALIGNED_FLAG
+  for(i = 1; i < vps->getMaxLayers(); i++)
+  {
+    for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
+    {
+      WRITE_FLAG( vps->getTileBoundariesAlignedFlag(i,j) ? 1 : 0 , "tile_boundaries_aligned_flag[i][j]" );
+    }
+  }  
+#endif 
+#if N0160_VUI_EXT_ILP_REF
+  WRITE_FLAG( vps->getNumIlpRestrictedRefLayers() ? 1 : 0 , "num_ilp_restricted_ref_layers" );    
+  if( vps->getNumIlpRestrictedRefLayers())
+  {
+    for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
+      {        
+        WRITE_UVLC(vps->getMinSpatialSegmentOffsetPlus1( i, j),    "min_spatial_segment_offset_plus1[i][j]");
+       
+        if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 ) 
+        {  
+          WRITE_FLAG( vps->getCtuBasedOffsetEnabledFlag( i, j) ? 1 : 0 , "ctu_based_offset_enabled_flag[i][j]" );    
+          
+          if(vps->getCtuBasedOffsetEnabledFlag(i,j))  
+          {
+            WRITE_UVLC(vps->getMinHorizontalCtuOffsetPlus1( i, j),    "min_horizontal_ctu_offset_plus1[i][j]");            
+          }
+        }  
+      }  
+    }
+  }
+#endif 
 }
 #endif
Index: branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.h	(revision 381)
+++ branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.h	(revision 382)
@@ -87,4 +87,7 @@
   Void  codeVPSExtension        ( TComVPS* pcVPS );
 #endif
+#if VPS_VUI
+  Void codeVPSVUI               (TComVPS *vps);
+#endif
   Void  codeVUI                 ( TComVUI *pcVUI, TComSPS* pcSPS );
   Void  codeSPS                 ( TComSPS* pcSPS );
