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
