shithub: openh264

Download patch

ref: 1342da9bc4335cdfb3152190103c1d12c83a4f06
parent: 56abd3c15bd265dbccb092f67a63cd5bd1c78828
author: Martin Storsjö <[email protected]>
date: Tue Apr 8 06:56:58 EDT 2014

Remove everything related to NO_DYNAMIC_VP

This mode is the default and used everywhere now.

--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@
 include build/platform-$(OS).mk
 
 
-CFLAGS += -DNO_DYNAMIC_VP
+CFLAGS +=
 LDFLAGS +=
 
 ifeq (Yes, $(GCOV))
--- a/codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj
@@ -93,7 +93,6 @@
 		4CE446AA18BC605C0017DF25 /* as264_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = as264_common.h; sourceTree = "<group>"; };
 		4CE446AB18BC605C0017DF25 /* au_set.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = au_set.h; sourceTree = "<group>"; };
 		4CE446AC18BC605C0017DF25 /* bit_stream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bit_stream.h; sourceTree = "<group>"; };
-		4CE446AD18BC605C0017DF25 /* bundleloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bundleloader.h; sourceTree = "<group>"; };
 		4CE446AE18BC605C0017DF25 /* deblocking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deblocking.h; sourceTree = "<group>"; };
 		4CE446AF18BC605C0017DF25 /* decode_mb_aux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = decode_mb_aux.h; sourceTree = "<group>"; };
 		4CE446B018BC605C0017DF25 /* dq_map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dq_map.h; sourceTree = "<group>"; };
@@ -286,7 +285,6 @@
 				4CE446AA18BC605C0017DF25 /* as264_common.h */,
 				4CE446AB18BC605C0017DF25 /* au_set.h */,
 				4CE446AC18BC605C0017DF25 /* bit_stream.h */,
-				4CE446AD18BC605C0017DF25 /* bundleloader.h */,
 				4CE446AE18BC605C0017DF25 /* deblocking.h */,
 				4CE446AF18BC605C0017DF25 /* decode_mb_aux.h */,
 				4CE446B018BC605C0017DF25 /* dq_map.h */,
@@ -636,12 +634,10 @@
 				GCC_PREPROCESSOR_DEFINITIONS = "";
 				"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*]" = (
 					APPLE_IOS,
-					NO_DYNAMIC_VP,
 					HAVE_NEON,
 				);
 				"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphonesimulator*]" = (
 					APPLE_IOS,
-					NO_DYNAMIC_VP,
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(SRCROOT)/../../../../common/inc",
@@ -670,12 +666,10 @@
 				GCC_PREPROCESSOR_DEFINITIONS = "";
 				"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*]" = (
 					APPLE_IOS,
-					NO_DYNAMIC_VP,
 					HAVE_NEON,
 				);
 				"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphonesimulator*]" = (
 					APPLE_IOS,
-					NO_DYNAMIC_VP,
 				);
 				HEADER_SEARCH_PATHS = (
 					"$(SRCROOT)/../../../../common/inc",
--- a/codec/build/win32/enc/WelsEncCore.vcproj
+++ b/codec/build/win32/enc/WelsEncCore.vcproj
@@ -53,7 +53,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\..\common\inc;..\..\..\encoder\core\inc,..\..\..\api\svc;..\..\..\processing\interface"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;X86_ASM;NO_DYNAMIC_VP"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;X86_ASM"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -133,7 +133,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\..\common\inc;..\..\..\encoder\core\inc,..\..\..\api\svc;..\..\..\processing\interface"
-				PreprocessorDefinitions="WIN64;_DEBUG;_LIB;X86_ASM;NO_DYNAMIC_VP"
+				PreprocessorDefinitions="WIN64;_DEBUG;_LIB;X86_ASM"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -215,7 +215,7 @@
 				FavorSizeOrSpeed="1"
 				WholeProgramOptimization="true"
 				AdditionalIncludeDirectories="..\..\..\common\inc;..\..\..\encoder\core\inc,..\..\..\api\svc;..\..\..\processing\interface"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;X86_ASM;NO_DYNAMIC_VP"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;X86_ASM"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -299,7 +299,7 @@
 				FavorSizeOrSpeed="1"
 				WholeProgramOptimization="true"
 				AdditionalIncludeDirectories="..\..\..\common\inc;..\..\..\encoder\core\inc,..\..\..\api\svc;..\..\..\processing\interface"
-				PreprocessorDefinitions="WIN64;NDEBUG;_LIB;X86_ASM;NO_DYNAMIC_VP"
+				PreprocessorDefinitions="WIN64;NDEBUG;_LIB;X86_ASM"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
--- a/codec/encoder/core/inc/bundleloader.h
+++ /dev/null
@@ -1,137 +1,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 <carbon/carbon.h>
-#include <coreFoundation/CFBundle.h>
-#include <string>
-
-int GetCurrentModulePath (char* lpModulePath, const int iPathMax) {
-if (lpModulePath == NULL || iPathMax <= 0) {
-  return -1;
-}
-
-memset (lpModulePath, 0, iPathMax);
-
-char cCurrentPath[PATH_MAX];
-memset (cCurrentPath, 0, PATH_MAX);
-
-Dl_info 	dlInfo;
-static int  sDummy;
-dladdr ((void*)&sDummy, &dlInfo);
-
-strlcpy (cCurrentPath, dlInfo.dli_fname, PATH_MAX);
-
-// whether is self a framework ?
-int locateNumber = 1;
-struct FSRef currentPath;
-OSStatus iStatus = FSPathMakeRef ((unsigned char*)cCurrentPath, &currentPath, NULL);
-if (noErr == iStatus) {
-  LSItemInfoRecord  info;
-  iStatus = LSCopyItemInfoForRef (&currentPath, kLSRequestExtension, &info);
-  if (noErr == iStatus && NULL == info.extension) {
-    locateNumber = 4;
-  }
-}
-std::string strPath (cCurrentPath);
-std::string::size_type pos = std::string::npos;
-for (int i = 0; i < locateNumber; i++) {
-  pos = strPath.rfind ('/');
-  if (std::string::npos == pos) {
-    break;
-  }
-  strPath.erase (pos);
-}
-if (std::string::npos == pos) {
-  return -2;
-}
-cCurrentPath[pos] = 0;
-
-strlcpy (lpModulePath, cCurrentPath, iPathMax);
-strlcat (lpModulePath, "/", iPathMax);
-
-return 0;
-}
-
-CFBundleRef LoadBundle (const char* lpBundlePath) {
-  if (lpBundlePath == NULL) {
-    return NULL;
-  }
-
-  struct FSRef bundlePath;
-  OSStatus iStatus = FSPathMakeRef ((unsigned char*)lpBundlePath, &bundlePath, NULL);
-  if (noErr != iStatus) {
-    return NULL;
-  }
-
-  CFURLRef bundleURL = CFURLCreateFromFSRef (kCFAllocatorSystemDefault, &bundlePath);
-  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
--- a/codec/encoder/core/inc/wels_preprocess.h
+++ b/codec/encoder/core/inc/wels_preprocess.h
@@ -126,7 +126,6 @@
   void* QueryFunction (const char* pName);
 
  private:
-  void* m_pVpLib;
   void* m_pInterface[2];
 };
 
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -30,16 +30,6 @@
  *
  */
 
-#ifndef NO_DYNAMIC_VP
-#if defined(_WIN32)
-#include <windows.h>
-#elif defined(MACOS)
-#include "bundleloader.h"
-#elif defined(__GNUC__)
-#include <dlfcn.h>
-#endif
-#endif
-
 #include "wels_preprocess.h"
 #include "picture_handle.h"
 #include "encoder_context.h"
@@ -79,96 +69,25 @@
 //***************************************************************************************************//
 CWelsLib::CWelsLib (sWelsEncCtx* pEncCtx) {
   m_pInterface[0] = m_pInterface[1] = NULL;
-
-#ifndef NO_DYNAMIC_VP
-#if defined(_WIN32)
-  const char WelsVPLib[] = "welsvp.dll";
-  HMODULE shModule = LoadLibrary (WelsVPLib);
-  if (!shModule)
-    WelsLog (pEncCtx, WELS_LOG_ERROR, "welsvp load lib dynamic failed module=%x\n", shModule);
-
-#elif defined(MACOS)
-  const char WelsVPLib[] = "welsvp.bundle";
-  char pCurPath[256];
-  GetCurrentModulePath (pCurPath, 256);
-  strlcat (pCurPath, WelsVPLib, 256);
-  CFBundleRef shModule = LoadBundle (pCurPath);
-  if (!shModule)
-    WelsLog (pEncCtx, WELS_LOG_ERROR, "welsvp load lib dynamic failed module=%x\n", shModule);
-
-#elif defined(__GNUC__)
-  const char WelsVPLib[] = "./libwelsvp.so";
-  void* shModule = NULL;
-  shModule = dlopen (WelsVPLib, RTLD_LAZY);
-  if (shModule == NULL)
-    printf ("dlopen %s iRet=%p, err=%s\n", WelsVPLib, shModule, dlerror());
-#endif
-
-  m_pVpLib = (void*)shModule;
-#endif
 }
 
 CWelsLib::~CWelsLib() {
-#ifndef NO_DYNAMIC_VP
-  if (m_pVpLib) {
-#if defined(_WIN32)
-    HMODULE shModule = (HMODULE)m_pVpLib;
-    FreeLibrary (shModule);
-
-#elif defined(MACOS)
-    CFBundleRef shModule = (CFBundleRef)m_pVpLib;
-    FreeBundle (shModule);
-
-#elif defined(__GNUC__)
-    void* shModule = m_pVpLib;
-    dlclose (shModule);
-#endif
-    m_pVpLib = NULL;
-  }
-#endif
 }
 
 void* CWelsLib::QueryFunction (const char* pName) {
   void* pFunc = NULL;
 
-#ifndef NO_DYNAMIC_VP
-  if (m_pVpLib) {
-#if defined(_WIN32)
-    HMODULE shModule = (HMODULE)m_pVpLib;
-    pFunc = (void*)GetProcAddress (shModule, pName);
-
-#elif defined(MACOS)
-    CFBundleRef shModule = (CFBundleRef)m_pVpLib;
-    pFunc = (void*)GetProcessAddress (shModule, pName);
-
-#elif defined(__GNUC__)
-    void* shModule = m_pVpLib;
-    pFunc = (void*)dlsym (shModule, pName);
-    if (pFunc == NULL)
-      printf ("dlsym %p iRet=%p, err=%s\n", shModule, pFunc, dlerror());
-#endif
-  }
-#endif
   return pFunc;
 }
 
 int32_t CWelsLib::CreateIface (IWelsVP** ppInterfaceVp) {
   *ppInterfaceVp = NULL;
-#ifndef NO_DYNAMIC_VP
-  if (m_pVpLib) {
-
-#endif
     pfnCreateVpInterface  pCreateVpInterface  = NULL;
     pfnDestroyVpInterface pDestroyVpInterface = NULL;
 
-#ifndef NO_DYNAMIC_VP
-    pCreateVpInterface  = (pfnCreateVpInterface)  QueryFunction ("CreateVpInterface");
-    pDestroyVpInterface = (pfnDestroyVpInterface) QueryFunction ("DestroyVpInterface");
-#else
     pCreateVpInterface  = CreateVpInterface;
     // TODO([email protected]): This cast corrects a signature difference... This is a potential real problem
     pDestroyVpInterface = (pfnDestroyVpInterface)DestroyVpInterface;
-#endif
 
     m_pInterface[0] = (void*)pCreateVpInterface;
     m_pInterface[1] = (void*)pDestroyVpInterface;
@@ -175,10 +94,6 @@
 
     if (m_pInterface[0] && m_pInterface[1])
       pCreateVpInterface ((void**)ppInterfaceVp, WELSVP_INTERFACE_VERION);
-#ifndef NO_DYNAMIC_VP
-  } else {
-  }
-#endif
 
   return (*ppInterfaceVp) ? 0 : 1;
 }