use function pointer as refactoring for further strategy adjustment
This commit is contained in:
parent
25cad576b3
commit
c480ffdad5
@ -98,7 +98,7 @@ bool CheckCurMarkFrameNumUsed (sWelsEncCtx* pCtx);
|
||||
*/
|
||||
void WelsMarkPic (void* pCtx);
|
||||
|
||||
void InitRefListMgrFunc (SWelsFuncPtrList* pFuncList, EUsageType eUsageType);
|
||||
void InitRefListMgrFunc (SWelsFuncPtrList* pFuncList, const bool bScreenContent);
|
||||
|
||||
#ifdef LONG_TERM_REF_DUMP
|
||||
void DumpRef (sWelsEncCtx* ctx);
|
||||
|
@ -195,6 +195,7 @@ typedef void (*PUpdateMbMvFunc) (SMVUnitXY* pMvUnit, const SMVUnitXY ksMv);
|
||||
typedef bool (*PBuildRefListFunc) (void* pCtx, const int32_t iPOC, int32_t iBestLtrRefIdx);
|
||||
typedef void (*PMarkPicFunc) (void* pCtx);
|
||||
typedef bool (*PUpdateRefListFunc) (void* pCtx);
|
||||
typedef void (*PEndofUpdateRefListFunc) (void* pCtx);
|
||||
|
||||
typedef int32_t (*PCavlcParamCalFunc) (int16_t* pCoff, uint8_t* pRun, int16_t* pLevel, int32_t* pTotalCoeffs,
|
||||
int32_t iEndIdx);
|
||||
@ -291,6 +292,7 @@ struct TagWelsFuncPointerList {
|
||||
PBuildRefListFunc pBuildRefList;
|
||||
PMarkPicFunc pMarkPic;
|
||||
PUpdateRefListFunc pUpdateRefList;
|
||||
PEndofUpdateRefListFunc pEndofUpdateRefList;
|
||||
|
||||
PCavlcParamCalFunc pfCavlcParamCal;
|
||||
};
|
||||
|
@ -218,7 +218,7 @@ int32_t InitFunctionPointers (SWelsFuncPtrList* pFuncList, SWelsSvcCodingParam*
|
||||
WelsBlockFuncInit (&pFuncList->pfSetNZCZero, uiCpuFlag);
|
||||
|
||||
InitFillNeighborCacheInterFunc (pFuncList, pParam->bEnableBackgroundDetection);
|
||||
InitRefListMgrFunc (pFuncList, pParam->iUsageType);
|
||||
InitRefListMgrFunc (pFuncList, bScreenContent);
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,8 @@ static inline void LTRMarkProcessScreen (sWelsEncCtx* pCtx) {
|
||||
pRefList->uiLongRefCount++;
|
||||
}
|
||||
|
||||
static inline void PrefetchNextBuffer (sWelsEncCtx* pCtx) {
|
||||
static void PrefetchNextBuffer (void* pEncCtx) {
|
||||
sWelsEncCtx* pCtx = (sWelsEncCtx*)pEncCtx;
|
||||
SRefList* pRefList = pCtx->ppRefPicListExt[pCtx->uiDependencyId];
|
||||
const int32_t kiNumRef = pCtx->pSvcParam->iNumRefFrame;
|
||||
int32_t i;
|
||||
@ -438,7 +439,7 @@ bool WelsUpdateRefList (void* pEncCtx) {
|
||||
pCtx->pVaa->uiMarkLongTermPicIdx = 0;
|
||||
}
|
||||
}
|
||||
PrefetchNextBuffer (pCtx);
|
||||
pCtx->pFuncList->pEndofUpdateRefList (pCtx);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -679,7 +680,8 @@ void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t iPOC, const int32_t u
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t UpdateSrcPicList (sWelsEncCtx* pCtx) {
|
||||
static void UpdateSrcPicList (void* pEncCtx) {
|
||||
sWelsEncCtx* pCtx = (sWelsEncCtx*)pEncCtx;
|
||||
int32_t iDIdx = pCtx->uiDependencyId;
|
||||
SPicture** pLongRefList = pCtx->ppRefPicListExt[iDIdx]->pLongRefList;
|
||||
SPicture** pLongRefSrcList = &pCtx->pVpp->m_pSpatialPic[iDIdx][0];
|
||||
@ -709,8 +711,6 @@ static int32_t UpdateSrcPicList (sWelsEncCtx* pCtx) {
|
||||
WelsExchangeSpatialPictures (&pCtx->pVpp->m_pSpatialPic[iDIdx][0],
|
||||
&pCtx->pVpp->m_pSpatialPic[iDIdx][1 + pCtx->pVaa->uiMarkLongTermPicIdx]);
|
||||
SetUnref (pCtx->pVpp->m_pSpatialPic[iDIdx][0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WelsUpdateRefListScreen (void* pEncCtx) {
|
||||
@ -759,7 +759,7 @@ bool WelsUpdateRefListScreen (void* pEncCtx) {
|
||||
pCtx->pVaa->uiValidLongTermPicIdx = 0;
|
||||
}
|
||||
|
||||
UpdateSrcPicList (pCtx);
|
||||
pCtx->pFuncList->pEndofUpdateRefList (pCtx);
|
||||
return true;
|
||||
}
|
||||
bool WelsBuildRefListScreen (void* pEncCtx, const int32_t iPOC, int32_t iBestLtrRefIdx) {
|
||||
@ -905,15 +905,17 @@ void WelsMarkPicScreen (void* pEncCtx) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
void InitRefListMgrFunc (SWelsFuncPtrList* pFuncList, EUsageType eUsageType) {
|
||||
if (eUsageType == SCREEN_CONTENT_REAL_TIME) {
|
||||
void InitRefListMgrFunc (SWelsFuncPtrList* pFuncList, const bool bScreenContent) {
|
||||
if (bScreenContent) {
|
||||
pFuncList->pBuildRefList = WelsBuildRefListScreen;
|
||||
pFuncList->pMarkPic = WelsMarkPicScreen;
|
||||
pFuncList->pUpdateRefList = WelsUpdateRefListScreen;
|
||||
pFuncList->pEndofUpdateRefList = UpdateSrcPicList;
|
||||
} else {
|
||||
pFuncList->pBuildRefList = WelsBuildRefList;
|
||||
pFuncList->pMarkPic = WelsMarkPic;
|
||||
pFuncList->pUpdateRefList = WelsUpdateRefList;
|
||||
pFuncList->pEndofUpdateRefList = PrefetchNextBuffer;
|
||||
}
|
||||
}
|
||||
} // namespace WelsEnc
|
||||
|
Loading…
x
Reference in New Issue
Block a user