Index: branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 297)
@@ -139,4 +139,8 @@
   m_colRefLayerIdx       = 0;
 #endif
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+  m_numSamplePredRefLayers       = 0;
+  m_interLayerSamplePredOnlyFlag = false;
+#endif
 #endif
 #endif
@@ -197,5 +201,8 @@
   m_numILRRefIdx              = 0;
 #endif  
-
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+  m_numSamplePredRefLayers       = 0;
+  m_interLayerSamplePredOnlyFlag = false;
+#endif
 #endif
   m_colFromL0Flag = 1;
@@ -488,4 +495,7 @@
       pcRefPic->getPicYuvRec()->extendPicBorder();
       RefPicSetStCurr0[NumPocStCurr0] = pcRefPic;
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+      if( !m_interLayerSamplePredOnlyFlag || pcRefPic->getLayerId() < getLayerId()) 
+#endif
       NumPocStCurr0++;
       pcRefPic->setCheckLTMSBPresent(false);  
@@ -501,4 +511,7 @@
       pcRefPic->getPicYuvRec()->extendPicBorder();
       RefPicSetStCurr1[NumPocStCurr1] = pcRefPic;
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+      if( !m_interLayerSamplePredOnlyFlag || pcRefPic->getLayerId() < getLayerId()) 
+#endif
       NumPocStCurr1++;
       pcRefPic->setCheckLTMSBPresent(false);  
@@ -514,4 +527,7 @@
       pcRefPic->getPicYuvRec()->extendPicBorder();
       RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+      if( !m_interLayerSamplePredOnlyFlag || pcRefPic->getLayerId() < getLayerId()) 
+#endif
       NumPocLtCurr++;
     }
@@ -662,5 +678,13 @@
   }
 #endif
-  
+
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+    if( m_interLayerSamplePredOnlyFlag && getLayerId() ) 
+    {
+      m_aiNumRefIdx[0] = m_aiNumRefIdx[0] > m_activeNumILRRefIdx ? m_activeNumILRRefIdx : m_aiNumRefIdx[0];
+      m_aiNumRefIdx[1] = m_aiNumRefIdx[1] > m_activeNumILRRefIdx ? m_activeNumILRRefIdx : m_aiNumRefIdx[1];
+    }
+#endif
+ 
     Int cIdx = 0;
     for ( i=0; i<NumPocStCurr0; i++, cIdx++)
Index: branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 297)
@@ -1464,4 +1464,8 @@
 #endif
 #endif 
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+  Int         m_numSamplePredRefLayers;
+  Bool        m_interLayerSamplePredOnlyFlag;
+#endif
 #if L0034_COMBINED_LIST_CLEANUP
   Int         m_list1IdxToList0Idx[MAX_NUM_REF];
@@ -1855,4 +1859,11 @@
 #endif 
 
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+  Int       getNumSamplePredRefLayers      ( )          { return  m_numSamplePredRefLayers;       }
+  Void      setNumSamplePredRefLayers      ( Int i )    { m_numSamplePredRefLayers = i;           }
+  Bool      getInterLayerSamplePredOnlyFlag( )          { return  m_interLayerSamplePredOnlyFlag; }
+  Void      setInterLayerSamplePredOnlyFlag( Bool val ) { m_interLayerSamplePredOnlyFlag = val;   }
+#endif
+
 #if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING
   Void      setNumMotionPredRefLayers(int i)            { m_numMotionPredRefLayers = i; }
Index: branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 297)
@@ -103,4 +103,10 @@
 #endif
 #define M0457_COL_PICTURE_SIGNALING      1
+
+#if !VPS_EXTN_DIRECT_REF_LAYERS || !M0457_PREDICTION_INDICATIONS || !JCTVC_M0458_INTERLAYER_RPS_SIG
+#define M0457_IL_SAMPLE_PRED_ONLY_FLAG   0
+#else
+#define M0457_IL_SAMPLE_PRED_ONLY_FLAG   0
+#endif
 
 #else
Index: branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 297)
@@ -1470,4 +1470,12 @@
       }
     }
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+    rpcSlice->setInterLayerSamplePredOnlyFlag( false );
+    if( rpcSlice->getNumSamplePredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() > 0 )
+    {
+      READ_FLAG( uiCode, "inter_layer_sample_pred_only_flag" );
+      rpcSlice->setInterLayerSamplePredOnlyFlag( uiCode > 0 );
+    }
+#endif
 #else
     if( rpcSlice->getLayerId() > 0 )
Index: branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 297)
@@ -546,4 +546,7 @@
 
 #if SVC_EXTENSION
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+  m_apcSlicePilot->setNumSamplePredRefLayers( getNumSamplePredRefLayers() );
+#endif
   m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder[m_layerId]);
 #else
Index: branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 297)
@@ -1119,4 +1119,10 @@
       }
     }     
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+    if( pcSlice->getNumSamplePredRefLayers() > 0 && pcSlice->getActiveNumILRRefIdx() > 0 )
+    {
+      WRITE_FLAG( pcSlice->getInterLayerSamplePredOnlyFlag(), "inter_layer_sample_pred_only_flag" );
+    }
+#endif
 #endif 
 
Index: branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCu.cpp	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCu.cpp	(revision 297)
@@ -463,4 +463,8 @@
         if(pcSlice->getSliceType() == B_SLICE && pcSlice->getNumRefIdx(REF_PIC_LIST_0) == pcSlice->getActiveNumILRRefIdx() && pcSlice->getNumRefIdx(REF_PIC_LIST_1) == pcSlice->getActiveNumILRRefIdx()) 
             testInter = false;
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+        if( pcSlice->getInterLayerSamplePredOnlyFlag() ) 
+            testInter = false; 
+#endif
     }
 #endif
Index: branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 297)
@@ -539,4 +539,16 @@
 #endif
 
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+    pcSlice->setNumSamplePredRefLayers( m_pcEncTop->getNumSamplePredRefLayers() );
+    pcSlice->setInterLayerSamplePredOnlyFlag( 0 );
+    if( pcSlice->getNumSamplePredRefLayers() > 0 && pcSlice->getActiveNumILRRefIdx() > 0 )
+    {
+      if( m_pcEncTop->getIlSampleOnlyPred() > 0 )
+      {
+        pcSlice->setInterLayerSamplePredOnlyFlag( true );
+      }
+    }
+#endif
+
     pcSlice->setLastIDR(m_iLastIDR);
     pcSlice->setSliceIdx(0);
@@ -923,5 +935,9 @@
 #endif
 
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+    if (pcSlice->getSliceType() == B_SLICE && m_pcEncTop->getIlSampleOnlyPred() == 0)
+#else
     if (pcSlice->getSliceType() == B_SLICE)
+#endif
     {
 #if !REF_IDX_FRAMEWORK
Index: branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.h	(revision 296)
+++ branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncTop.h	(revision 297)
@@ -139,4 +139,7 @@
   Bool                    m_bMFMEnabledFlag;
 #endif
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+  Int                     m_ilSampleOnlyPred;
+#endif
 #if SCALED_REF_LAYER_OFFSETS
   UInt                    m_numScaledRefLayerOffsets;
@@ -227,4 +230,8 @@
   Bool      getMFMEnabledFlag()                   {return m_bMFMEnabledFlag;}    
 #endif
+#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
+  Void      setIlSampleOnlyPred( Int i )          { m_ilSampleOnlyPred = i;    }
+  Int       getIlSampleOnlyPred()                 { return m_ilSampleOnlyPred; }
+#endif
 #if AVC_SYNTAX
   Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
