History

using function pointer to make different branch for different rc

ruil2 committed 11 years ago

Commit e3bf63d1 parent c1752e26 files · +7719 −7688Browse 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+13−8
@@ -3101,8 +3101,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3100 unmodified lines
31013101 // perform csc/denoise/downsample/padding, generate spatial layers
31023102 iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic);
31033103
3104− if (pCtx->pSvcParam->bEnableFrameSkip) {
3105− UpdateMaxBrCheckWindowStatus (pCtx, iSpatialNum, pSrcPic->uiTimeStamp);
3104+ if (pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus) {
3105+ pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum, pSrcPic->uiTimeStamp);
31063106 }
31073107
31083108 if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
@@ -3115,7 +3115,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 6 unmodified lines
31153115
31163116 eFrameType = DecideFrameType (pCtx, iSpatialNum);
31173117 if (eFrameType == videoFrameTypeSkip) {
3118− UpdateBufferWhenFrameSkipped (pCtx, iSpatialNum);
3118+ if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip)
3119+ pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iSpatialNum);
31193120 pFbi->eFrameType = eFrameType;
31203121 WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame, continual skipped %d frames",
31213122 pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);
@@ -3123,11 +3124,15 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1 unmodified line
31233124 }
31243125
31253126 //loop each layer to check if have skip frame when RC and frame skip enable
3126− if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, (uint32_t)pSrcPic->uiTimeStamp)) {
3127− pFbi->eFrameType = videoFrameTypeSkip;
3128− WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame, continual skipped %d frames",
3129− pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);
3130− return ENC_RETURN_SUCCESS;
3127+ if (pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr) {
3128+ bool bSkip = pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType,
3129+ (uint32_t)pSrcPic->uiTimeStamp);
3130+ if (bSkip) {
3131+ pFbi->eFrameType = videoFrameTypeSkip;
3132+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame, continual skipped %d frames",
3133+ pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);
3134+ return ENC_RETURN_SUCCESS;
3135+ }
31313136 }
31323137
31333138 pCtx->iContinualSkipFrames = 0;

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