History

modify data type to avoid overflow

Karina committed 9 years ago

Commit f4fed851 parent d0719d52 files · +5 −5Browse files

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

Unified · Split

codec/encoder/core/src/ratectl.cpp+4−4
@@ -473,7 +473,7 @@ void RcCalculatePictureQp (sWelsEncCtx* pEncCtx) { · 472 unmodified lines
473473 pWelsSvcRc->iQStep = WELS_DIV_ROUND ((pTOverRc->iLinearCmplx * iCmplxRatio), (pWelsSvcRc->iTargetBits * INT_MULTIPLY));
474474 iLumaQp = RcConvertQStep2Qp (pWelsSvcRc->iQStep);
475475 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
476− "iCmplxRatio = %d,frameComplexity = %lld,iFrameCmplxMean = %d,iQStep = %d,iLumaQp = %d", (int)iCmplxRatio,
476+ "iCmplxRatio = %d,frameComplexity = %lld,iFrameCmplxMean = %" PRId64 ",iQStep = %d,iLumaQp = %d", (int)iCmplxRatio,
477477 pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity, pTOverRc->iFrameCmplxMean, pWelsSvcRc->iQStep, iLumaQp);
478478 //limit QP
479479 int32_t iLastIdxCodecInVGop = pWelsSvcRc->iFrameCodedInVGop - 1;
@@ -1043,7 +1043,7 @@ void RcUpdateIntraComplexity (sWelsEncCtx* pEncCtx) { · 563 unmodified lines
10431043 pWelsSvcRc->iIntraComplexity = iIntraCmplx;
10441044 pWelsSvcRc->iIntraComplxMean = pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity;
10451045 } else {
1046− pWelsSvcRc->iIntraComplexity = WELS_DIV_ROUND (((LINEAR_MODEL_DECAY_FACTOR) * pWelsSvcRc->iIntraComplexity +
1046+ pWelsSvcRc->iIntraComplexity = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * pWelsSvcRc->iIntraComplexity +
10471047 (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) *
10481048 iIntraCmplx), INT_MULTIPLY);
10491049
@@ -1080,7 +1080,7 @@ void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) { · 30 unmodified lines
10801080 pTOverRc->iLinearCmplx = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * (int64_t)pTOverRc->iLinearCmplx
10811081 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * ((int64_t)pWelsSvcRc->iFrameDqBits * iQStep)),
10821082 INT_MULTIPLY);
1083− pTOverRc->iFrameCmplxMean = WELS_DIV_ROUND (((LINEAR_MODEL_DECAY_FACTOR) * static_cast<int64_t>
1083+ pTOverRc->iFrameCmplxMean = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * static_cast<int64_t>
10841084 (pTOverRc->iFrameCmplxMean)
10851085 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity),
10861086 INT_MULTIPLY);
@@ -1094,7 +1094,7 @@ void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) { · 7 unmodified lines
10941094 "RcUpdateFrameComplexity iFrameDqBits = %d,iQStep= %d,pWelsSvcRc->iQStep= %d,pTOverRc->iLinearCmplx = %" PRId64,
10951095 pWelsSvcRc->iFrameDqBits,
10961096 iQStep, pWelsSvcRc->iQStep, pTOverRc->iLinearCmplx);
1097− WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "iFrameCmplxMean = %d,iFrameComplexity = %lld",
1097+ WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "iFrameCmplxMean = %" PRId64 ",iFrameComplexity = %lld",
10981098 pTOverRc->iFrameCmplxMean, pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity);
10991099 }
11001100

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