History

fix the threshold calculation in lower frame rate

ruil2 committed 8 years ago

Commit 1a1e0751 parent e683d291 file · +12 −6Browse files

Showing the changes to codec/encoder/core/src/ratectl.cpp (1 of 1 file). Show all

Unified · Split

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

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