Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1479)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1483)
@@ -212,10 +212,5 @@
   
 #if SVC_EXTENSION
-  m_ppcTEncTop         = pcEncTop->getLayerEnc();
-  for(UInt i=0 ; i< m_uhTotalDepth-1 ; i++)
-  {    
-    m_ppcBestCU[i]->setLayerId(pcEncTop->getLayerId());
-    m_ppcTempCU[i]->setLayerId(pcEncTop->getLayerId());
-  }
+  m_ppcTEncTop         = pcEncTop->getLayerEnc();  
 #endif
   
@@ -465,5 +460,5 @@
 #if ENCODER_FAST_MODE
     Bool testInter = true;
-    if( rpcBestCU->getLayerId() > 0 )
+    if( rpcBestCU->getPic()->getLayerId() > 0 )
     {
       if(pcSlice->getSliceType() == P_SLICE && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == pcSlice->getActiveNumILRRefIdx())
@@ -1832,5 +1827,5 @@
   Bool disableILP = false;
 
-  if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getCtuRsAddr()) >= 0)
+  if (rpcCU->getPic()->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getCtuRsAddr()) >= 0)
   {
     if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getCtuRsAddr()) == 2)
@@ -1868,6 +1863,6 @@
 Void TEncCu::xVerifyTileSetConstraint( TComDataCU*& rpcCU )
 {
-  if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getCtuRsAddr()) >= 0 &&
-      m_disableILP)
+  if( rpcCU->getPic()->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && 
+      rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getCtuRsAddr()) >= 0 && m_disableILP )
   {
     UInt numPartitions = rpcCU->getPic()->getNumPartitionsInCtu();
@@ -1883,5 +1878,5 @@
             if (mvField->getRefIdx(i) >= 0)
             {
-              assert(!(rpcCU->getSlice()->getRefPic(RefPicList(refList), mvField->getRefIdx(i))->isILR(rpcCU->getLayerId())));
+              assert(!(rpcCU->getSlice()->getRefPic(RefPicList(refList), mvField->getRefIdx(i))->isILR(rpcCU->getPic()->getLayerId())));
             }
           }
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1479)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1483)
@@ -2265,5 +2265,5 @@
       pcCU->getIntraDirPredictor( uiPartOffset, uiPreds, COMPONENT_Y, &iMode );
 
-      if( m_pcEncCfg->getUseFastIntraScalable() && pcCU->getLayerId() > 0 )
+      if( m_pcEncCfg->getUseFastIntraScalable() && pcCU->getPic()->getLayerId() > 0 )
       {
         numModesAvailable = pcCU->reduceSetOfIntraModes(uiPartOffset, uiPreds, pcCU->getPic()->getPosScalingFactor(), iMode );
@@ -3098,5 +3098,5 @@
         
         // motion search only for the ILRP with sample prediction type
-        if( pcPic->isILR( pcCU->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerIdx(), pcPic->getLayerIdx() ) )
+        if( pcPic->isILR( pcCU->getPic()->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getPic()->getLayerIdx(), pcPic->getLayerIdx() ) )
         {
           continue;
@@ -3104,5 +3104,5 @@
 
 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
-        if( pcPic->isILR(pcCU->getLayerId()) && m_disableILP )
+        if( pcPic->isILR(pcCU->getPic()->getLayerId()) && m_disableILP )
         {
           continue;
@@ -3110,5 +3110,5 @@
 #endif
 #if ENCODER_FAST_MODE        
-        if( pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N) ) 
+        if( pcPic->isILR(pcCU->getPic()->getLayerId()) && (ePartSize == SIZE_2Nx2N) ) 
         {
           continue;
@@ -3202,5 +3202,5 @@
 
 #if SVC_EXTENSION
-    if( pcCU->getLayerId() && !doneUniPred )
+    if( pcCU->getPic()->getLayerId() && !doneUniPred )
     {
       // there is no valid reference pictures for inter prediction
@@ -3313,10 +3313,10 @@
         Bool     testIter = true;
         TComPic* pcPic    = pcCU->getSlice()->getRefPic( RefPicList(1 - iRefList), iRefIdxBi[1 - iRefList] );
-        if(pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N))
+        if(pcPic->isILR(pcCU->getPic()->getLayerId()) && (ePartSize == SIZE_2Nx2N))
         {
           testIter = false;  //the fixed part is ILR, skip this iteration       
         }
 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
-        if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP)
+        if (pcPic->isILR(pcCU->getPic()->getLayerId()) && m_disableILP)
         {
           testIter = false;
@@ -3336,15 +3336,15 @@
 
           // motion search only for the ILRP with sample prediction type
-          if( pcPic->isILR( pcCU->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerIdx(), pcPic->getLayerIdx() ) )
+          if( pcPic->isILR( pcCU->getPic()->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getPic()->getLayerIdx(), pcPic->getLayerIdx() ) )
           {
             continue;
           }
 
-          if(pcPic->isILR(pcCU->getLayerId()) && (ePartSize == SIZE_2Nx2N))
+          if(pcPic->isILR(pcCU->getPic()->getLayerId()) && (ePartSize == SIZE_2Nx2N))
           {
             testRefIdx = false;  //the refined part is ILR, skip this reference pic           
           }
 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
-          if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP)
+          if (pcPic->isILR(pcCU->getPic()->getLayerId()) && m_disableILP)
           {
             testRefIdx = false;
@@ -3919,5 +3919,5 @@
   //  Do integer search
 #if REF_IDX_ME_ZEROMV
-  if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getLayerId()))  //ILR reference pic 
+  if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getPic()->getLayerId()))  //ILR reference pic 
   {
     rcMv.setZero();  //use Mv(0, 0) for integer ME 
@@ -3955,5 +3955,5 @@
 
 #if REF_IDX_ME_ZEROMV
-  if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getLayerId()))  //ILR reference pic
+  if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->isILR(pcCU->getPic()->getLayerId()))  //ILR reference pic
   {
     xPatternSearchFracDIFMv0( pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost );
@@ -6026,5 +6026,5 @@
 
       // ILRP has to be for the sample prediction type
-      if( refPic->isILR(pcCU->getLayerId()) && refPic->getLayerId() == refLayerId && pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerIdx(), pcCU->getSlice()->getVPS()->getLayerIdxInVps(refLayerId) ) )
+      if( refPic->isILR(pcCU->getPic()->getLayerId()) && refPic->getLayerId() == refLayerId && pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getPic()->getLayerIdx(), pcCU->getSlice()->getVPS()->getLayerIdxInVps(refLayerId) ) )
       {
         iRefIdxTemp = refIdx;
