Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1047)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1049)
@@ -2991,5 +2991,5 @@
     {
 #if O0225_MAX_TID_FOR_REF_LAYERS
-      for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
+      for( j = i+1; j < vps->getMaxLayers(); j++)
       {
         if(vps->getDirectDependencyFlag(j, i))
@@ -3009,5 +3009,5 @@
     {
 #if O0225_MAX_TID_FOR_REF_LAYERS
-      for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
+      for( j = i+1; j < vps->getMaxLayers(); j++)
       {
         vps->setMaxTidIlRefPicsPlus1(i, j, 7);
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.h	(revision 1047)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.h	(revision 1049)
@@ -103,5 +103,5 @@
  
 #if SVC_EXTENSION
-  TDecTop*   getLayerDec        ( UInt layerIdx )  { return m_ppcTDecTop[layerIdx]; }
+  TDecTop*   getLayerDec        ( UInt layerId )  { return m_ppcTDecTop[layerId]; }
 #endif
 protected:
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp	(revision 1047)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp	(revision 1049)
@@ -252,8 +252,8 @@
   }
 #if CONFORMANCE_BITSTREAM_MODE
-  if( this->getLayerDec(pcPic->getLayerIdx())->getConfModeFlag() )
+  if( this->getLayerDec(pcPic->getLayerId())->getConfModeFlag() )
   {
     // Add this reconstructed picture to the parallel buffer.
-    std::vector<TComPic> *thisLayerBuffer = (this->getLayerDec(pcPic->getLayerIdx()))->getConfListPic();
+    std::vector<TComPic> *thisLayerBuffer = (this->getLayerDec(pcPic->getLayerId()))->getConfListPic();
     thisLayerBuffer->push_back(*pcPic);
     std::sort( thisLayerBuffer->begin(), thisLayerBuffer->end(), pocCompareFunction );
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.h	(revision 1047)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.h	(revision 1049)
@@ -118,5 +118,5 @@
 #endif
 #if SVC_EXTENSION
-  TDecTop*   getLayerDec(UInt layerIdx)  { return m_ppcTDecTop[layerIdx]; }
+  TDecTop*   getLayerDec(UInt layerId)  { return m_ppcTDecTop[layerId]; }
 #endif 
 
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1047)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1049)
@@ -483,5 +483,5 @@
 
 #if FIX_NON_OUTPUT_LAYER
-  if( this->getLayerDec(pcPic->getLayerIdx())->m_isOutputLayerFlag == false )
+  if( this->getLayerDec(pcPic->getLayerId())->m_isOutputLayerFlag == false )
   {
     pcPic->setOutputMark( false );
@@ -1096,9 +1096,9 @@
       resetPocRestrictionCheckParameters();
 #endif
-      markAllPicsAsNoCurrAu();
+      markAllPicsAsNoCurrAu(m_apcSlicePilot->getVPS());
 #if P0297_VPS_POC_LSB_ALIGNED_FLAG
       for (UInt i = 0; i < MAX_LAYERS; i++)
       {
-        m_ppcTDecTop[i]->m_pocDecrementedInDPBFlag = false;
+        m_ppcTDecTop[m_apcSlicePilot->getVPS()->getLayerIdInNuh(i)]->m_pocDecrementedInDPBFlag = false;
       }
 #endif
@@ -2857,5 +2857,5 @@
   }
   
-  return (TDecTop *)getLayerDec( vps->getLayerIdxInVps( vps->getRefLayerId( m_layerId, refLayerIdx ) ) );
+  return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, refLayerIdx ) );
 }
 #endif
@@ -2864,7 +2864,7 @@
 Void TDecTop::setRefLayerParams( TComVPS* vps )
 {
-  for(UInt layer = 0; layer < m_numLayer; layer++)
-  {
-    TDecTop *decTop = (TDecTop *)getLayerDec(layer);
+  for(UInt layerIdx = 0; layerIdx < m_numLayer; layerIdx++)
+  {
+    TDecTop *decTop = (TDecTop *)getLayerDec(vps->getLayerIdInNuh(layerIdx));
     decTop->setNumSamplePredRefLayers(0);
     decTop->setNumMotionPredRefLayers(0);
@@ -2877,16 +2877,16 @@
       decTop->setMotionPredRefLayerId(i, 0);
     }
-    for(Int j = 0; j < layer; j++)
-    {
-      if (vps->getDirectDependencyFlag(layer, j))
-      {
-        decTop->setRefLayerId(decTop->getNumDirectRefLayers(), vps->getLayerIdInNuh(layer));
+    for(Int j = 0; j < layerIdx; j++)
+    {
+      if (vps->getDirectDependencyFlag(layerIdx, j))
+      {
+        decTop->setRefLayerId(decTop->getNumDirectRefLayers(), vps->getLayerIdInNuh(layerIdx));
         decTop->setNumDirectRefLayers(decTop->getNumDirectRefLayers() + 1);
 
-        Int samplePredEnabledFlag = (vps->getDirectDependencyType(layer, j) + 1) & 1;
+        Int samplePredEnabledFlag = (vps->getDirectDependencyType(layerIdx, j) + 1) & 1;
         decTop->setSamplePredEnabledFlag(j, samplePredEnabledFlag == 1 ? true : false);
         decTop->setNumSamplePredRefLayers(decTop->getNumSamplePredRefLayers() + samplePredEnabledFlag);
 
-        Int motionPredEnabledFlag = ((vps->getDirectDependencyType(layer, j) + 1) & 2) >> 1;
+        Int motionPredEnabledFlag = ((vps->getDirectDependencyType(layerIdx, j) + 1) & 2) >> 1;
         decTop->setMotionPredEnabledFlag(j, motionPredEnabledFlag == 1 ? true : false);
         decTop->setNumMotionPredRefLayers(decTop->getNumMotionPredRefLayers() + motionPredEnabledFlag);
@@ -3108,5 +3108,5 @@
     if( vps->getOutputLayerFlag( targetOlsIdx, i ) )
     {
-      this->getLayerDec( vps->getLayerIdxInVps( vps->getLayerSetLayerIdList( targetLsIdx, i ) ) )->m_isOutputLayerFlag = true;
+      this->getLayerDec( vps->getLayerSetLayerIdList( targetLsIdx, i ) )->m_isOutputLayerFlag = true;
     }
   }
@@ -3130,9 +3130,9 @@
 #endif
 #if POC_RESET_IDC_DECODER
-Void TDecTop::markAllPicsAsNoCurrAu()
+Void TDecTop::markAllPicsAsNoCurrAu(TComVPS *vps)
 {
   for(Int i = 0; i < MAX_LAYERS; i++)
   {
-    TComList<TComPic*>* listPic = this->getLayerDec(i)->getListPic();
+    TComList<TComPic*>* listPic = this->getLayerDec(vps->getLayerIdInNuh(i))->getListPic();
     TComList<TComPic*>::iterator  iterPic = listPic->begin();
     while ( iterPic != listPic->end() )
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h	(revision 1047)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h	(revision 1049)
@@ -244,5 +244,5 @@
   Int       getParseIdc                     ()                              { return m_parseIdc;               }
   Void      setParseIdc                     (Int x)                         { m_parseIdc = x;                  }
-  Void      markAllPicsAsNoCurrAu();
+  Void      markAllPicsAsNoCurrAu           (TComVPS *vps);
 
   Int       getLastPocPeriodId              ()                              { return m_lastPocPeriodId;        }
@@ -258,5 +258,5 @@
   TComList<TComPic*>*  getListPic           ()                              { return &m_cListPic;              }
   Void      setLayerDec                     (TDecTop **p)                   { m_ppcTDecTop = p;                }
-  TDecTop*  getLayerDec                     (UInt layerIdx)                 { return m_ppcTDecTop[layerIdx];   }
+  TDecTop*  getLayerDec                     (UInt layerId)                  { return m_ppcTDecTop[layerId];    }
 #if R0235_SMALLEST_LAYER_ID
   Void      xDeriveSmallestLayerId(TComVPS* vps);
