Index: branches/SHM-5.1-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-5.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 635)
+++ branches/SHM-5.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 636)
@@ -778,9 +778,4 @@
   TimingInfo* getTimingInfo() { return &m_timingInfo; }
 
-#if SPS_DPB_PARAMS
-    Int       getTolsIdx  ()             { return m_TolsIdx;   }
-    Void      setTolsIdx  ( Int value  ) { m_TolsIdx = value;  }
-#endif
-
 #if SVC_EXTENSION
 #if DERIVE_LAYER_ID_LIST_VARIABLES
Index: branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 635)
+++ branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 636)
@@ -537,5 +537,5 @@
 }
 
-#if SVC_EXTENSION
+#if SVC_EXTENSION && !SPS_DPB_PARAMS
 Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager)
 #else
@@ -559,4 +559,5 @@
 #if SVC_EXTENSION
   }
+#if !SPS_DPB_PARAMS
   else
   {
@@ -565,9 +566,13 @@
   }
 #endif
+#endif
+
   if ( pcSPS->getMaxTLayers() == 1 )
   {
     // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0
 #if SVC_EXTENSION
+#if !SPS_DPB_PARAMS
     assert( pcSPS->getTemporalIdNestingFlag() == true );
+#endif
 #else
     assert( uiCode == 1 );
Index: branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 635)
+++ branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 636)
@@ -86,5 +86,9 @@
   Void  parseVpsDpbSizeTable( TComVPS *vps );
 #endif
+#if SPS_DPB_PARAMS
+  Void  parseSPS            ( TComSPS* pcSPS ); // it should be removed after macro clean up
+#else
   Void  parseSPS            ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager );
+#endif
   Void  parseSPSExtension    ( TComSPS* pcSPS );
 #else //SVC_EXTENSION
Index: branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecEntropy.h	(revision 635)
+++ branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecEntropy.h	(revision 636)
@@ -66,5 +66,5 @@
 
   virtual Void  parseVPS                  ( TComVPS* pcVPS )                       = 0;
-#if SVC_EXTENSION
+#if SVC_EXTENSION && !SPS_DPB_PARAMS
   virtual Void  parseSPS                  ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )           = 0;
 #else
@@ -133,5 +133,5 @@
   Void    resetEntropy                ( TComSlice* p)           { m_pcEntropyDecoderIf->resetEntropy(p);                    }
   Void    decodeVPS                   ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); }
-#if SVC_EXTENSION
+#if SVC_EXTENSION && !SPS_DPB_PARAMS
   Void    decodeSPS                   ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )    { m_pcEntropyDecoderIf->parseSPS(pcSPS, parameterSetManager);                    }
 #else
Index: branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecSbac.h	(revision 635)
+++ branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecSbac.h	(revision 636)
@@ -76,5 +76,5 @@
   Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
   Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
-#if SVC_EXTENSION
+#if SVC_EXTENSION && !SPS_DPB_PARAMS
   Void  parseSPS                  ( TComSPS* /*pcSPS*/, ParameterSetManagerDecoder * /*parameterSetManager*/ ) {}
 #else
Index: branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 635)
+++ branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 636)
@@ -316,7 +316,4 @@
     m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), pcSlice->getLayerId(), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
 #endif
-#if SPS_DPB_PARAMS
-      pcSlice->getVPS()->setTolsIdx(getCommonDecoderParams()->getTargetOutputLayerSetIdx());
-#endif
   }
 #else
@@ -740,4 +737,22 @@
         break;
       }
+    }
+  }
+#endif
+
+#if SPS_DPB_PARAMS
+  if( m_layerId > 0 )
+  {
+    // When not present sps_max_sub_layers_minus1 is inferred to be equal to vps_max_sub_layers_minus1.
+    sps->setMaxTLayers( activeVPS->getMaxTLayers() );
+
+    // When not present sps_temporal_id_nesting_flag is inferred to be equal to vps_temporal_id_nesting_flag
+    sps->setTemporalIdNestingFlag( activeVPS->getTemporalNestingFlag() );
+
+    // When sps_max_dec_pic_buffering_minus1[ i ] is not present for i in the range of 0 to sps_max_sub_layers_minus1, inclusive, due to nuh_layer_id being greater than 0, 
+    // it is inferred to be equal to max_vps_dec_pic_buffering_minus1[ TargetOptLayerSetIdx ][ currLayerId ][ i ] of the active VPS, where currLayerId is the nuh_layer_id of the layer that refers to the SPS.
+    for(UInt i=0; i < sps->getMaxTLayers(); i++)
+    {
+      sps->setMaxDecPicBuffering( activeVPS->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), sps->getLayerId(), i) + 1, i);
     }
   }
@@ -1712,5 +1727,9 @@
 #if SVC_EXTENSION
   sps->setLayerId(m_layerId);
+#if SPS_DPB_PARAMS
+  m_cEntropyDecoder.decodeSPS( sps ); // it should be removed after macro clean up
+#else
   m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder );
+#endif
   m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
 #if !REPN_FORMAT_IN_VPS   // ILRP can only be initialized at activation  
Index: branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 635)
+++ branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 636)
@@ -519,5 +519,6 @@
 
 #if SPS_DPB_PARAMS
-    if( pcSPS->getLayerId() == 0 )  {
+  if( pcSPS->getLayerId() == 0 )
+  {
 #endif
   const Bool subLayerOrderingInfoPresentFlag = 1;
@@ -534,5 +535,5 @@
   }
 #if SPS_DPB_PARAMS
-    }
+  }
 #endif
   assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() );
