Index: /branches/SHM-5.0-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/SHM-5.0-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 579)
+++ /branches/SHM-5.0-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 580)
@@ -1186,8 +1186,4 @@
     Int layerSetId = vps->getOutputLayerSetIdx(i);
 
-    // For each output layer set, set the DPB size for each layer and the reorder/latency value the maximum for all layers
-    Bool checkFlagOuter = false;      // Used to calculate sub_layer_flag_info_present_flag
-    Bool checkFlagInner[MAX_TLAYER];  // Used to calculate sub_layer_dpb_info_present_flag
-
     for(Int j = 0; j < vps->getMaxTLayers(); j++)
     {
@@ -1205,35 +1201,6 @@
       }
       vps->setMaxVpsNumReorderPics(i, j, maxNumReorderPics);
-      
-      if( j == 0 )  // checkFlagInner[0] is always 1
-      {
-        checkFlagInner[j] = true;     // Always signal sub-layer DPB information for the first sub-layer
-      }
-      else
-      {
-        checkFlagInner[j] = false;    // Initialize to be false. If the values of the current sub-layers matches with the earlier sub-layer, 
-                                      // then will be continue to be false - i.e. the j-th sub-layer DPB info is not signaled
-        checkFlagInner[j] |= ( maxNumReorderPics != vps->getMaxVpsNumReorderPics(i, j - 1) );
-#if CHANGE_NUMSUBDPB_IDX
-        for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; k++)  // If checkFlagInner[j] is true, break and signal the values
-#else
-        for(Int k = 0; k < vps->getNumSubDpbs(i) && !checkFlagInner[j]; k++)  // If checkFlagInner[j] is true, break and signal the values
-#endif
-        {
-          checkFlagInner[j] |= ( vps->getMaxVpsDecPicBufferingMinus1(i, k, j - 1) != vps->getMaxVpsDecPicBufferingMinus1(i, k, j) );
-        }
-      }
-      // If checkFlagInner[j] = true, then some value needs to be signalled for the j-th sub-layer
-      vps->setSubLayerDpbInfoPresentFlag( i, j, checkFlagInner[j] );
-    }
-    for(Int j = 1; j < vps->getMaxTLayers(); j++) // Check if DPB info of any of non-zero sub-layers is signaled. If so set flag to one
-    {
-      if( vps->getSubLayerDpbInfoPresentFlag(i, j) )
-      {
-        checkFlagOuter = true;
-        break;
-      }
-    }
-    vps->setSubLayerFlagInfoPresentFlag( i, checkFlagOuter );
+      vps->determineSubDpbInfoFlags();
+    }
   }
 #endif
Index: /branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 579)
+++ /branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 580)
@@ -2302,4 +2302,57 @@
 
   return scalIdx; 
+}
+#endif
+#if VPS_DPB_SIZE_TABLE
+Void TComVPS::determineSubDpbInfoFlags()
+{
+  for(Int i = 1; i < getNumOutputLayerSets(); i++)
+  {
+    Int layerSetIdxForOutputLayerSet = getOutputLayerSetIdx( i );
+    // For each output layer set, set the DPB size for each layer and the reorder/latency value the maximum for all layers
+    Bool checkFlagOuter = false;      // Used to calculate sub_layer_flag_info_present_flag
+    Bool checkFlagInner[MAX_TLAYER];  // Used to calculate sub_layer_dpb_info_present_flag
+
+    for(Int j = 0; j < getMaxTLayers(); j++)
+    {
+      // --------------------------------------------------------
+      // To determine value of m_subLayerDpbInfoPresentFlag
+      // --------------------------------------------------------
+      if( j == 0 )  // checkFlagInner[0] is always 1
+      {
+        checkFlagInner[j] = true;     // Always signal sub-layer DPB information for the first sub-layer
+      }
+      else
+      {
+        checkFlagInner[j] = false;    // Initialize to be false. If the values of the current sub-layers matches with the earlier sub-layer, 
+                                      // then will be continue to be false - i.e. the j-th sub-layer DPB info is not signaled
+        checkFlagInner[j] |= ( getMaxVpsNumReorderPics(i, j) != getMaxVpsNumReorderPics(i, j - 1) );
+#if CHANGE_NUMSUBDPB_IDX
+        for(Int k = 0; k < getNumSubDpbs(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; k++)  // If checkFlagInner[j] is true, break and signal the values
+#else
+        for(Int k = 0; k < getNumSubDpbs(i) && !checkFlagInner[j]; k++)  // If checkFlagInner[j] is true, break and signal the values
+#endif
+        {
+          checkFlagInner[j] |= ( getMaxVpsDecPicBufferingMinus1(i, k, j - 1) != getMaxVpsDecPicBufferingMinus1(i, k, j) );
+        }
+      }
+      // If checkFlagInner[j] = true, then some value needs to be signalled for the j-th sub-layer
+      setSubLayerDpbInfoPresentFlag( i, j, checkFlagInner[j] );
+    }
+
+    // --------------------------------------------------------
+    // To determine value of m_subLayerFlagInfoPresentFlag
+    // --------------------------------------------------------
+
+    for(Int j = 1; j < getMaxTLayers(); j++) // Check if DPB info of any of non-zero sub-layers is signaled. If so set flag to one
+    {
+      if( getSubLayerDpbInfoPresentFlag(i, j) )
+      {
+        checkFlagOuter = true;
+        break;
+      }
+    }
+    setSubLayerFlagInfoPresentFlag( i, checkFlagOuter );
+  }
 }
 #endif
Index: /branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.h	(revision 579)
+++ /branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.h	(revision 580)
@@ -1028,4 +1028,5 @@
   Int     getNumSubDpbs(Int i)                          { return m_numSubDpbs[i]; }
   Void    setNumSubDpbs(Int i, Int x)                   { m_numSubDpbs[i] = x;    }
+  Void    determineSubDpbInfoFlags();
 #endif
 
