Index: branches/SHM-upgrade/source/App/TAppDecoder/TAppDecCfg.cpp
===================================================================
--- branches/SHM-upgrade/source/App/TAppDecoder/TAppDecCfg.cpp	(revision 959)
+++ branches/SHM-upgrade/source/App/TAppDecoder/TAppDecCfg.cpp	(revision 961)
@@ -102,5 +102,9 @@
 #endif
 #endif
+#if FIX_CONF_MODE
+  ("LayerNum,-ls", nLayerNum, MAX_NUM_LAYER_IDS, "Number of layers to be decoded.")
+#else
   ("LayerNum,-ls", nLayerNum, 1, "Number of layers to be decoded.")
+#endif
 #if OUTPUT_LAYER_SET_INDEX
   ("OutpuLayerSetIdx,-olsidx", olsIdx, -1, "Index of output layer set to be decoded.")
Index: branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.cpp	(revision 959)
+++ branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.cpp	(revision 961)
@@ -214,5 +214,9 @@
       read(nalu, nalUnit);
       if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu)  ||
+#if FIX_CONF_MODE
+        (nalu.m_layerId > this->getCommonDecoderParams()->getTargetLayerId()) )
+#else
         (nalu.m_layerId > m_tgtLayerId) )
+#endif
       {
         bNewPicture = false;
@@ -1223,5 +1227,9 @@
     dpbStatus.m_numPicsInLayer[layerIdx]--;
 #endif
+#if FIX_ALIGN_BUMPING
+    dpbStatus.m_numPicsInSubDpb[dpbStatus.m_layerIdToSubDpbIdMap[layerIdx]]--;
+#else
     dpbStatus.m_numPicsInSubDpb[layerIdx]--;
+#endif
   }
 }
@@ -1235,6 +1243,11 @@
   {
     std::vector<Int>  listOfPocs;
+#if FIX_ALIGN_BUMPING
+    std::vector<Int>  listOfPocsInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+    std::vector<Int>  listOfPocsPositionInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+#else
     std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
     std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
+#endif
     DpbStatus dpbStatus;
 
@@ -1262,6 +1275,11 @@
   {
     std::vector<Int>  listOfPocs;
+#if FIX_ALIGN_BUMPING
+    std::vector<Int>  listOfPocsInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+    std::vector<Int>  listOfPocsPositionInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+#else
     std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
     std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
+#endif
     DpbStatus dpbStatus;
 
@@ -1285,5 +1303,9 @@
 Void TAppDecTop::markAllPicturesAsErased()
 {
+#if FIX_ALIGN_BUMPING
+  for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++)
+#else
   for(Int i = 0; i < MAX_LAYERS; i++)
+#endif
   {
     markAllPicturesAsErased(i);
@@ -1324,6 +1346,11 @@
     
   std::vector<Int>  listOfPocs;
+#if FIX_ALIGN_BUMPING
+  std::vector<Int>  listOfPocsInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+  std::vector<Int>  listOfPocsPositionInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+#else
   std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
   std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
+#endif
   DpbStatus dpbStatus;
 
@@ -1357,5 +1384,11 @@
   }
 #else
+#if FIX_ALIGN_BUMPING
+  Int subDpbIdx = getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 
+                  ? dpbStatus.m_layerIdToSubDpbIdMap[0] 
+                  : dpbStatus.m_layerIdToSubDpbIdMap[layerIdx];
+#else
   Int subDpbIdx = getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 ? 0 : layerIdx;
+#endif
   findDpbParametersFromVps(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, maxDpbLimit);
 #endif
@@ -1370,6 +1403,11 @@
 {    
   std::vector<Int>  listOfPocs;
+#if FIX_ALIGN_BUMPING
+  std::vector<Int>  listOfPocsInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+  std::vector<Int>  listOfPocsPositionInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+#else
   std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
   std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
+#endif
   DpbStatus dpbStatus;
 
@@ -1403,6 +1441,12 @@
   std::vector<int>::iterator it;
   TComList<TComPic*>::iterator iterPic;
+#if FIX_ALIGN_BUMPING
+  for( Int dpbLayerCtr = 0; dpbLayerCtr < dpbStatus.m_numLayers; dpbLayerCtr++)
+  {
+    Int layerIdx  = dpbStatus.m_targetDecLayerIdList[dpbLayerCtr];
+#else
   for( Int layerIdx = 0; layerIdx < dpbStatus.m_numLayers; layerIdx++)
   {
+#endif
     // Check if picture with pocValue is present.
     it = find( listOfPocsInEachLayer[layerIdx].begin(), listOfPocsInEachLayer[layerIdx].end(), pocValue );
@@ -1487,6 +1531,10 @@
       listOfPocsInEachLayer[layerIdx].erase( it );
       listOfPocsPositionInEachLayer[layerIdx].erase( listOfPocsPositionInEachLayer[layerIdx].begin() + picPosition );
-    }
-  }
+#if FIX_ALIGN_BUMPING
+      dpbStatus.m_numPicsInSubDpb[dpbStatus.m_layerIdToSubDpbIdMap[layerIdx]]--;
+#endif
+    }
+  }
+#if !FIX_ALIGN_BUMPING
   // Update sub-DPB status
   for( Int subDpbIdx = 0; subDpbIdx < dpbStatus.m_numSubDpbs; subDpbIdx++)
@@ -1494,4 +1542,5 @@
     dpbStatus.m_numPicsInSubDpb[subDpbIdx]--;
   }
+#endif
   dpbStatus.m_numAUsNotDisplayed--;    
 
@@ -1536,5 +1585,9 @@
     // Find the VPS used for the pictures
     // -------------------------------------
+#if FIX_ALIGN_BUMPING
+    for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++)
+#else
     for(Int i = 0; i < MAX_LAYERS; i++)
+#endif
     {
       if( m_acTDecTop[i].getListPic()->empty() )
@@ -1584,5 +1637,9 @@
 Void TAppDecTop::emptyUnusedPicturesNotNeededForOutput()
 {
+#if FIX_ALIGN_BUMPING
+  for(Int layerIdx = 0; layerIdx < MAX_VPS_LAYER_ID_PLUS1; layerIdx++)
+#else
   for(Int layerIdx = 0; layerIdx < MAX_LAYERS; layerIdx++)
+#endif
   {
     TComList <TComPic*> *pcListPic = m_acTDecTop[layerIdx].getListPic();
@@ -1639,5 +1696,9 @@
   TComVPS *vps = NULL;
   dpbStatus.init();
+#if FIX_ALIGN_BUMPING
+  for( Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++ )
+#else
   for( Int i = 0; i < MAX_LAYERS; i++ )
+#endif
   {
     if( m_acTDecTop[i].getListPic()->empty() )
@@ -1697,8 +1758,21 @@
   dpbStatus.m_numAUsNotDisplayed = listOfPocs.size();   // Number of AUs not displayed
   dpbStatus.m_numLayers = vps->getNumLayersInIdList( targetLsIdx );
+#if FIX_ALIGN_BUMPING
+  for(Int i = 0; i < dpbStatus.m_numLayers; i++)
+  {
+    dpbStatus.m_layerIdToSubDpbIdMap[vps->getLayerSetLayerIdList(targetLsIdx, i)] = i;
+    dpbStatus.m_targetDecLayerIdList[i] = vps->getLayerSetLayerIdList(targetLsIdx, i);  // Layer Id stored in a particular sub-DPB
+  }
+  dpbStatus.m_numSubDpbs = vps->getNumSubDpbs( targetLsIdx ); 
+#else
   dpbStatus.m_numSubDpbs = vps->getNumSubDpbs( vps->getOutputLayerSetIdx(
                                                       this->getCommonDecoderParams()->getTargetOutputLayerSetIdx() ) );
-
+#endif
+
+#if FIX_ALIGN_BUMPING
+  for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++)
+#else
   for(Int i = 0; i < dpbStatus.m_numLayers; i++)
+#endif
   {
     dpbStatus.m_numPicsNotDisplayedInLayer[i] = listOfPocsInEachLayer[i].size();
@@ -1716,6 +1790,11 @@
   { // All pictures in the DPB in that layer are to be output; this means other pictures would also be output
     std::vector<Int>  listOfPocs;
+#if FIX_ALIGN_BUMPING
+    std::vector<Int>  listOfPocsInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+    std::vector<Int>  listOfPocsPositionInEachLayer[MAX_VPS_LAYER_ID_PLUS1];
+#else
     std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
     std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
+#endif
     DpbStatus dpbStatus;
 
Index: branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.h
===================================================================
--- branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.h	(revision 959)
+++ branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.h	(revision 961)
@@ -143,4 +143,8 @@
 #endif
   Int m_numPicsInSubDpb[MAX_LAYERS];  // Pictures marked as used_for_reference or needed for output in the sub-DPB
+#if FIX_ALIGN_BUMPING
+  Int m_layerIdToSubDpbIdMap[MAX_VPS_LAYER_ID_PLUS1];
+  Int m_targetDecLayerIdList[MAX_LAYERS];
+#endif
   Bool m_maxLatencyIncrease;
   Int m_maxLatencyPictures;
@@ -165,4 +169,11 @@
     m_numSubDpbs = -1;
     m_numLayers = -1;
+#if FIX_ALIGN_BUMPING
+    ::memset( m_targetDecLayerIdList, 0, sizeof(m_targetDecLayerIdList) );
+    for(Int i = 0; i < MAX_LAYERS; i++)
+    {
+      m_layerIdToSubDpbIdMap[i] = -1;
+    }
+#endif
   }
 };
Index: branches/SHM-upgrade/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibCommon/CommonDef.h	(revision 959)
+++ branches/SHM-upgrade/source/Lib/TLibCommon/CommonDef.h	(revision 961)
@@ -311,10 +311,14 @@
   Int m_targetLayerId;
   Int m_targetOutputLayerSetIdx;
-  std::vector<Int> *m_targetDecLayerIdSet; 
+  std::vector<Int> *m_targetDecLayerIdSet;
   Bool m_valueCheckedFlag;
   Int m_highestTId;
 public:
-  CommonDecoderParams(): 
+  CommonDecoderParams():
+#if FIX_CONF_MODE
+    m_targetLayerId(MAX_VPS_LAYER_ID_PLUS1)
+#else
     m_targetLayerId(0)
+#endif
     , m_targetOutputLayerSetIdx(-1)
     , m_targetDecLayerIdSet(NULL)
Index: branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h	(revision 959)
+++ branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h	(revision 961)
@@ -47,4 +47,5 @@
 #define O0215_PHASE_ALIGNMENT_REMOVAL    1
 #define CONFORMANCE_BITSTREAM_MODE       1      ///< In order to generate the metadata related to conformance bitstreams
+#define FIX_CONF_MODE                    1
 #define SIGNALLING_BITRATE_PICRATE_FIX   1      ///< Fix for signalling of bitrate and picture rate info in VPS VUI to be more aligned to JCTVC-R1008
 #define INFERENCE_POC_MSB_VAL_PRESENT    1      ///< JCTVC-Q0146 -- poc_msb_val_present_flag shall be equal to 0 when slice_header_extension_length is (inferred to be ) equal to 0
@@ -98,4 +99,5 @@
                                                 ///< JCTVC-P0192: Assign layers to sub-DPBs based on the rep_format() signaled in the VPS
 #define ALIGNED_BUMPING                  1      ///< JCTVC-P0192: Align bumping of pictures in an AU
+#define FIX_ALIGN_BUMPING                1
 #define O0109_O0199_FLAGS_TO_VUI         1      ///< JCTVC-O0109, O0199: move single_layer_for_non_irap_flag and higher_layer_flag to vps_vui
 #define O0109_VIEW_ID_LEN                1      ///< JCTVC-O0109: view_id_len_minus1 to view_id_len, and add constraint (1<<view_id_len) is greater than or equal to NumViews
Index: branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp	(revision 959)
+++ branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp	(revision 961)
@@ -3001,4 +3001,10 @@
 
   }
+#if FIX_CONF_MODE
+  // Set correct value of targetLayerId
+  Int targetOlsIdx = params->getTargetOutputLayerSetIdx();
+  Int targetLsIdx = vps->getOutputLayerSetIdx( targetOlsIdx );
+  params->setTargetLayerId( vps->getLayerSetLayerIdList( targetLsIdx, vps->getNumLayersInIdList(targetLsIdx)-1 ) );
+#endif
 }
 #endif
