Index: /branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncTop.cpp	(revision 414)
@@ -1055,4 +1055,13 @@
 #endif
   }
+#if IL_SL_SIGNALLING_N0371
+  for(i = 1; i < vps->getMaxLayers(); i++)
+  {
+    for(Int j = 0; j < i; j++)
+    {
+      vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) );
+    }
+  }
+#endif
 #endif
 #if JCTVC_M0458_INTERLAYER_RPS_SIG        
Index: /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComRom.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComRom.cpp	(revision 414)
@@ -526,4 +526,11 @@
 Int g_mvScalingFactor  [MAX_LAYERS][2] = {{0,0}, {0,0}};
 Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}};
+
+#if IL_SL_SIGNALLING_N0371
+Int ref_scalingListDC         [MAX_LAYERS][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
+Int ref_scalingListCoef       [MAX_LAYERS][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM][MAX_MATRIX_COEF_NUM];
+Int activeRefPPSId            [MAX_LAYERS];
+Int activeRefSPSId            [MAX_LAYERS];
+#endif 
 #endif
 
Index: /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComRom.h
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComRom.h	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComRom.h	(revision 414)
@@ -282,4 +282,11 @@
 extern Int g_mvScalingFactor  [MAX_LAYERS][2];
 extern Int g_posScalingFactor [MAX_LAYERS][2];
+
+#if IL_SL_SIGNALLING_N0371
+extern Int ref_scalingListDC         [MAX_LAYERS][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
+extern Int ref_scalingListCoef       [MAX_LAYERS][SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM][MAX_MATRIX_COEF_NUM];
+extern Int activeRefPPSId            [MAX_LAYERS];
+extern Int activeRefSPSId            [MAX_LAYERS];  
+#endif   
 #endif
 
Index: /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 414)
@@ -46,6 +46,10 @@
 
 #if SVC_EXTENSION
-  ParameterSetMap<TComVPS> ParameterSetManager::m_vpsMap(MAX_NUM_VPS);
-  Int ParameterSetManager::m_activeVPSId = -1;
+ParameterSetMap<TComVPS> ParameterSetManager::m_vpsMap(MAX_NUM_VPS);
+Int ParameterSetManager::m_activeVPSId = -1;
+#if IL_SL_SIGNALLING_N0371
+TComSPS* TComSPS::m_pcSPS[MAX_LAYERS];
+TComPPS* TComPPS::m_pcPPS[MAX_LAYERS];
+#endif
 #endif
 
@@ -1879,4 +1883,28 @@
 }
 #endif
+<<<<<<< .mine
+
+#if IL_SL_SIGNALLING_N0371
+Bool TComVPS::checkLayerDependency(UInt i, UInt j)
+{
+  if( this->getDirectDependencyFlag(i, j) == true )
+  {                                                                                                                                    
+    return true;                                                                                                                       
+  }                                                                                                                                    
+  else                                                                                                                                   
+  {                                                                                                                                    
+    for(UInt k=i-1; k>j; k--)
+    {                                                                                                                                
+      if( this->getDirectDependencyFlag(i, k) == true )
+      {                                                                                                                            
+        checkLayerDependency( k,j );                                                                                           
+      }
+    }
+  }
+  return false;        
+}
+#endif
+
+=======
 #if VIEW_ID_RELATED_SIGNALING 
 Int TComVPS::getNumViews()
@@ -1912,4 +1940,5 @@
 }
 #endif
+>>>>>>> .r413
 // ------------------------------------------------------------------------------------------------
 // Sequence parameter set (SPS)
@@ -2382,5 +2411,9 @@
 /** set default quantization matrix to array
 */
+#if IL_SL_SIGNALLING_N0371
+Void TComSlice::setDefaultScalingList( UInt layerId )
+#else
 Void TComSlice::setDefaultScalingList()
+#endif
 {
   for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
@@ -2388,5 +2421,9 @@
     for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++)
     {
+#if IL_SL_SIGNALLING_N0371
+      getScalingList()->processDefaultMarix(sizeId, listId, layerId);
+#else
       getScalingList()->processDefaultMarix(sizeId, listId);
+#endif
     }
   }
@@ -2449,5 +2486,4 @@
     {
       src = getScalingListAddress(sizeIdc, listIdc);
-
       fseek(fp,0,0);
       do 
@@ -2563,13 +2599,38 @@
  * \param Index of input matrix
  */
+#if IL_SL_SIGNALLING_N0371
+Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId, UInt layerId)
+#else
 Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId)
-{
+#endif
+{
+#if IL_SL_SIGNALLING_N0371
+  Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]);
+  UInt* scan  = (sizeId == 0) ? g_auiSigLastScan [ SCAN_DIAG ] [ 1 ] :  g_sigLastScanCG32x32; 
+  Int *src = getScalingListDefaultAddress(sizeId, listId);   
+#endif
+
   ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
+
+#if IL_SL_SIGNALLING_N0371
+  for(i = 0; i < coefNum; i++) 
+  {
+    ref_scalingListCoef[layerId][sizeId][listId][i] = src[scan[i]];
+  }
+#endif
+
   setScalingListDC(sizeId,listId,SCALING_LIST_DC);
+#if IL_SL_SIGNALLING_N0371
+  ref_scalingListDC[layerId][sizeId][listId] = SCALING_LIST_DC;
+#endif
 }
 
 /** check DC value of matrix for default matrix signaling
  */
+#if IL_SL_SIGNALLING_N0371
+Void TComScalingList::checkDcOfMatrix( UInt layerId )
+#else
 Void TComScalingList::checkDcOfMatrix()
+#endif
 {
   for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
@@ -2580,5 +2641,9 @@
       if(getScalingListDC(sizeId,listId) == 0)
       {
+#if IL_SL_SIGNALLING_N0371
+        processDefaultMarix(sizeId, listId, layerId);
+#else
         processDefaultMarix(sizeId, listId);
+#endif
       }
     }
@@ -2661,4 +2726,10 @@
         m_activeVPSId = vpsId;
         m_activeSPSId = spsId;
+
+#if IL_SL_SIGNALLING_N0371
+        activeRefPPSId[ sps->getLayerId() ] = ppsId;
+        activeRefSPSId[ sps->getLayerId() ] = spsId;
+#endif
+
         return true;
       }
Index: /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.h	(revision 414)
@@ -156,16 +156,43 @@
   Void     setScalingListPresentFlag    (Bool b)                               { m_scalingListPresentFlag = b;    }
   Bool     getScalingListPresentFlag    ()                                     { return m_scalingListPresentFlag; }
+
+#if IL_SL_SIGNALLING_N0371
+  UInt     m_layerId;
+
+  Void     setPredScalingListFlag    (Bool b)                               { m_predScalingListFlag = b;    }
+  Bool     getPredScalingListFlag    ()                                     { return m_predScalingListFlag; }
+  Void     setScalingListRefLayerId  (UInt b)                               { m_scalingListRefLayerId = b;  }
+  UInt     getScalingListRefLayerId  ()                                     { return m_scalingListRefLayerId; }
+#endif
+
   Bool     getUseTransformSkip    ()                                     { return m_useTransformSkip; }      
   Void     setUseTransformSkip    (Bool b)                               { m_useTransformSkip = b;    }
+
   Int*     getScalingListAddress          (UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient
+
   Bool     checkPredMode                  (UInt sizeId, UInt listId);
+
   Void     setRefMatrixId                 (UInt sizeId, UInt listId, UInt u)   { m_refMatrixId[sizeId][listId] = u;    }     //!< set reference matrix ID
   UInt     getRefMatrixId                 (UInt sizeId, UInt listId)           { return m_refMatrixId[sizeId][listId]; }     //!< get reference matrix ID
   Int*     getScalingListDefaultAddress   (UInt sizeId, UInt listId);                                                        //!< get default matrix coefficient
+
+#if IL_SL_SIGNALLING_N0371
+  Void     processDefaultMarix            (UInt sizeId, UInt listId, UInt layerId );
+#else
   Void     processDefaultMarix            (UInt sizeId, UInt listId);
+#endif
+
   Void     setScalingListDC               (UInt sizeId, UInt listId, UInt u)   { m_scalingListDC[sizeId][listId] = u; }      //!< set DC value
 
   Int      getScalingListDC               (UInt sizeId, UInt listId)           { return m_scalingListDC[sizeId][listId]; }   //!< get DC value
+
+#if IL_SL_SIGNALLING_N0371
+  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
+  UInt     getLayerId() { return m_layerId; }
+  Void     checkDcOfMatrix                ( UInt m_layerId );
+#else
   Void     checkDcOfMatrix                ();
+#endif
+
   Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
   Bool     xParseScalingList              (Char* pchFile);
@@ -174,10 +201,19 @@
   Void     init                    ();
   Void     destroy                 ();
+
   Int      m_scalingListDC               [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< the DC value of the matrix coefficient for 16x16
   Bool     m_useDefaultScalingMatrixFlag [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< UseDefaultScalingMatrixFlag
   UInt     m_refMatrixId                 [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< RefMatrixID
   Bool     m_scalingListPresentFlag;                                                //!< flag for using default matrix
+
+#if IL_SL_SIGNALLING_N0371
+  Bool     m_predScalingListFlag;                                                   //!< flag for inter-layer scaling-list prediction
+  UInt     m_scalingListRefLayerId;                                                 //!< scaling_list_ref_layer_id  
+#endif
+
   UInt     m_predMatrixId                [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
+
   Int      *m_scalingListCoef            [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix
+
   Bool     m_useTransformSkip;                                                      //!< transform skipping flag for setting default scaling matrix for 4x4
 };
@@ -469,4 +505,7 @@
   Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
 #endif
+#if IL_SL_SIGNALLING_N0371
+  Bool        m_scalingListLayerDependency[MAX_LAYERS][MAX_LAYERS];  // layer dependency for scaling list
+#endif
   TComPTL     m_pcPTL;
   TimingInfo  m_timingInfo;
@@ -554,4 +593,7 @@
   Int         m_avgPicRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
 #endif
+<<<<<<< .mine
+
+=======
 #if REPN_FORMAT_IN_VPS
   Bool       m_repFormatIdxPresentFlag;
@@ -564,4 +606,5 @@
   Int         m_viewIdVal                [MAX_LAYERS];
 #endif
+>>>>>>> .r413
 public:
   TComVPS();
@@ -629,4 +672,11 @@
   Void    deriveLayerIdListVariables();
 #endif
+
+#if IL_SL_SIGNALLING_N0371
+  Bool    checkLayerDependency(UInt i, UInt j);
+  Bool    getScalingListLayerDependency  ( UInt layerId, UInt refLayerId )            { return m_scalingListLayerDependency[layerId][refLayerId]; }
+  Void    setScalingListLayerDependency  ( UInt layerId, UInt refLayerId, Bool val  ) { m_scalingListLayerDependency[layerId][refLayerId] = val;  }
+#endif
+
   TComPTL* getPTL() { return &m_pcPTL; }
   TimingInfo* getTimingInfo() { return &m_timingInfo; }
@@ -1083,5 +1133,7 @@
   Bool        m_scalingListEnabledFlag;
   Bool        m_scalingListPresentFlag;
+
   TComScalingList*     m_scalingList;   //!< ScalingList class pointer
+
   UInt        m_uiMaxDecPicBuffering[MAX_TLAYER]; 
   UInt        m_uiMaxLatencyIncrease[MAX_TLAYER];  // Really max latency increase plus 1 (value 0 expresses no limit)
@@ -1107,4 +1159,12 @@
 #if SVC_EXTENSION
   UInt m_layerId;
+
+#if IL_SL_SIGNALLING_N0371
+  TComVPS*    m_pVPS;
+  static TComSPS* m_pcSPS[MAX_LAYERS];
+  Bool        m_predScalingListFlag;
+  UInt        m_scalingListRefLayerId;
+#endif
+
 #endif
 #if REF_IDX_MFM
@@ -1229,6 +1289,20 @@
   Bool getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
   Void setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag  = b;       }
+
+#if IL_SL_SIGNALLING_N0371
+  Bool getPredScalingListFlag()         { return m_predScalingListFlag;     }
+  Void setPredScalingListFlag( Bool b ) { m_predScalingListFlag  = b;       }
+  UInt getScalingListRefLayerId()         { return m_scalingListRefLayerId;   }
+  Void setScalingListRefLayerId( UInt b ) { m_scalingListRefLayerId  = b;       }
+
+  TComVPS*  getVPS()                      { return  m_pVPS; }
+  Void      setVPS( TComVPS* vps )        { m_pVPS = vps;   }
+  static   TComSPS* getSPS(UInt layerId)               { return m_pcSPS[layerId]; }
+  static   Void     setSPS(UInt layerId, TComSPS* sps) { m_pcSPS[layerId] = sps;  }
+#endif
+
   Void setScalingList      ( TComScalingList *scalingList);
   TComScalingList* getScalingList ()       { return m_scalingList; }               //!< get ScalingList class pointer in SPS
+
   UInt getMaxDecPicBuffering  (UInt tlayer)            { return m_uiMaxDecPicBuffering[tlayer]; }
   Void setMaxDecPicBuffering  ( UInt ui, UInt tlayer ) { m_uiMaxDecPicBuffering[tlayer] = ui;   }
@@ -1364,5 +1438,18 @@
   Int      m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
   Bool     m_scalingListPresentFlag;
+
+#if SVC_EXTENSION
+  UInt m_layerId;
+
+#if IL_SL_SIGNALLING_N0371
+  static TComPPS* m_pcPPS[MAX_LAYERS];
+  Bool     m_predScalingListFlag;
+  UInt     m_scalingListRefLayerId;
+#endif
+
+#endif
+
   TComScalingList*     m_scalingList;   //!< ScalingList class pointer
+
   Bool m_listsModificationPresentFlag;
   UInt m_log2ParallelMergeLevelMinus2;
@@ -1478,4 +1565,18 @@
   Bool     getScalingListPresentFlag()         { return m_scalingListPresentFlag;     }
   Void     setScalingListPresentFlag( Bool b ) { m_scalingListPresentFlag  = b;       }
+
+#if IL_SL_SIGNALLING_N0371
+  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
+  UInt     getLayerId() { return m_layerId; }
+
+  Bool     getPredScalingListFlag()         { return m_predScalingListFlag;     }
+  Void     setPredScalingListFlag( Bool b ) { m_predScalingListFlag  = b;       }
+  UInt     getScalingListRefLayerId()         { return m_scalingListRefLayerId;     }
+  Void     setScalingListRefLayerId( UInt b ) { m_scalingListRefLayerId  = b;       }
+
+  static   TComPPS* getPPS(UInt layerId)               { return m_pcPPS[layerId]; }
+  static   Void     setPPS(UInt layerId, TComPPS* pps) { m_pcPPS[layerId] = pps;  }
+#endif
+
   Void     setScalingList      ( TComScalingList *scalingList);
   TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in PPS
@@ -1879,5 +1980,11 @@
   Void  setScalingList              ( TComScalingList* scalingList ) { m_scalingList = scalingList; }
   TComScalingList*   getScalingList ()                               { return m_scalingList; }
+
+#if IL_SL_SIGNALLING_N0371
+  Void  setDefaultScalingList       ( UInt m_layerId );
+#else
   Void  setDefaultScalingList       ();
+#endif
+
   Bool  checkDefaultScalingList     ();
   Void      setCabacInitFlag  ( Bool val ) { m_cabacInitFlag = val;      }  //!< set CABAC initial flag 
Index: /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComTrQuant.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComTrQuant.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComTrQuant.cpp	(revision 414)
@@ -2494,5 +2494,9 @@
 /** set flat matrix value to quantized coefficient
  */
+#if IL_SL_SIGNALLING_N0371
+Void TComTrQuant::setFlatScalingList( UInt m_layerId )
+#else
 Void TComTrQuant::setFlatScalingList()
+#endif
 {
   UInt size,list;
@@ -2503,4 +2507,12 @@
     for(list = 0; list <  g_scalingListNum[size]; list++)
     {
+#if IL_SL_SIGNALLING_N0371
+      ref_scalingListDC[m_layerId][size][list] = SCALING_LIST_DC;
+      for(UInt i=0; i<MAX_MATRIX_COEF_NUM; i++)
+      {
+        ref_scalingListCoef[m_layerId][size][list][i] = SCALING_LIST_DC;
+      }
+#endif
+
       for(qp=0;qp<SCALING_LIST_REM_NUM;qp++)
       {
Index: /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComTrQuant.h
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComTrQuant.h	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibCommon/TComTrQuant.h	(revision 414)
@@ -181,5 +181,11 @@
   Void setUseScalingList   ( Bool bUseScalingList){ m_scalingListEnabledFlag = bUseScalingList; };
   Bool getUseScalingList   (){ return m_scalingListEnabledFlag; };
+
+#if IL_SL_SIGNALLING_N0371
+  Void setFlatScalingList  ( UInt m_layerId );
+#else
   Void setFlatScalingList  ();
+#endif
+
   Void xsetFlatScalingList ( UInt list, UInt size, UInt qp);
   Void xSetScalingListEnc  ( TComScalingList *scalingList, UInt list, UInt size, UInt qp);
Index: /branches/SHM-3.1-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibCommon/TypeDef.h	(revision 414)
@@ -60,4 +60,9 @@
 #define TEMP_SCALABILITY_FIX             1      ///< fix for temporal scalability
 #endif
+<<<<<<< .mine
+#define IL_SL_SIGNALLING_N0371           1      ///< JCTVC-N0371: inter-layer scaling list
+#define M0464_TILE_BOUNDARY_ALIGNED_FLAG 0      ///< VUI flag to indicate tile boundary alignment
+=======
+>>>>>>> .r413
 #define M0463_VUI_EXT_ILP_REF            0      ///< VUI extension inter-layer dependency offset signalling
 #define SPS_EXTENSION                    1      ///< Define sps_extension() syntax structure
Index: /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 414)
@@ -291,7 +291,55 @@
   }
   READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" );           pcPPS->setScalingListPresentFlag( uiCode ? true : false );
+
+#if IL_SL_SIGNALLING_N0371
+  pcPPS->setPPS( pcPPS->getLayerId(), pcPPS );  
+#endif
+
   if(pcPPS->getScalingListPresentFlag ())
   {
+#if IL_SL_SIGNALLING_N0371
+    pcPPS->getScalingList()->setLayerId( pcPPS->getLayerId() );
+
+    if( pcPPS->getLayerId() > 0 ) 
+    {
+      READ_FLAG( uiCode, "pps_pred_scaling_list_flag" );           pcPPS->setPredScalingListFlag( uiCode ? true : false );
+      pcPPS->getScalingList()->setPredScalingListFlag( pcPPS->getPredScalingListFlag() );
+      
+      if( pcPPS->getPredScalingListFlag() )
+      {
+        READ_UVLC ( uiCode, "scaling_list_pps_ref_layer_id" );   pcPPS->setScalingListRefLayerId( uiCode );
+
+        // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
+        assert( pcPPS->getScalingListRefLayerId() >= 0 && pcPPS->getScalingListRefLayerId() <= 62 );
+
+        // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of pps_scaling_list_ref_layer_id shall be greater than 0
+        if( pcPPS->getSPS()->getVPS()->getAvcBaseLayerFlag() )
+        {
+          assert( pcPPS->getScalingListRefLayerId() > 0 );
+        }
+
+        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 
+        // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
+        assert( pcPPS->getPPS( pcPPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
+
+        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 
+        // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
+        assert( pcPPS->getSPS()->getVPS()->getScalingListLayerDependency( pcPPS->getLayerId(), pcPPS->getScalingListRefLayerId() ) == true );
+
+        pcPPS->getScalingList()->setScalingListRefLayerId( pcPPS->getScalingListRefLayerId() );
+        parseScalingList( pcPPS->getScalingList() );
+      }
+      else
+      {
+        parseScalingList( pcPPS->getScalingList() );
+      }
+    }
+    else
+    {
+      parseScalingList( pcPPS->getScalingList() );
+    }
+#else
     parseScalingList( pcPPS->getScalingList() );
+#endif
   }
 
@@ -522,4 +570,8 @@
   }
 #endif 
+#if IL_SL_SIGNALLING_N0371
+  pcSPS->setVPS( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId()) );
+  pcSPS->setSPS( pcSPS->getLayerId(), pcSPS );
+#endif
   if ( pcSPS->getMaxTLayers() == 1 )
   {
@@ -647,6 +699,6 @@
   Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() );
   pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth );
-
   READ_FLAG( uiCode, "scaling_list_enabled_flag" );                 pcSPS->setScalingListFlag ( uiCode );
+
   if(pcSPS->getScalingListFlag())
   {
@@ -654,5 +706,50 @@
     if(pcSPS->getScalingListPresentFlag ())
     {
+
+#if IL_SL_SIGNALLING_N0371
+      pcSPS->getScalingList()->setLayerId( pcSPS->getLayerId() );
+
+      if( pcSPS->getLayerId() > 0 )
+      {
+        READ_FLAG( uiCode, "sps_pred_scaling_list_flag" );  pcSPS->setPredScalingListFlag ( uiCode );
+        pcSPS->getScalingList()->setPredScalingListFlag( pcSPS->getPredScalingListFlag() );
+
+        if( pcSPS->getPredScalingListFlag() )
+        {
+          READ_UVLC( uiCode, "scaling_list_sps_ref_layer_id" );    pcSPS->setScalingListRefLayerId( uiCode );
+
+          // The value of sps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
+          assert( pcSPS->getScalingListRefLayerId() >= 0 && pcSPS->getScalingListRefLayerId() <= 62 );
+
+          // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
+          if( pcSPS->getVPS()->getAvcBaseLayerFlag() )
+          {
+            assert( pcSPS->getScalingListRefLayerId() > 0 );
+          }
+
+          // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 
+          // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
+          assert( pcSPS->getSPS( pcSPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
+
+          // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 
+          // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
+          assert( pcSPS->getVPS()->getScalingListLayerDependency( pcSPS->getLayerId(), pcSPS->getScalingListRefLayerId() ) == true );
+
+          pcSPS->getScalingList()->setScalingListRefLayerId( pcSPS->getScalingListRefLayerId() );
+          parseScalingList( pcSPS->getScalingList() );
+        }
+        else
+        {
+          parseScalingList( pcSPS->getScalingList() );
+        }
+      }
+      else
+      {
+        parseScalingList( pcSPS->getScalingList() );
+      }
+#else
       parseScalingList( pcSPS->getScalingList() );
+#endif
+
     }
   }
@@ -1243,5 +1340,17 @@
     }
   }
-#endif
+
+#endif
+
+#if IL_SL_SIGNALLING_N0371
+  for(i = 1; i < vps->getMaxLayers(); i++)
+    {
+      for(j = 0; j < i; j++)
+        {      
+          vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) );
+        }
+    }
+#endif
+
 #if M0040_ADAPTIVE_RESOLUTION_CHANGE
   READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false);
@@ -2447,4 +2556,5 @@
   UInt  code, sizeId, listId;
   Bool scalingListPredModeFlag;
+
   //for each size
   for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
@@ -2452,4 +2562,46 @@
     for(listId = 0; listId <  g_scalingListNum[sizeId]; listId++)
     {
+#if IL_SL_SIGNALLING_N0371
+      if ( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
+      { 
+        READ_FLAG( code, "scaling_list_pred_mode_flag");
+        scalingListPredModeFlag = (code) ? true : false;
+        if(!scalingListPredModeFlag) //Copy Mode
+        {
+          READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
+          scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code)));
+          if( sizeId > SCALING_LIST_8x8 )
+          {
+            scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))));
+          }
+          scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
+
+        }
+        else //DPCM Mode
+        {
+          xDecodeScalingList(scalingList, sizeId, listId);
+        }
+      }
+      else
+      {
+        READ_FLAG( code, "scaling_list_pred_mode_flag");
+        scalingListPredModeFlag = (code) ? true : false;
+        if(!scalingListPredModeFlag) //Copy Mode
+        {
+          READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
+          scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code)));
+          if( sizeId > SCALING_LIST_8x8 )
+          {
+            scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))));
+          }
+          scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
+
+        }
+        else //DPCM Mode
+        {
+          xDecodeScalingList(scalingList, sizeId, listId);
+        }
+      }
+#else
       READ_FLAG( code, "scaling_list_pred_mode_flag");
       scalingListPredModeFlag = (code) ? true : false;
@@ -2469,4 +2621,5 @@
         xDecodeScalingList(scalingList, sizeId, listId);
       }
+#endif
     }
   }
@@ -2490,14 +2643,44 @@
   if( sizeId > SCALING_LIST_8x8 )
   {
+#if IL_SL_SIGNALLING_N0371
+    if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
+    {
+      ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
+      scalingList->setScalingListDC(sizeId,listId,ref_scalingListDC[scalingList->getScalingListRefLayerId()][sizeId][listId]);
+    }
+    else
+    {
+      READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8");
+      scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8);
+      nextCoef = scalingList->getScalingListDC(sizeId,listId);
+      ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
+    }
+#else
     READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8");
     scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8);
     nextCoef = scalingList->getScalingListDC(sizeId,listId);
+#endif
   }
 
   for(i = 0; i < coefNum; i++)
   {
+#if IL_SL_SIGNALLING_N0371
+    if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
+    {
+      ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = dst[scan[i]];
+      dst[scan[i]] = ref_scalingListCoef[scalingList->getScalingListRefLayerId()][sizeId][listId][i];
+    }
+    else
+    {
+      READ_SVLC( data, "scaling_list_delta_coef");
+      nextCoef = (nextCoef + data + 256 ) % 256;
+      dst[scan[i]] = nextCoef;
+      ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = dst[scan[i]];
+    }
+#else
     READ_SVLC( data, "scaling_list_delta_coef");
     nextCoef = (nextCoef + data + 256 ) % 256;
     dst[scan[i]] = nextCoef;
+#endif
   }
 }
Index: /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 414)
@@ -75,4 +75,5 @@
   Void  parseVPSExtension   ( TComVPS* pcVPS );
 #endif
+
 #if VPS_VUI
   Void  parseVPSVUI   ( TComVPS* pcVPS );
Index: /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 414)
@@ -1232,7 +1232,16 @@
   if(pcSlice->getSPS()->getScalingListFlag())
   {
+#if IL_SL_SIGNALLING_N0371
+    pcSlice->getSPS()->getScalingList()->setLayerId( m_layerId );
+#endif
+
     pcSlice->setScalingList ( pcSlice->getSPS()->getScalingList()  );
+
     if(pcSlice->getPPS()->getScalingListPresentFlag())
     {
+#if IL_SL_SIGNALLING_N0371
+      pcSlice->getPPS()->getScalingList()->setLayerId( m_layerId );
+#endif
+
       pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList()  );
     }
@@ -1240,5 +1249,9 @@
     if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag())
     {
+#if IL_SL_SIGNALLING_N0371
+      pcSlice->setDefaultScalingList( m_layerId );
+#else
       pcSlice->setDefaultScalingList();
+#endif
     }
     m_cTrQuant.setScalingListDec(pcSlice->getScalingList());
@@ -1247,5 +1260,9 @@
   else
   {
+#if IL_SL_SIGNALLING_N0371
+    m_cTrQuant.setFlatScalingList( m_layerId );
+#else
     m_cTrQuant.setFlatScalingList();
+#endif
     m_cTrQuant.setUseScalingList(false);
   }
@@ -1278,4 +1295,5 @@
   sps->setLayerId(m_layerId);
 #endif
+
 #if SPS_SUB_LAYER_INFO
   m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder[0] );
@@ -1301,4 +1319,9 @@
 {
   TComPPS* pps = new TComPPS();
+
+#if IL_SL_SIGNALLING_N0371
+  pps->setLayerId(m_layerId);
+#endif
+
   m_cEntropyDecoder.decodePPS( pps );
 #if SVC_EXTENSION
Index: /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.h	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.h	(revision 414)
@@ -79,5 +79,5 @@
 
   TComSlice*              m_apcSlicePilot;
-  
+
   SEIMessages             m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices
 
Index: /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 414)
@@ -221,4 +221,9 @@
   }
   WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0,                          "pps_scaling_list_data_present_flag" ); 
+
+#if IL_SL_SIGNALLING_N0371
+  pcPPS->setPPS( pcPPS->getLayerId(), pcPPS );  
+#endif
+
   if( pcPPS->getScalingListPresentFlag() )
   {
@@ -226,5 +231,49 @@
     printf("PPS\n");
 #endif
+
+#if IL_SL_SIGNALLING_N0371
+    m_pcSlice->getScalingList()->setLayerId( pcPPS->getLayerId() );
+
+    if( pcPPS->getLayerId() > 0 )
+    {
+      WRITE_FLAG( pcPPS->getPredScalingListFlag() ? 1 : 0,                          "pps_pred_scaling_list_flag" );
+      m_pcSlice->getScalingList()->setPredScalingListFlag( pcPPS->getPredScalingListFlag() );
+
+      if( pcPPS->getPredScalingListFlag() )
+      {
+        // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
+        assert( pcPPS->getScalingListRefLayerId() >= 0 && pcPPS->getScalingListRefLayerId() <= 62 );
+
+        // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of pps_scaling_list_ref_layer_id shall be greater than 0
+        if( pcPPS->getSPS()->getVPS()->getAvcBaseLayerFlag() )
+        {
+          assert( pcPPS->getScalingListRefLayerId() > 0 );
+        }
+
+        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 
+        // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
+        assert( pcPPS->getPPS( pcPPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
+
+        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 
+        // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
+        assert( pcPPS->getSPS()->getVPS()->getScalingListLayerDependency( pcPPS->getLayerId(), pcPPS->getScalingListRefLayerId() ) == true );
+        
+        WRITE_UVLC( pcPPS->getScalingListRefLayerId(),                            "scaling_list_pps_ref_layer_id" );
+        m_pcSlice->getScalingList()->setScalingListRefLayerId( pcPPS->getScalingListRefLayerId() );
+        codeScalingList( m_pcSlice->getScalingList() );
+      }
+      else
+      {
+        codeScalingList( m_pcSlice->getScalingList() );
+      }
+    }
+    else
+    {
+      codeScalingList( m_pcSlice->getScalingList() );
+    }
+#else
     codeScalingList( m_pcSlice->getScalingList() );
+#endif
+
   }
   WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
@@ -489,4 +538,9 @@
   WRITE_UVLC( pcSPS->getQuadtreeTUMaxDepthIntra() - 1,                               "max_transform_hierarchy_depth_intra" );
   WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0,                                   "scaling_list_enabled_flag" ); 
+
+#if IL_SL_SIGNALLING_N0371
+  pcSPS->setSPS( pcSPS->getLayerId(), pcSPS );
+#endif
+
   if(pcSPS->getScalingListFlag())
   {
@@ -497,5 +551,50 @@
     printf("SPS\n");
 #endif
+
+#if IL_SL_SIGNALLING_N0371
+    m_pcSlice->getScalingList()->setLayerId( pcSPS->getLayerId() );
+
+    if( pcSPS->getLayerId() > 0 )
+    {
+      WRITE_FLAG( pcSPS->getPredScalingListFlag() ? 1 : 0,                          "sps_pred_scaling_list_flag" );
+      m_pcSlice->getScalingList()->setPredScalingListFlag( pcSPS->getPredScalingListFlag() );
+
+      if( pcSPS->getPredScalingListFlag() )
+      {
+
+        // The value of sps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
+        assert( pcSPS->getScalingListRefLayerId() >= 0 && pcSPS->getScalingListRefLayerId() <= 62 );
+        
+        // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
+        if( pcSPS->getVPS()->getAvcBaseLayerFlag() )
+        {
+          assert( pcSPS->getScalingListRefLayerId() > 0 );
+        }
+
+        // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 
+        // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
+        assert( pcSPS->getSPS( pcSPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
+
+        // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 
+        // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
+        assert( pcSPS->getVPS()->getScalingListLayerDependency( pcSPS->getLayerId(), pcSPS->getScalingListRefLayerId() ) == true );
+
+        WRITE_UVLC( pcSPS->getScalingListRefLayerId(),                            "scaling_list_sps_ref_layer_id" );
+        m_pcSlice->getScalingList()->setScalingListRefLayerId( pcSPS->getScalingListRefLayerId() );
+        codeScalingList( m_pcSlice->getScalingList() );
+      }
+      else
+      {
+        codeScalingList( m_pcSlice->getScalingList() );
+      }
+    }
+    else
+    {
       codeScalingList( m_pcSlice->getScalingList() );
+    }
+#else
+      codeScalingList( m_pcSlice->getScalingList() );
+#endif
+
     }
   }
@@ -517,5 +616,5 @@
   TComRPSList* rpsList = pcSPS->getRPSList();
   TComReferencePictureSet*      rps;
-
+  
   WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" );
   for(Int i=0; i < rpsList->getNumberOfReferencePictureSets(); i++)
@@ -949,4 +1048,15 @@
     }
   }
+
+#if IL_SL_SIGNALLING_N0371
+  for(i = 1; i < vps->getMaxLayers(); i++)
+  {
+    for(j = 0; j < i; j++)
+    {
+      vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) );
+    }
+  }
+#endif
+
 #endif
 #if M0040_ADAPTIVE_RESOLUTION_CHANGE
@@ -1901,4 +2011,33 @@
         startBit = m_pcBitIf->getNumberOfWrittenBits();
 #endif
+
+#if IL_SL_SIGNALLING_N0371
+        if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
+        {
+          scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId );
+          WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" );
+          if(!scalingListPredModeFlag)// Copy Mode
+          {
+            WRITE_UVLC( (Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta");
+          }
+          else// DPCM Mode
+          {
+            xCodeScalingList(scalingList, sizeId, listId);
+          }
+        }
+        else
+        {
+          scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId );
+          WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" );
+          if(!scalingListPredModeFlag)// Copy Mode
+          {
+            WRITE_UVLC( (Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta");
+          }
+          else// DPCM Mode
+          {
+            xCodeScalingList(scalingList, sizeId, listId);
+          }
+        }
+#else
         scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId );
         WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" );
@@ -1911,7 +2050,10 @@
           xCodeScalingList(scalingList, sizeId, listId);
         }
+#endif
+
 #if SCALING_LIST_OUTPUT_RESULT
         printf("Matrix [%d][%d] Bit %d\n",sizeId,listId,m_pcBitIf->getNumberOfWrittenBits() - startBit);
 #endif
+
       }
     }
@@ -1933,11 +2075,49 @@
   Int data;
   Int *src = scalingList->getScalingListAddress(sizeId, listId);
+
     if( sizeId > SCALING_LIST_8x8 )
     {
+#if IL_SL_SIGNALLING_N0371
+      if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
+      {
+        ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
+        scalingList->setScalingListDC(sizeId,listId,ref_scalingListDC[scalingList->getScalingListRefLayerId()][sizeId][listId]);
+      }
+      else
+      {
+        WRITE_SVLC( scalingList->getScalingListDC(sizeId,listId) - 8, "scaling_list_dc_coef_minus8");
+        nextCoef = scalingList->getScalingListDC(sizeId,listId);
+        ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
+      }
+#else
       WRITE_SVLC( scalingList->getScalingListDC(sizeId,listId) - 8, "scaling_list_dc_coef_minus8");
       nextCoef = scalingList->getScalingListDC(sizeId,listId);
+#endif
     }
     for(Int i=0;i<coefNum;i++)
     {
+#if IL_SL_SIGNALLING_N0371
+      if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
+      {
+        ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = src[scan[i]];
+        src[scan[i]] = ref_scalingListCoef[scalingList->getScalingListRefLayerId()][sizeId][listId][i];
+      }
+      else
+      {
+        data = src[scan[i]] - nextCoef;
+        ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = src[scan[i]];
+        nextCoef = src[scan[i]];
+        if(data > 127)
+        {
+          data = data - 256;
+        }
+        if(data < -128)
+        {
+          data = data + 256;
+        }
+
+        WRITE_SVLC( data,  "scaling_list_delta_coef");
+      }
+#else
       data = src[scan[i]] - nextCoef;
       nextCoef = src[scan[i]];
@@ -1952,4 +2132,5 @@
 
       WRITE_SVLC( data,  "scaling_list_delta_coef");
+#endif
     }
 }
Index: /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.h	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.h	(revision 414)
@@ -87,4 +87,5 @@
   Void  codeVPSExtension        ( TComVPS* pcVPS );
 #endif
+
 #if VPS_VUI
   Void codeVPSVUI               (TComVPS *vps);
Index: /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 414)
@@ -593,4 +593,8 @@
 #endif
 
+#if IL_SL_SIGNALLING_N0371
+    m_pcEncTop->getScalingList()->setLayerId( m_layerId );
+#endif
+
     pcSlice->setLastIDR(m_iLastIDR);
     pcSlice->setSliceIdx(0);
@@ -601,5 +605,9 @@
     if(m_pcEncTop->getUseScalingListId() == SCALING_LIST_OFF)
     {
+#if IL_SL_SIGNALLING_N0371
+      m_pcEncTop->getTrQuant()->setFlatScalingList( m_layerId );
+#else
       m_pcEncTop->getTrQuant()->setFlatScalingList();
+#endif
       m_pcEncTop->getTrQuant()->setUseScalingList(false);
       m_pcEncTop->getSPS()->setScalingListPresentFlag(false);
@@ -608,5 +616,14 @@
     else if(m_pcEncTop->getUseScalingListId() == SCALING_LIST_DEFAULT)
     {
+#if IL_SL_SIGNALLING_N0371
+      pcSlice->getScalingList()->setLayerId( m_layerId );
+#endif
+
+#if IL_SL_SIGNALLING_N0371
+      pcSlice->setDefaultScalingList ( m_layerId );
+#else
       pcSlice->setDefaultScalingList ();
+#endif
+
       m_pcEncTop->getSPS()->setScalingListPresentFlag(false);
       m_pcEncTop->getPPS()->setScalingListPresentFlag(false);
@@ -616,11 +633,41 @@
     else if(m_pcEncTop->getUseScalingListId() == SCALING_LIST_FILE_READ)
     {
+#if IL_SL_SIGNALLING_N0371
+      pcSlice->getScalingList()->setLayerId( m_layerId );
+#endif
+
       if(pcSlice->getScalingList()->xParseScalingList(m_pcCfg->getScalingListFile()))
       {
+#if IL_SL_SIGNALLING_N0371
+        pcSlice->setDefaultScalingList ( m_layerId );
+#else
         pcSlice->setDefaultScalingList ();
-      }
+#endif
+      }
+#if IL_SL_SIGNALLING_N0371
+      pcSlice->getScalingList()->checkDcOfMatrix( m_layerId );
+#else
       pcSlice->getScalingList()->checkDcOfMatrix();
+#endif
       m_pcEncTop->getSPS()->setScalingListPresentFlag(pcSlice->checkDefaultScalingList());
+
+#if IL_SL_SIGNALLING_N0371
+      if( m_layerId > 0 )
+      {
+        m_pcEncTop->getSPS()->setPredScalingListFlag  (true); 
+        m_pcEncTop->getSPS()->setScalingListRefLayerId( 0 ); 
+      }
+#endif
+
       m_pcEncTop->getPPS()->setScalingListPresentFlag(false);
+
+#if IL_SL_SIGNALLING_N0371
+      if( m_layerId > 0 )
+      {
+        m_pcEncTop->getPPS()->setPredScalingListFlag  (false); 
+        m_pcEncTop->getPPS()->setScalingListRefLayerId( 0   ); 
+      }
+#endif
+
       m_pcEncTop->getTrQuant()->setScalingList(pcSlice->getScalingList());
       m_pcEncTop->getTrQuant()->setUseScalingList(true);
@@ -1493,4 +1540,7 @@
 #if SVC_EXTENSION
       nalu = NALUnit(NAL_UNIT_SPS, 0, m_layerId);
+#if IL_SL_SIGNALLING_N0371
+      pcSlice->getSPS()->setVPS( pcSlice->getVPS() );
+#endif
 #else
       nalu = NALUnit(NAL_UNIT_SPS);
Index: /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 414)
@@ -110,5 +110,5 @@
   initROM();
 #endif
-  
+
   // create processing unit classes
 #if SVC_EXTENSION
@@ -761,4 +761,8 @@
 Void TEncTop::xInitPPS()
 {
+#if IL_SL_SIGNALLING_N0371
+  m_cPPS.setLayerId(m_layerId);
+#endif
+
   m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred );
   Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
Index: /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.h	(revision 413)
+++ /branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.h	(revision 414)
@@ -130,4 +130,5 @@
   
 #if SVC_EXTENSION
+
   TEncTop**               m_ppcTEncTop;
   TEncTop*                getLayerEnc(UInt layer)   { return m_ppcTEncTop[layer]; }
