Index: /branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 725)
+++ /branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 726)
@@ -785,5 +785,5 @@
   //set L0 inter-layer reference picture modification
 #if RPL_INIT_N0316_N0082
-  Bool hasModification = (m_aiNumRefIdx[REF_PIC_LIST_0] == (numberOfPocBeforeCurr + m_activeNumILRRefIdx)) ? false : true;
+  Bool hasModification = (m_aiNumRefIdx[REF_PIC_LIST_0] >= (numberOfPocBeforeCurr + m_activeNumILRRefIdx)) ? false : true;
 #else
   Bool hasModification = (m_aiNumRefIdx[REF_PIC_LIST_0] == numberOfRpsCurrTempList) ? false : true;
@@ -799,7 +799,8 @@
       refPicListModification->setRefPicSetIdxL0(i, i);
     }
+
     if(m_aiNumRefIdx[REF_PIC_LIST_0] > numberOfRpsCurrTempList)
     {
-        // repeat last ref pic when the number of active ref idx are more than RPS entries
+      // repeat last ref pic when the number of active ref idx are more than RPS entries
       for (Int i = numberOfRpsCurrTempList; i < m_aiNumRefIdx[REF_PIC_LIST_0]; i ++)
       {
@@ -809,5 +810,8 @@
     else
     {
-      for(Int i = m_activeNumILRRefIdx; i > 0; i-- )
+      // number of ILRPs included into the reference picture list with the list modification
+      Int inlucdeNumILRP = min(m_aiNumRefIdx[REF_PIC_LIST_0]-numberOfPocBeforeCurr, m_activeNumILRRefIdx);
+
+      for(Int i = inlucdeNumILRP; i > 0; i-- )
       {
 #if RPL_INIT_N0316_N0082
@@ -821,5 +825,6 @@
           for (Int j = numberOfPocBeforeCurr; j < (m_aiNumRefIdx[REF_PIC_LIST_0] - i); j++)
           {
-            refPicListModification->setRefPicSetIdxL0(j, j + m_activeNumILRRefIdx);
+            assert( j + inlucdeNumILRP < numberOfRpsCurrTempList );
+            refPicListModification->setRefPicSetIdxL0(j, j + inlucdeNumILRP);
           }
         }
@@ -832,5 +837,5 @@
 
   //set L1 inter-layer reference picture modification
-  hasModification = (m_aiNumRefIdx[REF_PIC_LIST_1] == numberOfRpsCurrTempList) ? false : true;
+  hasModification = (m_aiNumRefIdx[REF_PIC_LIST_1] >= numberOfRpsCurrTempList) ? false : true;
 #if N0147_IRAP_ALIGN_FLAG
   hasModification = hasModification && ( m_aiNumRefIdx[REF_PIC_LIST_1] > 1 );
@@ -854,5 +859,7 @@
     else
     {
-      for(Int i = m_activeNumILRRefIdx; i > 0; i-- )
+      Int inlucdeNumILRP = min(m_aiNumRefIdx[REF_PIC_LIST_1], m_activeNumILRRefIdx);
+
+      for(Int i = inlucdeNumILRP; i > 0; i-- )
       {
         refPicListModification->setRefPicSetIdxL1(m_aiNumRefIdx[REF_PIC_LIST_1] - i, numberOfRpsCurrTempList - i);
Index: /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 725)
+++ /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 726)
@@ -2990,5 +2990,5 @@
 #if SVC_EXTENSION && REF_IDX_MFM
       // set motion mapping flag
-      rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() ) ? true : false );
+      rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() && !rpcSlice->isIntra() ) ? true : false );
 #endif
       if ( rpcSlice->getSliceType() == B_SLICE )
Index: /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 725)
+++ /branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 726)
@@ -1737,5 +1737,10 @@
     if( pcSlice->getMFMEnabledFlag() )
     {
-      Int refLayerId = pcSlice->getRefPic( pcSlice->getSliceType() == B_SLICE ? ( RefPicList )( 1 - pcSlice->getColFromL0Flag() ) : REF_PIC_LIST_0 , pcSlice->getColRefIdx() )->getLayerId();
+      TComPic* refPic = pcSlice->getRefPic( pcSlice->getSliceType() == B_SLICE ? ( RefPicList )( 1 - pcSlice->getColFromL0Flag() ) : REF_PIC_LIST_0 , pcSlice->getColRefIdx() );
+
+      assert( refPic );
+
+      Int refLayerId = refPic->getLayerId();
+
       if( refLayerId != pcSlice->getLayerId() )
       {
@@ -1765,7 +1770,9 @@
 #endif
 
-    if( m_layerId > 0 && pcSlice->getEnableTMVPFlag() )
+    if( m_layerId > 0 && !pcSlice->isIntra() && pcSlice->getEnableTMVPFlag() )
     {
       TComPic* refPic = pcSlice->getRefPic(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
+
+      assert( refPic );
 
       // It is a requirement of bitstream conformance when the collocated picture, used for temporal motion vector prediction, is an inter-layer reference picture, 
Index: /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCu.cpp	(revision 725)
+++ /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCu.cpp	(revision 726)
@@ -696,4 +696,5 @@
 #if (ENCODER_FAST_MODE)
         if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 
+          rpcBestCU->getPredictionMode(0) == SIZE_NONE ||  // if there is no valid inter prediction
           !testInter ||
           rpcBestCU->getCbf( 0, TEXT_LUMA     ) != 0   ||
@@ -701,21 +702,21 @@
           rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0     ) // avoid very complex intra if it is unlikely
 #else
-          if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 
-            rpcBestCU->getCbf( 0, TEXT_LUMA     ) != 0   ||
-            rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0   ||
-            rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0     ) // avoid very complex intra if it is unlikely
-#endif
+        if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 
+          rpcBestCU->getCbf( 0, TEXT_LUMA     ) != 0   ||
+          rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0   ||
+          rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0     ) // avoid very complex intra if it is unlikely
+#endif
+        {
+          xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
+          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
+          if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
           {
-            xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
-          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-            if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
+            if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) )
             {
-              if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) )
-              {
-                xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN   );
+              xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN   );
               rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
-              }
             }
           }
+        }
 
         // test PCM
@@ -734,15 +735,15 @@
 #if (ENCODER_FAST_MODE)
 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
-      if(pcPic->getLayerId() > 0 && !m_disableILP)
-#else
-      if(pcPic->getLayerId() > 0)
-#endif
-      {
-        for(Int refLayer = 0; refLayer < pcSlice->getActiveNumILRRefIdx(); refLayer++)
-        {  
-           xCheckRDCostILRUni( rpcBestCU, rpcTempCU, pcSlice->getInterLayerPredLayerIdc(refLayer));
-           rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
+        if(pcPic->getLayerId() > 0 && !m_disableILP)
+#else
+        if(pcPic->getLayerId() > 0)
+#endif
+        {
+          for(Int refLayer = 0; refLayer < pcSlice->getActiveNumILRRefIdx(); refLayer++)
+          {  
+            xCheckRDCostILRUni( rpcBestCU, rpcTempCU, pcSlice->getInterLayerPredLayerIdc(refLayer));
+            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
+          }
         }
-      }
 #endif
 
@@ -821,7 +822,7 @@
 
   if ( m_pcEncCfg->getCUTransquantBypassFlagForceValue() )
-    {
+  {
     iMaxQP = iMinQP; // If all blocks are forced into using transquant bypass, do not loop here.
-    }
+  }
 
   for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++)
@@ -1476,4 +1477,17 @@
   rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
   
+#if SVC_EXTENSION
+#if AMP_MRG
+  rpcTempCU->setMergeAMP (true);
+  Bool ret = m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG );
+#else  
+  Bool ret = m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
+#endif
+
+  if( !ret )
+  {
+    return;
+  }
+#else
 #if AMP_MRG
   rpcTempCU->setMergeAMP (true);
@@ -1481,4 +1495,5 @@
 #else  
   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
+#endif
 #endif
 
Index: /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 725)
+++ /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 726)
@@ -1476,8 +1476,28 @@
     if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
     {
+#if POC_RESET_FLAG
+      if ( pocCurr > 0          && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
+#else
+      if (pcSlice->getPOC()>0  && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
+#endif
+      {
+        pcSlice->setActiveNumILRRefIdx(0);
+        pcSlice->setInterLayerPredEnabledFlag(0);
+      }
+      if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
+      {
+        pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getActiveNumILRRefIdx());
+        pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getActiveNumILRRefIdx());
+      }
+      else
+      {
+        pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+pcSlice->getActiveNumILRRefIdx());
+        pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getActiveNumILRRefIdx());
+      }
+
       // check for the reference pictures whether there is at least one either temporal picture or ILRP with sample prediction type
-      if( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) == 0 && pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) == 0 )
-      {
-        Bool foundSamplePredPicture = false;
+      if( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) - pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) - pcSlice->getActiveNumILRRefIdx() == 0 )
+      {
+        Bool foundSamplePredPicture = false;                
 
         for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
@@ -1493,25 +1513,7 @@
         {
           pcSlice->setSliceType(I_SLICE);
-        }
-      }
-
-#if POC_RESET_FLAG
-      if ( pocCurr > 0          && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
-#else
-      if (pcSlice->getPOC()>0  && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
-#endif
-      {
-        pcSlice->setActiveNumILRRefIdx(0);
-        pcSlice->setInterLayerPredEnabledFlag(0);
-      }
-      if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
-      {
-        pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getActiveNumILRRefIdx());
-        pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getActiveNumILRRefIdx());
-      }
-      else
-      {
-        pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+pcSlice->getActiveNumILRRefIdx());
-        pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getActiveNumILRRefIdx());
+          pcSlice->setInterLayerPredEnabledFlag(0);
+          pcSlice->setActiveNumILRRefIdx(0);
+        }
       }
     }
@@ -1545,5 +1547,5 @@
       //  Set reference list
       pcSlice->setRefPicList ( rcListPic );
-#endif //SVC_EXTENSION
+#endif
       pcSlice->setRefPicListModificationSvc();
       pcSlice->setRefPicList( rcListPic, false, m_pcEncTop->getIlpList());
@@ -1602,56 +1604,4 @@
           pcSlice->setColFromL0Flag(ColFromL0Flag);
           pcSlice->setColRefIdx(ColRefIdx);
-
-          // remove motion only ILRP from the end of the ColFromL0Flag reference picture list
-          RefPicList refList = RefPicList(ColFromL0Flag);
-          Int numRefIdx = pcSlice->getNumRefIdx(refList);
-
-          if( numRefIdx > 0 )
-          {
-            for( Int refIdx = pcSlice->getNumRefIdx(refList) - 1; refIdx >= pcSlice->getNumRefIdx(refList) - pcSlice->getActiveNumILRRefIdx(); refIdx-- )
-            {
-              TComPic* ilrp = pcSlice->getRefPic(refList, refIdx);
-
-              assert( ilrp->isILR(m_layerId) );
-
-              if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( ilrp->getLayerId() ) )
-              {
-                break;
-              }
-              else
-              {
-                assert( numRefIdx > 1 );
-                numRefIdx--;              
-              }
-            }
-
-            pcSlice->setNumRefIdx( refList, numRefIdx );
-          }
-
-          // remove motion only ILRP from the end of the (1-ColFromL0Flag) reference picture list up to ColRefIdx
-          refList = RefPicList(1 - ColFromL0Flag);
-          numRefIdx = pcSlice->getNumRefIdx(refList);
-
-          if( numRefIdx > 0 )
-          {
-            for( Int refIdx = pcSlice->getNumRefIdx(refList) - 1; refIdx >= pcSlice->getNumRefIdx(refList) - pcSlice->getActiveNumILRRefIdx() && refIdx > ColRefIdx; refIdx-- )
-            {
-              TComPic* ilrp = pcSlice->getRefPic(refList, refIdx);
-
-              assert( ilrp->isILR(m_layerId) );
-
-              if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( ilrp->getLayerId() ) )
-              {
-                break;
-              }
-              else
-              {
-                assert( numRefIdx > 1 );
-                numRefIdx--;              
-              }
-            }
-
-            pcSlice->setNumRefIdx( refList, numRefIdx );
-          }
         }
       }
@@ -1737,4 +1687,83 @@
       pcSlice->setEnableTMVPFlag(0);
     }
+
+#if SVC_EXTENSION
+    if( m_layerId > 0 && !pcSlice->isIntra() )
+    {
+      Int colFromL0Flag = 1;
+      Int colRefIdx = 0;
+
+      // check whether collocated picture is valid
+      if( pcSlice->getEnableTMVPFlag() )
+      {
+        colFromL0Flag = pcSlice->getColFromL0Flag();
+        colRefIdx = pcSlice->getColRefIdx();
+
+        TComPic* refPic = pcSlice->getRefPic(RefPicList(1-colFromL0Flag), colRefIdx);
+
+        assert( refPic );
+
+        // It is a requirement of bitstream conformance when the collocated picture, used for temporal motion vector prediction, is an inter-layer reference picture, 
+        // VpsInterLayerMotionPredictionEnabled[ LayerIdxInVps[ currLayerId ] ][ LayerIdxInVps[ rLId ] ] shall be equal to 1, where rLId is set equal to nuh_layer_id of the inter-layer picture.
+        if( refPic->isILR(m_layerId) && !m_ppcTEncTop[m_layerId]->getMotionPredEnabledFlag(refPic->getLayerId()) )
+        {
+          pcSlice->setEnableTMVPFlag(false);
+          pcSlice->setMFMEnabledFlag(false);
+          colRefIdx = 0;
+        }
+      }
+
+      // remove motion only ILRP from the end of the colFromL0Flag reference picture list
+      RefPicList refList = RefPicList(colFromL0Flag);
+      Int numRefIdx = pcSlice->getNumRefIdx(refList);
+
+      if( numRefIdx > 0 )
+      {
+        for( Int refIdx = pcSlice->getNumRefIdx(refList) - 1; refIdx > 0; refIdx-- )
+        {
+          TComPic* refPic = pcSlice->getRefPic(refList, refIdx);
+
+          if( !refPic->isILR(m_layerId) || refPic->isILR(m_layerId) && m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( refPic->getLayerId() ) )
+          {
+            break;
+          }
+          else
+          {
+            assert( numRefIdx > 1 );
+            numRefIdx--;              
+          }
+        }
+
+        pcSlice->setNumRefIdx( refList, numRefIdx );
+      }
+
+      // remove motion only ILRP from the end of the (1-colFromL0Flag) reference picture list up to colRefIdx
+      refList = RefPicList(1 - colFromL0Flag);
+      numRefIdx = pcSlice->getNumRefIdx(refList);
+
+      if( numRefIdx > 0 )
+      {
+        for( Int refIdx = pcSlice->getNumRefIdx(refList) - 1; refIdx > colRefIdx; refIdx-- )
+        {
+          TComPic* refPic = pcSlice->getRefPic(refList, refIdx);
+
+          if( !refPic->isILR(m_layerId) || refPic->isILR(m_layerId) && m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( refPic->getLayerId() ) )
+          {
+            break;
+          }
+          else
+          {
+            assert( numRefIdx > 1 );
+            numRefIdx--;              
+          }
+        }
+
+        pcSlice->setNumRefIdx( refList, numRefIdx );
+      }
+
+      assert( pcSlice->getNumRefIdx(REF_PIC_LIST_0) > 0 && ( pcSlice->isInterP() || (pcSlice->isInterB() && pcSlice->getNumRefIdx(REF_PIC_LIST_1) > 0) ) );
+    }
+#endif
+
     /////////////////////////////////////////////////////////////////////////////////////////////////// Compress a slice
     //  Slice compression
Index: /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 725)
+++ /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 726)
@@ -3102,8 +3102,16 @@
  * \returns Void
  */
+#if SVC_EXTENSION
+#if AMP_MRG
+Bool TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG )
+#else
+Bool TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes )
+#endif
+#else
 #if AMP_MRG
 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG )
 #else
 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes )
+#endif
 #endif
 {
@@ -3215,4 +3223,8 @@
 #endif
 
+#if SVC_EXTENSION
+      Bool doneUniPred = false;
+#endif
+
     //  Uni-directional prediction
     for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ )
@@ -3243,4 +3255,5 @@
         }
 #endif
+        doneUniPred = true;
 #endif
 
@@ -3351,4 +3364,13 @@
       }
     }
+
+#if SVC_EXTENSION
+    if( pcCU->getLayerId() && !doneUniPred )
+    {
+      // there is no valid reference pictures for inter prediction
+      return false;
+    }
+#endif
+
     //  Bi-directional prediction
 #if REF_IDX_ME_ZEROMV
@@ -3797,5 +3819,9 @@
   setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X );
 
+#if SVC_EXTENSION
+  return true;
+#else
   return;
+#endif
 }
 
Index: /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.h	(revision 725)
+++ /branches/SHM-6-dev/source/Lib/TLibEncoder/TEncSearch.h	(revision 726)
@@ -193,5 +193,9 @@
   
   /// encoder estimation - inter prediction (non-skip)
+#if SVC_EXTENSION
+  Bool predInterSearch          ( TComDataCU* pcCU,
+#else
   Void predInterSearch          ( TComDataCU* pcCU,
+#endif
                                   TComYuv*    pcOrgYuv,
                                   TComYuv*&   rpcPredYuv,
