ref: 17df23c2eb6398d68fdb059f51507aa8e459e11e
parent: 480ff5acc2366d37fdc1605c0e7546bba4bf7d29
parent: c480ffdad551bea56eca01c9e7d1e7e544f59ba1
author: ruil2 <[email protected]>
date: Fri Sep 19 12:01:14 EDT 2014
Merge pull request #1375 from sijchen/ref_refac11 [Encoder] Use function pointer for pEndofUpdateRefList
--- a/codec/encoder/core/inc/ref_list_mgr_svc.h
+++ b/codec/encoder/core/inc/ref_list_mgr_svc.h
@@ -98,7 +98,7 @@
*/
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);
--- a/codec/encoder/core/inc/wels_func_ptr_def.h
+++ b/codec/encoder/core/inc/wels_func_ptr_def.h
@@ -195,6 +195,7 @@
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 @@
PBuildRefListFunc pBuildRefList;
PMarkPicFunc pMarkPic;
PUpdateRefListFunc pUpdateRefList;
+ PEndofUpdateRefListFunc pEndofUpdateRefList;
PCavlcParamCalFunc pfCavlcParamCal;
};
--- a/codec/encoder/core/src/encoder.cpp
+++ b/codec/encoder/core/src/encoder.cpp
@@ -218,7 +218,7 @@
WelsBlockFuncInit (&pFuncList->pfSetNZCZero, uiCpuFlag);
InitFillNeighborCacheInterFunc (pFuncList, pParam->bEnableBackgroundDetection);
- InitRefListMgrFunc (pFuncList, pParam->iUsageType);
+ InitRefListMgrFunc (pFuncList, bScreenContent);
return iReturn;
}
--- a/codec/encoder/core/src/ref_list_mgr_svc.cpp
+++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp
@@ -337,7 +337,8 @@
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 @@
pCtx->pVaa->uiMarkLongTermPicIdx = 0;
}
}
- PrefetchNextBuffer (pCtx);
+ pCtx->pFuncList->pEndofUpdateRefList (pCtx);
return true;
}
@@ -679,7 +680,8 @@
}
}
-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 @@
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 @@
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 @@
}
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