/*! * \brief initialize function pointers that potentially used in Wels encoding * \param pEncCtx sWelsEncCtx* * \return successful - 0; otherwise none 0 for failed */ int32_t InitFunctionPointers (SWelsFuncPtrList* pFuncList, SWelsSvcCodingParam* pParam, uint32_t uiCpuFlag) { int32_t iReturn = ENC_RETURN_SUCCESS; /* Functionality utilization of CPU instructions dependency */ pFuncList->pfSetMemZeroSize8 = WelsSetMemZero_c; // confirmed_safe_unsafe_usage pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZero_c; // confirmed_safe_unsafe_usage pFuncList->pfSetMemZeroSize64 = WelsSetMemZero_c; // confirmed_safe_unsafe_usage #if defined(X86_ASM) if (uiCpuFlag & WELS_CPU_MMXEXT) { pFuncList->pfSetMemZeroSize8 = WelsSetMemZeroSize8_mmx; // confirmed_safe_unsafe_usage pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZeroSize64_mmx; // confirmed_safe_unsafe_usage pFuncList->pfSetMemZeroSize64 = WelsSetMemZeroSize64_mmx; // confirmed_safe_unsafe_usage } if (uiCpuFlag & WELS_CPU_SSE2) { pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZeroAligned64_sse2; // confirmed_safe_unsafe_usage } #endif//X86_ASM #if defined(HAVE_NEON) if (uiCpuFlag & WELS_CPU_NEON) { pFuncList->pfSetMemZeroSize8 = WelsSetMemZero_neon; pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZero_neon; pFuncList->pfSetMemZeroSize64 = WelsSetMemZero_neon; } #endif InitExpandPictureFunc (pFuncList, uiCpuFlag); /* Intra_Prediction_fn*/ WelsInitFillingPredFuncs (uiCpuFlag); WelsInitIntraPredFuncs (pFuncList, uiCpuFlag); /* ME func */ WelsInitMeFunc(pFuncList, uiCpuFlag, SCREEN_CONTENT_REAL_TIME==pParam->iUsageType); /* sad, satd, average */ WelsInitSampleSadFunc (pFuncList, uiCpuFlag); // WelsInitBGDFunc (pFuncList, pParam->bEnableBackgroundDetection); // for pfGetVarianceFromIntraVaa function ptr adaptive by CPU features, 6/7/2010 InitIntraAnalysisVaaInfo (pFuncList, uiCpuFlag); /* Motion compensation */ /*init pixel average function*/ /*get one column or row pixel when refinement*/ WelsInitMcFuncs (pFuncList, uiCpuFlag); InitCoeffFunc (uiCpuFlag); WelsInitEncodingFuncs (pFuncList, uiCpuFlag); WelsInitReconstructionFuncs (pFuncList, uiCpuFlag); DeblockingInit (&pFuncList->pfDeblocking, uiCpuFlag); WelsBlockFuncInit (&pFuncList->pfSetNZCZero, uiCpuFlag); InitFillNeighborCacheInterFunc (pFuncList, pParam->bEnableBackgroundDetection); InitRefListMgrFunc(pFuncList,pParam->iUsageType); return iReturn; }
/*! * \brief initialize function pointers that potentially used in Wels encoding * \param pEncCtx sWelsEncCtx* * \return successful - 0; otherwise none 0 for failed */ int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, uint32_t uiCpuFlag) { int32_t iReturn = ENC_RETURN_SUCCESS; SWelsFuncPtrList* pFuncList = pEncCtx->pFuncList; bool bScreenContent = (SCREEN_CONTENT_REAL_TIME == pParam->iUsageType); /* Functionality utilization of CPU instructions dependency */ pFuncList->pfSetMemZeroSize8 = WelsSetMemZero_c; // confirmed_safe_unsafe_usage pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZero_c; // confirmed_safe_unsafe_usage pFuncList->pfSetMemZeroSize64 = WelsSetMemZero_c; // confirmed_safe_unsafe_usage #if defined(X86_ASM) if (uiCpuFlag & WELS_CPU_MMXEXT) { pFuncList->pfSetMemZeroSize8 = WelsSetMemZeroSize8_mmx; // confirmed_safe_unsafe_usage pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZeroSize64_mmx; // confirmed_safe_unsafe_usage pFuncList->pfSetMemZeroSize64 = WelsSetMemZeroSize64_mmx; // confirmed_safe_unsafe_usage } if (uiCpuFlag & WELS_CPU_SSE2) { pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZeroAligned64_sse2; // confirmed_safe_unsafe_usage } #endif//X86_ASM #if defined(HAVE_NEON) if (uiCpuFlag & WELS_CPU_NEON) { pFuncList->pfSetMemZeroSize8 = WelsSetMemZero_neon; pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZero_neon; pFuncList->pfSetMemZeroSize64 = WelsSetMemZero_neon; } #endif #if defined(HAVE_NEON_AARCH64) if (uiCpuFlag & WELS_CPU_NEON) { pFuncList->pfSetMemZeroSize8 = WelsSetMemZero_AArch64_neon; pFuncList->pfSetMemZeroSize64Aligned16 = WelsSetMemZero_AArch64_neon; pFuncList->pfSetMemZeroSize64 = WelsSetMemZero_AArch64_neon; } #endif InitExpandPictureFunc (& (pFuncList->sExpandPicFunc), uiCpuFlag); /* Intra_Prediction_fn*/ WelsInitIntraPredFuncs (pFuncList, uiCpuFlag); /* ME func */ WelsInitMeFunc (pFuncList, uiCpuFlag, bScreenContent); /* sad, satd, average */ WelsInitSampleSadFunc (pFuncList, uiCpuFlag); // WelsInitBGDFunc (pFuncList, pParam->bEnableBackgroundDetection); WelsInitSCDPskipFunc (pFuncList, bScreenContent && (pParam->bEnableSceneChangeDetect)); // for pfGetVarianceFromIntraVaa function ptr adaptive by CPU features, 6/7/2010 InitIntraAnalysisVaaInfo (pFuncList, uiCpuFlag); /* Motion compensation */ /*init pixel average function*/ /*get one column or row pixel when refinement*/ InitMcFunc (&pFuncList->sMcFuncs, uiCpuFlag); InitCoeffFunc (pFuncList, uiCpuFlag, pParam->iEntropyCodingModeFlag); WelsInitEncodingFuncs (pFuncList, uiCpuFlag); WelsInitReconstructionFuncs (pFuncList, uiCpuFlag); DeblockingInit (&pFuncList->pfDeblocking, uiCpuFlag); WelsBlockFuncInit (&pFuncList->pfSetNZCZero, uiCpuFlag); InitFillNeighborCacheInterFunc (pFuncList, pParam->bEnableBackgroundDetection); pFuncList->pParametersetStrategy = IWelsParametersetStrategy::CreateParametersetStrategy (pParam->eSpsPpsIdStrategy, pParam->bSimulcastAVC, pParam->iSpatialLayerNum); WELS_VERIFY_RETURN_IF (ENC_RETURN_MEMALLOCERR, (NULL == pFuncList->pParametersetStrategy)) return iReturn; }