remove some redundant files

This commit is contained in:
ruil2 2013-12-24 11:49:14 +08:00
parent e66b3488c5
commit d6cea43bd7
8 changed files with 0 additions and 779 deletions

View File

@ -1,382 +0,0 @@
/*!
* \copy
* Copyright (c) 2013, Cisco Systems
* 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.
*
*/
// WelsVideoProcessor.cpp : Defines the entry point for the console application.
//
#include <tchar.h>
#include "stdafx.h"
#include "wels_process.h"
//////////////////////////////////////////////////////////////////////////
typedef struct {
FILE* srcfile;
FILE* dstfile;
vPixMap src;
vPixMap dst;
vMethods methods[vMethods_Mask];
} VpConfigure;
//////////////////////////////////////////////////////////////////////////
void PrintHelp (TCHAR* strAppName, TCHAR* strError) {
if (strError) {
_tprintf (_T ("Error: %s\n"), strError);
} else {
_tprintf (_T ("Welsvp Sample Console\n"));
}
_tprintf (_T ("Usage1: %s [Options] -i InputFile -o OutputFile -w 640 -h 480\n"), strAppName);
_tprintf (_T ("Options: \n"));
_tprintf (_T (" [-sx x] - cropX of src video (def: 0)\n"));
_tprintf (_T (" [-sy y] - cropY of src video (def: 0)\n"));
_tprintf (_T (" [-sw width] - cropW of src video (def: width)\n"));
_tprintf (_T (" [-sh height] - cropH of src video (def: height)\n"));
_tprintf (_T (" [-scc format] - format (FourCC) of src video (def: support yv12|yuy2|rgb3|rgb4)\n"));
_tprintf (_T (" [-dx x] - cropX of dst video (def: 0)\n"));
_tprintf (_T (" [-dy y] - cropY of dst video (def: 0)\n"));
_tprintf (_T (" [-dw width] - cropW of dst video (def: width)\n"));
_tprintf (_T (" [-dh height] - cropH of dst video (def: height)\n"));
_tprintf (_T (" [-dcc format] - format (FourCC) of dst video (def: nv12. support nv12|yuy2)\n"));
_tprintf (_T (" Video Processing Algorithms\n"));
_tprintf (_T (" [-vaa] - enable video analysis algorithm \n"));
_tprintf (_T (" [-bgd] - enable background detection algorithm \n"));
_tprintf (_T (" [-scd] - enable scene change detection algorithm \n"));
_tprintf (_T (" [-denoise] - enable denoise algorithm \n"));
_tprintf (_T (" [-downsample] - enable downsample algorithm \n"));
_tprintf (_T (" [-n frames] - number of frames to VP process\n\n"));
_tprintf (_T ("\n"));
_tprintf (_T ("Usage2: %s -sw 640 -sh 480 -scc rgb3 -dw 320 -dh 240 -dcc i420 -denoise -vaa -i in.rgb -o out.yuv\n"),
strAppName);
_tprintf (_T ("\n"));
}
vVideoFormat Str2FourCC (TCHAR* strInput) {
vVideoFormat format = vVideoFormat_I420; // as default
if (0 == _tcscmp (strInput, _T ("yv12"))) {
format = vVideoFormat_YV12;
} else if (0 == _tcscmp (strInput, _T ("i420"))) {
format = vVideoFormat_I420;
} else if (0 == _tcscmp (strInput, _T ("rgb24"))) {
format = vVideoFormat_RGB24;
} else if (0 == _tcscmp (strInput, _T ("rgb32"))) {
format = vVideoFormat_RGB32;
} else if (0 == _tcscmp (strInput, _T ("yuy2"))) {
format = vVideoFormat_YUY2;
} else if (0 == _tcscmp (strInput, _T ("nv12"))) {
format = vVideoFormat_NV12;
}
return format;
}
int ReadFile (vPixMap& pixmap, FILE* fp) {
int ret = 0;
int size = pixmap.Rect.width * pixmap.Rect.height;
switch (pixmap.eFormat) {
case vVideoFormat_I420:
case vVideoFormat_YV12: {
if (fread (pixmap.pPixel[0], pixmap.nSizeInBits / 8, (3 * size) >> 1, fp) <= 0)
ret = 1;
}
break;
case vVideoFormat_YUY2: {
if (fread (pixmap.pPixel[0], pixmap.nSizeInBits / 8, 2 * size, fp) <= 0)
ret = 1;
}
break;
case vVideoFormat_RGB24: {
if (fread (pixmap.pPixel[0], pixmap.nSizeInBits / 8, 3 * size, fp) <= 0)
ret = 1;
}
break;
case vVideoFormat_RGB32: {
if (fread (pixmap.pPixel[0], pixmap.nSizeInBits / 8, 4 * size, fp) <= 0)
ret = 1;
}
break;
default:
ret = 1;
break;
}
return ret;
}
int WriteFile (vPixMap& pixmap, FILE* fp) {
int ret = 0;
int size = pixmap.Rect.width * pixmap.Rect.height;
switch (pixmap.eFormat) {
case vVideoFormat_I420:
case vVideoFormat_YV12: {
if (fwrite (pixmap.pPixel[0], pixmap.nSizeInBits / 8, (3 * size) >> 1, fp) <= 0)
ret = 1;
}
break;
case vVideoFormat_YUY2: {
if (fwrite (pixmap.pPixel[0], pixmap.nSizeInBits / 8, 2 * size, fp) <= 0)
ret = 1;
}
break;
case vVideoFormat_RGB24: {
if (fwrite (pixmap.pPixel[0], pixmap.nSizeInBits / 8, 3 * size, fp) <= 0)
ret = 1;
}
break;
case vVideoFormat_RGB32: {
if (fwrite (pixmap.pPixel[0], pixmap.nSizeInBits / 8, 4 * size, fp) <= 0)
ret = 1;
}
break;
default:
ret = 1;
break;
}
return ret;
}
int AllocPixMap (vPixMap& pixmap) {
pixmap.nSizeInBits = sizeof (unsigned char) * 8;
switch (pixmap.eFormat) {
case vVideoFormat_I420:
case vVideoFormat_YV12: {
pixmap.nStride[0] = pixmap.Rect.width;
pixmap.nStride[1] = pixmap.nStride[2] = pixmap.Rect.width / 2;
pixmap.pPixel[0] = new void* [pixmap.nStride[0] * pixmap.Rect.height * pixmap.nSizeInBits / 8 * 3 / 2];
pixmap.pPixel[1] = (unsigned char*)pixmap.pPixel[0] + pixmap.nStride[0] * pixmap.Rect.height * pixmap.nSizeInBits / 8;
pixmap.pPixel[2] = (unsigned char*)pixmap.pPixel[0] + pixmap.nStride[0] * pixmap.Rect.height * pixmap.nSizeInBits /
8 * 5 / 4;
}
break;
case vVideoFormat_YUY2: {
pixmap.nStride[0] = pixmap.nStride[1] = pixmap.nStride[2] = pixmap.Rect.width * 2;
pixmap.pPixel[0] = new void* [pixmap.nStride[0] * pixmap.Rect.height * pixmap.nSizeInBits / 8 * 2];
pixmap.pPixel[1] = pixmap.pPixel[2] = NULL;
}
break;
case vVideoFormat_RGB24: {
pixmap.nStride[0] = pixmap.nStride[1] = pixmap.nStride[2] = pixmap.Rect.width * 3;
pixmap.pPixel[0] = new void* [pixmap.nStride[0] * pixmap.Rect.height * pixmap.nSizeInBits / 8 * 3];
pixmap.pPixel[1] = pixmap.pPixel[2] = NULL;
}
break;
case vVideoFormat_RGB32: {
pixmap.nStride[0] = pixmap.nStride[1] = pixmap.nStride[2] = pixmap.Rect.width * 4;
pixmap.pPixel[0] = new void* [pixmap.nStride[0] * pixmap.Rect.height * pixmap.nSizeInBits / 8 * 4];
pixmap.pPixel[1] = pixmap.pPixel[2] = NULL;
}
break;
default:
return 1;
}
return (pixmap.pPixel[0]) ? 0 : 1;
}
void FreePixMap (vPixMap& pixmap) {
if (pixmap.pPixel[0]) {
free (pixmap.pPixel[0]);
pixmap.pPixel[0] = pixmap.pPixel[1] = pixmap.pPixel[2] = NULL;
}
}
int InitResource (TCHAR* strAppName, VpConfigure& cfg) {
if (0 == cfg.srcfile) {
PrintHelp (strAppName, _T ("Source file can not found!\n"));
goto exit;
};
if (0 == cfg.dstfile) {
PrintHelp (strAppName, _T ("Destination file name not found"));
goto exit;
};
if (cfg.dst.Rect.width == 0)
cfg.dst.Rect.width = cfg.src.Rect.width;
if (cfg.dst.Rect.height == 0)
cfg.dst.Rect.height = cfg.src.Rect.height;
cfg.methods[vMethods_ColorSpaceConvert] = vMethods_ColorSpaceConvert;
if (AllocPixMap (cfg.src))
goto exit;
if (AllocPixMap (cfg.dst))
goto exit;
return 0;
exit:
FreePixMap (cfg.src);
FreePixMap (cfg.dst);
return 1;
}
int ParseCommond (TCHAR* strInput[], int nArgNum, VpConfigure& cfg) {
if (nArgNum < 9) {
PrintHelp (strInput[0], _T ("please specify all necessary parameters!"));
return 1;
}
int width = 0, height = 0;
for (int i = 1; i < nArgNum; i++) {
if (strInput[i]) {
if (0 == _tcscmp (strInput[i], _T ("-i"))) {
i++;
_tfopen_s (&cfg.srcfile, strInput[i], _T ("rb"));
} else if (0 == _tcscmp (strInput[i], _T ("-o"))) {
i++;
_tfopen_s (&cfg.dstfile, strInput[i], _T ("wb"));
} else if (0 == _tcscmp (strInput[i], _T ("-w"))) {
i++;
_stscanf_s (strInput[i], _T ("%d"), &width);
} else if (0 == _tcscmp (strInput[i], _T ("-h"))) {
i++;
_stscanf_s (strInput[i], _T ("%d"), &height);
}
//-----------------------------------------------------------------------------------
else if (0 == _tcscmp (strInput[i], _T ("-sx"))) {
i++;
_stscanf_s (strInput[i], _T ("%hd"), &cfg.src.Rect.top);
} else if (0 == _tcscmp (strInput[i], _T ("-sy"))) {
i++;
_stscanf_s (strInput[i], _T ("%hd"), &cfg.src.Rect.left);
} else if (0 == _tcscmp (strInput[i], _T ("-sw"))) {
i++;
TCHAR* a = strInput[i];
_stscanf_s (strInput[i], _T ("%hd"), &cfg.src.Rect.width);
} else if (0 == _tcscmp (strInput[i], _T ("-sh"))) {
i++;
_stscanf_s (strInput[i], _T ("%hd"), &cfg.src.Rect.height);
} else if (0 == _tcscmp (strInput[i], _T ("-scc"))) {
i++;
cfg.src.eFormat = Str2FourCC (strInput[i]);
}
//-----------------------------------------------------------------------------------
else if (0 == _tcscmp (strInput[i], _T ("-dx"))) {
i++;
_stscanf_s (strInput[i], _T ("%hd"), &cfg.dst.Rect.top);
} else if (0 == _tcscmp (strInput[i], _T ("-dy"))) {
i++;
_stscanf_s (strInput[i], _T ("%hd"), &cfg.dst.Rect.left);
} else if (0 == _tcscmp (strInput[i], _T ("-dw"))) {
i++;
_stscanf_s (strInput[i], _T ("%hd"), &cfg.dst.Rect.width);
} else if (0 == _tcscmp (strInput[i], _T ("-dh"))) {
i++;
_stscanf_s (strInput[i], _T ("%hd"), &cfg.dst.Rect.height);
} else if (0 == _tcscmp (strInput[i], _T ("-dcc"))) {
i++;
cfg.dst.eFormat = Str2FourCC (strInput[i]);
}
//-----------------------------------------------------------------------------------
else if (0 == _tcscmp (strInput[i], _T ("-denoise"))) {
cfg.methods[vMethods_Denoise] = vMethods_Denoise;
} else if (0 == _tcscmp (strInput[i], _T ("-scd"))) {
cfg.methods[vMethods_SceneChangeDetection] = vMethods_SceneChangeDetection;
} else if (0 == _tcscmp (strInput[i], _T ("-downsample"))) {
} else if (0 == _tcscmp (strInput[i], _T ("-vaa"))) {
} else if (0 == _tcscmp (strInput[i], _T ("-bgd"))) {
} else if (0 == _tcscmp (strInput[i], _T ("-aq"))) {
}
}
}
if (cfg.src.Rect.width == 0) cfg.src.Rect.width = width;
if (cfg.src.Rect.height == 0) cfg.src.Rect.height = height;
if (cfg.dst.Rect.width == 0) cfg.dst.Rect.width = width;
if (cfg.dst.Rect.height == 0) cfg.dst.Rect.height = height;
return InitResource (strInput[0], cfg);
}
int _tmain (int argc, _TCHAR* argv[]) {
int ret = 0;
VpConfigure cfg = {0};
IWelsVpPlugin* pVpp = NULL;
ret = ParseCommond (argv, argc, cfg);
if (ret)
goto exit;
pVpp = new IWelsVpPlugin (ret);
if (pVpp && ret == 0) {
vResult vret = vRet_Success;
while (1) {
if (feof (cfg.srcfile))
break;
if (ReadFile (cfg.src, cfg.srcfile))
break;
vret = pVpp->Process (cfg.methods[vMethods_ColorSpaceConvert], &cfg.src, &cfg.dst);
if (vret)
break;
vret = pVpp->Process (cfg.methods[vMethods_Denoise], &cfg.dst, NULL);
if (vret)
break;
if (WriteFile (cfg.dst, cfg.dstfile))
break;
}
}
exit:
if (pVpp) {
delete pVpp;
pVpp = NULL;
}
if (cfg.srcfile)
fclose (cfg.srcfile);
if (cfg.dstfile)
fclose (cfg.dstfile);
FreePixMap (cfg.src);
FreePixMap (cfg.dst);
return 0;
}

View File

@ -1,87 +0,0 @@
/*!
* \copy
* Copyright (c) 2013, Cisco Systems
* 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_BOUNDLELOAD_H
#define WELS_BOUNDLELOAD_H
#if defined(MACOS)
#include <dlfcn.h>
#include <string>
CFBundleRef LoadBundle (const char* lpBundlePath) {
if (lpBundlePath == NULL) {
return NULL;
}
CFStringRef bundlePath = CFStringCreateWithCString (kCFAllocatorSystemDefault, lpBundlePath,
CFStringGetSystemEncoding());
if (NULL == bundlePath) {
return NULL;
}
CFURLRef bundleURL = CFURLCreateWithString (kCFAllocatorSystemDefault, bundlePath, NULL);
if (NULL == bundleURL) {
return NULL;
}
// 2.get bundle ref
CFBundleRef bundleRef = CFBundleCreate (kCFAllocatorSystemDefault, bundleURL);
CFRelease (bundleURL);
// Boolean bReturn = FALSE;
if (NULL != bundleRef) {
// bReturn = CFBundleLoadExecutable(bundleRef);
}
return bundleRef;
}
Boolean FreeBundle (CFBundleRef bundleRef) {
if (NULL != bundleRef) {
// CFBundleUnloadExecutable(bundleRef);
CFRelease (bundleRef);
}
return TRUE;
}
void* GetProcessAddress (CFBundleRef bundleRef, const char* lpProcName) {
void* processAddress = NULL;
if (NULL != bundleRef) {
CFStringRef cfProcName = CFStringCreateWithCString (kCFAllocatorSystemDefault, lpProcName, CFStringGetSystemEncoding());
processAddress = CFBundleGetFunctionPointerForName (bundleRef, cfProcName);
CFRelease (cfProcName);
}
return processAddress;
}
#endif
#endif

View File

@ -1,8 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// WelsVideoProcessor.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@ -1,20 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#ifndef _WELSVP_STDAFX_H
#define _WELSVP_STDAFX_H
#include "targetver.h"
#if defined (WIN32)
#include <windows.h>
#include <tchar.h>
#else
#include <string.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#endif

View File

@ -1,16 +0,0 @@
#ifndef _WELSVP_TARGETVER_H
#define _WELSVP_TARGETVER_H
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif
#endif

View File

@ -1,181 +0,0 @@
/*!
* \copy
* Copyright (c) 2013, Cisco Systems
* 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 <windows.h>
#include "wels_process.h"
#include "bundleloader.h"
// entry API declaration
typedef vResult (WELSAPI* pfnCreateVpInterface) (void**, int);
typedef vResult (WELSAPI* pfnDestroyVpInterface) (void*, int);
////////////////////////////////////////////////////////
void* loadlib() {
#if defined(WIN32)
HMODULE shModule = LoadLibraryA ("WelsVP.dll");
if (shModule == NULL)
shModule = LoadLibraryA ("../WelsVP.dll");
#elif defined(MACOS)
const char WelsVPLib[] = "WelsVP.bundle";
CFBundleRef shModule = LoadBundle (WelsVPLib);
#elif defined(UNIX)
const char WelsVPLib[] = "WelsVP.so";
void* shModule = dlopen (WelsVPLib, RTLD_LAZY);
#endif
return (void*)shModule;
}
void freelib (void* lib) {
if (lib) {
#ifdef WIN32
HMODULE shModule = (HMODULE)lib;
FreeLibrary (shModule);
#elif defined(MACOS)
CFBundleRef shModule = (CFBundleRef)lib;
FreeBundle (shModule);
#elif defined(UNIX)
void* shModule = lib;
dlclose (shModule);
#endif
}
}
void* queryfunc (void* lib, const char* name) {
void* pFunc = NULL;
#ifdef WIN32
HMODULE shModule = (HMODULE)lib;
pFunc = (void*)GetProcAddress (shModule, name);
#elif defined(MACOS)
CFBundleRef shModule = (CFBundleRef)lib;
pFunc = (void*)GetProcessAddress (shModule, name);
#elif defined(UNIX)
void* shModule = lib;
pFunc = (void*)dlsym (shModule, name);
#endif
return pFunc;
}
IWelsVpPlugin::IWelsVpPlugin (int& ret)
: flag (0)
, ivp (NULL)
, hlib (NULL) {
pfnCreateVpInterface pCreateVpInterface = NULL;
pfnDestroyVpInterface pDestroyVpInterface = NULL;
iface[0] = iface[1] = NULL;
hlib = loadlib();
if (!hlib)
goto exit;
pCreateVpInterface = (pfnCreateVpInterface) queryfunc (hlib, ("CreateVpInterface"));
pDestroyVpInterface = (pfnDestroyVpInterface) queryfunc (hlib, ("DestroyVpInterface"));
if (!pCreateVpInterface || !pDestroyVpInterface)
goto exit;
iface[0] = (void*) pCreateVpInterface;
iface[1] = (void*) pDestroyVpInterface;
pCreateVpInterface ((void**)&ivp, WELSVP_INTERFACE_VERION);
if (!iface)
goto exit;
ret = 0;
return;
exit:
ret = 1;
}
IWelsVpPlugin::~IWelsVpPlugin() {
if (hlib) {
pfnDestroyVpInterface pDestroyVpInterface = (pfnDestroyVpInterface) iface[1];
if (pDestroyVpInterface)
pDestroyVpInterface ((void*)ivp, WELSVP_INTERFACE_VERION);
freelib (hlib);
hlib = NULL;
}
}
vResult IWelsVpPlugin::Init (int nType, void* pCfg) {
vResult ret = vRet_NotSupport;
if (hlib && nType > 0)
ret = ivp->Init (nType, pCfg);
return ret;
}
vResult IWelsVpPlugin::Uninit (int nType) {
vResult ret = vRet_NotSupport;
if (hlib && nType > 0)
ret = ivp->Uninit (nType);
return ret;
}
vResult IWelsVpPlugin::Flush (int nType) {
vResult ret = vRet_NotSupport;
if (hlib && nType > 0)
ret = ivp->Flush (nType);
return ret;
}
vResult IWelsVpPlugin::Process (int nType, vPixMap* src, vPixMap* dst) {
vResult ret = vRet_NotSupport;
if (hlib && nType > 0)
ret = ivp->Process (nType, src, dst);
return ret;
}
vResult IWelsVpPlugin::Get (int nType, void* pParam) {
vResult ret = vRet_NotSupport;
if (hlib && nType > 0)
ret = ivp->Get (nType, pParam);
return ret;
}
vResult IWelsVpPlugin::Set (int nType, void* pParam) {
vResult ret = vRet_NotSupport;
if (hlib && nType > 0)
ret = ivp->Set (nType, pParam);
return ret;
}
vResult IWelsVpPlugin::SpecialFeature (int nType, void* pIn, void* pOut) {
vResult ret = vRet_NotSupport;
if (hlib && nType > 0)
ret = ivp->SpecialFeature (nType, pIn, pOut);
return ret;
}

View File

@ -1,81 +0,0 @@
/*!
* \copy
* Copyright (c) 2011-2013, Cisco Systems
* 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.
*
* \file wels_process.h
*
* \brief interface of video pre-process plugins
*
* \date 03/21/2011
*
* \description : this class is designed as an interface to unify video pre-processing
* class implement sets such as denoise,colorspace conversion etc...
*
*************************************************************************************
*/
#ifndef WELS_PREPROCESS_H
#define WELS_PREPROCESS_H
#include "../../interface/IWelsVP.h"
class IWelsVpPlugin {
public:
IWelsVpPlugin (int& ret);
~IWelsVpPlugin();
enum {
STATE_BEFOREENC = 0, /* before picture encoding */
STATE_AFTERENC , /* after picture encoded */
};
public:
vResult Init (int nType, void* pCfg);
vResult Uninit (int nType);
vResult Flush (int nType);
vResult Process (int nType, vPixMap* src, vPixMap* dst);
vResult Get (int nType, void* pParam);
vResult Set (int nType, void* pParam);
vResult SpecialFeature (int nType, void* pIn, void* pOut);
void SetFlag (int a) {
flag = a;
}
void GetFlag (int& a) {
a = flag;
}
private:
int flag;
IWelsVP* ivp;
void* hlib;
void* iface[2];
};
#endif

View File

@ -18,7 +18,6 @@ PROCESSING_CPP_SRCS=\
$(PROCESSING_SRCDIR)/./src/imagerotate/imagerotatefuncs.cpp\
$(PROCESSING_SRCDIR)/./src/scenechangedetection/SceneChangeDetection.cpp\
$(PROCESSING_SRCDIR)/./src/scenechangedetection/SceneChangeDetectionCommon.cpp\
$(PROCESSING_SRCDIR)/./src/testbed/stdafx.cpp\
$(PROCESSING_SRCDIR)/./src/vaacalc/vaacalcfuncs.cpp\
$(PROCESSING_SRCDIR)/./src/vaacalc/vaacalculation.cpp\
@ -88,9 +87,6 @@ $(PROCESSING_SRCDIR)/./src/scenechangedetection/SceneChangeDetection.o: $(PROCES
$(PROCESSING_SRCDIR)/./src/scenechangedetection/SceneChangeDetectionCommon.o: $(PROCESSING_SRCDIR)/./src/scenechangedetection/SceneChangeDetectionCommon.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(PROCESSING_CFLAGS) $(PROCESSING_INCLUDES) -c -o $(PROCESSING_SRCDIR)/./src/scenechangedetection/SceneChangeDetectionCommon.o $(PROCESSING_SRCDIR)/./src/scenechangedetection/SceneChangeDetectionCommon.cpp
$(PROCESSING_SRCDIR)/./src/testbed/stdafx.o: $(PROCESSING_SRCDIR)/./src/testbed/stdafx.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(PROCESSING_CFLAGS) $(PROCESSING_INCLUDES) -c -o $(PROCESSING_SRCDIR)/./src/testbed/stdafx.o $(PROCESSING_SRCDIR)/./src/testbed/stdafx.cpp
$(PROCESSING_SRCDIR)/./src/vaacalc/vaacalcfuncs.o: $(PROCESSING_SRCDIR)/./src/vaacalc/vaacalcfuncs.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(PROCESSING_CFLAGS) $(PROCESSING_INCLUDES) -c -o $(PROCESSING_SRCDIR)/./src/vaacalc/vaacalcfuncs.o $(PROCESSING_SRCDIR)/./src/vaacalc/vaacalcfuncs.cpp