Showing the changes to codec/encoder/core/src/wels_preprocess.cpp (1 of 11 files). Show all
Unified · Split
| @@ -50,11 +50,16 @@ · 49 unmodified lines | |||
| 50 | #include "encoder_context.h" | 50 | #include "encoder_context.h" |
| 51 | #include "utils.h" | 51 | #include "utils.h" |
| 52 | 52 | ||
| 53 | #ifdef NO_DYNAMIC_VP | ||
| 54 | EResult WELSAPI CreateVpInterface (void **ppCtx, int iVersion); | ||
| 55 | EResult WELSAPI DestroyVpInterface (void **ppCtx, int iVersion); | ||
| 56 | #endif | ||
| 53 | 57 | ||
| 54 | namespace WelsSVCEnc { | 58 | namespace WelsSVCEnc { |
| 55 | 59 | ||
| 56 | #define WelsSafeDelete(p) if(p){ delete (p); (p) = NULL; } | 60 | #define WelsSafeDelete(p) if(p){ delete (p); (p) = NULL; } |
| 57 | 61 | ||
| 62 | |||
| 58 | //***** entry API declaration ************************************************************************// | 63 | //***** entry API declaration ************************************************************************// |
| 59 | typedef EResult (WELSAPI *pfnCreateVpInterface) (void **, int ); | 64 | typedef EResult (WELSAPI *pfnCreateVpInterface) (void **, int ); |
| 60 | typedef EResult (WELSAPI *pfnDestroyVpInterface) (void * , int ); | 65 | typedef EResult (WELSAPI *pfnDestroyVpInterface) (void * , int ); |
| @@ -87,6 +92,8 @@ inline void WelsUpdateSpatialIdxMap(sWelsEncCtx * pEncCtx, int32_t iPos, SPic · 26 unmodified lines | |||
| 87 | CWelsLib::CWelsLib(void *pEncCtx) | 92 | CWelsLib::CWelsLib(void *pEncCtx) |
| 88 | { | 93 | { |
| 89 | m_pInterface[0] = m_pInterface[1] = NULL; | 94 | m_pInterface[0] = m_pInterface[1] = NULL; |
| 95 | |||
| 96 | #ifndef NO_DYNAMIC_VP | ||
| 90 | #if defined(WIN32) | 97 | #if defined(WIN32) |
| 91 | const str_t WelsVPLib[] = "welsvp.dll"; | 98 | const str_t WelsVPLib[] = "welsvp.dll"; |
| 92 | HMODULE shModule = LoadLibrary(WelsVPLib); | 99 | HMODULE shModule = LoadLibrary(WelsVPLib); |
| @@ -111,6 +118,7 @@ CWelsLib::CWelsLib(void *pEncCtx) · 18 unmodified lines | |||
| 111 | #endif | 118 | #endif |
| 112 | 119 | ||
| 113 | m_pVpLib = (void *)shModule; | 120 | m_pVpLib = (void *)shModule; |
| 121 | #endif | ||
| 114 | } | 122 | } |
| 115 | 123 | ||
| 116 | CWelsLib::~CWelsLib() | 124 | CWelsLib::~CWelsLib() |
| @@ -136,6 +144,7 @@ CWelsLib::~CWelsLib() · 19 unmodified lines | |||
| 136 | void* CWelsLib::QueryFunction(const str_t *pName) | 144 | void* CWelsLib::QueryFunction(const str_t *pName) |
| 137 | { | 145 | { |
| 138 | void *pFunc = NULL; | 146 | void *pFunc = NULL; |
| 147 | |||
| 139 | if (m_pVpLib) | 148 | if (m_pVpLib) |
| 140 | { | 149 | { |
| 141 | #if defined(WIN32) | 150 | #if defined(WIN32) |
| @@ -158,23 +167,34 @@ void* CWelsLib::QueryFunction(const str_t *pName) · 16 unmodified lines | |||
| 158 | 167 | ||
| 159 | int32_t CWelsLib::CreateIface(void **ppEncCtx) | 168 | int32_t CWelsLib::CreateIface(void **ppEncCtx) |
| 160 | { | 169 | { |
| 170 | #ifndef NO_DYNAMIC_VP | ||
| 161 | if (m_pVpLib) | 171 | if (m_pVpLib) |
| 162 | { | 172 | { |
| 173 | |||
| 174 | #endif | ||
| 163 | pfnCreateVpInterface pCreateVpInterface = NULL; | 175 | pfnCreateVpInterface pCreateVpInterface = NULL; |
| 164 | pfnDestroyVpInterface pDestroyVpInterface = NULL; | 176 | pfnDestroyVpInterface pDestroyVpInterface = NULL; |
| 165 | 177 | ||
| 178 | #ifndef NO_DYNAMIC_VP | ||
| 166 | pCreateVpInterface = (pfnCreateVpInterface) QueryFunction("CreateVpInterface"); | 179 | pCreateVpInterface = (pfnCreateVpInterface) QueryFunction("CreateVpInterface"); |
| 167 | pDestroyVpInterface = (pfnDestroyVpInterface) QueryFunction("DestroyVpInterface"); | 180 | pDestroyVpInterface = (pfnDestroyVpInterface) QueryFunction("DestroyVpInterface"); |
| 181 | #else | ||
| 182 | pCreateVpInterface = CreateVpInterface; | ||
| 183 | // TODO(ekr@rtfm.com): This cast corrects a signature difference... This is a potential real problem | ||
| 184 | pDestroyVpInterface = (pfnDestroyVpInterface)DestroyVpInterface; | ||
| 185 | #endif | ||
| 168 | 186 | ||
| 169 | m_pInterface[0] = (void *)pCreateVpInterface; | 187 | m_pInterface[0] = (void *)pCreateVpInterface; |
| 170 | m_pInterface[1] = (void *)pDestroyVpInterface; | 188 | m_pInterface[1] = (void *)pDestroyVpInterface; |
| 171 | 189 | ||
| 172 | if (m_pInterface[0] && m_pInterface[1]) | 190 | if (m_pInterface[0] && m_pInterface[1]) |
| 173 | pCreateVpInterface(ppEncCtx, WELSVP_INTERFACE_VERION); | 191 | pCreateVpInterface(ppEncCtx, WELSVP_INTERFACE_VERION); |
| 192 | #ifndef NO_DYNAMIC_VP | ||
| 174 | } | 193 | } |
| 175 | else | 194 | else |
| 176 | { | 195 | { |
| 177 | } | 196 | } |
| 197 | #endif | ||
| 178 | 198 | ||
| 179 | return ppEncCtx ? 0 : 1; | 199 | return ppEncCtx ? 0 : 1; |
| 180 | } | 200 | } |