History

move strategy related pointer to class

sijchen committed 10 years ago

Commit 00747541 parent f623aa36 files · +136 −37Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 6 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+11−4
@@ -1983,6 +1983,9 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 1982 unmodified lines
19831983 return 1;
19841984 }
19851985
1986+ (*ppCtx)->pReferenceStrategy = IWelsReferenceStrategy::CreateReferenceStrategy((*ppCtx), pParam->iUsageType, pParam->bEnableLongTermReference);
1987+ WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pReferenceStrategy), FreeMemorySvc (ppCtx))
1988+
19861989 (*ppCtx)->pIntra4x4PredModeBlocks = static_cast<int8_t*>
19871990 (pMa->WelsMallocz (iCountMaxMbNum * INTRA_4x4_MODE_NUM, "pIntra4x4PredModeBlocks"));
19881991 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pIntra4x4PredModeBlocks), FreeMemorySvc (ppCtx))
@@ -2171,6 +2174,10 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 182 unmodified lines
21712174 if (pParam != NULL && pParam->iMultipleThreadIdc > 1)
21722175 ReleaseMtResource (ppCtx);
21732176
2177+ if (NULL != pCtx->pReferenceStrategy) {
2178+ WELS_DELETE_OP(pCtx->pReferenceStrategy);
2179+ }
2180+
21742181 // frame bitstream pBuffer
21752182 if (NULL != pCtx->pFrameBs) {
21762183 pMa->WelsFree (pCtx->pFrameBs, "pFrameBs");
@@ -4013,8 +4020,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1836 unmodified lines
40134020
40144021 WelsInitCurrentLayer (pCtx, iCurWidth, iCurHeight);
40154022
4016− pCtx->pFuncList->pMarkPic (pCtx);
4017− if (!pCtx->pFuncList->pBuildRefList (pCtx, pParamInternal->iPOC, 0)) {
4023+ pCtx->pReferenceStrategy->MarkPic ();
4024+ if (!pCtx->pReferenceStrategy->BuildRefList (pParamInternal->iPOC, 0)) {
40184025 WelsLog (pLogCtx, WELS_LOG_WARNING,
40194026 "WelsEncoderEncodeExt(), WelsBuildRefList failed for P frames, pCtx->iNumRef0= %d. ForceCodingIDR!",
40204027 pCtx->iNumRef0);
@@ -4023,7 +4030,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2 unmodified lines
40234030 break;
40244031 }
40254032 if (pCtx->eSliceType != I_SLICE) {
4026− pCtx->pFuncList->pAfterBuildRefList (pCtx);
4033+ pCtx->pReferenceStrategy->AfterBuildRefList ();
40274034 }
40284035 #ifdef LONG_TERM_REF_DUMP
40294036 DumpRef (pCtx);
@@ -4277,7 +4284,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 247 unmodified lines
42774284
42784285 // reference picture list update
42794286 if (eNalRefIdc != NRI_PRI_LOWEST) {
4280− if (!pCtx->pFuncList->pUpdateRefList (pCtx)) {
4287+ if (!pCtx->pReferenceStrategy->UpdateRefList ()) {
42814288 WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsUpdateRefList failed. ForceCodingIDR!");
42824289 //the above is to set the next frame to be IDR
42834290 pCtx->iEncoderError = ENC_RETURN_CORRECTED;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t