ref: 5449a8a548129edb3561bcdedb54ca6deffcf879
parent: 3747f562492ea301b84e3eae4fa8cae765d95ccb
parent: a15ad8cc80773b251f88798e364668cc175c0738
author: ekr <ekr@rtfm.com>
date: Wed Dec 11 13:31:15 EST 2013
Merge pull request #14 from ethanhugg/master Rebase of EKR's patches for tracing and frame size with makefile updates.
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@
endif
ifeq ($(USE_ASM),Yes)
- CFLAGS += -DX86_ASM
+ CFLAGS += -DX86_ASM
endif
include build/platform-$(UNAME).mk
@@ -20,13 +20,16 @@
CFLAGS += -DNO_DYNAMIC_VP -DHAVE_CACHE_LINE_ALIGN
LDFLAGS +=
-ASMFLAGS += -DNO_DYNAMIC_VP -DNOPREFIX
+ASMFLAGS += -DNO_DYNAMIC_VP -DNOPREFIX
#### No user-serviceable parts below this line
-INCLUDES = -Icodec/api/svc
+INCLUDES = -Icodec/api/svc -Icodec/common
ASM_INCLUDES = -Iprocessing/src/asm/
+COMMON_INCLUDES = \
+ -Icodec/decoder/core/inc
+
DECODER_INCLUDES = \
-Icodec/decoder/core/inc \
-Icodec/decoder/plus/inc
@@ -41,10 +44,10 @@
-Icodec/encoder/plus/inc
H264DEC_INCLUDES = $(DECODER_INCLUDES) -Icodec/console/dec/inc
-H264DEC_LDFLAGS = -L. -ldecoder
+H264DEC_LDFLAGS = -L. -ldecoder -lcommon
H264ENC_INCLUDES = $(ENCODER_INCLUDES) -Icodec/console/enc/inc
-H264ENC_LDFLAGS = -L. -lencoder -lprocessing
+H264ENC_LDFLAGS = -L. -lencoder -lprocessing -lcommon
all: libraries binaries
@@ -52,6 +55,7 @@
rm -f $(OBJS) $(LIBRARIES) $(BINARIES)
+include codec/common/targets.mk
include codec/decoder/targets.mk
include codec/encoder/targets.mk
include processing/targets.mk
--- a/build/mktargets.sh
+++ b/build/mktargets.sh
@@ -1,6 +1,7 @@
#!/bin/sh
(cd codec/decoder; python ../../build/mktargets.py --directory codec/decoder --library decoder --exclude StdAfx.cpp)
(cd codec/encoder; python ../../build/mktargets.py --directory codec/encoder --library encoder --exclude DllEntry.cpp)
+(cd codec/common; python ../../build/mktargets.py --directory codec/common --library common)
(cd processing; python ../build/mktargets.py --directory processing --library processing --exclude wels_process.cpp --exclude WelsVideoProcessor.cpp)
(cd codec/console/dec; python ../../../build/mktargets.py --directory codec/console/dec --binary h264dec --exclude dec_console.h --exclude load_bundle_functions.cpp)
--- a/codec/build/linux/dec/makefile
+++ b/codec/build/linux/dec/makefile
@@ -7,11 +7,12 @@
BINDIR= ../bin
OUTDIR= ../../../../bin/linux
-INCLUDE= -I../../../api/svc -I../../../decoder/core/inc -I../../../decoder/plus/inc -I../../../console/dec/inc
+INCLUDE= -I../../../api/svc -I../../../decoder/core/inc -I../../../decoder/plus/inc -I../../../console/dec/inc -I../../../common
CORESRCDIR= ../../../decoder/core/src
PLUSSRCDIR= ../../../decoder/plus/src
ASMSRCDIR= ../../../decoder/core/asm
MAINSRCDIR= ../../../console/dec/src
+COMMONSRCDIR= ../../../common
OBJMAINDIR= ../obj
OBJDIR= ../obj/dec
@@ -63,7 +64,8 @@
$(CORESRCDIR)/decoder_core.cpp \
$(CORESRCDIR)/utils.cpp \
$(PLUSSRCDIR)/welsDecoderExt.cpp \
-$(PLUSSRCDIR)/welsCodecTrace.cpp
+$(PLUSSRCDIR)/welsCodecTrace.cpp \
+$(COMMONSRCDIR)/logging.cpp
ASMSRC= $(ASMSRCDIR)/block_add.asm \
$(ASMSRCDIR)/cpuid.asm \
@@ -103,7 +105,8 @@
$(OBJDIR)/decoder_core.o \
$(OBJDIR)/utils.o \
$(OBJDIR)/welsDecoderExt.o \
-$(OBJDIR)/welsCodecTrace.o
+$(OBJDIR)/welsCodecTrace.o \
+$(OBJDIR)/logging.o
ifeq ($(NASM), 1)
OBJDEC+=$(OBJDIR)/block_add.o \
@@ -241,6 +244,10 @@
$(OBJDIR)/%.o$(SUFFIX): $(MAINSRCDIR)/%.cpp
@echo 'compiling object file "$@" ...'
@$(CC) -m32 -c $(CFLAGS) -o $@ $<
+
+$(OBJDIR)/%.o$(SUFFIX): $(COMMONSRCDIR)/%.cpp
+ @echo 'compiling object file "$@" ...'
+ @$(CC) -m32 -c $(CFLAGS) -o $@ $<
include $(DEPEND)
--- a/codec/build/linux/enc/makefile
+++ b/codec/build/linux/enc/makefile
@@ -7,12 +7,13 @@
OUTDIR= ../../../../bin/linux
BINDIR= ../bin
-INCLUDE= -I../../../encoder/core/inc -I../../../encoder/plus/inc -I../../../api/svc -I../../../WelsThreadLib/api -I../../../console/enc/inc
+INCLUDE= -I../../../encoder/core/inc -I../../../encoder/plus/inc -I../../../api/svc -I../../../WelsThreadLib/api -I../../../console/enc/inc -I../../../common
THREADLIBSRCDIR=../../../WelsThreadLib/src
CORESRCDIR= ../../../encoder/core/src
PLUSSRCDIR= ../../../encoder/plus/src
ASMSRCDIR= ../../../encoder/core/asm
MAINSRCDIR= ../../../console/enc/src
+COMMONSRCDIR= ../../../common
OBJMAINDIR= ../obj
OBJDIR= ../obj/enc
@@ -24,7 +25,7 @@
ASFLAGS= -f elf -DNOPREFIX -I ../../../encoder/core/asm/
-LIBS= -lstdc++ -ldl -lpthread
+LIBS= -lstdc++ -ldl -lpthread -lm
#-lm
CFLAGS= $(INCLUDE) -m32 -fPIC -D__GCC__ -DLINUX -D__NO_CTYPE -DWELS_SVC -DENCODER_CORE -DHAVE_CACHE_LINE_ALIGN -DWELS_TESTBED -DMT_ENABLED
@@ -73,7 +74,8 @@
$(CORESRCDIR)/utils.cpp \
$(THREADLIBSRCDIR)/WelsThreadLib.cpp \
$(PLUSSRCDIR)/welsEncoderExt.cpp \
-$(PLUSSRCDIR)/welsCodecTrace.cpp
+$(PLUSSRCDIR)/welsCodecTrace.cpp \
+$(COMMONSRCDIR)/logging.cpp
ASMSRC= $(ASMSRCDIR)/coeff.asm \
$(ASMSRCDIR)/cpuid.asm \
@@ -129,7 +131,8 @@
$(OBJDIR)/utils.o \
$(OBJDIR)/WelsThreadLib.o \
$(OBJDIR)/welsEncoderExt.o \
-$(OBJDIR)/welsCodecTrace.o
+$(OBJDIR)/welsCodecTrace.o \
+$(OBJDIR)/logging.o
ifeq ($(NASM), 1)
OBJENC += $(OBJDIR)/cpuid.o \
@@ -266,5 +269,9 @@
@echo 'compiling object file "$@" ...'
@$(CC) -m32 -c $(CFLAGS) -o $@ $<
+$(OBJDIR)/%.o$(SUFFIX): $(COMMONSRCDIR)/%.cpp
+ @echo 'compiling object file "$@" ...'
+ @$(CC) -m32 -c $(CFLAGS) -o $@ $<
+
include $(DEPEND)
--- a/codec/build/win32/dec/WelsDecPlus.vcproj
+++ b/codec/build/win32/dec/WelsDecPlus.vcproj
@@ -50,7 +50,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common\inc;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc"
+ AdditionalIncludeDirectories="..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WELSDECPLUS_EXPORTS;HAVE_CACHE_LINE_ALIGN"
StringPooling="true"
RuntimeLibrary="2"
@@ -149,7 +149,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common\inc;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc"
+ AdditionalIncludeDirectories="..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WELSDECPLUS_EXPORTS;HAVE_CACHE_LINE_ALIGN"
MinimalRebuild="true"
BasicRuntimeChecks="3"
--- a/codec/build/win32/dec/WelsDecPlus_2010.vcxproj
+++ b/codec/build/win32/dec/WelsDecPlus_2010.vcxproj
@@ -67,7 +67,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common\inc;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WELSDECPLUS_EXPORTS;HAVE_CACHE_LINE_ALIGN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -116,7 +116,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common\inc;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;WELSDECPLUS_EXPORTS;HAVE_CACHE_LINE_ALIGN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
--- a/codec/build/win32/dec/WelsDecPlus_2012.vcxproj
+++ b/codec/build/win32/dec/WelsDecPlus_2012.vcxproj
@@ -66,7 +66,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common\inc;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WELSDECPLUS_EXPORTS;HAVE_CACHE_LINE_ALIGN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -115,7 +115,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common\inc;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\decoder\plus\inc;..\..\..\decoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\hwDecoder\plus\inc;..\..\..\hwDecoder\core\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;WELSDECPLUS_EXPORTS;HAVE_CACHE_LINE_ALIGN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
--- a/codec/build/win32/dec/decConsole.vcproj
+++ b/codec/build/win32/dec/decConsole.vcproj
@@ -45,7 +45,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..\console\dec\inc,..\..\..\api\svc,..\..\..\common\inc"
+ AdditionalIncludeDirectories="..\..\..\console\dec\inc,..\..\..\api\svc,..\..\..\common"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="2"
@@ -135,7 +135,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\console\dec\inc,..\..\..\api\svc,..\..\..\common\inc"
+ AdditionalIncludeDirectories="..\..\..\console\dec\inc,..\..\..\api\svc,..\..\..\common,..\..\..\decoder\core\inc"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -230,6 +230,10 @@
PreprocessorDefinitions=""
/>
</FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\common\logging.cpp"
+ >
</File>
<File
RelativePath="..\..\..\console\dec\src\read_config.cpp"
--- a/codec/build/win32/dec/decConsole_2010.vcxproj
+++ b/codec/build/win32/dec/decConsole_2010.vcxproj
@@ -62,7 +62,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>..\..\..\console\dec\inc;..\..\..\api\svc;..\..\..\common\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\console\dec\inc;..\..\..\api\svc;..\..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -103,7 +103,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..\console\dec\inc;..\..\..\api\svc;..\..\..\common\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\console\dec\inc;..\..\..\api\svc;..\..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -152,6 +152,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
+ <ClCompile Include="..\..\..\common\logging.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\console\dec\inc\d3d9_utils.h" />
--- a/codec/build/win32/dec/decConsole_2012.vcxproj
+++ b/codec/build/win32/dec/decConsole_2012.vcxproj
@@ -61,7 +61,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>..\..\..\console\dec\inc;..\..\..\api\svc;..\..\..\common\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\console\dec\inc;..\..\..\api\svc;..\..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -102,7 +102,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..\console\dec\inc;..\..\..\api\svc;..\..\..\common\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\console\dec\inc;..\..\..\api\svc;..\..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -143,6 +143,7 @@
<ClCompile Include="..\..\..\console\dec\src\d3d9_utils.cpp" />
<ClCompile Include="..\..\..\console\dec\src\h264dec.cpp" />
<ClCompile Include="..\..\..\console\dec\src\read_config.cpp" />
+ <ClCompile Include="..\..\..\common\logging.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\console\dec\inc\d3d9_utils.h" />
--- a/codec/build/win32/enc/WelsEncPlus.vcproj
+++ b/codec/build/win32/enc/WelsEncPlus.vcproj
@@ -49,7 +49,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api"
+ AdditionalIncludeDirectories="..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\WelsThreadLib\api"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;WELSENCPLUS_EXPORTS;ENCODER_CORE;HAVE_CACHE_LINE_ALIGN;MT_ENABLED;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -152,7 +152,7 @@
FavorSizeOrSpeed="1"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
- AdditionalIncludeDirectories="..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api"
+ AdditionalIncludeDirectories="..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\WelsThreadLib\api"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WELSENCPLUS_EXPORTS;ENCODER_CORE;HAVE_CACHE_LINE_ALIGN;MT_ENABLED;"
StringPooling="true"
RuntimeLibrary="2"
--- a/codec/build/win32/enc/WelsEncPlus_2010.vcxproj
+++ b/codec/build/win32/enc/WelsEncPlus_2010.vcxproj
@@ -66,7 +66,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\WelsThreadLib\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;WELSENCPLUS_EXPORTS;ENCODER_CORE;HAVE_CACHE_LINE_ALIGN;MT_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -117,7 +117,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\WelsThreadLib\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WELSENCPLUS_EXPORTS;ENCODER_CORE;HAVE_CACHE_LINE_ALIGN;MT_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
--- a/codec/build/win32/enc/WelsEncPlus_2012.vcxproj
+++ b/codec/build/win32/enc/WelsEncPlus_2012.vcxproj
@@ -65,7 +65,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\WelsThreadLib\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;WELSENCPLUS_EXPORTS;ENCODER_CORE;HAVE_CACHE_LINE_ALIGN;MT_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -116,7 +116,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<WholeProgramOptimization>true</WholeProgramOptimization>
- <AdditionalIncludeDirectories>..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\encoder\plus\inc;..\..\..\encoder\core\inc;..\..\..\api\svc;..\..\..\common;..\..\..\WelsThreadLib\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WELSENCPLUS_EXPORTS;ENCODER_CORE;HAVE_CACHE_LINE_ALIGN;MT_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
--- a/codec/build/win32/enc/encConsole.vcproj
+++ b/codec/build/win32/enc/encConsole.vcproj
@@ -45,7 +45,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\console\enc\inc,..\..\..\api\svc,..\..\..\WelsThreadLib\api,..\..\..\encoder\core\inc,..\..\..\common\inc"
+ AdditionalIncludeDirectories="..\..\..\console\enc\inc,..\..\..\api\svc,..\..\..\WelsThreadLib\api,..\..\..\encoder\core\inc,..\..\..\common"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;ENCODER_CORE;MT_ENABLED;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -140,7 +140,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..\console\enc\inc,..\..\..\api\svc,..\..\..\WelsThreadLib\api,..\..\..\encoder\core\inc,..\..\..\common\inc"
+ AdditionalIncludeDirectories="..\..\..\console\enc\inc,..\..\..\api\svc,..\..\..\WelsThreadLib\api,..\..\..\encoder\core\inc,..\..\..\common"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;ENCODER_CORE;X86_ASM;MT_ENABLED;"
StringPooling="true"
RuntimeLibrary="2"
@@ -213,6 +213,10 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
+ <File
+ RelativePath="..\..\..\common\logging.cpp"
+ >
+ </File>
<File
RelativePath="..\..\..\console\enc\src\read_config.cpp"
>
--- a/codec/build/win32/enc/encConsole_2010.vcxproj
+++ b/codec/build/win32/enc/encConsole_2010.vcxproj
@@ -62,7 +62,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..\console\enc\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;..\..\..\encoder\core\inc;..\..\..\common\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\console\enc\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;..\..\..\encoder\core\inc;..\..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ENCODER_CORE;X86_ASM;MT_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -105,7 +105,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>..\..\..\console\enc\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;..\..\..\encoder\core\inc;..\..\..\common\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\console\enc\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;..\..\..\encoder\core\inc;..\..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;ENCODER_CORE;X86_ASM;MT_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -155,6 +155,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
+ <ClCompile Include="..\..\..\common\logging.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\console\enc\inc\read_config.h" />
--- a/codec/build/win32/enc/encConsole_2012.vcxproj
+++ b/codec/build/win32/enc/encConsole_2012.vcxproj
@@ -61,7 +61,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..\console\enc\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;..\..\..\encoder\core\inc;..\..\..\common\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\console\enc\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;..\..\..\encoder\core\inc;..\..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ENCODER_CORE;X86_ASM;MT_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -105,7 +105,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>..\..\..\console\enc\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;..\..\..\encoder\core\inc;..\..\..\common\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\..\console\enc\inc;..\..\..\api\svc;..\..\..\WelsThreadLib\api;..\..\..\encoder\core\inc;..\..\..\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;ENCODER_CORE;X86_ASM;MT_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -147,6 +147,7 @@
<ItemGroup>
<ClCompile Include="..\..\..\console\enc\src\read_config.cpp" />
<ClCompile Include="..\..\..\console\enc\src\welsenc.cpp" />
+ <ClCompile Include="..\..\..\common\logging.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\console\enc\inc\read_config.h" />
--- /dev/null
+++ b/codec/common/logging.cpp
@@ -1,0 +1,49 @@
+/*!
+ * \copy
+ * Copyright (c) 2013, Cisco Systems
+ * Copyright (c) 2013, Mozilla
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include "typedefs.h"
+
+static int32_t g_TraceLevel = 0;
+
+void WelsStderrSetTraceLevel(int32_t level) {
+ g_TraceLevel = level;
+}
+
+int32_t welsStderrLevelTrace(int32_t level, const str_t* format, va_list ap) {
+ if (level < g_TraceLevel) {
+ vfprintf(stderr, format, ap);
+ }
+ return 0;
+}
--- /dev/null
+++ b/codec/common/logging.h
@@ -1,0 +1,60 @@
+/*!
+ * \copy
+ * Copyright (c) 2013, Cisco Systems
+ * Copyright (c) 2013, Mozilla
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef WELS_LOGGING_H__
+#define WELS_LOGGING_H__
+
+// API surface.
+void WelsStderrSetTraceLevel(int32_t level);
+
+
+// Internal details.
+int32_t welsStderrLevelTrace(int32_t level, const str_t* format, va_list ap);
+
+template<int level> int32_t welsStderrTrace(
+#ifndef WIN32
+ const str_t *dllname,
+#endif
+ const str_t* format, ...) {
+#ifndef WIN32
+ (void)dllname; // Unused.
+#endif
+ va_list ap;
+ va_start(ap, format);
+ welsStderrLevelTrace(level, format, ap);
+ va_end(ap);
+ return 0;
+}
+
+#endif
--- /dev/null
+++ b/codec/common/targets.mk
@@ -1,0 +1,22 @@
+COMMON_PREFIX=COMMON
+COMMON_SRCDIR=codec/common
+COMMON_CPP_SRCS=\
+ $(COMMON_SRCDIR)/./logging.cpp\
+
+COMMON_OBJS += $(COMMON_CPP_SRCS:.cpp=.o)
+ifdef USE_ASM
+COMMON_ASM_SRCS=\
+
+COMMON_OBJS += $(COMMON_ASM_SRCS:.asm=.o)
+endif
+
+OBJS += $(COMMON_OBJS)
+$(COMMON_SRCDIR)/./logging.o: $(COMMON_SRCDIR)/./logging.cpp
+ $(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(COMMON_CFLAGS) $(COMMON_INCLUDES) -c -o $(COMMON_SRCDIR)/./logging.o $(COMMON_SRCDIR)/./logging.cpp
+
+$(LIBPREFIX)common.$(LIBSUFFIX): $(COMMON_OBJS)
+ rm -f $(LIBPREFIX)common.$(LIBSUFFIX)
+ ar cr $@ $(COMMON_OBJS)
+
+libraries: $(LIBPREFIX)common.$(LIBSUFFIX)
+LIBRARIES += $(LIBPREFIX)common.$(LIBSUFFIX)
--- a/codec/console/dec/src/h264dec.cpp
+++ b/codec/console/dec/src/h264dec.cpp
@@ -39,6 +39,7 @@
#endif
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#include "codec_def.h"
#include "codec_app_def.h"
@@ -47,6 +48,7 @@
#include "../../decoder/core/inc/typedefs.h"
#include "../../decoder/core/inc/measure_time.h"
#include "d3d9_utils.h"
+#include "logging.h"
typedef long (*PCreateDecoderFunc) (ISVCDecoder** ppDecoder);
typedef void_t (*PDestroyDecoderFunc)(ISVCDecoder* pDecoder);
@@ -434,8 +436,24 @@
sDecParam.uiTargetDqLayer = (uint8_t)-1;
sDecParam.uiEcActiveFlag = 1;
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
- if (iArgC > 3)
- strOptionFile = pArgV[3];
+ if (iArgC > 3) {
+ // Basic option parser. Note that this is not safe about the
+ // number of remaining arguments.
+ // TODO: rewrite
+ for (int i = 3; i < iArgC; i++) {
+ char *cmd = pArgV[i];
+
+ if( !strcmp(cmd, "-options") ) {
+ strOutputFile = pArgV[i+1];
+ i += 2;
+ } else if( !strcmp(cmd, "-trace") ) {
+ WelsStderrSetTraceLevel(atoi(pArgV[i + 1]));
+ i += 2;
+ } else {
+ i++;
+ }
+ }
+ }
if (strOutputFile.empty())
{
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -34,6 +34,7 @@
#include <string.h>
#include <assert.h>
#include <signal.h>
+#include <stdarg.h>
#ifdef ONLY_ENC_FRAMES_NUM
#undef ONLY_ENC_FRAMES_NUM
@@ -75,6 +76,7 @@
#include "extern.h"
#include "macros.h"
#include "wels_const.h"
+#include "logging.h"
#ifdef MT_ENABLED
#include "mt_defs.h"
@@ -473,7 +475,22 @@
int iSpatialBitrate = atoi( argv[i+2] );
sParam.sSpatialLayers[iLayer].iSpatialBitrate = iSpatialBitrate;
i += 3;
- } else {
+ } else if( !strcmp(pCmd,"-trace") ) {
+ int32_t iLog = atoi (argv[i+1]);
+ WelsStderrSetTraceLevel(iLog);
+ i += 2;
+ } else if( !strcmp(pCmd,"-sw") )
+ {
+ int iWidth = atoi (argv[i+1]);
+ sParam.iPicWidth = iWidth;
+ i += 2;
+ } else if( !strcmp(pCmd,"-sh") )
+ {
+ int iHeight = atoi (argv[i+1]);
+ sParam.iPicHeight = iHeight;
+ i += 2;
+ }
+ else {
i ++;
}
}
--- a/codec/decoder/plus/src/welsCodecTrace.cpp
+++ b/codec/decoder/plus/src/welsCodecTrace.cpp
@@ -44,6 +44,7 @@
#include "welsCodecTrace.h"
#include "utils.h"
+#include "logging.h"
#if defined LINUX || defined SOLARIS || defined UNIX || defined MACOS //LINUX/SOLARIS/UNIX
#include <dlfcn.h>
#endif
@@ -210,7 +211,7 @@
CWelsCodecTrace::CWelsCodecTrace()
{
m_hTraceHandle = NULL;
- m_fpDebugTrace = NULL;
+ m_fpDebugTrace = NULL;
m_fpInfoTrace = NULL;
m_fpWarnTrace = NULL;
m_fpErrorTrace = NULL;
@@ -224,7 +225,13 @@
}
int32_t CWelsCodecTrace::LoadWelsTraceModule()
-{
+{
+#ifdef NO_DYNAMIC_VP
+ m_fpDebugTrace = welsStderrTrace<WELS_LOG_DEBUG>;
+ m_fpInfoTrace = welsStderrTrace<WELS_LOG_INFO>;
+ m_fpWarnTrace = welsStderrTrace<WELS_LOG_WARNING>;
+ m_fpErrorTrace = welsStderrTrace<WELS_LOG_ERROR>;
+#else
#if defined WIN32
HMODULE hHandle = ::LoadLibrary("welstrace.dll");
// HMODULE handle = ::LoadLibrary("contrace.dll"); // for c7 trace
@@ -307,6 +314,7 @@
}
}
#endif
+#endif // NO_DYNAMIC_VP
return 0;
}
@@ -336,7 +344,9 @@
int32_t CWelsCodecTrace::WriteString(int32_t iLevel, const str_t * pStr)
{
+#ifndef NO_DYNAMIC_VP
if( m_hTraceHandle )
+#endif
{
#ifdef WIN32
switch(iLevel)
@@ -416,4 +426,4 @@
return pTrace;
}
-} // namespace WelsDec
\ No newline at end of file
+} // namespace WelsDec
--- a/codec/encoder/plus/src/welsCodecTrace.cpp
+++ b/codec/encoder/plus/src/welsCodecTrace.cpp
@@ -56,6 +56,8 @@
extern HANDLE g_hInstDll;
#endif
+#include "logging.h"
+
//#define CODEC_TRACE_ERROR 0
//#define CODEC_TRACE_WARNING 1
//#define CODEC_TRACE_INFO 2
@@ -153,10 +155,10 @@
CM_WELS_TRACE welsCodecTrace::m_fpWarnTrace = NULL;
CM_WELS_TRACE welsCodecTrace::m_fpErrorTrace = NULL;
#else
-CM_WELS_TRACE2 welsCodecTrace::m_fpDebugTrace= NULL;
+CM_WELS_TRACE2 welsCodecTrace::m_fpDebugTrace = NULL;
CM_WELS_TRACE2 welsCodecTrace::m_fpInfoTrace = NULL;
CM_WELS_TRACE2 welsCodecTrace::m_fpWarnTrace = NULL;
-CM_WELS_TRACE2 welsCodecTrace::m_fpErrorTrace= NULL;
+CM_WELS_TRACE2 welsCodecTrace::m_fpErrorTrace = NULL;
#endif//WIN32
welsCodecTrace::welsCodecTrace()
@@ -167,7 +169,14 @@
m_fpWarnTrace = NULL;
m_fpErrorTrace = NULL;
m_WelsTraceExistFlag = false;
-
+#ifdef NO_DYNAMIC_VP
+ m_fpDebugTrace = welsStderrTrace<WELS_LOG_DEBUG>;
+ m_fpInfoTrace = welsStderrTrace<WELS_LOG_INFO>;
+ m_fpWarnTrace = welsStderrTrace<WELS_LOG_WARNING>;
+ m_fpErrorTrace = welsStderrTrace<WELS_LOG_ERROR>;
+
+ m_WelsTraceExistFlag = true;
+#else
#if defined WIN32
HMODULE handle = ::GetModuleHandle("welstrace.dll");
// HMODULE handle = ::GetModuleHandle("contrace.dll"); // for c7
@@ -247,6 +256,7 @@
{
m_WelsTraceExistFlag = true;
}
+#endif
}
welsCodecTrace::~welsCodecTrace()