Index: /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 856)
+++ /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 857)
@@ -1752,5 +1752,7 @@
 
   m_avcBaseLayerFlag = false;
-#if !H_MV_HLS7_GEN
+#if H_MV_HLS_7_VPS_P0307_23
+  m_vpsNonVuiExtensionLength = 0;
+#else
   m_vpsVuiOffset     = 0; 
 #endif
Index: /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 856)
+++ /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 857)
@@ -768,5 +768,7 @@
   /// VPS EXTENSION SYNTAX ELEMENTS
   Bool        m_avcBaseLayerFlag;
-#if !H_MV_HLS7_GEN
+#if H_MV_HLS_7_VPS_P0307_23
+  Int         m_vpsNonVuiExtensionLength;
+#else
   Int         m_vpsVuiOffset;
 #endif
@@ -829,5 +831,4 @@
 #if H_MV_HLS7_GEN
   Int         m_directDependencyType     [MAX_NUM_LAYERS] [MAX_NUM_LAYERS];
-  Int         m_vpsNonVuiExtensionLength;
 #endif
   Bool        m_vpsVuiPresentFlag;
@@ -973,5 +974,8 @@
   Bool    getAvcBaseLayerFlag()                                            { return m_avcBaseLayerFlag; } 
 
-#if !H_MV_HLS7_GEN
+#if H_MV_HLS_7_VPS_P0307_23
+  Void    setVpsNonVuiExtensionLength( Int  val )                          { m_vpsNonVuiExtensionLength = val; } 
+  Int     getVpsNonVuiExtensionLength(  )                                  { return m_vpsNonVuiExtensionLength; } 
+#else
   Void    setVpsVuiOffset( Int  val )                                      { m_vpsVuiOffset = val; } 
   Int     getVpsVuiOffset(  )                                              { return m_vpsVuiOffset; } 
@@ -1140,9 +1144,4 @@
   Void    setDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps, Int val) { m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ] = val; } 
   Int     getDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps)   { return m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ]; } 
-
-#if H_MV_HLS7_GEN
-  Void    setVpsNonVuiExtensionLength( Int  val )                          { m_vpsNonVuiExtensionLength = val; } 
-  Int     getVpsNonVuiExtensionLength(  )                                  { return m_vpsNonVuiExtensionLength; } 
-#endif
 
   Void    setVpsVuiPresentFlag( Bool flag )                                { m_vpsVuiPresentFlag = flag; } 
Index: /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 856)
+++ /branches/HTM-10.0-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 857)
@@ -336,5 +336,5 @@
 // #define H_MV_HLS_7_SEI_P0133_28           0 // (SEI/P0133/Recovery point SEI) #28 Decision: Adopt change to recover point semantics only (-v3)
 #define H_MV_HLS_7_VPS_P0125_24           1 // (VPS/P0125/VPS extension offset ) #24 Decision: Keep it as a reserved FFFF value. 
-// #define H_MV_HLS_7_VPS_P0307_23           0 // (VPS/P0307/VPS VUI extension)  #23 Decision: Adopt modification in P0307.
+#define H_MV_HLS_7_VPS_P0307_23           1 // (VPS/P0307/VPS VUI extension)  #23 Decision: Adopt modification in P0307.
 // #define H_MV_HLS_7_POC_P0041_3            0 // (POC/P0041/POC reset) #3 It was remarked that we should require each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture. This was agreed. Decision: Adopt (with constraint for discardable_flag as described above) 
 // #define H_MV_HLS_7_POC_P0041_FIXES        0 // (POC/P0041/Fixes) For each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture. 
Index: /branches/HTM-10.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-10.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 856)
+++ /branches/HTM-10.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 857)
@@ -1211,5 +1211,6 @@
   UInt uiCode; 
   READ_FLAG( uiCode, "avc_base_layer_flag" );                     pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false );
-#if !H_MV_HLS7_GEN
+
+#if !H_MV_HLS_7_VPS_P0307_23
   READ_FLAG( uiCode, "vps_vui_present_flag" );                    pcVPS->setVpsVuiPresentFlag( uiCode == 1 );
   if ( pcVPS->getVpsVuiPresentFlag() )
@@ -1526,11 +1527,11 @@
   }  
 
-#if H_MV_HLS7_GEN
+#if H_MV_HLS_7_VPS_P0307_23
   READ_UVLC( uiCode, "vps_non_vui_extension_length" ); pcVPS->setVpsNonVuiExtensionLength( uiCode ); 
-  for ( Int i = 1; i < pcVPS->getVpsNonVuiExtensionLength(); i++ )
+  for ( Int i = 1; i <= pcVPS->getVpsNonVuiExtensionLength(); i++ )
   {
     READ_CODE( 8, uiCode, "vps_non_vui_extension_data_byte" );
   }
-  READ_FLAG( uiCode, "vps_vui_present_flag" );                    pcVPS->setVpsVuiPresentFlag( uiCode == 1 );  if ( pcVPS->getVpsVuiPresentFlag() )
+  READ_FLAG( uiCode, "vps_vui_present_flag" );  pcVPS->setVpsVuiPresentFlag( uiCode == 1 );
 #endif
 #if !H_MV_HLS_7_RESERVED_FLAGS
Index: /branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 856)
+++ /branches/HTM-10.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 857)
@@ -1017,5 +1017,5 @@
 {
   WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0,          "avc_base_layer_flag" );
-#if !H_MV_HLS7_GEN
+#if !H_MV_HLS_7_VPS_P0307_23
   WRITE_FLAG( pcVPS->getVpsVuiPresentFlag() ? 1 : 0 , "vps_vui_present_flag" );
   if ( pcVPS->getVpsVuiPresentFlag() )
@@ -1324,5 +1324,5 @@
     }
   }  
-#if H_MV_HLS7_GEN
+#if H_MV_HLS_7_VPS_P0307_23
   WRITE_UVLC( 0, "vps_non_vui_extension_length" );
   WRITE_FLAG( pcVPS->getVpsVuiPresentFlag() ? 1 : 0 , "vps_vui_present_flag" );
