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 | void RcVBufferCalculationPadding (sWelsEncCtx* pEncCtx) { | 730 | void RcVBufferCalculationPadding (sWelsEncCtx* pEncCtx) { |
| 715 | SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId]; | 731 | SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId]; |
| 716 | const int32_t kiOutputBits = WELS_DIV_ROUND(pWelsSvcRc->iBitsPerFrame, INT_MULTIPLY); | 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 | #endif | 878 | #endif |
| 863 | 879 | ||
| 864 | 880 | ||
| 865 | if (pEncCtx->pSvcParam->bEnableFrameSkip && | 881 | if (pEncCtx->pSvcParam->bEnableFrameSkip /*&& |
| 866 | pEncCtx->uiDependencyId == pEncCtx->pSvcParam->iSpatialLayerNum - 1) { | 882 | pEncCtx->uiDependencyId == pEncCtx->pSvcParam->iSpatialLayerNum - 1*/) { |
| 867 | RcVBufferCalculationSkip (pEncCtx); | 883 | RcVBufferCalculationSkip (pEncCtx); |
| 868 | } | 884 | } |
| 869 | 885 | ||
| @@ -976,6 +992,7 @@ void WelsRcInitModule (void* pCtx, int32_t iModule) { · 106 unmodified lines | |||
| 976 | switch (iModule) { | 992 | switch (iModule) { |
| 977 | case WELS_RC_DISABLE: | 993 | case WELS_RC_DISABLE: |
| 978 | pRcf->pfWelsRcPictureInit = WelsRcPictureInitDisable; | 994 | pRcf->pfWelsRcPictureInit = WelsRcPictureInitDisable; |
| 995 | pRcf->pfWelsRcPicDelayJudge = NULL; | ||
| 979 | pRcf->pfWelsRcPictureInfoUpdate = WelsRcPictureInfoUpdateDisable; | 996 | pRcf->pfWelsRcPictureInfoUpdate = WelsRcPictureInfoUpdateDisable; |
| 980 | pRcf->pfWelsRcMbInit = WelsRcMbInitDisable; | 997 | pRcf->pfWelsRcMbInit = WelsRcMbInitDisable; |
| 981 | pRcf->pfWelsRcMbInfoUpdate = WelsRcMbInfoUpdateDisable; | 998 | pRcf->pfWelsRcMbInfoUpdate = WelsRcMbInfoUpdateDisable; |
| @@ -983,6 +1000,7 @@ void WelsRcInitModule (void* pCtx, int32_t iModule) { · 1 unmodified line | |||
| 983 | case WELS_RC_GOM: | 1000 | case WELS_RC_GOM: |
| 984 | default: | 1001 | default: |
| 985 | pRcf->pfWelsRcPictureInit = WelsRcPictureInitGom; | 1002 | pRcf->pfWelsRcPictureInit = WelsRcPictureInitGom; |
| 1003 | pRcf->pfWelsRcPicDelayJudge = WelsRcFrameDelayJudge; | ||
| 986 | pRcf->pfWelsRcPictureInfoUpdate = WelsRcPictureInfoUpdateGom; | 1004 | pRcf->pfWelsRcPictureInfoUpdate = WelsRcPictureInfoUpdateGom; |
| 987 | pRcf->pfWelsRcMbInit = WelsRcMbInitGom; | 1005 | pRcf->pfWelsRcMbInit = WelsRcMbInitGom; |
| 988 | pRcf->pfWelsRcMbInfoUpdate = WelsRcMbInfoUpdateGom; | 1006 | pRcf->pfWelsRcMbInfoUpdate = WelsRcMbInfoUpdateGom; |