diff --git a/codec/encoder/core/inc/wels_preprocess.h b/codec/encoder/core/inc/wels_preprocess.h index 1bcd5072..b2e5f18d 100644 --- a/codec/encoder/core/inc/wels_preprocess.h +++ b/codec/encoder/core/inc/wels_preprocess.h @@ -114,21 +114,6 @@ typedef struct SVAAFrameInfoExt_t: public SVAAFrameInfo uint8_t *pVaaBlockStaticIdc[16];//real memory, }SVAAFrameInfoExt; -class CWelsLib { - public: - CWelsLib (sWelsEncCtx* pEncCtx); - virtual ~CWelsLib(); - - int32_t CreateIface (IWelsVP** ppInterfaceVp); - int32_t DestroyIface (IWelsVP* pInterfaceVp); - - protected: - void* QueryFunction (const char* pName); - - private: - void* m_pInterface[2]; -}; - class CWelsPreProcess { public: CWelsPreProcess (sWelsEncCtx* pEncCtx); @@ -184,7 +169,6 @@ private: Scaled_Picture m_sScaledPicture; SPicture* m_pLastSpatialPicture[MAX_DEPENDENCY_LAYER][2]; IWelsVP* m_pInterfaceVp; - CWelsLib* m_pEncLib; sWelsEncCtx* m_pEncCtx; bool m_bInitDone; uint8_t m_uiSpatialLayersInTemporal[MAX_DEPENDENCY_LAYER]; diff --git a/codec/encoder/core/src/wels_preprocess.cpp b/codec/encoder/core/src/wels_preprocess.cpp index b9c0f07d..3c973016 100644 --- a/codec/encoder/core/src/wels_preprocess.cpp +++ b/codec/encoder/core/src/wels_preprocess.cpp @@ -42,8 +42,6 @@ namespace WelsSVCEnc { //***** entry API declaration ************************************************************************// -typedef EResult (* pfnCreateVpInterface) (void**, int); -typedef EResult (* pfnDestroyVpInterface) (void*, int); int32_t WelsInitScaledPic (SWelsSvcCodingParam* pParam, Scaled_Picture* pScaledPic, CMemoryAlign* pMemoryAlign); bool JudgeNeedOfScaling (SWelsSvcCodingParam* pParam, Scaled_Picture* pScaledPic); @@ -66,49 +64,6 @@ inline void WelsUpdateSpatialIdxMap (sWelsEncCtx* pEncCtx, int32_t iPos, SPic } -//***************************************************************************************************// -CWelsLib::CWelsLib (sWelsEncCtx* pEncCtx) { - m_pInterface[0] = m_pInterface[1] = NULL; -} - -CWelsLib::~CWelsLib() { -} - -void* CWelsLib::QueryFunction (const char* pName) { - void* pFunc = NULL; - - return pFunc; -} - -int32_t CWelsLib::CreateIface (IWelsVP** ppInterfaceVp) { - *ppInterfaceVp = NULL; - pfnCreateVpInterface pCreateVpInterface = NULL; - pfnDestroyVpInterface pDestroyVpInterface = NULL; - - pCreateVpInterface = CreateVpInterface; - pDestroyVpInterface = DestroyVpInterface; - - m_pInterface[0] = (void*)pCreateVpInterface; - m_pInterface[1] = (void*)pDestroyVpInterface; - - if (m_pInterface[0] && m_pInterface[1]) - pCreateVpInterface ((void**)ppInterfaceVp, WELSVP_INTERFACE_VERION); - - return (*ppInterfaceVp) ? 0 : 1; -} - -int32_t CWelsLib::DestroyIface (IWelsVP* pInterfaceVp) { - if (pInterfaceVp) { - pfnDestroyVpInterface pDestroyVpInterface = (pfnDestroyVpInterface) m_pInterface[1]; - if (pDestroyVpInterface) { - pDestroyVpInterface (pInterfaceVp, WELSVP_INTERFACE_VERION); - } else { - } - } - - return 0; -} - /*************************************************************************** * * implement of the interface @@ -117,7 +72,6 @@ int32_t CWelsLib::DestroyIface (IWelsVP* pInterfaceVp) { CWelsPreProcess::CWelsPreProcess (sWelsEncCtx* pEncCtx) { m_pInterfaceVp = NULL; - m_pEncLib = NULL; m_bInitDone = false; m_pEncCtx = pEncCtx; memset (&m_sScaledPicture, 0, sizeof (m_sScaledPicture)); @@ -132,12 +86,8 @@ CWelsPreProcess::~CWelsPreProcess() { } int32_t CWelsPreProcess::WelsPreprocessCreate() { - if (m_pEncLib == NULL && m_pInterfaceVp == NULL) { - m_pEncLib = new CWelsLib (m_pEncCtx); - if (!m_pEncLib) - goto exit; - - m_pEncLib->CreateIface (&m_pInterfaceVp); + if (m_pInterfaceVp == NULL) { + CreateVpInterface ((void**) &m_pInterfaceVp, WELSVP_INTERFACE_VERION); if (!m_pInterfaceVp) goto exit; } else @@ -151,11 +101,8 @@ exit: } int32_t CWelsPreProcess::WelsPreprocessDestroy() { - if (m_pEncLib) { - m_pEncLib->DestroyIface (m_pInterfaceVp); - m_pInterfaceVp = NULL; - WelsSafeDelete (m_pEncLib); - } + DestroyVpInterface (m_pInterfaceVp, WELSVP_INTERFACE_VERION); + m_pInterfaceVp = NULL; return 0; }