Rebase of EKR's patches for tracing and frame size
This commit is contained in:
parent
3747f56249
commit
2ca14fed1c
14
Makefile
14
Makefile
@ -13,20 +13,23 @@ USE_ASM = No
|
||||
endif
|
||||
|
||||
ifeq ($(USE_ASM),Yes)
|
||||
CFLAGS += -DX86_ASM
|
||||
CFLAGS += -DX86_ASM
|
||||
endif
|
||||
|
||||
include build/platform-$(UNAME).mk
|
||||
|
||||
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 @@ PROCESSING_INCLUDES = \
|
||||
-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 @@ clean:
|
||||
rm -f $(OBJS) $(LIBRARIES) $(BINARIES)
|
||||
|
||||
|
||||
include codec/common/targets.mk
|
||||
include codec/decoder/targets.mk
|
||||
include codec/encoder/targets.mk
|
||||
include processing/targets.mk
|
||||
|
@ -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)
|
||||
|
49
codec/common/logging.cpp
Normal file
49
codec/common/logging.cpp
Normal file
@ -0,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;
|
||||
}
|
60
codec/common/logging.h
Normal file
60
codec/common/logging.h
Normal file
@ -0,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
|
22
codec/common/targets.mk
Normal file
22
codec/common/targets.mk
Normal file
@ -0,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)
|
@ -47,6 +47,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 +435,24 @@ int32_t main(int32_t iArgC, char* pArgV[])
|
||||
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())
|
||||
{
|
||||
|
@ -75,6 +75,7 @@
|
||||
#include "extern.h"
|
||||
#include "macros.h"
|
||||
#include "wels_const.h"
|
||||
#include "logging.h"
|
||||
|
||||
#ifdef MT_ENABLED
|
||||
#include "mt_defs.h"
|
||||
@ -473,7 +474,22 @@ int ParseCommandLine( int argc, char ** argv, SVCEncodingParam & sParam)
|
||||
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 ++;
|
||||
}
|
||||
}
|
||||
|
@ -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 @@ int32_t CWelsTraceWinDgb::WriteString(int32_t iLevel, const str_t * pStr)
|
||||
CWelsCodecTrace::CWelsCodecTrace()
|
||||
{
|
||||
m_hTraceHandle = NULL;
|
||||
m_fpDebugTrace = NULL;
|
||||
m_fpDebugTrace = NULL;
|
||||
m_fpInfoTrace = NULL;
|
||||
m_fpWarnTrace = NULL;
|
||||
m_fpErrorTrace = NULL;
|
||||
@ -224,7 +225,13 @@ CWelsCodecTrace::~CWelsCodecTrace()
|
||||
}
|
||||
|
||||
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 @@ int32_t CWelsCodecTrace::LoadWelsTraceModule()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // NO_DYNAMIC_VP
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -336,7 +344,9 @@ int32_t CWelsCodecTrace::UnloadWelsTraceModule()
|
||||
|
||||
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 @@ IWelsTrace * CreateWelsTrace(EWelsTraceType eType, void_t * pParam)
|
||||
return pTrace;
|
||||
}
|
||||
|
||||
} // namespace WelsDec
|
||||
} // namespace WelsDec
|
||||
|
@ -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_fpInfoTrace = NULL;
|
||||
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 @@ welsCodecTrace::welsCodecTrace()
|
||||
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 @@ welsCodecTrace::welsCodecTrace()
|
||||
{
|
||||
m_WelsTraceExistFlag = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
welsCodecTrace::~welsCodecTrace()
|
||||
|
Loading…
x
Reference in New Issue
Block a user