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
473 pWelsSvcRc->iQStep = WELS_DIV_ROUND ((pTOverRc->iLinearCmplx * iCmplxRatio), (pWelsSvcRc->iTargetBits * INT_MULTIPLY));473 pWelsSvcRc->iQStep = WELS_DIV_ROUND ((pTOverRc->iLinearCmplx * iCmplxRatio), (pWelsSvcRc->iTargetBits * INT_MULTIPLY));
474 iLumaQp = RcConvertQStep2Qp (pWelsSvcRc->iQStep);474 iLumaQp = RcConvertQStep2Qp (pWelsSvcRc->iQStep);
475 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,475 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,
477 pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity, pTOverRc->iFrameCmplxMean, pWelsSvcRc->iQStep, iLumaQp);477 pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity, pTOverRc->iFrameCmplxMean, pWelsSvcRc->iQStep, iLumaQp);
478//limit QP478//limit QP
479 int32_t iLastIdxCodecInVGop = pWelsSvcRc->iFrameCodedInVGop - 1;479 int32_t iLastIdxCodecInVGop = pWelsSvcRc->iFrameCodedInVGop - 1;
@@ -1043,7 +1043,7 @@ void RcUpdateIntraComplexity (sWelsEncCtx* pEncCtx) { · 563 unmodified lines
1043 pWelsSvcRc->iIntraComplexity = iIntraCmplx;1043 pWelsSvcRc->iIntraComplexity = iIntraCmplx;
1044 pWelsSvcRc->iIntraComplxMean = pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity;1044 pWelsSvcRc->iIntraComplxMean = pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity;
1045 } else {1045 } 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 +
1047 (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) *1047 (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) *
1048 iIntraCmplx), INT_MULTIPLY);1048 iIntraCmplx), INT_MULTIPLY);
1049 1049
@@ -1080,7 +1080,7 @@ void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) { · 30 unmodified lines
1080 pTOverRc->iLinearCmplx = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * (int64_t)pTOverRc->iLinearCmplx1080 pTOverRc->iLinearCmplx = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * (int64_t)pTOverRc->iLinearCmplx
1081 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * ((int64_t)pWelsSvcRc->iFrameDqBits * iQStep)),1081 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * ((int64_t)pWelsSvcRc->iFrameDqBits * iQStep)),
1082 INT_MULTIPLY);1082 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>
1084 (pTOverRc->iFrameCmplxMean)1084 (pTOverRc->iFrameCmplxMean)
1085 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity),1085 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity),
1086 INT_MULTIPLY);1086 INT_MULTIPLY);
@@ -1094,7 +1094,7 @@ void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) { · 7 unmodified lines
1094 "RcUpdateFrameComplexity iFrameDqBits = %d,iQStep= %d,pWelsSvcRc->iQStep= %d,pTOverRc->iLinearCmplx = %" PRId64,1094 "RcUpdateFrameComplexity iFrameDqBits = %d,iQStep= %d,pWelsSvcRc->iQStep= %d,pTOverRc->iLinearCmplx = %" PRId64,
1095 pWelsSvcRc->iFrameDqBits,1095 pWelsSvcRc->iFrameDqBits,
1096 iQStep, pWelsSvcRc->iQStep, pTOverRc->iLinearCmplx);1096 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",
1098 pTOverRc->iFrameCmplxMean, pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity);1098 pTOverRc->iFrameCmplxMean, pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity);
1099}1099}
1100 1100

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