Index: branches/SHM-dev/source/Lib/TLibDecoder/NALread.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/NALread.cpp	(revision 1235)
+++ branches/SHM-dev/source/Lib/TLibDecoder/NALread.cpp	(revision 1237)
@@ -110,10 +110,5 @@
   assert(forbidden_zero_bit == 0);
   nalu.m_nalUnitType = (NalUnitType) bs.read(6);  // nal_unit_type
-  nalu.m_reservedZero6Bits = bs.read(6);       // nuh_reserved_zero_6bits
-#if SVC_EXTENSION
-  nalu.m_layerId = nalu.m_reservedZero6Bits;
-#else
-  assert(nalu.m_reservedZero6Bits == 0);
-#endif
+  nalu.m_nuhLayerId = bs.read(6);                 // nuh_layer_id
   nalu.m_temporalId = bs.read(3) - 1;             // nuh_temporal_id_plus1
 #if RExt__DECODER_DEBUG_BIT_STATISTICS
@@ -121,7 +116,31 @@
 #endif
 
-  if ( nalu.m_temporalId )
+  // only check these rules for base layer
+  if (nalu.m_nuhLayerId == 0)
   {
+    if ( nalu.m_temporalId )
+    {
+      assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
+           && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
+           && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP
+           && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL
+           && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP
+           && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA
+           && nalu.m_nalUnitType != NAL_UNIT_VPS
+           && nalu.m_nalUnitType != NAL_UNIT_SPS
+           && nalu.m_nalUnitType != NAL_UNIT_EOS
+           && nalu.m_nalUnitType != NAL_UNIT_EOB );
+    }
+    else
+    {
+      assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
+           && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
+           && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
+           && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_N );
+    }
+  }
 #if SVC_EXTENSION
+  else if ( nalu.m_temporalId )
+  {
     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
@@ -133,30 +152,12 @@
          && nalu.m_nalUnitType != NAL_UNIT_SPS
          && nalu.m_nalUnitType != NAL_UNIT_EOS);
-#else
-    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA
-         && nalu.m_nalUnitType != NAL_UNIT_VPS
-         && nalu.m_nalUnitType != NAL_UNIT_SPS
-         && nalu.m_nalUnitType != NAL_UNIT_EOS
-         && nalu.m_nalUnitType != NAL_UNIT_EOB ); 
-#endif
   }
   else
   {
-#if SVC_EXTENSION
     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
          );
-#else
-    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
-         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_N );
+  }
 #endif
-  }
 }
 /**
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1235)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1237)
@@ -1006,5 +1006,5 @@
 #else
   READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
-  READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
+  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );
 #endif
   READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 );    assert(uiCode+1 <= MAX_TLAYER);
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1235)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1237)
@@ -723,5 +723,5 @@
 {
 #if SVC_EXTENSION
-  m_apcSlicePilot->initSlice( nalu.m_layerId );
+  m_apcSlicePilot->initSlice( nalu.m_nuhLayerId );
   m_apcSlicePilot->setTLayer( nalu.m_temporalId );
 #else //SVC_EXTENSION
@@ -768,5 +768,5 @@
   if( !vps->getBaseLayerAvailableFlag() )
   {
-    assert( nalu.m_layerId != 0 );
+    assert( nalu.m_nuhLayerId != 0 );
     assert( vps->getNumAddLayerSets() > 0 );
 
@@ -1512,6 +1512,6 @@
 
 #if SVC_EXTENSION
-  m_pcPic->setLayerId(nalu.m_layerId);
-  pcSlice->setLayerId(nalu.m_layerId);
+  m_pcPic->setLayerId(nalu.m_nuhLayerId);
+  pcSlice->setLayerId(nalu.m_nuhLayerId);
   pcSlice->setPic(m_pcPic);
 #endif
@@ -1928,4 +1928,12 @@
 #endif
 {
+#if !SVC_EXTENSION
+  // ignore all NAL units of layers > 0
+  if (nalu.m_nuhLayerId > 0)
+  {
+    fprintf (stderr, "Warning: found NAL unit with nuh_layer_id equal to %d. Ignoring.\n", nalu.m_nuhLayerId);
+    return false;
+  }
+#endif
   // Initialize entropy decoder
   m_cEntropyDecoder.setEntropyDecoder (&m_cCavlcDecoder);
@@ -1934,5 +1942,5 @@
 #if SVC_EXTENSION
   // ignore any NAL units with nuh_layer_id == 63
-  if( nalu.m_layerId == 63 )
+  if( nalu.m_nuhLayerId == 63 )
   {  
     return false;
@@ -1943,5 +1951,5 @@
     case NAL_UNIT_VPS:
 #if SVC_EXTENSION
-      assert( nalu.m_layerId == 0 ); // Non-conforming bitstream. The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
+      assert( nalu.m_nuhLayerId == 0 ); // Non-conforming bitstream. The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
 #endif
       xDecodeVPS(nalu.m_Bitstream->getFifo());
@@ -2041,5 +2049,5 @@
 #if SVC_EXTENSION
       //Check layer id of the nalu. if it is not 0, give a warning message.
-      if (nalu.m_layerId > 0)
+      if (nalu.m_nuhLayerId > 0)
       {
         printf( "\n\nThis bitstream is ended with EOB NALU that has layer id greater than 0\n" );
