Index: /trunk/source/Lib/TLibCommon/TComPicSym.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComPicSym.cpp	(revision 10)
+++ /trunk/source/Lib/TLibCommon/TComPicSym.cpp	(revision 11)
@@ -191,5 +191,9 @@
   {
     m_apcTComSlice[m_uiNumAllocatedSlice-1]->copySliceInfo( m_apcTComSlice[m_uiNumAllocatedSlice-2] );
+#if SET_SLICE_LAYER_ID
+    m_apcTComSlice[m_uiNumAllocatedSlice-1]->initSlice( m_apcTComSlice[m_uiNumAllocatedSlice-1]->getLayerId() );
+#else
     m_apcTComSlice[m_uiNumAllocatedSlice-1]->initSlice();
+#endif
   }
 }
Index: /trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 10)
+++ /trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 11)
@@ -153,6 +153,13 @@
 
 
+#if SET_SLICE_LAYER_ID
+Void TComSlice::initSlice( UInt layerId )
+#else
 Void TComSlice::initSlice()
-{
+#endif
+{
+#if SET_SLICE_LAYER_ID
+  m_layerId = layerId;
+#endif
   m_aiNumRefIdx[0]      = 0;
   m_aiNumRefIdx[1]      = 0;
Index: /trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComSlice.h	(revision 10)
+++ /trunk/source/Lib/TLibCommon/TComSlice.h	(revision 11)
@@ -1289,5 +1289,9 @@
   TComSlice();
   virtual ~TComSlice(); 
+#if SET_SLICE_LAYER_ID
+  Void      initSlice       ( UInt layerId );
+#else
   Void      initSlice       ();
+#endif
 
   Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
Index: /trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TypeDef.h	(revision 10)
+++ /trunk/source/Lib/TLibCommon/TypeDef.h	(revision 11)
@@ -46,4 +46,5 @@
 #define SVC_UPSAMPLING                   1      ///< upsampling filters
 #define PHASE_DERIVATION_IN_INTEGER      1      ///< upsampling filters implementation using only integer arithmetic
+#define SET_SLICE_LAYER_ID               1      ///< set layerId to the slice
 
 #define AVC_BASE                         0      ///< YUV BL reading for AVC base SVC
Index: /trunk/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 10)
+++ /trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 11)
@@ -344,10 +344,18 @@
   cFillSlice.setSPS( m_parameterSetManagerDecoder.getFirstSPS() );
   cFillSlice.setPPS( m_parameterSetManagerDecoder.getFirstPPS() );
+#if SET_SLICE_LAYER_ID
+  cFillSlice.initSlice( m_parameterSetManagerDecoder.getFirstSPS()->getLayerId() );
+#else
   cFillSlice.initSlice();
+#endif
   TComPic *cFillPic;
   xGetNewPicBuffer(&cFillSlice,cFillPic);
   cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder.getFirstSPS() );
   cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder.getFirstPPS() );
+#if SET_SLICE_LAYER_ID
+  cFillPic->getSlice(0)->initSlice( cFillPic->getLayerId() );
+#else
   cFillPic->getSlice(0)->initSlice();
+#endif
   
   TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
@@ -440,5 +448,9 @@
 {
   TComPic*&   pcPic         = m_pcPic;
+#if SET_SLICE_LAYER_ID
+  m_apcSlicePilot->initSlice( nalu.m_layerId );
+#else
   m_apcSlicePilot->initSlice();
+#endif
 
   if (m_bFirstSliceInPicture)
Index: /trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 10)
+++ /trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 11)
@@ -192,9 +192,13 @@
   rpcSlice->setSliceBits(0);
   rpcSlice->setPic( pcPic );
+#if SET_SLICE_LAYER_ID
+  rpcSlice->initSlice( pcPic->getLayerId() );
+#else
   rpcSlice->initSlice();
+#endif
   rpcSlice->setPicOutputFlag( true );
   rpcSlice->setPOC( uiPOCCurr );
   
-#if SVC_EXTENSION
+#if SVC_EXTENSION && !SET_SLICE_LAYER_ID
   rpcSlice->setLayerId( pcPic->getLayerId());
 #endif
