Index: /branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncTop.cpp	(revision 109)
+++ /branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncTop.cpp	(revision 110)
@@ -692,4 +692,30 @@
     m_acTEncTop[layer].init();
   }
+#if VPS_EXTN_OP_LAYER_SETS
+  TComVPS* vps = m_acTEncTop[0].getVPS();
+  vps->setMaxLayerId(m_numLayers - 1);    // Set max-layer ID
+
+  vps->setNumLayerSets(m_numLayers);
+  for(Int setId = 1; setId < vps->getNumLayerSets(); setId++)
+  {
+    for(Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++)
+    {
+      vps->setLayerIdIncludedFlag(true, setId, layerId);
+    }
+  }
+
+  // Target output layer
+  vps->setNumOutputLayerSets(1);
+  Int lsIdx = 1;
+  vps->setOutputLayerSetIdx(0, lsIdx); // Because only one layer set
+  // Include the highest layer as output layer 
+  for(UInt layer=0; layer <= vps->getMaxLayerId() ; layer++)
+  {
+    if(vps->getLayerIdIncludedFlag(lsIdx, layer))
+    {
+      vps->setOutputLayerFlag(lsIdx, layer, layer == (vps->getMaxLayerId()));
+    }
+  }
+#endif
 #else
   m_cTEncTop.init();
Index: /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp	(revision 109)
+++ /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp	(revision 110)
@@ -1474,4 +1474,7 @@
 , m_numLayerSets              (0)
 #endif
+#if VPS_EXTN_OP_LAYER_SETS
+, m_numOutputLayerSets        (0)  
+#endif
 {
 
@@ -1482,4 +1485,10 @@
     m_uiMaxLatencyIncrease[i] = 0;
   }
+#if VPS_EXTN_OP_LAYER_SETS
+  ::memset(m_layerIdIncludedFlag, 0, sizeof(m_layerIdIncludedFlag));
+  // Consider dynamic allocation for outputLayerSetIdx and outputLayerFlag
+  ::memset(m_outputLayerSetIdx, 0, sizeof(m_outputLayerSetIdx));
+  ::memset(m_outputLayerFlag, 0, sizeof(m_outputLayerFlag));
+#endif
 }
 
Index: /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.h	(revision 109)
+++ /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.h	(revision 110)
@@ -507,4 +507,16 @@
 #endif
 
+  // ------------------------------------------
+  // Variables related to VPS extensions
+  // ------------------------------------------
+#if VPS_EXTN_OP_LAYER_SETS
+  // .. More declarations here
+  // Target output layer signalling related
+  UInt       m_numOutputLayerSets;
+  UInt       m_outputLayerSetIdx[MAX_VPS_LAYER_SETS_PLUS1];
+  Bool       m_outputLayerFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
+  // .. More declarations here
+#endif
+
 public:
   TComVPS();
@@ -570,4 +582,16 @@
 #if L0043_TIMING_INFO
   TimingInfo* getTimingInfo() { return &m_timingInfo; }
+#endif
+
+#if VPS_EXTN_OP_LAYER_SETS
+  // Target output layer signalling related
+  UInt   getNumOutputLayerSets()                                { return m_numOutputLayerSets;     } 
+  Void   setNumOutputLayerSets(Int x)                           { m_numOutputLayerSets = x;        }
+  
+  UInt   getOutputLayerSetIdx(Int idx)                          { return m_outputLayerSetIdx[idx]; }
+  Void   setOutputLayerSetIdx(Int idx, UInt x)                  { m_outputLayerSetIdx[idx] = x;    }
+
+  Bool   getOutputLayerFlag(Int layerSet, Int layerId)          { return m_outputLayerFlag[layerSet][layerId]; }
+  Void   setOutputLayerFlag(Int layerSet, Int layerId, Bool x)  { m_outputLayerFlag[layerSet][layerId] = x;    }
 #endif
 };
Index: /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TypeDef.h	(revision 109)
+++ /branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TypeDef.h	(revision 110)
@@ -46,4 +46,7 @@
 #define VPS_RENAME                       1      ///< Rename variables max_layer_id and num_layer_sets_minus1 in VPS
 #define VPS_EXTNS                        1      ///< Include function structure for VPS extensions
+#if VPS_EXTNS
+#define VPS_EXTN_OP_LAYER_SETS           1      ///< Include output layer sets in VPS extension
+#endif
 #define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
 
@@ -135,5 +138,5 @@
 #if VPS_RENAME
 #define MAX_VPS_LAYER_SETS_PLUS1                  1024
-#define MAX_VPS_LAYER_ID_PLUS1                    1
+#define MAX_VPS_LAYER_ID_PLUS1                    2
 #else
 #define MAX_VPS_NUM_HRD_PARAMETERS                1
Index: /branches/HM-10.0-dev-SHM/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HM-10.0-dev-SHM/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 109)
+++ /branches/HM-10.0-dev-SHM/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 110)
@@ -839,6 +839,21 @@
 Void TDecCavlc::parseVPSExtension(TComVPS *vps)
 {  
+  UInt uiCode;
   // ... More syntax elements to be parsed here
 
+  // Target output layer signalling
+  READ_UVLC( uiCode,            "vps_num_output_layer_sets"); vps->setNumOutputLayerSets(uiCode);
+  for(Int i = 0; i < vps->getNumOutputLayerSets(); i++)
+  {
+    READ_UVLC( uiCode,           "vps_output_layer_set_idx[i]"); vps->setOutputLayerSetIdx(i, uiCode);
+    Int lsIdx = vps->getOutputLayerSetIdx(i);
+    for(Int j = 0; j <= vps->getMaxLayerId(); j++)
+    {
+      if(vps->getLayerIdIncludedFlag(lsIdx, j))
+      {
+        READ_FLAG( uiCode, "vps_output_layer_flag[lsIdx][j]"); vps->setOutputLayerFlag(lsIdx, j, uiCode);
+      }
+    }
+  }  
   // ... More syntax elements to be parsed here
 }
Index: /branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 109)
+++ /branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 110)
@@ -591,5 +591,7 @@
   assert( pcVPS->getNumHrdParameters() <= MAX_VPS_LAYER_SETS_PLUS1 );
   assert( pcVPS->getMaxLayerId() < MAX_VPS_LAYER_ID_PLUS1 );
+#if !VPS_EXTN_OP_LAYER_SETS     // num layer sets set in TAppEncTop.cpp
   pcVPS->setNumLayerSets(1);
+#endif
   WRITE_CODE( pcVPS->getMaxLayerId(), 6,                       "vps_max_layer_id" );
   WRITE_UVLC( pcVPS->getNumLayerSets() - 1,                 "vps_num_layer_sets_minus1" );
@@ -610,6 +612,8 @@
 #endif
     {
+#if !VPS_EXTN_OP_LAYER_SETS     // layer Id include flag set in TAppEncTop.cpp
       // Only applicable for version 1
       pcVPS->setLayerIdIncludedFlag( true, opsIdx, i );
+#endif
       WRITE_FLAG( pcVPS->getLayerIdIncludedFlag( opsIdx, i ) ? 1 : 0, "layer_id_included_flag[opsIdx][i]" );
     }
@@ -667,4 +671,18 @@
 
   // ... More syntax elements to be written here
+  // Target output layer signalling
+  WRITE_UVLC( vps->getNumOutputLayerSets(),            "vps_num_output_layer_sets");
+  for(Int i = 0; i < vps->getNumOutputLayerSets(); i++)
+  {
+    WRITE_UVLC( vps->getOutputLayerSetIdx(i),           "vps_output_layer_set_idx[i]");
+    Int lsIdx = vps->getOutputLayerSetIdx(i);
+    for(Int j = 0; j <= vps->getMaxLayerId(); j++)
+    {
+      if(vps->getLayerIdIncludedFlag(lsIdx, j))
+      {
+        WRITE_FLAG( vps->getOutputLayerFlag(lsIdx, j), "vps_output_layer_flag[lsIdx][j]");
+      }
+    }
+  }
 }
 #endif
