commit 9c95d6a0b10d2e40cb5003934ccc98af6330dfcb Author: JuannyWang <hongjwan@cisco.com> Date: Thu Jun 19 10:43:15 2014 +0800 [delay skip] delay skip to relieve bitrate burst somehow
Showing the changes to codec/encoder/core/src/ratectl.cpp (1 of 15 files). Show all
Unified · Split
| @@ -711,6 +711,22 @@ void RcVBufferCalculationSkip (sWelsEncCtx* pEncCtx) { · 710 unmodified lines | ||
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | +void WelsRcFrameDelayJudge(void* pCtx) { | |
| 715 | + sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx; | |
| 716 | + SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId]; | |
| 717 | + SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId]; | |
| 718 | + SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId]; | |
| 719 | + | |
| 720 | + int32_t iSentBits = WELS_ROUND(pDLayerParam->iSpatialBitrate / pDLayerParamInternal->fOutputFrameRate); | |
| 721 | + | |
| 722 | + pWelsSvcRc->bSkipFlag = false; | |
| 723 | + if (pWelsSvcRc->iBufferFullnessSkip > pWelsSvcRc->iBufferSizeSkip) { | |
| 724 | + pWelsSvcRc->bSkipFlag = true; | |
| 725 | + pWelsSvcRc->iBufferFullnessSkip -= iSentBits; | |
| 726 | + pWelsSvcRc->iBufferFullnessSkip = WELS_MAX(pWelsSvcRc->iBufferFullnessSkip, 0); | |
| 727 | + } | |
| 728 | +} | |
| 729 | + | |
| 714 | 730 | void RcVBufferCalculationPadding (sWelsEncCtx* pEncCtx) { |
| 715 | 731 | SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId]; |
| 716 | 732 | const int32_t kiOutputBits = WELS_DIV_ROUND(pWelsSvcRc->iBitsPerFrame, INT_MULTIPLY); |
| @@ -862,8 +878,8 @@ void WelsRcPictureInfoUpdateGom (void* pCtx, int32_t layer_size) { · 145 unmodified lines | ||
| 862 | 878 | #endif |
| 863 | 879 | |
| 864 | 880 | |
| 865 | − if (pEncCtx->pSvcParam->bEnableFrameSkip && | |
| 866 | − pEncCtx->uiDependencyId == pEncCtx->pSvcParam->iSpatialLayerNum - 1) { | |
| 881 | + if (pEncCtx->pSvcParam->bEnableFrameSkip /*&& | |
| 882 | + pEncCtx->uiDependencyId == pEncCtx->pSvcParam->iSpatialLayerNum - 1*/) { | |
| 867 | 883 | RcVBufferCalculationSkip (pEncCtx); |
| 868 | 884 | } |
| 869 | 885 | |
| @@ -976,6 +992,7 @@ void WelsRcInitModule (void* pCtx, int32_t iModule) { · 106 unmodified lines | ||
| 976 | 992 | switch (iModule) { |
| 977 | 993 | case WELS_RC_DISABLE: |
| 978 | 994 | pRcf->pfWelsRcPictureInit = WelsRcPictureInitDisable; |
| 995 | + pRcf->pfWelsRcPicDelayJudge = NULL; | |
| 979 | 996 | pRcf->pfWelsRcPictureInfoUpdate = WelsRcPictureInfoUpdateDisable; |
| 980 | 997 | pRcf->pfWelsRcMbInit = WelsRcMbInitDisable; |
| 981 | 998 | pRcf->pfWelsRcMbInfoUpdate = WelsRcMbInfoUpdateDisable; |
| @@ -983,6 +1000,7 @@ void WelsRcInitModule (void* pCtx, int32_t iModule) { · 1 unmodified line | ||
| 983 | 1000 | case WELS_RC_GOM: |
| 984 | 1001 | default: |
| 985 | 1002 | pRcf->pfWelsRcPictureInit = WelsRcPictureInitGom; |
| 1003 | + pRcf->pfWelsRcPicDelayJudge = WelsRcFrameDelayJudge; | |
| 986 | 1004 | pRcf->pfWelsRcPictureInfoUpdate = WelsRcPictureInfoUpdateGom; |
| 987 | 1005 | pRcf->pfWelsRcMbInit = WelsRcMbInitGom; |
| 988 | 1006 | pRcf->pfWelsRcMbInfoUpdate = WelsRcMbInfoUpdateGom; |