| 774 | } |
| 775 | |
| 776 | void RcVBufferCalculationSkip (sWelsEncCtx* pEncCtx) { |
| 777 | SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId]; |
| 778 | SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc; |
| 779 | const int32_t kiOutputBits = pWelsSvcRc->iBitsPerFrame; |
| 780 | const int32_t kiOutputMaxBits = pWelsSvcRc->iMaxBitsPerFrame; |
| 781 | //condition 1: whole pBuffer fullness |
| 782 | pWelsSvcRc->iBufferFullnessSkip += (pWelsSvcRc->iFrameDqBits - kiOutputBits); |
| 783 | pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW] += (pWelsSvcRc->iFrameDqBits - kiOutputMaxBits); |
| 784 | pWelsSvcRc->iBufferMaxBRFullness[ODD_TIME_WINDOW] += (pWelsSvcRc->iFrameDqBits - kiOutputMaxBits); |
| 785 | |
| 786 | WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, |
| 787 | "[Rc] bits in buffer = %" PRId64 ", bits in Max bitrate buffer = %" PRId64, |
| 788 | pWelsSvcRc->iBufferFullnessSkip, pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW]); |
| 789 | //condition 2: VGOP bits constraint |
| 790 | int64_t iVGopBitsPred = 0; |
| 791 | for (int32_t i = pWelsSvcRc->iFrameCodedInVGop + 1; i < VGOP_SIZE; i++) |
| 792 | iVGopBitsPred += pTOverRc[pWelsSvcRc->iTlOfFrames[i]].iMinBitsTl; |
| 793 | iVGopBitsPred -= pWelsSvcRc->iRemainingBits; |
| 794 | double dIncPercent = iVGopBitsPred * 100.0 / (pWelsSvcRc->iBitsPerFrame * VGOP_SIZE) - |
| 795 | (double)VGOP_BITS_PERCENTAGE_DIFF; |
| 796 | |
| 797 | if ((pWelsSvcRc->iBufferFullnessSkip > pWelsSvcRc->iBufferSizeSkip |
| 798 | && pWelsSvcRc->iAverageFrameQp > pWelsSvcRc->iSkipQpValue) |
| 799 | || (dIncPercent > pWelsSvcRc->iRcVaryPercentage)) { |
| 800 | pWelsSvcRc->bSkipFlag = true; |
| 801 | } |
| 802 | WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, |
| 803 | "[Rc] VBV_Skip,dIncPercent = %f,iRcVaryPercentage = %d,pWelsSvcRc->bSkipFlag = %d", dIncPercent, |
| 804 | pWelsSvcRc->iRcVaryPercentage, pWelsSvcRc->bSkipFlag); |
| 805 | } |
| 806 | void CheckFrameSkipBasedMaxbr (sWelsEncCtx* pEncCtx, const long long uiTimeStamp, int32_t iDidIdx) { |
| 807 | SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[iDidIdx]; |
| 808 | SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[iDidIdx]; |
no test coverage detected