Index: branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/SEIread.cpp
===================================================================
--- branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/SEIread.cpp	(revision 1330)
+++ branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/SEIread.cpp	(revision 1331)
@@ -124,5 +124,9 @@
  * unmarshal a single SEI message from bitstream bs
  */
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
+#else
 Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
+#endif
 {
   setBitstream(bs);
@@ -131,6 +135,9 @@
   do
   {
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+    xReadSEImessage(seis, nalUnitType, vps, sps, pDecodedMessageOutputStream);
+#else
     xReadSEImessage(seis, nalUnitType, sps, pDecodedMessageOutputStream);
-
+#endif
     /* SEI messages are an integer number of bytes, something has failed
     * in the parsing if bitstream not byte-aligned */
@@ -142,5 +149,9 @@
 }
 
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
+#else
 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
+#endif
 {
 #if ENC_DEC_TRACE
@@ -261,5 +272,9 @@
     case SEI::SCALABLE_NESTING:
       sei = new SEIScalableNesting;
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps, pDecodedMessageOutputStream);
+#else
       xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps, pDecodedMessageOutputStream);
+#endif
       break;
     case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:
@@ -290,8 +305,15 @@
       break;
 #else
-#if NH_MV_TBD
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
     case SEI::LAYERS_NOT_PRESENT:
-      sei = new SEILayersNotPresent;
-      xParseSEILayersNotPresent((SEILayersNotPresent&) *sei, payloadSize, pDecodedMessageOutputStream );
+      if (!vps)
+      {
+        printf ("Warning: Found Layers not present SEI message, but no active VPS is available. Ignoring.");
+      }
+      else
+      {
+        sei = new SEILayersNotPresent;
+        xParseSEILayersNotPresent((SEILayersNotPresent&) *sei, payloadSize, vps, pDecodedMessageOutputStream);
+      }
       break;
 #endif
@@ -885,5 +907,9 @@
 }
 
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
+#else
 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
+#endif
 {
   UInt uiCode;
@@ -927,5 +953,9 @@
   do
   {
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, pDecodedMessageOutputStream);
+#else
     xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, pDecodedMessageOutputStream);
+#endif
   } while (m_pcBitstream->getNumBitsLeft() > 8);
 
@@ -1183,14 +1213,20 @@
 }
 
-#if NH_MV_SEI_TBD
-Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
-{
-  UInt code;
-  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
-
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
+{
+  UInt code;
+  UInt i = 0;
+
+  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
   sei_read_code( pDecodedMessageOutputStream, 4, code, "lnp_sei_active_vps_id" ); sei.m_lnpSeiActiveVpsId = code;
-  for( Int i = 0; i  <=  MaxLayersMinus1; i++ )
-  {
-    sei_read_flag( pDecodedMessageOutputStream, code, "layer_not_present_flag" ); sei.m_layerNotPresentFlag[i] = (code == 1);
+  assert(vps->getVPSId() == sei.m_lnpSeiActiveVpsId);
+
+  sei.m_lnpSeiMaxLayers = vps->getMaxLayersMinus1() + 1;
+  sei.resizeDimI(sei.m_lnpSeiMaxLayers);
+  for (; i < sei.m_lnpSeiMaxLayers; i++)
+  {
+    sei_read_flag( pDecodedMessageOutputStream, code, "layer_not_present_flag" ); 
+    sei.m_layerNotPresentFlag[i] = (code == 1);
   }
 };
Index: branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/SEIread.h
===================================================================
--- branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/SEIread.h	(revision 1330)
+++ branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/SEIread.h	(revision 1331)
@@ -56,5 +56,9 @@
   SEIReader() {};
   virtual ~SEIReader() {};
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
+#else
   Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
+#endif
 #if NH_MV_SEI
   Void setLayerId                            ( Int   layerId )   { m_layerId  = layerId; }; 
@@ -62,5 +66,9 @@
 #endif
 protected:
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
+#else
   Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
+#endif
   Void xParseSEIuserDataUnregistered          (SEIuserDataUnregistered &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
   Void xParseSEIActiveParameterSets           (SEIActiveParameterSets  &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
@@ -78,5 +86,9 @@
   Void xParseSEIToneMappingInfo               (SEIToneMappingInfo& sei,               UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
   Void xParseSEISOPDescription                (SEISOPDescription &sei,                UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
+#else
   Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
+#endif
   Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
   Void xParseSEITimeCode                      (SEITimeCode& sei,                      UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
@@ -90,6 +102,6 @@
 #endif
 #endif
-#if NH_MV_SEI_TBD
-  Void xParseSEILayersNotPresent              (SEILayersNotPresent& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+  Void xParseSEILayersNotPresent              (SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps ,std::ostream *pDecodedMessageOutputStream);
 #endif
   Void xParseSEIInterLayerConstrainedTileSets (SEIInterLayerConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
Index: branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1330)
+++ branches/HTM-15.1-dev0-Vidyo/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1331)
@@ -836,5 +836,9 @@
     InputNALUnit &nalu=*m_prefixSEINALUs.front();
 #if NH_MV
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+    m_seiReader.parseSEImessage(&(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(getLayerId()), m_pDecodedSEIOutputStream);
+#else
     m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
+#endif
 #else
     m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
@@ -1308,5 +1312,9 @@
       {
 #if NH_MV
-        m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
+#if NH_MV_LAYERS_NOT_PRESENT_SEI
+      m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(getLayerId()), m_pDecodedSEIOutputStream);
+#else
+      m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
+#endif
 #else
         m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
