Index: branches/SHM-6-dev/source/Lib/TLibDecoder/SEIread.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibDecoder/SEIread.cpp	(revision 772)
+++ branches/SHM-6-dev/source/Lib/TLibDecoder/SEIread.cpp	(revision 773)
@@ -1209,14 +1209,53 @@
     UInt lsIdx = nestingSei.m_nestingOpIdx[h];
     READ_UVLC( uiCode, "num_sei_bitstream_partitions_minus1[i]"); sei.m_seiNumBitstreamPartitionsMinus1[lsIdx] = uiCode;
-    for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
-    {
+#if HRD_BPB
+      Int chkPart=0;
+#endif
+      UInt i;
+    for (i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
+    {
+#if HRD_BPB
+        UInt nl=0; UInt j;
+    for (j = 0 ; j < sei.m_vpsMaxLayers; j++)
+      {
+          if (sei.m_layerIdIncludedFlag[lsIdx][j])
+              nl++;
+      }
+    for (j = 0; j < nl; j++)
+      {
+#else
       for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
       {
         if (sei.m_layerIdIncludedFlag[lsIdx][j])
         {
+#endif
           READ_FLAG( uiCode, "sei_layer_in_bsp_flag[lsIdx][i][j]" ); sei.m_seiLayerInBspFlag[lsIdx][i][j] = uiCode;
         }
-      }
-    }
+#if !HRD_BPB
+      }
+#endif
+#if HRD_BPB
+        chkPart+=sei.m_seiLayerInBspFlag[lsIdx][i][j];
+#endif
+    }
+#if HRD_BPB
+      assert(chkPart<=1);
+#endif
+#if HRD_BPB
+      if(sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]==0)
+      {
+          Int chkPartition1=0; Int chkPartition2=0;
+          for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
+          {
+              if( sei.m_layerIdIncludedFlag[lsIdx][j] )
+              {
+                  chkPartition1+=sei.m_seiLayerInBspFlag[lsIdx][i][j];
+                  chkPartition2++;
+              }
+          }
+          assert(chkPartition1!=chkPartition2);
+      }
+#endif
+      
     READ_UVLC( uiCode, "sei_num_bsp_sched_combinations_minus1[i]"); sei.m_seiNumBspSchedCombinationsMinus1[lsIdx] = uiCode;
     for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
@@ -1225,5 +1264,12 @@
       {
         READ_UVLC( uiCode, "sei_bsp_comb_hrd_idx[lsIdx][i][j]"); sei.m_seiBspCombHrdIdx[lsIdx][i][j] = uiCode;
+#if HRD_BPB
+          assert(uiCode <= sei.m_seiNumBspHrdParametersMinus1);
+#endif
         READ_UVLC( uiCode, "sei_bsp_comb_sched_idx[lsIdx][i][j]"); sei.m_seiBspCombScheddx[lsIdx][i][j] = uiCode;
+#if HRD_BPB
+          assert(uiCode <=  sei.hrd->getCpbCntMinus1( sps->getMaxTLayers()-1 ));
+#endif
+
       }
     }
Index: branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 772)
+++ branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 773)
@@ -2310,4 +2310,7 @@
       {
         READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode);
+#if HRD_BPB
+          Int chkPart=0;
+#endif
         for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ )
         {
@@ -2319,5 +2322,26 @@
             }
           }
-        }
+#if HRD_BPB
+            chkPart+=vps->getLayerInBspFlag(h, i, j);
+#endif
+        }
+#if HRD_BPB
+          assert(chkPart<=1);
+#endif
+#if HRD_BPB
+          if(vps->getNumBitstreamPartitions(h)==1)
+          {
+              Int chkPartition1=0; Int chkPartition2=0;
+              for( j = 0; j <= (vps->getMaxLayers()-1); j++ )
+              {
+                  if( vps->getLayerIdIncludedFlag(h, j) )
+                  {
+                      chkPartition1+=vps->getLayerInBspFlag(h, 0, j);
+                      chkPartition2++;
+                  }
+              }
+              assert(chkPartition1!=chkPartition2);
+          }
+#endif
         if (vps->getNumBitstreamPartitions(h))
         {
@@ -2332,5 +2356,12 @@
             {
               READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode);
+#if HRD_BPB
+                assert(uiCode <= vps->getVpsNumBspHrdParametersMinus1());
+#endif
+                
               READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode);
+#if HRD_BPB
+                assert(uiCode <= vps->getBspHrdParamBufferCpbCntMinus1(uiCode,vps->getMaxTLayers()-1));
+#endif
             }
           }
