Index: /trunk/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg
===================================================================
--- /trunk/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg	(revision 41)
+++ /trunk/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg	(revision 42)
@@ -56,5 +56,6 @@
 TemporalLayerQPOffset_L6  : 6                                      # QP offset for temporal layer 6
 TemporalLayerQPOffset_L7  : 7                                      # QP offset for temporal layer 7
-
+FCO                       : 0                                      # flexible coding order (0:off, 1:on)
+CodingOrder               : T0D0D1T1                               # coding order 
 
 #========== encoder control /motion search ==========
@@ -114,7 +115,8 @@
 MVI                       : 1                                      # motion parameter inheritance
 
+#========== view synthesis optimization (VSO) ==========
+VSOConfig                 : [cx0 B(cc1) I(s0.5)][cx1 B(oo0) I(s0.5)] # VSO configuration string
+#VSOConfig                : [ox0 B(cc1) I(s0.5)][cx1 B(oo0) I(s0.5)] # VSO configuration string for FCO=1 and CodingOrder=T0D0D1T1
 
-#========== view synthesis optimization (VSO) ==========
-VSOConfig                 : [cx0 B(cc1) I(s0.5)][cx1 B(oo0) I(s0.5)]
-                                                                   # VSO configuration string
 
+
Index: /trunk/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg
===================================================================
--- /trunk/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg	(revision 41)
+++ /trunk/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg	(revision 42)
@@ -1,3 +1,2 @@
-
 
 #========== file i/o ==========
@@ -19,5 +18,4 @@
 
 BitstreamFile             : stream.bit                             # bitstream file
-
 
 #========== general coding parameters ==========
@@ -60,5 +58,6 @@
 TemporalLayerQPOffset_L6  : 6                                      # QP offset for temporal layer 6
 TemporalLayerQPOffset_L7  : 7                                      # QP offset for temporal layer 7
-
+FCO                       : 0                                      # flexible coding order (0:off, 1:on) 
+CodingOrder               : T0D0D1D2T1T2                           # coding order   
 
 #========== encoder control /motion search ==========
@@ -112,5 +111,4 @@
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
 
-
 #========== depth coding tools ==========
 DMM                       : 1                                      # use depth intra modes (wedgelets)
@@ -118,7 +116,11 @@
 MVI                       : 1                                      # motion parameter inheritance
 
+#========== view synthesis optimization (VSO) ==========
+VSOConfig                 : [cx0 B(cc1) I(s0.5)][cx1 B(oo0) B(oo2) I(s0.5 s1.5)][cx2 B(cc1) I(s1.5)] # VSO configuration string
+#VSOConfig                : [ox0 B(cc1) I(s0.5)][cx1 B(oo0) B(oo2) I(s0.5 s1.5)][ox2 B(cc1) I(s1.5)] # VSO configuration string for FCO=1 and CodingOrder=T0D0D1D2T1T2
 
-#========== view synthesis optimization (VSO) ==========
-VSOConfig                 : [cx0 B(cc1) I(s0.5)][cx1 B(oo0) B(oo2) I(s0.5 s1.5)][cx2 B(cc1) I(s1.5)]
-                                                                   # VSO configuration string
 
+
+
+
+
Index: /trunk/build/HM_vc10.sln
===================================================================
--- /trunk/build/HM_vc10.sln	(revision 41)
+++ /trunk/build/HM_vc10.sln	(revision 42)
@@ -5,7 +5,4 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppEncoder", "vc10\TAppEncoder_vc10.vcxproj", "{D759E4E1-D33A-4483-B57B-0FD248E022FE}"
-	ProjectSection(ProjectDependencies) = postProject
-		{2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4} = {2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4}
-	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppCommon", "vc10\TAppCommon_vc10.vcxproj", "{D1E8A1C2-15DB-4C94-80E8-4F70CF0A2DC5}"
@@ -20,9 +17,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppRenderer", "vc10\TAppRenderer_vc10.vcxproj", "{3A5A8B26-8CA4-4690-944E-AB78559DE848}"
-	ProjectSection(ProjectDependencies) = postProject
-		{2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4} = {2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4}
-	EndProjectSection
 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
@@ -106,4 +104,16 @@
 		{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|Win32
+		{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|Win32
+		{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|Win32
+		{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|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: /trunk/build/HM_vc8.sln
===================================================================
--- /trunk/build/HM_vc8.sln	(revision 41)
+++ /trunk/build/HM_vc8.sln	(revision 42)
@@ -38,4 +38,15 @@
 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
@@ -119,4 +130,16 @@
 		{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|Win32
+		{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|Win32
+		{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|Win32
+		{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|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: /trunk/build/HM_vc9.sln
===================================================================
--- /trunk/build/HM_vc9.sln	(revision 41)
+++ /trunk/build/HM_vc9.sln	(revision 42)
@@ -38,4 +38,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
@@ -119,4 +130,16 @@
 		{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|Win32
+		{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|Win32
+		{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|Win32
+		{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|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: /trunk/build/linux/lib/TLibExtractor/makefile
===================================================================
--- /trunk/build/linux/lib/TLibExtractor/makefile	(revision 42)
+++ /trunk/build/linux/lib/TLibExtractor/makefile	(revision 42)
@@ -0,0 +1,55 @@
+# the SOURCE definiton lets move your makefile to another position
+CONFIG 			= LIBRARY
+
+# set pathes to the correct directories
+SRC_DIR			= ../../../../source/Lib/TLibExtractor
+INC_DIR			= ../../../../source/Lib/TLibExtractor
+LIB_DIR			= ../../../../lib
+BIN_DIR			= ../../../../bin
+
+SRC_DIR1		=
+SRC_DIR2		=
+SRC_DIR3		=
+SRC_DIR4		=
+
+
+USER_INC_DIRS	= -I$(SRC_DIR)
+USER_LIB_DIRS	=
+
+# intermediate directory for object files
+OBJ_DIR			= ./objects
+
+# the library name
+PRJ_NAME	 	= TLibExtractor
+
+# version information
+MAJOR_VER		= 0
+MINOR_VER		= 1
+VER				= $(MAJOR_VER).$(MINOR_VER)
+
+# defines to set
+DEFS			= -DMSYS_LINUX
+
+# set objects
+OBJS          	= \
+				$(OBJ_DIR)/TExtrTop.o \
+
+LIBS				= -lpthread
+
+DEBUG_LIBS			=
+RELEASE_LIBS		=
+
+STAT_LIBS			=
+DYN_LIBS			= -ldl
+
+# the libraries to link with
+STAT_DEBUG_LIBS		=
+STAT_RELEASE_LIBS	=
+DYN_DEBUG_LIBS		=
+DYN_RELEASE_LIBS	=
+
+# name of the base makefile
+MAKE_FILE_NAME		= ../../common/makefile.base
+
+# include the base makefile
+include $(MAKE_FILE_NAME)
Index: /trunk/build/linux/makefile
===================================================================
--- /trunk/build/linux/makefile	(revision 41)
+++ /trunk/build/linux/makefile	(revision 42)
@@ -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: /trunk/build/linux/test/TAppExtractor/makefile
===================================================================
--- /trunk/build/linux/test/TAppExtractor/makefile	(revision 42)
+++ /trunk/build/linux/test/TAppExtractor/makefile	(revision 42)
@@ -0,0 +1,58 @@
+# the SOURCE definiton lets you move your makefile to another position
+CONFIG 				= CONSOLE
+
+# set directories to your wanted values
+SRC_DIR				= ../../../../source/App/TAppExtractor
+INC_DIR				= ../../../../source/App/TAppExtractor
+LIB_DIR				= ../../../../lib
+BIN_DIR				= ../../../../bin
+
+SRC_DIR1		=
+SRC_DIR2		=
+SRC_DIR3		=
+SRC_DIR4		=
+
+USER_INC_DIRS	= -I$(SRC_DIR)
+USER_LIB_DIRS	=
+
+# intermediate directory for object files
+OBJ_DIR				= ./objects
+
+# set executable name
+PRJ_NAME			= TAppExtractor
+
+# defines to set
+DEFS				= -DMSYS_LINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE
+
+# set objects
+OBJS          		= 	\
+					$(OBJ_DIR)/extrmain.o \
+					$(OBJ_DIR)/TAppExtrCfg.o \
+					$(OBJ_DIR)/TAppExtrTop.o \
+
+# set libs to link with
+LIBS				= -ldl
+
+DEBUG_LIBS			=
+RELEASE_LIBS		=
+
+STAT_LIBS			= -lpthread
+DYN_LIBS			=
+
+
+DYN_DEBUG_LIBS		= -lTLibExtractord -lTLibDecoderd -lTLibCommond -lTLibVideoIOd -lTAppCommond
+DYN_DEBUG_PREREQS		= $(LIB_DIR)/libTLibExtractord.a $(LIB_DIR)/libTLibDecoderd.a $(LIB_DIR)/libTLibCommond.a $(LIB_DIR)/libTLibVideoIOd.a $(LIB_DIR)/libTAppCommond.a
+STAT_DEBUG_LIBS		= -lTLibExtractorStaticd -lTLibDecoderStaticd -lTLibCommonStaticd -lTLibVideoIOStaticd -lTAppCommonStaticd
+STAT_DEBUG_PREREQS		= $(LIB_DIR)/libTLibExtractorStaticd.a $(LIB_DIR)/libTLibDecoderStaticd.a $(LIB_DIR)/libTLibCommonStaticd.a $(LIB_DIR)/libTLibVideoIOStaticd.a $(LIB_DIR)/libTAppCommonStaticd.a
+
+DYN_RELEASE_LIBS	= -lTLibExtractor -lTLibDecoder -lTLibCommon -lTLibVideoIO -lTAppCommon
+DYN_RELEASE_PREREQS	= $(LIB_DIR)/libTLibExtractor.a $(LIB_DIR)/libTLibDecoder.a $(LIB_DIR)/libTLibCommon.a $(LIB_DIR)/libTLibVideoIO.a $(LIB_DIR)/libTAppCommon.a
+STAT_RELEASE_LIBS	= -lTLibExtractorStatic -lTLibDecoderStatic -lTLibCommonStatic -lTLibVideoIOStatic -lTAppCommonStatic
+STAT_RELEASE_PREREQS	= $(LIB_DIR)/libTLibExtractorStatic.a $(LIB_DIR)/libTLibDecoderStatic.a $(LIB_DIR)/libTLibCommonStatic.a $(LIB_DIR)/libTLibVideoIOStatic.a $(LIB_DIR)/libTAppCommonStatic.a
+
+
+# name of the base makefile
+MAKE_FILE_NAME		= ../../common/makefile.base
+
+# include the base makefile
+include $(MAKE_FILE_NAME)
Index: /trunk/build/vc8/TAppExtractor_vc8.vcproj
===================================================================
--- /trunk/build/vc8/TAppExtractor_vc8.vcproj	(revision 42)
+++ /trunk/build/vc8/TAppExtractor_vc8.vcproj	(revision 42)
@@ -0,0 +1,367 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="TAppExtractor"
+	ProjectGUID="{F46F95E9-7174-4328-90DD-092450E4DCF6}"
+	RootNamespace="TAppExtractor"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)\..\bin\vc8\$(PlatformName)\$(ConfigurationName)\"
+			IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)\..\bin\vc8\$(PlatformName)\$(ConfigurationName)\"
+			IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)\..\bin\vc8\$(PlatformName)\$(ConfigurationName)\"
+			IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="false"
+				FavorSizeOrSpeed="1"
+				PreprocessorDefinitions="WIN32;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)\..\bin\vc8\$(PlatformName)\$(ConfigurationName)\"
+			IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="false"
+				FavorSizeOrSpeed="1"
+				PreprocessorDefinitions="WIN32;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\extrmain.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\TAppExtrCfg.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\TAppExtrTop.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\TAppExtrCfg.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\TAppExtrTop.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: /trunk/build/vc8/TLibExtractor_vc8.vcproj
===================================================================
--- /trunk/build/vc8/TLibExtractor_vc8.vcproj	(revision 42)
+++ /trunk/build/vc8/TLibExtractor_vc8.vcproj	(revision 42)
@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="TLibExtractor"
+	ProjectGUID="{27E2C758-E3CE-44CA-A226-83491EC7F798}"
+	RootNamespace="TLibExtractor"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="false"
+				FavorSizeOrSpeed="1"
+				PreprocessorDefinitions="WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="false"
+				FavorSizeOrSpeed="1"
+				PreprocessorDefinitions="WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath="..\..\source\Lib\TLibExtractor\TExtrTop.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl"
+			>
+			<File
+				RelativePath="..\..\source\Lib\TLibExtractor\TExtrTop.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: /trunk/build/vc9/TAppExtractor_vc9.vcproj
===================================================================
--- /trunk/build/vc9/TAppExtractor_vc9.vcproj	(revision 42)
+++ /trunk/build/vc9/TAppExtractor_vc9.vcproj	(revision 42)
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="TAppExtractor"
+	ProjectGUID="{F46F95E9-7174-4328-90DD-092450E4DCF6}"
+	RootNamespace="TAppExtractor"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)\..\bin\vc9\$(PlatformName)\$(ConfigurationName)\"
+			IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)\..\bin\vc9\$(PlatformName)\$(ConfigurationName)\"
+			IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="false"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				PreprocessorDefinitions="WIN32;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)\..\bin\vc9\$(PlatformName)\$(ConfigurationName)\"
+			IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)\..\bin\vc9\$(PlatformName)\$(ConfigurationName)\"
+			IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="false"
+				FavorSizeOrSpeed="1"
+				PreprocessorDefinitions="WIN32;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\extrmain.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\TAppExtrCfg.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\TAppExtrTop.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\TAppExtrCfg.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\source\App\TAppExtractor\TAppExtrTop.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: /trunk/build/vc9/TLibExtractor_vc9.vcproj
===================================================================
--- /trunk/build/vc9/TLibExtractor_vc9.vcproj	(revision 42)
+++ /trunk/build/vc9/TLibExtractor_vc9.vcproj	(revision 42)
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="TLibExtractor"
+	ProjectGUID="{27E2C758-E3CE-44CA-A226-83491EC7F798}"
+	RootNamespace="TLibExtractor"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="false"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				PreprocessorDefinitions="WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
+			ConfigurationType="4"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="false"
+				FavorSizeOrSpeed="1"
+				PreprocessorDefinitions="WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
+				AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath="..\..\source\Lib\TLibExtractor\TExtrTop.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl"
+			>
+			<File
+				RelativePath="..\..\source\Lib\TLibExtractor\TExtrTop.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: /trunk/cfg/encoder_mvd.cfg
===================================================================
--- /trunk/cfg/encoder_mvd.cfg	(revision 41)
+++ /trunk/cfg/encoder_mvd.cfg	(revision 42)
@@ -18,5 +18,4 @@
 BitstreamFile                 : BitStreamMV.bin
 
-
 #====== General Coding Parameters ======
 NumberOfViews                 : 3           # Number of views to be coded
@@ -30,4 +29,7 @@
 OutputBitDepth                : 8           # Output bit-depth
 InternalBitDepth              : 10          # Internal bit-depth
+FCO                           : 0
+3DVCodingOrder                : T0D0D1D2T1T2
+
 
 #====== Camera Parameters ======
@@ -72,4 +74,7 @@
 VSOConfig                     : [cx0 B(cc1) I(s0.5)][cx1 B(oo0) B(oo2) I(s0.5 s1.5)][cx2 B(cc1) I(s1.5)]  #VSO Configuration (3-View) coding order 1 0 2 oder 1 2 0
 #VSOConfig                    : [cx0 B(cc1) I(s0.5)][cx1 B(oo0) I(s0.5)]                                  #VSO Configuration (2-View) coding order 1 0
+#VSOConfig                    : [ox0 B(cc1) I(s0.5)][cx1 B(oo0) B(oo2) I(s0.5 s1.5)][ox2 B(cc1) I(s1.5)]  #VSO Configuration (3-View) coding order 1 0 2 oder 1 2 0; FCO: 1
+#VSOConfig                    : [ox0 B(cc1) I(s0.5)][cx1 B(oo0) I(s0.5)]                                  #VSO Configuration (2-View) coding order 1 0; FCO 1
+
 
 #======== Quantization =============
Index: /trunk/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- /trunk/source/App/TAppDecoder/TAppDecTop.cpp	(revision 41)
+++ /trunk/source/App/TAppDecoder/TAppDecTop.cpp	(revision 42)
@@ -126,4 +126,10 @@
   NalUnitType eNalUnitType;
 
+#if FLEX_CODING_ORDER
+  Int iDepthViewIdx = 0;
+  Bool bCountDepthViewIdx = false;		// a flag which avoid repeating assign a value to iDepthViewIdx   
+  Bool bNewPictureType =true;
+  Bool bFirstDepth = false;
+#endif
   
   while ( !bEos )
@@ -136,11 +142,21 @@
       if( bIsDepth )
       {
+#if FLEX_CODING_ORDER
+		  if (!bFirstSliceDecoded) m_acTDecDepthTopList[iDepthViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx] ,bNewPictureType);
+		  m_acTDecDepthTopList[iDepthViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx]);
+
+#else
         if (!bFirstSliceDecoded) m_acTDecDepthTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx] );
         m_acTDecDepthTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx]);
+#endif
       }
       else
       {
+#if FLEX_CODING_ORDER
+		  if (!bFirstSliceDecoded) m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx], bNewPictureType);
+#else
         if (!bFirstSliceDecoded) m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx] );
-        m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]);
+#endif
+		m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]);
       }
       if( pcListPic )
@@ -156,8 +172,53 @@
     Bool bNewPicture;
     if( bIsDepth )
+#if FLEX_CODING_ORDER
+		  bNewPicture = m_acTDecDepthTopList[iDepthViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx], bNewPictureType);
+#else
       bNewPicture = m_acTDecDepthTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx] );
+#endif
     else
+#if FLEX_CODING_ORDER
+		bNewPicture = m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx], bNewPictureType );
+#else
       bNewPicture = m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx] );
+#endif
     bFirstSliceDecoded   = true;
+
+#if FLEX_CODING_ORDER
+	  if (eNalUnitType == NAL_UNIT_SPS)
+	  {
+		  if( cComSPS.isDepth() && (m_bUsingDepth==false) )  // expected not using depth, but bitstream are using depth
+		  {                                                     // know from sps
+			  assert( cComSPS.getViewId() == 0 && iDepthViewIdx == 0 && !bIsDepth );
+			  startUsingDepth() ;
+		  }
+		  if (cComSPS.isDepth())
+		  {
+			  if (cComSPS.getViewId() >= m_acTVideoIOYuvDepthReconFileList.size())
+			  {
+				  assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() );
+				  increaseNumberOfViews(cComSPS.getViewId()+1);
+			  }
+  			
+			  m_acTDecDepthTopList[cComSPS.getViewId()]->setSPS(cComSPS);
+		  }
+		  else 
+		  {
+			  if (cComSPS.getViewId() >= m_acTVideoIOYuvReconFileList.size())
+			  {
+				  assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() );
+				  increaseNumberOfViews(cComSPS.getViewId()+1);
+			  }
+			  m_acTDecTopList[cComSPS.getViewId()]->setSPS(cComSPS);
+		  }
+		  bEos = m_cTVideoIOBitstreamFile.readBits( pcBitstream );
+		  assert( !bEos);
+		  if( cComSPS.isDepth() )
+			  m_acTDecDepthTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[cComSPS.getViewId()], bNewPictureType); // decode PPS
+		  else
+			  m_acTDecTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[cComSPS.getViewId()], bNewPictureType); // decode PPS
+		  assert( eNalUnitType == NAL_UNIT_PPS );
+	  }
+#else
 
     if( eNalUnitType == NAL_UNIT_SPS )
@@ -188,9 +249,15 @@
       assert( eNalUnitType == NAL_UNIT_PPS );
     }
+
+#endif
     assert( eNalUnitType != NAL_UNIT_SEI ); // not yet supported for MVC
     if (bNewPicture)
     {
       if( bIsDepth )
+#if FLEX_CODING_ORDER
+        m_acTDecDepthTopList[iDepthViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx]);
+#else
         m_acTDecDepthTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx]);
+#endif
       else
         m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]);
@@ -199,19 +266,42 @@
       bFirstSliceDecoded = false;
 
-      if( m_bUsingDepth && !bIsDepth )
-      {
-        bIsDepth = true;
+#if FLEX_CODING_ORDER
+      if (m_bUsingDepth)
+      {
+        bIsDepth = bNewPictureType;	  
+
+      }
+      if (bCountDepthViewIdx == false )
+      {
+        bCountDepthViewIdx = true;
+        if (bIsDepth == true)
+        {
+          bFirstDepth = true;
+          bCountDepthViewIdx = true;
+        }
+        if (!bFirstDepth && !bIsDepth)
+        {
+          iViewIdx++;
+          bCountDepthViewIdx = false;
+        }
+
       }
       else
       {
-        bIsDepth = false;
-        if( iViewIdx<m_acTDecTopList.size()-1)
-        {
-          iViewIdx++ ;
+        if (bIsDepth)
+        {
+          iDepthViewIdx++;
         }
         else
         {
+          iViewIdx ++;
+        }
+
+        if (iViewIdx >= m_acTDecTopList.size() || iDepthViewIdx >= m_acTDecDepthTopList.size())
+        {
+          bFirstDepth = false;
           iViewIdx = 0;
-
+          iDepthViewIdx = 0;
+          bCountDepthViewIdx = false;
           // end of access unit: delete extra pic buffers
           Int iNumViews = (Int)m_acTVideoIOYuvReconFileList.size();
@@ -244,4 +334,53 @@
         }
       }
+	  
+#else
+
+      if( m_bUsingDepth && !bIsDepth )
+      {
+        bIsDepth = true;
+      }
+      else
+      {
+        bIsDepth = false;
+        if( iViewIdx<m_acTDecTopList.size()-1)
+        {
+          iViewIdx++ ;
+        }
+        else
+        {
+          iViewIdx = 0;
+
+          // end of access unit: delete extra pic buffers
+          Int iNumViews = (Int)m_acTVideoIOYuvReconFileList.size();
+          for( Int iVId = 0; iVId < iNumViews; iVId++ )
+          {
+            if( iVId < (Int)m_acTDecTopList.size() &&  m_acTDecTopList[iVId] )
+            {
+              m_acTDecTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC );
+            }
+            if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] )
+            {
+              m_acTDecDepthTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC );
+            }
+          }
+
+#if AMVP_BUFFERCOMPRESS
+          // compress motion for entire access unit
+          for( Int iVId = 0; iVId < iNumViews; iVId++ )
+          {
+            if( iVId < (Int)m_acTDecTopList.size() &&  m_acTDecTopList[iVId] )
+            {
+              m_acTDecTopList[iVId]->compressMotion( (Int)uiPOC );
+            }
+            if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] )
+            {
+              m_acTDecDepthTopList[iVId]->compressMotion( (Int)uiPOC );
+            }
+          }
+#endif
+        }
+	  }
+#endif
     }
 #else
@@ -506,5 +645,11 @@
       m_acTDecDepthTopList.back()->create() ;
       m_acTDecDepthTopList.back()->init( this, false );
-      m_acTDecDepthTopList.back()->setViewIdx((Int)m_acTDecTopList.size()-1);
+#if FLEX_CODING_ORDER
+      Int iNumofgen = (Int)m_acTDecDepthTopList.size();
+      m_acTDecDepthTopList.back()->setViewIdx(iNumofgen-1);
+#else
+	  m_acTDecDepthTopList.back()->setViewIdx((Int)m_acTDecTopList.size()-1);
+#endif
+
       m_acTDecDepthTopList.back()->setPictureDigestEnabled(m_pictureDigestEnabled);
       m_acTDecDepthTopList.back()->setToDepth( true );
Index: /trunk/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 41)
+++ /trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 42)
@@ -110,4 +110,10 @@
     free (m_pchBitstreamFile) ;
 
+#if FLEX_CODING_ORDER
+  if (m_pchMVCJointCodingOrder != NULL)
+  {
+	  free(m_pchMVCJointCodingOrder) ;
+  }
+#endif
   for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ )
   {
@@ -153,4 +159,9 @@
   string cfg_ReconFile;
   string cfg_dQPFile;
+
+#if FLEX_CODING_ORDER
+  string cfg_JointCodingOrdering;
+#endif
+
   po::Options opts;
   opts.addOptions()
@@ -191,4 +202,8 @@
   ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
 
+#if FLEX_CODING_ORDER
+  ("FCO",               m_b3DVFlexOrder,   false, "flexible coding order flag" )
+  ("CodingOrder",   		cfg_JointCodingOrdering,  string(""), "The coding order for joint texture-depth coding")
+#endif
 
   /* Unit definition parameters */
@@ -380,4 +395,39 @@
 
 
+#if FLEX_CODING_ORDER
+  m_pchMVCJointCodingOrder	= cfg_JointCodingOrdering.empty()?NULL:strdup(cfg_JointCodingOrdering.c_str());
+  // If flexible order is enabled and if depth comes before the texture for a view, disable VSO
+
+#if HHI_VSO && DISABLE_FCO_FOR_VSO
+  Bool depthComesFirst = false;
+  if ( m_b3DVFlexOrder )
+  {
+    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
+    {
+      for ( Int ii=1; ii<12; ii+=2 )
+      {
+        Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
+        if ( iViewIdxCfg == iViewIdx )
+        {
+          if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
+          {
+            depthComesFirst = true;
+            break;
+          }
+          else
+          {
+            assert(m_pchMVCJointCodingOrder[ii-1]=='T');
+          }
+        }
+      }
+    }
+  }
+  if (depthComesFirst)
+  {
+    m_bUseVSO = false;		
+  }
+#endif
+#endif
+
 // GT FIX
   if ( m_bUsingDepthMaps )
Index: /trunk/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 41)
+++ /trunk/source/App/TAppEncoder/TAppEncCfg.h	(revision 42)
@@ -81,4 +81,9 @@
   Bool      m_bUsingDepthMaps ;
 
+#if FLEX_CODING_ORDER
+  char*		m_pchMVCJointCodingOrder;		///<  texture-depth coding order
+  Bool		m_b3DVFlexOrder;		///<  flexible coding order flag
+#endif
+
 
   // coding structure
Index: /trunk/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 41)
+++ /trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 42)
@@ -145,4 +145,7 @@
 #endif
 
+#if BITSTREAM_EXTRACTION
+    m_acTEncTopList[iViewIdx]->setLayerId                      ( ( (UInt)iViewIdx ) << 1 );
+#endif
     m_acTEncTopList[iViewIdx]->setViewId                       ( (UInt)iViewIdx );
     m_acTEncTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
@@ -235,4 +238,27 @@
     for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
     {
+#if FLEX_CODING_ORDER
+      // Detect whether depth comes before than texture for this view
+      Bool isDepthFirst = false;
+      if ( m_b3DVFlexOrder )
+      {
+        for ( Int ii=1; ii<12; ii+=2 )
+        {
+          Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
+          if ( iViewIdxCfg == iViewIdx )
+          {
+            if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
+            {
+              isDepthFirst = true;
+            }
+            else
+            {
+              assert(m_pchMVCJointCodingOrder[ii-1]=='T');
+            }
+            break;
+          }
+        }
+      }
+#endif
       m_iDepthFrameRcvdVector.push_back(0) ;
       m_acTEncDepthTopList.push_back(new TEncTop);
@@ -314,4 +340,7 @@
 #endif
 
+#if BITSTREAM_EXTRACTION
+      m_acTEncDepthTopList[iViewIdx]->setLayerId                      ( ( ( (UInt)iViewIdx ) << 1 ) + 1 );
+#endif
       m_acTEncDepthTopList[iViewIdx]->setViewId                       ( (UInt)iViewIdx );
       m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
@@ -354,4 +383,7 @@
       m_acTEncDepthTopList[iViewIdx]->setUseDMM( m_bUseDMM );
 #endif
+#if FLEX_CODING_ORDER && HHI_DMM_PRED_TEX
+      m_acTEncDepthTopList[iViewIdx]->setUseDMM34( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseDMM );
+#endif
 #if CONSTRAINED_INTRA_PRED
       m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
@@ -380,7 +412,11 @@
 #endif
 #if HHI_MPI
+#if FLEX_CODING_ORDER
+      m_acTEncDepthTopList[iViewIdx]->setUseMVI( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseMVI );
+#else
       m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
 #endif
-
+#endif
+      
       m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled);
 
@@ -591,5 +627,4 @@
   std::vector<Bool>  bDepthEos ;
   std::vector<Bool>  bContinueReadingDepthPics ;
-
   for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
   {
@@ -689,4 +724,62 @@
 #endif
 
+#if FLEX_CODING_ORDER
+    if (m_b3DVFlexOrder)
+    {
+      Int i=0;
+      Int iViewIdx = 0;
+      bool bThisViewContinueReadingPics = false;
+      bool bThisViewContinueReadingDepthPics = false;
+      Int iNumberofDepthViews = m_bUsingDepthMaps?m_iNumberOfViews:0;
+      for(Int j=0; j < (m_iNumberOfViews+ iNumberofDepthViews); j++ )     // Start encoding
+      {
+        if (m_pchMVCJointCodingOrder[i]=='T')
+        {
+          i++;
+          assert(isdigit(m_pchMVCJointCodingOrder[i]));
+          iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
+          bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx];
+          m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics );
+          bContinueReadingPics[iViewIdx]=bThisViewContinueReadingPics;
+          bAllContinueReadingPics = bAllContinueReadingPics||bContinueReadingPics[iViewIdx];
+
+          if(pcBitstream->getNumberOfWrittenBits()!=0)
+          {
+            m_cTVideoIOBitsFile.writeBits( pcBitstream );
+          }
+          pcBitstream->resetBits(); //GT: also done later in ....
+          pcBitstream->rewindStreamPacket( );
+          // write bistream to file if necessary
+          xWriteOutput( iViewIdx ); //GT: Write Reconfiles (when gop is complete?)
+          i++;
+        }
+        else if ( m_pchMVCJointCodingOrder[i] == 'D')
+        {
+          i++;
+          if( m_bUsingDepthMaps )
+          {
+            assert(isdigit(m_pchMVCJointCodingOrder[i]));
+            iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
+            bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx];
+            m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics );
+            bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics;
+
+            bAllContinueReadingDepthPics = bAllContinueReadingDepthPics||bContinueReadingDepthPics[iViewIdx];
+            if(pcBitstream->getNumberOfWrittenBits()!=0)
+            {
+              m_cTVideoIOBitsFile.writeBits( pcBitstream );
+            }
+            pcBitstream->resetBits();
+            pcBitstream->rewindStreamPacket( );
+            // write bistream to file if necessary
+            xWriteOutput( iViewIdx, true );
+            i++;
+          }
+        }
+      }
+    }
+    else
+    {
+#endif
     //GT: Encode
     for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )     // Start encoding
@@ -723,5 +816,7 @@
       }
     }
-
+#if FLEX_CODING_ORDER
+	}
+#endif
     // delete extra picture buffers
     if( bCurrPocCoded )
Index: /trunk/source/App/TAppExtractor/TAppExtrCfg.cpp
===================================================================
--- /trunk/source/App/TAppExtractor/TAppExtrCfg.cpp	(revision 42)
+++ /trunk/source/App/TAppExtractor/TAppExtrCfg.cpp	(revision 42)
@@ -0,0 +1,130 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.  
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \file     TAppExtrCfg.cpp
+    \brief    Extractor configuration class
+*/
+
+#include <cstdio>
+#include <cstring>
+#include <string>
+#include "TAppExtrCfg.h"
+#include "../../App/TAppCommon/program_options_lite.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef WIN32
+#define strdup _strdup
+#endif
+
+using namespace std;
+namespace po = df::program_options_lite;
+
+// ====================================================================================================================
+// Public member functions
+// ====================================================================================================================
+
+/** \param argc number of arguments
+    \param argv array of arguments
+ */
+Bool TAppExtrCfg::parseCfg( Int argc, Char* argv[] )
+{
+  bool do_help = false;
+  string cfg_InputBitstreamFile;
+  string cfg_OutputBitstreamFile;
+  string cfg_SpsInfoFile;
+  string cfg_ExtractLayerIds;
+
+  po::Options opts;
+  opts.addOptions()
+  ("help",                   do_help,                   false,      "this help text")
+  ("InputBitstreamFile,i",   cfg_InputBitstreamFile,    string(""), "bitstream input file name")
+  ("OutputBitstreamFile,o",  cfg_OutputBitstreamFile,   string(""), "bitstream output file name")
+  ("SpsInfoFile,s",          cfg_SpsInfoFile,           string(""), "SPS info file name")
+  ("ExtractLayerIds,e",      cfg_ExtractLayerIds,       string(""), "comma-separated list of layer IDs for extraction")
+  ;
+
+  po::setDefaults(opts);
+  const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv);
+
+  for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
+  {
+    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
+  }
+
+  if (argc == 1 || do_help)
+  {
+    po::doHelp(cout, opts);
+    return false;
+  }
+
+  /* convert std::string to c string for compatability */
+  m_pchInputBitstreamFile = cfg_InputBitstreamFile.empty() ? NULL : strdup(cfg_InputBitstreamFile.c_str());
+  m_pchOutputBitstreamFile = cfg_OutputBitstreamFile.empty() ? NULL : strdup(cfg_OutputBitstreamFile.c_str());
+  m_pchSpsInfoFile = cfg_SpsInfoFile.empty() ? NULL : strdup(cfg_SpsInfoFile.c_str());
+
+  xSplitUIntString( cfg_ExtractLayerIds, m_suiExtractLayerIds );
+
+  if (!m_pchInputBitstreamFile)
+  {
+    fprintf(stderr, "No input file specifed, aborting\n");
+    return false;
+  }
+
+  if (!m_pchOutputBitstreamFile && !m_pchSpsInfoFile)
+  {
+    fprintf(stderr, "No output file specifed, aborting\n");
+    return false;
+  }
+
+  return true;
+}
+
+Void TAppExtrCfg::xSplitUIntString( const std::string& rString, std::set<UInt>& rSet )
+{
+  char* cString = NULL;
+  char* cElement = NULL;
+
+  cString = new char[rString.size()+1];
+  strcpy(cString, rString.c_str());
+
+  cElement = strtok( cString, "," );
+  while ( cElement != NULL )
+  {
+     rSet.insert( atoi( cElement ) );
+     cElement = strtok( NULL, "," );
+  }
+
+  delete cString;
+}
+
Index: /trunk/source/App/TAppExtractor/TAppExtrCfg.h
===================================================================
--- /trunk/source/App/TAppExtractor/TAppExtrCfg.h	(revision 42)
+++ /trunk/source/App/TAppExtractor/TAppExtrCfg.h	(revision 42)
@@ -0,0 +1,75 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.  
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \file     TAppExtrCfg.h
+    \brief    Extractor configuration class (header)
+*/
+
+#ifndef __TAPPEXTRCFG__
+#define __TAPPEXTRCFG__
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "../../Lib/TLibCommon/CommonDef.h"
+#include <string>
+#include <set>
+
+// ====================================================================================================================
+// Class definition
+// ====================================================================================================================
+
+/// Extractor configuration class
+class TAppExtrCfg
+{
+protected:
+  char*          m_pchInputBitstreamFile;              ///< input bitstream file name
+  char*          m_pchOutputBitstreamFile;             ///< output bitstream file name
+  char*          m_pchSpsInfoFile;                     ///< SPS information file name
+
+  std::set<UInt> m_suiExtractLayerIds;                 ///< list of layer IDs to be extracted
+
+public:
+  TAppExtrCfg()          {}
+  virtual ~TAppExtrCfg() {}
+  
+  Bool  parseCfg        ( Int argc, Char* argv[] );    ///< initialize option class from configuration
+
+protected:
+  Void  xSplitUIntString( const std::string& rString, std::set<UInt>& rList );
+};
+
+#endif
+
+
Index: /trunk/source/App/TAppExtractor/TAppExtrTop.cpp
===================================================================
--- /trunk/source/App/TAppExtractor/TAppExtrTop.cpp	(revision 42)
+++ /trunk/source/App/TAppExtractor/TAppExtrTop.cpp	(revision 42)
@@ -0,0 +1,228 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.  
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \file     TAppExtrTop.cpp
+    \brief    Extractor application class
+*/
+
+#include <list>
+#include <stdio.h>
+#include <fcntl.h>
+#include <assert.h>
+
+#include "TAppExtrTop.h"
+
+// ====================================================================================================================
+// Local constants
+// ====================================================================================================================
+
+/// initial bitstream buffer size
+/// should be large enough for parsing SPS
+/// resized as a function of picture size after parsing SPS
+#define BITS_BUF_SIZE 65536
+
+// ====================================================================================================================
+// Constructor / destructor / initialization / destroy
+// ====================================================================================================================
+
+TAppExtrTop::TAppExtrTop()
+{
+}
+
+Void TAppExtrTop::create()
+{
+  m_apcInputBitstream  = new TComBitstream;
+  m_apcInputBitstream->create( BITS_BUF_SIZE );
+
+  if ( m_pchOutputBitstreamFile )
+  {
+     m_apcOutputBitstream  = new TComBitstream;
+     m_apcOutputBitstream->create( BITS_BUF_SIZE );
+  }
+  else
+  {
+     m_apcOutputBitstream  = NULL;
+  }
+}
+
+Void TAppExtrTop::destroy()
+{
+  if ( m_apcInputBitstream )
+  {
+    m_apcInputBitstream->destroy();
+    delete m_apcInputBitstream;
+    m_apcInputBitstream = NULL;
+  }
+
+  if ( m_apcOutputBitstream )
+  {
+    m_apcOutputBitstream->destroy();
+    delete m_apcOutputBitstream;
+    m_apcOutputBitstream = NULL;
+  }
+}
+
+// ====================================================================================================================
+// Public member functions
+// ====================================================================================================================
+
+/**
+ - create internal class
+ - initialize internal class
+ - until the end of the bitstream, call extraction function in TExtrTop class
+ - delete allocated buffers
+ - destroy internal class
+ .
+ */
+Void TAppExtrTop::extract()
+{
+  TComBitstream*      pcInputBitstream = m_apcInputBitstream;
+  TComBitstream*      pcOutputBitstream = m_apcOutputBitstream;
+
+  // create & initialize internal classes
+  xCreateExtrLib();
+  xInitExtrLib  ();
+
+  // main extractor loop
+  Bool resizedBitstreamBuffer = false;
+
+  while ( !m_cTVideoIOInputBitstreamFile.readBits( pcInputBitstream ) )
+  {
+    // decide whether to extract packet or not
+    if ( m_cTExtrTop.extract( pcInputBitstream, m_suiExtractLayerIds ) && pcOutputBitstream )
+    {
+       xCopyInputPacketIntoOutput();
+       m_cTVideoIOOutputBitstreamFile.writeBits( pcOutputBitstream );
+    }
+
+    if ( !resizedBitstreamBuffer )
+    {
+      TComSPS *sps = m_cTExtrTop.getFirstSPS();
+      if ( sps )
+      {
+        pcInputBitstream->destroy();
+        pcInputBitstream->create(sps->getWidth() * sps->getHeight() * 2);
+        if ( pcOutputBitstream )
+        {
+           pcOutputBitstream->destroy();
+           pcOutputBitstream->create(sps->getWidth() * sps->getHeight() * 2);
+        }
+        resizedBitstreamBuffer = true;
+      }
+    }
+  }
+
+  // write SPS info file
+  if ( m_pchSpsInfoFile )
+  {
+    m_cTExtrTop.dumpSpsInfo( m_cSpsInfoFileHandle );
+  }
+  m_cTExtrTop.dumpSpsInfo( std::cout );
+  
+  // destroy internal classes
+  xDestroyExtrLib();
+}
+
+// ====================================================================================================================
+// Protected member functions
+// ====================================================================================================================
+
+Void TAppExtrTop::xCreateExtrLib()
+{
+  // open bitstream files
+  m_cTVideoIOInputBitstreamFile.openBits( m_pchInputBitstreamFile, false);  // read mode
+  if ( m_pchOutputBitstreamFile )
+  {
+     m_cTVideoIOOutputBitstreamFile.openBits( m_pchOutputBitstreamFile, true);  // write mode
+  }
+
+  // open text file
+  if ( m_pchSpsInfoFile )
+  {
+     m_cSpsInfoFileHandle.open( m_pchSpsInfoFile, ios::binary | ios::out );
+
+    if( m_cSpsInfoFileHandle.fail() )
+    {
+      printf("\nfailed writing SPS info file\n");
+      exit(0);
+    }
+  }
+
+  // create extractor class
+  m_cTExtrTop.create();
+}
+
+Void TAppExtrTop::xDestroyExtrLib()
+{
+  // close bitstream files
+  m_cTVideoIOInputBitstreamFile.closeBits();
+  if ( m_pchOutputBitstreamFile )
+  {
+     m_cTVideoIOOutputBitstreamFile.closeBits();
+  }
+
+  // open text file
+  if ( m_pchSpsInfoFile )
+  {
+     m_cSpsInfoFileHandle.close();
+  }
+
+  // destroy extractor class
+  m_cTExtrTop.destroy();
+}
+
+Void TAppExtrTop::xInitExtrLib()
+{
+  // initialize extractor class
+  m_cTExtrTop.init();
+}
+
+Void TAppExtrTop::xCopyInputPacketIntoOutput()
+{
+  UInt  uiNumBytes = m_apcInputBitstream->reinitParsing();
+  UInt  uiByteCount;
+  UInt  uiByte;
+
+  assert( m_apcOutputBitstream );
+
+  m_apcOutputBitstream->rewindStreamPacket();
+  m_apcOutputBitstream->resetBits();
+
+  for ( uiByteCount = 0; uiByteCount < uiNumBytes; uiByteCount++ )
+  {
+    m_apcInputBitstream->read( 8, uiByte );
+    m_apcOutputBitstream->write( uiByte, 8 );
+  }
+
+  m_apcOutputBitstream->flushBuffer();
+}
Index: /trunk/source/App/TAppExtractor/TAppExtrTop.h
===================================================================
--- /trunk/source/App/TAppExtractor/TAppExtrTop.h	(revision 42)
+++ /trunk/source/App/TAppExtractor/TAppExtrTop.h	(revision 42)
@@ -0,0 +1,83 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.  
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \file     TAppExtrTop.h
+    \brief    Extractor application class (header)
+*/
+
+#ifndef __TAPPEXTRTOP__
+#define __TAPPEXTRTOP__
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "../../Lib/TLibVideoIO/TVideoIOBits.h"
+#include "../../Lib/TLibCommon/TComBitStream.h"
+#include "../../Lib/TLibExtractor/TExtrTop.h"
+#include "TAppExtrCfg.h"
+
+// ====================================================================================================================
+// Class definition
+// ====================================================================================================================
+
+/// extractor application class
+class TAppExtrTop : public TAppExtrCfg
+{
+private:
+  // class interface
+  TExtrTop                        m_cTExtrTop;                    ///< extractor class
+  TComBitstream*                  m_apcInputBitstream;            ///< bitstream class
+  TComBitstream*                  m_apcOutputBitstream;           ///< bitstream class
+  TVideoIOBitsStartCode           m_cTVideoIOInputBitstreamFile;  ///< file I/O class
+  TVideoIOBitsStartCode           m_cTVideoIOOutputBitstreamFile; ///< file I/O class
+  std::fstream                    m_cSpsInfoFileHandle;           ///< file handle
+
+public:
+  TAppExtrTop();
+  virtual ~TAppExtrTop() {}
+  
+  Void  create                     (); ///< create internal members
+  Void  destroy                    (); ///< destroy internal members
+  Void  extract                    (); ///< main extraction function
+  
+protected:
+  Void  xCreateExtrLib             (); ///< create internal classes
+  Void  xDestroyExtrLib            (); ///< destroy internal classes
+  Void  xInitExtrLib               (); ///< initialize extractor class
+
+  Void  xCopyInputPacketIntoOutput ();
+};
+
+#endif
+
Index: /trunk/source/App/TAppExtractor/extrmain.cpp
===================================================================
--- /trunk/source/App/TAppExtractor/extrmain.cpp	(revision 42)
+++ /trunk/source/App/TAppExtractor/extrmain.cpp	(revision 42)
@@ -0,0 +1,86 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.  
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \file     extrmain.cpp
+    \brief    Extractor application main
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include "../../Lib/TLibCommon/CommonDef.h"
+#include "TAppExtrTop.h"
+
+// ====================================================================================================================
+// Main function
+// ====================================================================================================================
+
+int main(int argc, char* argv[])
+{
+  TAppExtrTop  cTAppExtrTop;
+
+  // print information
+  fprintf( stdout, "\n" );
+  fprintf( stdout, "HM %s based Multiview Video plus Depth Coder: Extractor Version [%s]", HM_VERSION, NV_VERSION );
+  fprintf( stdout, NVM_ONOS );
+  fprintf( stdout, NVM_COMPILEDBY );
+  fprintf( stdout, NVM_BITS );
+  fprintf( stdout, "\n" );
+
+  // parse configuration
+  if(!cTAppExtrTop.parseCfg( argc, argv ))
+  {
+    return EXIT_FAILURE;
+  }
+
+  // create application extractor class
+  cTAppExtrTop.create();
+
+  // starting time
+  double dResult;
+  long lBefore = clock();
+
+  // call extraction function
+  cTAppExtrTop.extract();
+
+  // ending time
+  dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
+  printf("\n Total Time: %12.3f sec.\n", dResult);
+
+  // destroy application extractor class
+  cTAppExtrTop.destroy();
+
+  return EXIT_SUCCESS;
+}
+
+
Index: /trunk/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- /trunk/source/Lib/TLibCommon/CommonDef.h	(revision 41)
+++ /trunk/source/Lib/TLibCommon/CommonDef.h	(revision 42)
@@ -58,5 +58,5 @@
 
 #define HM_VERSION        "3.0rc2"                 ///< Current software version
-#define NV_VERSION        "0.3"                    ///< Current software version
+#define NV_VERSION        "0.4"                    ///< Current software version
 
 // ====================================================================================================================
Index: /trunk/source/Lib/TLibCommon/SEI.h
===================================================================
--- /trunk/source/Lib/TLibCommon/SEI.h	(revision 41)
+++ /trunk/source/Lib/TLibCommon/SEI.h	(revision 42)
@@ -41,4 +41,9 @@
 class SEI
 {
+#if BITSTREAM_EXTRACTION
+protected:
+  UInt m_uiLayerId;
+#endif
+
 public:
   enum PayloadType {
@@ -51,4 +56,9 @@
   
   virtual PayloadType payloadType() const = 0;
+
+#if BITSTREAM_EXTRACTION
+  Void      setLayerId              ( UInt u )       { m_uiLayerId = u; }
+  UInt      getLayerId              ()         const { return m_uiLayerId; }
+#endif
 };
 
Index: /trunk/source/Lib/TLibCommon/TComBitStream.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComBitStream.cpp	(revision 41)
+++ /trunk/source/Lib/TLibCommon/TComBitStream.cpp	(revision 42)
@@ -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: /trunk/source/Lib/TLibCommon/TComBitStream.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComBitStream.h	(revision 41)
+++ /trunk/source/Lib/TLibCommon/TComBitStream.h	(revision 42)
@@ -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: /trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 41)
+++ /trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 42)
@@ -66,4 +66,8 @@
   m_iViewIdx = 0 ;
 
+#if BITSTREAM_EXTRACTION
+  m_uiLayerId = 0;
+#endif
+
 #if SONY_COLPIC_AVAILABILITY
   m_iViewOrderIdx = 0;
@@ -659,5 +663,8 @@
   m_bUseMVI = false;
 #endif
-  
+
+#if BITSTREAM_EXTRACTION
+  m_uiLayerId             = 0;
+#endif
   m_uiViewId              = 0;
   m_iViewOrderIdx         = 0;
@@ -687,4 +694,7 @@
   m_bUseDMM = false;
 #endif
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+   m_bUseDMM34 = false;
+#endif
 }
 
@@ -695,4 +705,7 @@
 TComPPS::TComPPS()
 {
+#if BITSTREAM_EXTRACTION
+  m_uiLayerId             = 0;
+#endif
 #if CONSTRAINED_INTRA_PRED
   m_bConstrainedIntraPred = false;
Index: /trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TComSlice.h	(revision 41)
+++ /trunk/source/Lib/TLibCommon/TComSlice.h	(revision 42)
@@ -76,4 +76,7 @@
   UInt        m_uiMaxTrDepth;
 
+#if BITSTREAM_EXTRACTION
+  UInt        m_uiLayerId;
+#endif
   UInt        m_uiViewId;
   Int         m_iViewOrderIdx;
@@ -133,4 +136,7 @@
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   Bool  m_bUseDMM;
+#endif
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+  Bool  m_bUseDMM34;
 #endif
 
@@ -230,5 +236,8 @@
   Void setUseDMM( Bool b ) { m_bUseDMM = b;    }
 #endif
-
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+  Bool getUseDMM34()         { return m_bUseDMM34; }
+  Void setUseDMM34( Bool b ) { m_bUseDMM34 = b;    }
+#endif
 
 #if DCM_COMB_LIST
@@ -304,4 +313,9 @@
   Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
   TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
+#endif
+
+#if BITSTREAM_EXTRACTION
+  Void      setLayerId              ( UInt u ) { m_uiLayerId = u; }
+  UInt      getLayerId              ()         { return m_uiLayerId; }
 #endif
 };
@@ -320,4 +334,7 @@
   UInt        m_uiPPSId;
   UInt        m_uiSPSId;
+#if BITSTREAM_EXTRACTION
+  UInt        m_uiLayerId;
+#endif
 
 public:
@@ -340,4 +357,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
 };
@@ -370,4 +392,7 @@
   UInt        m_uiPPSId;
   Int         m_iPOC;
+#if BITSTREAM_EXTRACTION
+  UInt        m_uiLayerId;
+#endif
 #if SONY_COLPIC_AVAILABILITY
   Int         m_iViewOrderIdx;
@@ -534,4 +559,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: /trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /trunk/source/Lib/TLibCommon/TypeDef.h	(revision 41)
+++ /trunk/source/Lib/TLibCommon/TypeDef.h	(revision 42)
@@ -40,6 +40,9 @@
 
 
-
-#define SONY_COLPIC_AVAILABILITY  		  1
+#define BITSTREAM_EXTRACTION            1
+#define FLEX_CODING_ORDER               1
+#define DISABLE_FCO_FOR_VSO             0
+
+#define SONY_COLPIC_AVAILABILITY        1
 
 //>>>>> HHI 3DV tools >>>>>
@@ -54,4 +57,5 @@
 #define HHI_VSO_DIST_INT                1   // view synthesis optimization integer distorition in rdo process
 #define HHI_VSO_LS_TABLE                1   // table based lambda scaling
+#define HHI_VSO_PRINT_DIST              0   // print VSO distortion instead of depth distrotion
 
 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE && !HHI_INTERVIEW_SKIP
@@ -328,4 +332,6 @@
 #endif
 #endif
+
+
 
 // ====================================================================================================================
Index: /trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 41)
+++ /trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 42)
@@ -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: /trunk/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 41)
+++ /trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 42)
@@ -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: /trunk/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 41)
+++ /trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 42)
@@ -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: /trunk/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 41)
+++ /trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 42)
@@ -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: /trunk/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 41)
+++ /trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 42)
@@ -513,5 +513,10 @@
 
 #if DCM_SKIP_DECODING_FRAMES
+#if FLEX_CODING_ORDER
+Bool TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame,  Int& iPOCLastDisplay, Bool& bNewPictureType)
+#else
 Bool TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame,  Int& iPOCLastDisplay)
+
+#endif
 #else
 Void TDecTop::decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS )
@@ -530,7 +535,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;
 
@@ -541,4 +554,7 @@
       TComSPS cTempSPS;
       m_cEntropyDecoder.decodeSPS( &cTempSPS );
+#if FLEX_CODING_ORDER
+      m_cNewSPS = cTempSPS;
+#endif
 
       if( (m_iViewIdx == cTempSPS.getViewId()) && ( m_bIsDepth == cTempSPS.isDepth() ) )
@@ -615,4 +631,7 @@
       {
         m_uiPrevPOC = m_apcSlicePilot->getPOC();
+#if FLEX_CODING_ORDER
+        bNewPictureType = m_cNewSPS.isDepth();
+#endif
         return true;
       }
@@ -697,7 +716,16 @@
         std::vector<TComPic*> apcSpatRefPics = getDecTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_cSPS.isDepth() );
         TComPic * const pcTexturePic = m_cSPS.isDepth() ? getDecTop()->getPicFromView( pcPic->getViewIdx(), pcSlice->getPOC(), false ) : NULL;
+
+#if FLEX_CODING_ORDER
+        if (pcTexturePic != NULL)
+        {
+          assert( ! m_cSPS.isDepth() || pcTexturePic != NULL );
+          pcSlice->setTexturePic( pcTexturePic );
+        }
+#else
         assert( ! m_cSPS.isDepth() || pcTexturePic != NULL );
         pcSlice->setTexturePic( pcTexturePic );
         pcSlice->setViewIdx( pcPic->getViewIdx() );
+#endif
 #if SONY_COLPIC_AVAILABILITY
         pcSlice->setViewOrderIdx( pcPic->getViewOrderIdx() );
Index: /trunk/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- /trunk/source/Lib/TLibDecoder/TDecTop.h	(revision 41)
+++ /trunk/source/Lib/TLibDecoder/TDecTop.h	(revision 42)
@@ -111,4 +111,7 @@
   TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
   TComSPS                 m_cSPS;
+#if FLEX_CODING_ORDER
+  TComSPS                 m_cNewSPS;
+#endif
   TComPPS                 m_cPPS;
   TComSlice*              m_apcSlicePilot;
@@ -167,5 +170,10 @@
   Void  init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance = true );
 #if DCM_SKIP_DECODING_FRAMES
+#if FLEX_CODING_ORDER
+  Bool  decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay, Bool& bNewPictureType);
+#else
   Bool  decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay);
+
+#endif
 #else
   Void  decode ( Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS );
Index: /trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 42)
@@ -39,4 +39,5 @@
 
 #include "TEncCavlc.h"
+#include "../TLibCommon/SEI.h"
 #include "SEIwrite.h"
 
@@ -228,5 +229,9 @@
 void TEncCavlc::codeSEI(const SEI& sei)
 {
+#if BITSTREAM_EXTRACTION
+  codeNALUnitHeader( NAL_UNIT_SEI, NAL_REF_IDC_PRIORITY_LOWEST, 0, sei.getLayerId() );
+#else
   codeNALUnitHeader(NAL_UNIT_SEI, NAL_REF_IDC_PRIORITY_LOWEST);
+#endif
   writeSEImessage(*m_pcBitIf, sei);
 }
@@ -235,5 +240,9 @@
 {
   // uiFirstByte
+#if BITSTREAM_EXTRACTION
+  codeNALUnitHeader( NAL_UNIT_PPS, NAL_REF_IDC_PRIORITY_HIGHEST, 0, pcPPS->getLayerId() );
+#else
   codeNALUnitHeader( NAL_UNIT_PPS, NAL_REF_IDC_PRIORITY_HIGHEST );
+#endif
 
   xWriteUvlc( pcPPS->getPPSId() );
@@ -249,4 +258,16 @@
 }
 
+#if BITSTREAM_EXTRACTION
+Void TEncCavlc::codeNALUnitHeader( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId, UInt uiLayerId )
+{
+  // uiFirstByte
+  xWriteCode( 0, 1);                    // forbidden_zero_flag
+  xWriteCode( eNalRefIdc==0 ? 0:1, 1);  // nal_ref_flag
+  xWriteCode( eNalUnitType, 6);         // nal_unit_type
+
+  xWriteCode( TemporalId, 3);           // temporal_id
+  xWriteCode( uiLayerId+1, 5);          // layer_id_plus1
+}
+#else
 Void TEncCavlc::codeNALUnitHeader( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId, Bool bOutputFlag )
 {
@@ -263,9 +284,14 @@
   }
 }
+#endif
 
 Void TEncCavlc::codeSPS( TComSPS* pcSPS )
 {
   // uiFirstByte
+#if BITSTREAM_EXTRACTION
+  codeNALUnitHeader( NAL_UNIT_SPS, NAL_REF_IDC_PRIORITY_HIGHEST, 0, pcSPS->getLayerId() );
+#else
   codeNALUnitHeader( NAL_UNIT_SPS, NAL_REF_IDC_PRIORITY_HIGHEST );
+#endif
 
   // Structure
@@ -385,7 +411,15 @@
   // here someone can add an appropriated NalRefIdc type
 #if DCM_DECODING_REFRESH
+#if BITSTREAM_EXTRACTION
+  codeNALUnitHeader (pcSlice->getNalUnitType(), NAL_REF_IDC_PRIORITY_HIGHEST, 1, pcSlice->getLayerId());
+#else
   codeNALUnitHeader (pcSlice->getNalUnitType(), NAL_REF_IDC_PRIORITY_HIGHEST, 1, true);
+#endif
+#else
+#if BITSTREAM_EXTRACTION
+  codeNALUnitHeader (NAL_UNIT_CODED_SLICE, NAL_REF_IDC_PRIORITY_HIGHEST, 0, pcSlice->getLayerId());
 #else
   codeNALUnitHeader (NAL_UNIT_CODED_SLICE, NAL_REF_IDC_PRIORITY_HIGHEST);
+#endif
 #endif
 
Index: /trunk/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 42)
@@ -206,5 +206,9 @@
   UInt  getCoeffCost          ()                { return  m_uiCoeffCost;  }
   
+#if BITSTREAM_EXTRACTION
+  Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, UInt uiLayerId = 0 );
+#else
   Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, Bool bOutputFlag = true );
+#endif
   
   Void  codeSPS                 ( TComSPS* pcSPS );
Index: /trunk/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 42)
@@ -159,4 +159,7 @@
   Bool m_bUseDMM;
 #endif
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+  Bool m_bUseDMM34;
+#endif
 #if HHI_MPI
   Bool m_bUseMVI;
@@ -184,4 +187,7 @@
   //std::vector<int>  m_aiLayerQPOffset;
 
+#if BITSTREAM_EXTRACTION
+  UInt        m_uiLayerId;
+#endif
   UInt        m_uiViewId;
   Int         m_iViewOrderIdx;
@@ -235,4 +241,8 @@
   Void      setRateGOPSize                  ( Int   i )      { m_iRateGOPSize = i; }
 
+#if BITSTREAM_EXTRACTION
+  Void      setLayerId                      ( UInt  u )      { m_uiLayerId              = u; }
+  UInt      getLayerId                      ( )              { return m_uiLayerId; }
+#endif
   Void      setViewId                       ( UInt  u )      { m_uiViewId               = u; }
   Void      setViewOrderIdx                 ( Int   i )      { m_iViewOrderIdx          = i; }
@@ -424,5 +434,8 @@
   Bool getUseDMM()        { return m_bUseDMM; }
 #endif
-
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+  Void setUseDMM34( Bool b) { m_bUseDMM34 = b;    }
+  Bool getUseDMM34()        { return m_bUseDMM34; }
+#endif
 #if LM_CHROMA
   Bool getUseLMChroma                       ()      { return m_bUseLMChroma;        }
Index: /trunk/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 42)
@@ -72,5 +72,9 @@
   virtual UInt  getCoeffCost          ()                = 0;
   
+#if BITSTREAM_EXTRACTION
+  virtual Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, UInt uiLayerId = 0 ) = 0;
+#else
   virtual Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, Bool bOutputFlag = true ) = 0;
+#endif
 
   virtual Void  codeSPS                 ( TComSPS* pcSPS )                                      = 0;
Index: /trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 42)
@@ -639,4 +639,7 @@
         seiBs.create(1024);
         /* write the SEI messages */
+#if BITSTREAM_EXTRACTION
+        sei_recon_picture_digest.setLayerId( pcSlice->getLayerId() );
+#endif
         m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
         m_pcEntropyCoder->setBitstream(&seiBs);
@@ -824,5 +827,5 @@
   }
 
-#if HHI_VSO
+#if HHI_VSO_PRINT_DIST
   if ( m_pcRdCost->getUseRenModel() )
   {
Index: /trunk/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 42)
@@ -177,5 +177,9 @@
 }
 
+#if BITSTREAM_EXTRACTION
+Void TEncSbac::codeNALUnitHeader( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId, UInt uiLayerId )
+#else
 Void TEncSbac::codeNALUnitHeader( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId, Bool bOutputFlag )
+#endif
 {
   assert (0);
@@ -1126,4 +1130,11 @@
 #endif
 #if HHI_DMM_PRED_TEX
+#if FLEX_CODING_ORDER
+    if ( !pcCU->getSlice()->getSPS()->getUseDMM34() )
+    {
+      assert( uiDir != DMM_WEDGE_PREDTEX_D_IDX );
+      assert( uiDir != DMM_CONTOUR_PREDTEX_D_IDX );
+    }
+#endif
     if( uiDir == DMM_WEDGE_PREDTEX_D_IDX )     { xCodeWedgePredTexDeltaInfo  ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX )   { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); }
Index: /trunk/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 42)
@@ -89,5 +89,9 @@
   //--SBAC RD
   
+#if BITSTREAM_EXTRACTION
+  Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, UInt uiLayerId = 0 );
+#else
   Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, Bool bOutputFlag = true );
+#endif
 
   Void  codeSPS                 ( TComSPS* pcSPS     );
Index: /trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 42)
@@ -1926,4 +1926,8 @@
 #endif
 #if HHI_DMM_PRED_TEX
+#if FLEX_CODING_ORDER
+      if ( pcCU->getSlice()->getSPS()->getUseDMM34() )
+      {
+#endif
       TComYuv cTempYuv; cTempYuv.create( uiWidth, uiHeight ); cTempYuv.clear();
       Pel* piTempY      = cTempYuv.getLumaAddr();
@@ -1958,6 +1962,8 @@
         uiRdModeList[ uiNewMaxMode++ ] = DMM_CONTOUR_PREDTEX_D_IDX;
       }
-
       cTempYuv.destroy();
+#if FLEX_CODING_ORDER
+      }
+#endif
 #endif
     }
@@ -1988,5 +1994,9 @@
 #else
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() ) )
+#else
       if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) )
+#endif
         continue;
 #endif
@@ -2076,5 +2086,9 @@
 #else
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() ) )
+#else
       if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) )
+#endif
         continue;
 #endif
@@ -2719,5 +2733,9 @@
 }
 
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight, Bool bDMMAvailable34 )
+#else
 Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight )
+#endif
 {
   if( uiMode <= MAX_MODE_ID_INTRA_DIR ) return true;
@@ -2747,4 +2765,10 @@
       bDMMAvailable = false;
     }
+#if FLEX_CODING_ORDER
+    if ( !bDMMAvailable34 )
+    {
+      bDMMAvailable = false;
+    }
+#endif
   }
 
Index: /trunk/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 42)
@@ -207,5 +207,10 @@
   Bool predIntraLumaDMMAvailable( UInt         uiMode, 
                                   UInt         uiWidth, 
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+                                  UInt         uiHeight, 
+                                  Bool         bDMMAvailable34 );
+#else
                                   UInt         uiHeight );
+#endif
 #endif
 #if HHI_DMM_WEDGE_INTRA
Index: /trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 42)
@@ -149,4 +149,7 @@
   rpcSlice->initSlice();
   rpcSlice->setPOC( pcPic->getPOC() );
+#if BITSTREAM_EXTRACTION
+  rpcSlice->setLayerId( m_pcCfg->getLayerId() );
+#endif
 #if SONY_COLPIC_AVAILABILITY
   rpcSlice->setViewOrderIdx(m_pcCfg->getViewOrderIdx());
Index: /trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 41)
+++ /trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 42)
@@ -287,6 +287,9 @@
 
   bool bSomethingCoded = false ;
-
+#if FLEX_CODING_ORDER  
+  if (TEncTop::m_bPicWaitingForCoding )
+#else
   if (m_bPicWaitingForCoding )
+#endif
   {
     std::map<Int, TComPic*>::iterator cIter = m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() );
@@ -543,4 +546,8 @@
   m_cSPS.setMaxTrSize   ( 1 << m_uiQuadtreeTULog2MaxSize );
 
+#if BITSTREAM_EXTRACTION
+  m_cSPS.setLayerId( m_uiLayerId );
+#endif
+
   if( m_bIsDepth )
   {
@@ -616,4 +623,7 @@
   m_cSPS.setUseDMM( m_bUseDMM );
 #endif
+#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER
+  m_cSPS.setUseDMM34( m_bUseDMM34 );
+#endif
 #if HHI_MPI
   m_cSPS.setUseMVI( m_bUseMVI );
@@ -626,4 +636,8 @@
 Void TEncTop::xInitPPS()
 {
+#if BITSTREAM_EXTRACTION
+  m_cPPS.setLayerId( m_uiLayerId );
+#endif
+
   m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred );
   m_cPPS.setPPSId( ( m_uiViewId << 1 ) + ( m_bIsDepth ? 1 : 0 ) );
Index: /trunk/source/Lib/TLibExtractor/TExtrTop.cpp
===================================================================
--- /trunk/source/Lib/TLibExtractor/TExtrTop.cpp	(revision 42)
+++ /trunk/source/Lib/TLibExtractor/TExtrTop.cpp	(revision 42)
@@ -0,0 +1,103 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.  
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \file     TExtrTop.cpp
+    \brief    extractor class
+*/
+
+#include "TExtrTop.h"
+
+TExtrTop::TExtrTop()
+{
+}
+
+TExtrTop::~TExtrTop()
+{
+}
+
+Void TExtrTop::create()
+{
+}
+
+Void TExtrTop::destroy()
+{
+  m_acSPSBuffer.clear();
+}
+
+Void TExtrTop::init()
+{
+  m_cEntropyDecoder.init(&m_cPrediction);
+
+  m_acSPSBuffer.clear();
+}
+
+
+Bool TExtrTop::extract( TComBitstream* pcBitstream, std::set<UInt>& rsuiExtractLayerIds )
+{
+  // Initialize entropy decoder
+  m_cEntropyDecoder.setEntropyDecoder (&m_cCavlcDecoder);
+  m_cEntropyDecoder.setBitstream      (pcBitstream);
+  
+  NalUnitType eNalUnitType;
+  UInt uiTemporalId, uiLayerId;
+
+  m_cEntropyDecoder.decodeNalUnitHeader( eNalUnitType, uiTemporalId, uiLayerId );  
+
+  if ( eNalUnitType == NAL_UNIT_SPS )
+  {
+     TComSPS cSPS;
+
+     m_cEntropyDecoder.decodeSPS( &cSPS );
+     cSPS.setLayerId( uiLayerId );
+
+     m_acSPSBuffer.push_back( cSPS );
+  }
+
+  return ( rsuiExtractLayerIds.find( uiLayerId ) != rsuiExtractLayerIds.end() );
+}
+
+
+Void TExtrTop::dumpSpsInfo( std::ostream& rcSpsInfoHandle )
+{
+  rcSpsInfoHandle << "NumSPS = " << m_acSPSBuffer.size() << std::endl;
+
+  for( std::list<TComSPS>::iterator iterSPS = m_acSPSBuffer.begin(); iterSPS != m_acSPSBuffer.end(); iterSPS++ )
+  {
+     rcSpsInfoHandle << std::endl;
+     rcSpsInfoHandle << "layer_id = "              << iterSPS->getLayerId() << std::endl;
+     rcSpsInfoHandle << "seq_parameter_set_id = "  << iterSPS->getSPSId() << std::endl;
+     rcSpsInfoHandle << "view_id = "               << iterSPS->getViewId() << std::endl;
+     rcSpsInfoHandle << "view_order_idx = "        << iterSPS->getViewOrderIdx() << std::endl;
+     rcSpsInfoHandle << "is_depth = "              << iterSPS->isDepth() << std::endl;
+  }
+}
Index: /trunk/source/Lib/TLibExtractor/TExtrTop.h
===================================================================
--- /trunk/source/Lib/TLibExtractor/TExtrTop.h	(revision 42)
+++ /trunk/source/Lib/TLibExtractor/TExtrTop.h	(revision 42)
@@ -0,0 +1,80 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.  
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \file     TDecTop.h
+    \brief    decoder class (header)
+*/
+
+#ifndef __TEXTRTOP__
+#define __TEXTRTOP__
+
+#include "../TLibCommon/TComSlice.h"
+#include "../TLibCommon/TComPrediction.h"
+#include "../TLibDecoder/TDecCAVLC.h"
+
+#include <list>
+#include <set>
+
+// ====================================================================================================================
+// Class definition
+// ====================================================================================================================
+
+/// decoder class
+class TExtrTop
+{
+private:
+   std::list<TComSPS>      m_acSPSBuffer;
+
+  // functional classes
+  TComPrediction           m_cPrediction;
+  TDecEntropy              m_cEntropyDecoder;
+  TDecCavlc                m_cCavlcDecoder;
+
+public:
+  TExtrTop();
+  virtual ~TExtrTop();
+  
+  Void     create  ();
+  Void     destroy ();
+  Void     init();
+
+  Bool     extract( TComBitstream* pcBitstream, std::set<UInt>& rsuiExtractLayerIds );
+  Void     dumpSpsInfo( std::ostream& rcSpsInfoHandle );
+  
+  TComSPS *getFirstSPS() { return m_acSPSBuffer.empty() ? 0 : &(m_acSPSBuffer.front()); }
+
+};// END CLASS DEFINITION TExtrTop
+
+
+#endif // __TEXTRTOP__
+
