Index: branches/0.3-poznan-univ/build/HM_vc10.sln
===================================================================
--- branches/0.3-poznan-univ/build/HM_vc10.sln	(revision 45)
+++ branches/0.3-poznan-univ/build/HM_vc10.sln	(revision 46)
@@ -28,4 +28,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLibRenderer", "vc10\TLibRenderer_vc10.vcxproj", "{2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLibExtractor", "vc10\TLibExtractor_vc10.vcxproj", "{27E2C758-E3CE-44CA-A226-83491EC7F798}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppExtractor", "vc10\TAppExtractor_vc10.vcxproj", "{F46F95E9-7174-4328-90DD-092450E4DCF6}"
 EndProject
 Global
@@ -109,4 +113,20 @@
 		{2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4}.Release|x64.ActiveCfg = Release|x64
 		{2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4}.Release|x64.Build.0 = Release|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|Win32.ActiveCfg = Debug|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|Win32.Build.0 = Debug|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|x64.ActiveCfg = Debug|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|x64.Build.0 = Debug|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|Win32.ActiveCfg = Release|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|Win32.Build.0 = Release|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|x64.ActiveCfg = Release|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|x64.Build.0 = Release|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|Win32.Build.0 = Debug|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|x64.ActiveCfg = Debug|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|x64.Build.0 = Debug|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|Win32.ActiveCfg = Release|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|Win32.Build.0 = Release|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|x64.ActiveCfg = Release|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: branches/0.3-poznan-univ/build/HM_vc8.sln
===================================================================
--- branches/0.3-poznan-univ/build/HM_vc8.sln	(revision 45)
+++ branches/0.3-poznan-univ/build/HM_vc8.sln	(revision 46)
@@ -9,4 +9,6 @@
 		{F8B77A48-AF6C-4746-A89F-B706ABA6AD94} = {F8B77A48-AF6C-4746-A89F-B706ABA6AD94}
 		{5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
+		{F8B77A48-AF6C-4746-A89F-B706ABA6AD94} = {F8B77A48-AF6C-4746-A89F-B706ABA6AD94}
+		{78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
 	EndProjectSection
 EndProject
@@ -18,4 +20,8 @@
 		{5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
 		{5E87AD84-AC4F-4336-B4EE-549CA210EE4A} = {5E87AD84-AC4F-4336-B4EE-549CA210EE4A}
+		{5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
+		{47E90995-1FC5-4EE4-A94D-AD474169F0E1} = {47E90995-1FC5-4EE4-A94D-AD474169F0E1}
+		{78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
+		{8783AD3A-A5CA-42B7-AAC4-A07EB845A684} = {8783AD3A-A5CA-42B7-AAC4-A07EB845A684}
 	EndProjectSection
 EndProject
@@ -36,7 +42,21 @@
 		{78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
 		{5E87AD84-AC4F-4336-B4EE-549CA210EE4A} = {5E87AD84-AC4F-4336-B4EE-549CA210EE4A}
+		{78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
+		{5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
+		{8783AD3A-A5CA-42B7-AAC4-A07EB845A684} = {8783AD3A-A5CA-42B7-AAC4-A07EB845A684}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLibRenderer", "vc8\TLibRenderer_vc8.vcproj", "{5E87AD84-AC4F-4336-B4EE-549CA210EE4A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLibExtractor", "vc8\TLibExtractor_vc8.vcproj", "{27E2C758-E3CE-44CA-A226-83491EC7F798}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppExtractor", "vc8\TAppExtractor_vc8.vcproj", "{F46F95E9-7174-4328-90DD-092450E4DCF6}"
+	ProjectSection(ProjectDependencies) = postProject
+		{F8B77A48-AF6C-4746-A89F-B706ABA6AD94} = {F8B77A48-AF6C-4746-A89F-B706ABA6AD94}
+		{27E2C758-E3CE-44CA-A226-83491EC7F798} = {27E2C758-E3CE-44CA-A226-83491EC7F798}
+		{5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
+		{78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
+		{8783AD3A-A5CA-42B7-AAC4-A07EB845A684} = {8783AD3A-A5CA-42B7-AAC4-A07EB845A684}
+	EndProjectSection
 EndProject
 Global
@@ -120,4 +140,20 @@
 		{5E87AD84-AC4F-4336-B4EE-549CA210EE4A}.Release|x64.ActiveCfg = Release|x64
 		{5E87AD84-AC4F-4336-B4EE-549CA210EE4A}.Release|x64.Build.0 = Release|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|Win32.ActiveCfg = Debug|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|Win32.Build.0 = Debug|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|x64.ActiveCfg = Debug|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|x64.Build.0 = Debug|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|Win32.ActiveCfg = Release|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|Win32.Build.0 = Release|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|x64.ActiveCfg = Release|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|x64.Build.0 = Release|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|Win32.Build.0 = Debug|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|x64.ActiveCfg = Debug|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|x64.Build.0 = Debug|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|Win32.ActiveCfg = Release|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|Win32.Build.0 = Release|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|x64.ActiveCfg = Release|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: branches/0.3-poznan-univ/build/HM_vc9.sln
===================================================================
--- branches/0.3-poznan-univ/build/HM_vc9.sln	(revision 45)
+++ branches/0.3-poznan-univ/build/HM_vc9.sln	(revision 46)
@@ -39,4 +39,15 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLibRenderer", "vc9\TLibRenderer_vc9.vcproj", "{457993C6-AE2C-4B9B-B5F9-71033279A0B9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLibExtractor", "vc9\TLibExtractor_vc9.vcproj", "{27E2C758-E3CE-44CA-A226-83491EC7F798}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppExtractor", "vc9\TAppExtractor_vc9.vcproj", "{F46F95E9-7174-4328-90DD-092450E4DCF6}"
+	ProjectSection(ProjectDependencies) = postProject
+		{F8B77A48-AF6C-4746-A89F-B706ABA6AD94} = {F8B77A48-AF6C-4746-A89F-B706ABA6AD94}
+		{27E2C758-E3CE-44CA-A226-83491EC7F798} = {27E2C758-E3CE-44CA-A226-83491EC7F798}
+		{5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
+		{78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
+		{D1E8A1C2-15DB-4C94-80E8-4F70CF0A2DC5} = {D1E8A1C2-15DB-4C94-80E8-4F70CF0A2DC5}
+	EndProjectSection
 EndProject
 Global
@@ -120,4 +131,20 @@
 		{457993C6-AE2C-4B9B-B5F9-71033279A0B9}.Release|x64.ActiveCfg = Release|x64
 		{457993C6-AE2C-4B9B-B5F9-71033279A0B9}.Release|x64.Build.0 = Release|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|Win32.ActiveCfg = Debug|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|Win32.Build.0 = Debug|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|x64.ActiveCfg = Debug|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Debug|x64.Build.0 = Debug|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|Win32.ActiveCfg = Release|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|Win32.Build.0 = Release|Win32
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|x64.ActiveCfg = Release|x64
+		{27E2C758-E3CE-44CA-A226-83491EC7F798}.Release|x64.Build.0 = Release|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|Win32.Build.0 = Debug|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|x64.ActiveCfg = Debug|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Debug|x64.Build.0 = Debug|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|Win32.ActiveCfg = Release|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|Win32.Build.0 = Release|Win32
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|x64.ActiveCfg = Release|x64
+		{F46F95E9-7174-4328-90DD-092450E4DCF6}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: branches/0.3-poznan-univ/build/linux/lib/TLibCommon/makefile
===================================================================
--- branches/0.3-poznan-univ/build/linux/lib/TLibCommon/makefile	(revision 45)
+++ branches/0.3-poznan-univ/build/linux/lib/TLibCommon/makefile	(revision 46)
@@ -42,5 +42,5 @@
 			$(OBJ_DIR)/TComLoopFilter.o \
 			$(OBJ_DIR)/TComMotionInfo.o \
-            $(OBJ_DIR)/TComMP.o \
+                        $(OBJ_DIR)/TComMP.o \
 			$(OBJ_DIR)/TComPattern.o \
 			$(OBJ_DIR)/TComPic.o \
Index: branches/0.3-poznan-univ/build/linux/makefile
===================================================================
--- branches/0.3-poznan-univ/build/linux/makefile	(revision 45)
+++ branches/0.3-poznan-univ/build/linux/makefile	(revision 46)
@@ -8,4 +8,5 @@
 	$(MAKE) -C lib/TLibCommon 	MM32=$(M32)
 	$(MAKE) -C lib/TLibRenderer  MM32=$(M32)
+	$(MAKE) -C lib/TLibExtractor  MM32=$(M32)
 	$(MAKE) -C lib/TLibDecoder 	MM32=$(M32)
 	$(MAKE) -C lib/TLibEncoder 	MM32=$(M32)
@@ -14,4 +15,5 @@
 	$(MAKE) -C test/TAppEncoder MM32=$(M32)
 	$(MAKE) -C test/TAppRenderer MM32=$(M32)
+	$(MAKE) -C test/TAppExtractor MM32=$(M32)
 
 debug:
@@ -19,4 +21,5 @@
 	$(MAKE) -C lib/TLibCommon 	debug	MM32=$(M32)
 	$(MAKE) -C lib/TLibRenderer  debug	MM32=$(M32)
+	$(MAKE) -C lib/TLibExtractor  debug	MM32=$(M32)
 	$(MAKE) -C lib/TLibDecoder 	debug	MM32=$(M32)
 	$(MAKE) -C lib/TLibEncoder 	debug	MM32=$(M32)
@@ -25,4 +28,5 @@
 	$(MAKE) -C test/TAppEncoder debug MM32=$(M32)
 	$(MAKE) -C test/TAppRenderer debug MM32=$(M32)
+	$(MAKE) -C test/TAppExtractor debug MM32=$(M32)
 
 release:
@@ -30,4 +34,5 @@
 	$(MAKE) -C lib/TLibCommon 	release MM32=$(M32)
 	$(MAKE) -C lib/TLibRenderer  release MM32=$(M32)
+	$(MAKE) -C lib/TLibExtractor  release MM32=$(M32)
 	$(MAKE) -C lib/TLibDecoder 	release MM32=$(M32)
 	$(MAKE) -C lib/TLibEncoder 	release MM32=$(M32)
@@ -36,4 +41,5 @@
 	$(MAKE) -C test/TAppEncoder release MM32=$(M32)
 	$(MAKE) -C test/TAppRenderer release MM32=$(M32)
+	$(MAKE) -C test/TAppExtractor release MM32=$(M32)
 
 clean:
@@ -41,4 +47,5 @@
 	$(MAKE) -C lib/TLibCommon 	clean MM32=$(M32)
 	$(MAKE) -C lib/TLibRenderer  clean MM32=$(M32)
+	$(MAKE) -C lib/TLibExtractor  clean MM32=$(M32)
 	$(MAKE) -C lib/TLibDecoder 	clean MM32=$(M32)
 	$(MAKE) -C lib/TLibEncoder 	clean MM32=$(M32)
@@ -47,4 +54,3 @@
 	$(MAKE) -C test/TAppEncoder clean MM32=$(M32)
 	$(MAKE) -C test/TAppRenderer clean MM32=$(M32)
-	
-	
+	$(MAKE) -C test/TAppExtractor clean MM32=$(M32)
Index: branches/0.3-poznan-univ/cfg/encoder_mvd.cfg
===================================================================
--- branches/0.3-poznan-univ/cfg/encoder_mvd.cfg	(revision 45)
+++ branches/0.3-poznan-univ/cfg/encoder_mvd.cfg	(revision 46)
@@ -17,4 +17,7 @@
 
 BitstreamFile                 : BitStreamMV.bin
+
+3DVFlexOrder 	              :	0
+3DVCodingOrder 	              :	T0D0D1D2T1T2
 
 
Index: branches/0.3-poznan-univ/source/Lib/TLibCommon/TComBitStream.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibCommon/TComBitStream.cpp	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibCommon/TComBitStream.cpp	(revision 46)
@@ -61,4 +61,8 @@
   m_auiSliceByteLocation = NULL;
   m_uiSliceCount         = 0;
+#if BITSTREAM_EXTRACTION
+  m_apulPacketPayloadBuffer = new UInt[uiSize];
+  m_uiPacketPayloadSize = 0;
+#endif  
 }
 
@@ -66,4 +70,7 @@
 {
   delete [] m_apulStreamPacketBegin;     m_apulStreamPacketBegin = NULL;
+#if BITSTREAM_EXTRACTION
+  delete [] m_apulPacketPayloadBuffer;   m_apulPacketPayloadBuffer = NULL;
+#endif
 }
 
@@ -148,4 +155,14 @@
   xReadNextWord();
 }
+
+#if BITSTREAM_EXTRACTION
+UInt TComBitstream::reinitParsing()
+{
+  rewindStreamPacket();
+  memcpy( m_apulStreamPacketBegin, m_apulPacketPayloadBuffer, m_uiPacketPayloadSize );
+  initParsing( m_uiPacketPayloadSize );
+  return m_uiPacketPayloadSize;
+}
+#endif
 
 #if LCEC_INTRA_MODE || QC_LCEC_INTER_MODE
@@ -319,4 +336,9 @@
   UChar* pucWrite      = reinterpret_cast<UChar*> (getBuffer());
   
+#if BITSTREAM_EXTRACTION
+  memcpy( m_apulPacketPayloadBuffer, m_apulStreamPacketBegin, uiBytesRead );
+  m_uiPacketPayloadSize = uiBytesRead;
+#endif
+
   for( ; uiReadOffset < uiBytesRead; uiReadOffset++ )
   {
Index: branches/0.3-poznan-univ/source/Lib/TLibCommon/TComBitStream.h
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibCommon/TComBitStream.h	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibCommon/TComBitStream.h	(revision 46)
@@ -85,4 +85,9 @@
   UInt        m_uiSliceProcessed;
 
+#if BITSTREAM_EXTRACTION
+  UInt*       m_apulPacketPayloadBuffer;
+  UInt        m_uiPacketPayloadSize;
+#endif  
+
   UInt xSwap ( UInt ui )
   {
@@ -164,4 +169,8 @@
 
   void insertAt(const TComBitstream& src, unsigned pos);
+
+#if BITSTREAM_EXTRACTION
+  UInt        reinitParsing();
+#endif  
 };
 
Index: branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.cpp	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.cpp	(revision 46)
@@ -66,4 +66,8 @@
   m_iViewIdx = 0 ;
 
+#if BITSTREAM_EXTRACTION
+  m_uiLayerId = 0;
+#endif
+
 #if SONY_COLPIC_AVAILABILITY
   m_iViewOrderIdx = 0;
@@ -669,4 +673,7 @@
 #endif
   
+#if BITSTREAM_EXTRACTION
+  m_uiLayerId             = 0;
+#endif
   m_uiViewId              = 0;
   m_iViewOrderIdx         = 0;
@@ -716,4 +723,7 @@
 TComPPS::TComPPS()
 {
+#if BITSTREAM_EXTRACTION
+  m_uiLayerId             = 0;
+#endif
 #if CONSTRAINED_INTRA_PRED
   m_bConstrainedIntraPred = false;
Index: branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.h	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.h	(revision 46)
@@ -81,4 +81,7 @@
   UInt        m_uiMaxTrDepth;
 
+#if BITSTREAM_EXTRACTION
+  UInt        m_uiLayerId;
+#endif
   UInt        m_uiViewId;
   Int         m_iViewOrderIdx;
@@ -370,4 +373,8 @@
   Bool getUseTexDqpAccordingToDepth    ()           {return m_bUseTexDqpAccordingToDepth;}
 #endif
+#if BITSTREAM_EXTRACTION
+  Void      setLayerId              ( UInt u ) { m_uiLayerId = u; }
+  UInt      getLayerId              ()         { return m_uiLayerId; }
+#endif
 };
 
@@ -385,4 +392,7 @@
   UInt        m_uiPPSId;
   UInt        m_uiSPSId;
+#if BITSTREAM_EXTRACTION
+  UInt        m_uiLayerId;
+#endif
 
 public:
@@ -405,4 +415,9 @@
   Void setUseWP                     ( Bool b )  { m_bUseWeightPred = b;       }
   Void setWPBiPredIdc               ( UInt u )  { m_uiBiPredIdc = u;          }
+#endif
+
+#if BITSTREAM_EXTRACTION
+  Void      setLayerId              ( UInt u ) { m_uiLayerId = u; }
+  UInt      getLayerId              ()         { return m_uiLayerId; }
 #endif
 };
@@ -435,4 +450,7 @@
   UInt        m_uiPPSId;
   Int         m_iPOC;
+#if BITSTREAM_EXTRACTION
+  UInt        m_uiLayerId;
+#endif
 #if SONY_COLPIC_AVAILABILITY
   Int         m_iViewOrderIdx;
@@ -608,4 +626,9 @@
   Void      setLambda( Double d ) { m_dLambda = d; }
   Double    getLambda() { return m_dLambda;        }
+
+#if BITSTREAM_EXTRACTION
+  Void      setLayerId( UInt u )                        { m_uiLayerId = u; }
+  UInt      getLayerId()                                { return m_uiLayerId; }
+#endif
 
   Void      setViewIdx(Int i)                           { m_iViewIdx = i; }
Index: branches/0.3-poznan-univ/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibCommon/TypeDef.h	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibCommon/TypeDef.h	(revision 46)
@@ -40,4 +40,6 @@
 
 
+#define BITSTREAM_EXTRACTION            1
+
 #define FLEX_CODING_ORDER               1
 
Index: branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 46)
@@ -82,4 +82,21 @@
 // ====================================================================================================================
 
+#if BITSTREAM_EXTRACTION
+Void  TDecCavlc::parseNalUnitHeader ( NalUnitType& eNalUnitType, UInt& TemporalId, UInt& uiLayerId )
+{
+  UInt  uiCode;
+
+  xReadCode ( 1, uiCode ); assert( 0 == uiCode); // forbidden_zero_bit
+  xReadCode ( 1, uiCode );                       // nal_ref_flag
+  xReadCode ( 6, uiCode );                       // nal_unit_type
+  eNalUnitType = (NalUnitType) uiCode;
+
+  xReadCode(3, uiCode); // temporal_id
+  TemporalId = uiCode;
+  xReadCode(5, uiCode); // layer_id_plus1
+  assert( 1 <= uiCode );
+  uiLayerId = uiCode - 1;
+}
+#else
 Void  TDecCavlc::parseNalUnitHeader ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag )
 {
@@ -105,4 +122,5 @@
   }
 }
+#endif
 
 /**
Index: branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 46)
@@ -182,5 +182,10 @@
 #endif
   
+#if BITSTREAM_EXTRACTION
+  Void  parseNalUnitHeader  ( NalUnitType& eNalUnitType, UInt& TemporalId, UInt& uiLayerId );
+#else
   Void  parseNalUnitHeader  ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag );
+#endif
+
   
   Void  parseSPS            ( TComSPS* pcSPS );
Index: branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecEntropy.h	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecEntropy.h	(revision 46)
@@ -67,5 +67,9 @@
   virtual Void  setBitstream          ( TComBitstream* p )  = 0;
 
+#if BITSTREAM_EXTRACTION
+  virtual Void  parseNalUnitHeader    ( NalUnitType& eNalUnitType, UInt& TemporalId, UInt& uiLayerId )  = 0;
+#else
   virtual Void  parseNalUnitHeader    ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag )  = 0;
+#endif
 
   virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
@@ -147,7 +151,11 @@
   Void    resetEntropy                ( TComSlice* p)           { m_pcEntropyDecoderIf->resetEntropy(p);                    }
 
+#if BITSTREAM_EXTRACTION
+  Void    decodeNalUnitHeader         ( NalUnitType& eNalUnitType, UInt& TemporalId, UInt& uiLayerId )
+                                                                { m_pcEntropyDecoderIf->parseNalUnitHeader( eNalUnitType, TemporalId, uiLayerId ); }
+#else
   Void    decodeNalUnitHeader         ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag )
                                                                 { m_pcEntropyDecoderIf->parseNalUnitHeader(eNalUnitType, TemporalId, bOutputFlag ); }
-
+#endif
 
   Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
Index: branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecSbac.h	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecSbac.h	(revision 46)
@@ -75,5 +75,9 @@
   Void  setMaxAlfCtrlDepth        ( UInt uiMaxAlfCtrlDepth ) { m_uiMaxAlfCtrlDepth = uiMaxAlfCtrlDepth; }
   
+#if BITSTREAM_EXTRACTION
+  Void  parseNalUnitHeader    ( NalUnitType& eNalUnitType, UInt& TemporalId, UInt& uiLayerId ) {}
+#else
   Void  parseNalUnitHeader    ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag ) {}
+#endif
   
   Void  parseSPS                  ( TComSPS* pcSPS         ) {}
Index: branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp	(revision 45)
+++ branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp	(revision 46)
@@ -709,7 +709,15 @@
   NalUnitType eNalUnitType;
   UInt        TemporalId;
+
+#if BITSTREAM_EXTRACTION
+  UInt        uiLayerId;
+
+  m_cEntropyDecoder.decodeNalUnitHeader(eNalUnitType, TemporalId, uiLayerId);
+#else
   Bool        OutputFlag;
 
   m_cEntropyDecoder.decodeNalUnitHeader(eNalUnitType, TemporalId, OutputFlag);
+#endif
+
   reNalUnitType = eNalUnitType;
 
