Showing the changes to codec/encoder/core/src/ratectl.cpp (1 of 1 file). Show all
Unified · Split
| @@ -580,12 +580,17 @@ void RcDecideTargetBitsTimestamp (sWelsEncCtx* pEncCtx) { · 579 unmodified lines | ||
| 580 | 580 | pWelsSvcRc->iTargetBits = pTOverRc->iMinBitsTl; |
| 581 | 581 | } else { |
| 582 | 582 | int32_t iMaxTh = iBufferTh * 3 / 4; |
| 583 | − int32_t iMinTh = static_cast<int32_t> (iBufferTh * 2 / pDLayerParam->fFrameRate); | |
| 584 | − pWelsSvcRc->iTargetBits = static_cast<int32_t> (((double) (pDLayerParam->iSpatialBitrate) / (double) ( | |
| 585 | − pDLayerParam->fFrameRate) * IDR_BITRATE_RATIO)); | |
| 583 | + int32_t iMinTh = (pDLayerParam->fFrameRate < 8) ? iBufferTh * 1.0 / 4 : static_cast<int32_t> | |
| 584 | + (iBufferTh * 2 / pDLayerParam->fFrameRate); | |
| 585 | + if (pDLayerParam->fFrameRate < (IDR_BITRATE_RATIO + 1)) | |
| 586 | + pWelsSvcRc->iTargetBits = static_cast<int32_t> (((double) (pDLayerParam->iSpatialBitrate) / (double) ( | |
| 587 | + pDLayerParam->fFrameRate))); | |
| 588 | + else | |
| 589 | + pWelsSvcRc->iTargetBits = static_cast<int32_t> (((double) (pDLayerParam->iSpatialBitrate) / (double) ( | |
| 590 | + pDLayerParam->fFrameRate) * IDR_BITRATE_RATIO)); | |
| 586 | 591 | WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, |
| 587 | 592 | "iMaxTh = %d,iMinTh = %d,pWelsSvcRc->iTargetBits = %d,pWelsSvcRc->iBufferSizeSkip = %d, pWelsSvcRc->iBufferFullnessSkip= %" |
| 588 | − PRId64 , | |
| 593 | + PRId64, | |
| 589 | 594 | iMaxTh, iMinTh, pWelsSvcRc->iTargetBits, pWelsSvcRc->iBufferSizeSkip, pWelsSvcRc->iBufferFullnessSkip); |
| 590 | 595 | pWelsSvcRc->iTargetBits = WELS_CLIP3 (pWelsSvcRc->iTargetBits, iMinTh, iMaxTh); |
| 591 | 596 | } |
| @@ -607,7 +612,8 @@ void RcDecideTargetBitsTimestamp (sWelsEncCtx* pEncCtx) { · 15 unmodified lines | ||
| 607 | 612 | pWelsSvcRc->iTargetBits = WELS_DIV_ROUND (pTOverRc->iTlayerWeight * kiGopBits, INT_MULTIPLY * 10 * 2); |
| 608 | 613 | |
| 609 | 614 | int32_t iMaxTh = iBufferTh / 2; |
| 610 | − int32_t iMinTh = (int32_t) (iBufferTh * 2 / pDLayerParam->fFrameRate); | |
| 615 | + int32_t iMinTh = (pDLayerParam->fFrameRate < 8) ? iBufferTh * 1.0 / 4 : static_cast<int32_t> | |
| 616 | + (iBufferTh * 2 / pDLayerParam->fFrameRate); | |
| 611 | 617 | WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, |
| 612 | 618 | "iMaxTh = %d,iMinTh = %d,pWelsSvcRc->iTargetBits = %d,pWelsSvcRc->iBufferSizeSkip = %d, pWelsSvcRc->iBufferFullnessSkip= % " |
| 613 | 619 | PRId64, |
| @@ -1117,7 +1123,7 @@ void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) { · 503 unmodified lines | ||
| 1117 | 1123 | "RcUpdateFrameComplexity iFrameDqBits = %d,iQStep= %d,pWelsSvcRc->iQStep= %d,pTOverRc->iLinearCmplx = %" PRId64, |
| 1118 | 1124 | pWelsSvcRc->iFrameDqBits, |
| 1119 | 1125 | iQStep, pWelsSvcRc->iQStep, pTOverRc->iLinearCmplx); |
| 1120 | − WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "iFrameCmplxMean = %" PRId64 ",iFrameComplexity = %" PRId64 , | |
| 1126 | + WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "iFrameCmplxMean = %" PRId64 ",iFrameComplexity = %" PRId64, | |
| 1121 | 1127 | pTOverRc->iFrameCmplxMean, iFrameComplexity); |
| 1122 | 1128 | } |
| 1123 | 1129 | |