Index: branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 539)
+++ branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 542)
@@ -2049,4 +2049,7 @@
 #if VIEW_ID_RELATED_SIGNALING 
 , m_viewIdLenMinus1           (0)
+#endif
+#if VPS_VUI_OFFSET
+, m_vpsVuiOffset (0)
 #endif
 {
Index: branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 539)
+++ branches/SHM-4.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 542)
@@ -643,4 +643,7 @@
 #endif
 #endif //SVC_EXTENSION
+#if VPS_VUI_OFFSET
+  Int     m_vpsVuiOffset;
+#endif
 public:
   TComVPS();
@@ -985,4 +988,8 @@
   Int     getNumSubDpbs(Int i)                          { return m_numSubDpbs[i]; }
   Void    setNumSubDpbs(Int i, Int x)                   { m_numSubDpbs[i] = x;    }
+#endif
+#if VPS_VUI_OFFSET
+  Int     getVpsVuiOffset()         { return m_vpsVuiOffset; }
+  Void    setVpsVuiOffset(Int x)    { m_vpsVuiOffset = x; }
 #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 539)
+++ branches/SHM-4.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 542)
@@ -42,4 +42,6 @@
 
 #define SYNTAX_BYTES                     10      ///< number of bytes taken by syntaxes per 4x4 block [RefIdxL0(1byte), RefIdxL1(1byte), MVxL0(2bytes), MVyL0(2bytes), MVxL1(2bytes), MVyL1(2bytes)]
+
+#define VPS_VUI_OFFSET                   1      ///< N0085: Signal VPS VUI offset in the VPS extension 
 
 #define RANDOM_ACCESS_SEI_FIX            1
Index: branches/SHM-4.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 539)
+++ branches/SHM-4.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 542)
@@ -990,4 +990,7 @@
 
   READ_FLAG( uiCode, "avc_base_layer_flag" ); vps->setAvcBaseLayerFlag(uiCode ? true : false);
+#if VPS_VUI_OFFSET
+  READ_CODE( 16, uiCode, "vps_vui_offset" );  vps->setVpsVuiOffset( uiCode );
+#endif
   READ_FLAG( uiCode, "splitting_flag" ); vps->setSplittingFlag(uiCode ? true : false);
 
Index: branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 539)
+++ branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 542)
@@ -669,4 +669,7 @@
   UInt numBytesInVps = this->m_pcBitIf->getNumberOfWrittenBits();
 #endif
+#if VPS_VUI_OFFSET
+   m_vpsVuiCounter = this->m_pcBitIf->getNumberOfWrittenBits();
+#endif
   WRITE_CODE( pcVPS->getVPSId(),                    4,        "vps_video_parameter_set_id" );
   WRITE_CODE( 3,                                    2,        "vps_reserved_three_2bits" );
@@ -795,4 +798,7 @@
 
   WRITE_FLAG( vps->getAvcBaseLayerFlag(),              "avc_base_layer_flag" );
+#if VPS_VUI_OFFSET
+  WRITE_CODE( vps->getVpsVuiOffset(  ), 16,             "vps_vui_offset" );  
+#endif
   WRITE_FLAG( vps->getSplittingFlag(),                 "splitting_flag" );
 
@@ -1089,4 +1095,9 @@
       WRITE_FLAG(1,                  "vps_vui_alignment_bit_equal_to_one");
     }
+#if VPS_VUI_OFFSET
+    Int vpsVuiOffsetValeInBits = this->m_pcBitIf->getNumberOfWrittenBits() - m_vpsVuiCounter + 16; // 2 bytes for NUH
+    assert( vpsVuiOffsetValeInBits % 8 == 0 );
+    vps->setVpsVuiOffset( vpsVuiOffsetValeInBits >> 3 );
+#endif
     codeVPSVUI(vps);  
   }
Index: branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.h	(revision 539)
+++ branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncCavlc.h	(revision 542)
@@ -68,5 +68,7 @@
   TComSlice*    m_pcSlice;
   UInt          m_uiCoeffCost;
-
+#if VPS_VUI_OFFSET
+  Int m_vpsVuiCounter;
+#endif
   Void codeShortTermRefPicSet              ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx );
   Bool findMatchingLTRP ( TComSlice* pcSlice, UInt *ltrpsIndex, Int ltrpPOC, Bool usedFlag );
Index: branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 539)
+++ branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 542)
@@ -1753,4 +1753,7 @@
       OutputNALUnit nalu(NAL_UNIT_VPS);
 #endif
+#if VPS_VUI_OFFSET
+      // The following code also calculates the VPS VUI offset
+#endif
 #if VPS_EXTN_OFFSET_CALC
       OutputNALUnit tempNalu(NAL_UNIT_VPS, 0, 0        ); // The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
