Index: /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 180)
+++ /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 181)
@@ -744,7 +744,7 @@
 #if REF_IDX_FRAMEWORK
 #if JCTVC_M0458_INTERLAYER_RPS_SIG
+    return m_activeNumILRRefIdx;
+#else
     return getNumILRRefIdx();
-#else
-    return m_numILRRefIdx;
 #endif 
 #else
@@ -762,5 +762,9 @@
   if(getLayerId())
   {
+#if JCTVC_M0458_INTERLAYER_RPS_SIG
+    numRpsCurrTempList += m_activeNumILRRefIdx;
+#else
     numRpsCurrTempList += getNumILRRefIdx();
+#endif
   }
 #endif
Index: /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 180)
+++ /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 181)
@@ -1323,4 +1323,6 @@
         rpcSlice->setRPS(rps);
       }
+
+
       if (rpcSlice->getSPS()->getTMVPFlagsPresent())
       {
@@ -1333,4 +1335,47 @@
       }
     }
+
+#if REF_IDX_FRAMEWORK
+#if JCTVC_M0458_INTERLAYER_RPS_SIG    
+    rpcSlice->setActiveNumILRRefIdx(0);
+    if((sps->getLayerId() > 0)  &&  (rpcSlice->getNumILRRefIdx() > 0) ) 
+    {      
+      READ_FLAG(uiCode,"inter_layer_pred_enabled_flag");
+      rpcSlice->setInterLayerPredEnabledFlag(uiCode);
+      if( rpcSlice->getInterLayerPredEnabledFlag())
+      {
+        if(rpcSlice->getNumILRRefIdx() > 1) 
+        {
+          if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 
+          {
+            READ_UVLC(uiCode,"num_inter_layer_ref_pics_minus1");   
+            rpcSlice->setActiveNumILRRefIdx(uiCode + 1);          
+          }
+          else
+          {
+            rpcSlice->setActiveNumILRRefIdx(1);          
+            rpcSlice->setInterLayerPredLayerIdc(0,0);          
+          }
+          for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 
+          {
+            READ_UVLC(uiCode,"inter_layer_pred_layer_idc[i]");          
+            rpcSlice->setInterLayerPredLayerIdc(uiCode,i);          
+          }
+        }
+        else
+        {
+          rpcSlice->setActiveNumILRRefIdx(1);          
+          rpcSlice->setInterLayerPredLayerIdc(0,0);      
+        }
+      }
+    }
+#else
+    if( rpcSlice->getLayerId() > 0 )
+    {
+      rpcSlice->setNumILRRefIdx( rpcSlice->getVPS()->getNumDirectRefLayers( rpcSlice->getLayerId() ) );
+    }
+#endif
+#endif
+
     if(sps->getUseSAO())
     {
@@ -1606,46 +1651,4 @@
     rpcSlice->setNumEntryPointOffsets ( 0 );
   }
-
-#if REF_IDX_FRAMEWORK
-#if JCTVC_M0458_INTERLAYER_RPS_SIG    
-  rpcSlice->setActiveNumILRRefIdx(0);
-  if((sps->getLayerId() > 0)  &&  (rpcSlice->getNumILRRefIdx() > 0) ) 
-  {      
-    READ_FLAG(uiCode,"inter_layer_pred_enabled_flag");
-    rpcSlice->setInterLayerPredEnabledFlag(uiCode);
-    if( rpcSlice->getInterLayerPredEnabledFlag())
-    {
-      if(rpcSlice->getNumILRRefIdx() > 1) 
-      {
-        if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 
-        {
-          READ_UVLC(uiCode,"num_inter_layer_ref_pics_minus1");   
-          rpcSlice->setActiveNumILRRefIdx(uiCode + 1);          
-        }
-        else
-        {
-          rpcSlice->setActiveNumILRRefIdx(1);          
-          rpcSlice->setInterLayerPredLayerIdc(0,0);          
-        }
-        for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 
-        {
-          READ_UVLC(uiCode,"inter_layer_pred_layer_idc[i]");          
-          rpcSlice->setInterLayerPredLayerIdc(uiCode,i);          
-        }
-      }
-      else
-      {
-        rpcSlice->setActiveNumILRRefIdx(1);          
-        rpcSlice->setInterLayerPredLayerIdc(0,0);      
-      }
-    }
-  }
-#else
-  if( rpcSlice->getLayerId() > 0 )
-  {
-    rpcSlice->setNumILRRefIdx( rpcSlice->getVPS()->getNumDirectRefLayers( rpcSlice->getLayerId() ) );
-  }
-#endif
-#endif
 
   if(pps->getSliceHeaderExtensionPresentFlag())
Index: /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 180)
+++ /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 181)
@@ -1013,4 +1013,5 @@
         }
       }
+
       if (pcSlice->getSPS()->getTMVPFlagsPresent())
       {
@@ -1018,4 +1019,24 @@
       }
     }
+
+#if JCTVC_M0458_INTERLAYER_RPS_SIG    
+    if((pcSlice->getSPS()->getLayerId() > 0)  &&  (pcSlice->getNumILRRefIdx() > 0) ) 
+    {
+      WRITE_FLAG(pcSlice->getInterLayerPredEnabledFlag(),"inter_layer_pred_enabled_flag");
+      if( pcSlice->getInterLayerPredEnabledFlag())
+      {
+        if(pcSlice->getNumILRRefIdx() > 1)
+        {
+          if( !pcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 
+          {
+            WRITE_UVLC(pcSlice->getNumInterLayerRefPics(),"num_inter_layer_ref_pics_minus1");                     
+          }       
+          for(Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 
+            WRITE_UVLC(pcSlice->getInterLayerPredLayerIdc(i),"inter_layer_pred_layer_idc[i]");     
+        }
+      }
+    }     
+#endif 
+
     if(pcSlice->getSPS()->getUseSAO())
     {
@@ -1176,22 +1197,5 @@
     }
   }
-#if JCTVC_M0458_INTERLAYER_RPS_SIG    
-    if((pcSlice->getSPS()->getLayerId() > 0)  &&  (pcSlice->getNumILRRefIdx() > 0) ) 
-    {
-      WRITE_FLAG(pcSlice->getInterLayerPredEnabledFlag(),"inter_layer_pred_enabled_flag");
-      if( pcSlice->getInterLayerPredEnabledFlag())
-      {
-        if(pcSlice->getNumILRRefIdx() > 1)
-        {
-          if( !pcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 
-          {
-            WRITE_UVLC(pcSlice->getNumInterLayerRefPics(),"num_inter_layer_ref_pics_minus1");                     
-          }       
-          for(Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 
-            WRITE_UVLC(pcSlice->getInterLayerPredLayerIdc(i),"inter_layer_pred_layer_idc[i]");     
-        }
-      }
-    }     
-#endif 
+
   if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag())
   {
