MCPcopy Create free account
hub / github.com/cisco/openh264 / RcUpdateFrameComplexity

Function RcUpdateFrameComplexity

codec/encoder/core/src/ratectl.cpp:1125–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1123}
1124
1125void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) {
1126 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
1127 const int32_t kiTl = pEncCtx->uiTemporalId;
1128 SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[kiTl];
1129
1130 int64_t iFrameComplexity = pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity;
1131 if (pEncCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
1132 SVAAFrameInfoExt* pVaa = static_cast<SVAAFrameInfoExt*> (pEncCtx->pVaa);
1133 iFrameComplexity = pVaa->sComplexityScreenParam.iFrameComplexity;
1134 }
1135 int32_t iQStep = RcConvertQp2QStep (pWelsSvcRc->iAverageFrameQp);
1136 int32_t iAlpha = WELS_DIV_ROUND (INT_MULTIPLY, (1 + pTOverRc->iPFrameNum));
1137 if (iAlpha < SMOOTH_FACTOR_MIN_VALUE)
1138 iAlpha = SMOOTH_FACTOR_MIN_VALUE;
1139 if (0 == pTOverRc->iPFrameNum) {
1140 pTOverRc->iLinearCmplx = ((int64_t)pWelsSvcRc->iFrameDqBits) * iQStep;
1141 pTOverRc->iFrameCmplxMean = (int32_t)iFrameComplexity;
1142 } else {
1143 pTOverRc->iLinearCmplx = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * (int64_t)pTOverRc->iLinearCmplx
1144 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * ((int64_t)pWelsSvcRc->iFrameDqBits * iQStep)),
1145 INT_MULTIPLY);
1146 pTOverRc->iFrameCmplxMean = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * static_cast<int64_t>
1147 (pTOverRc->iFrameCmplxMean)
1148 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * iFrameComplexity),
1149 INT_MULTIPLY);
1150 }
1151
1152
1153 pTOverRc->iPFrameNum++;
1154 if (pTOverRc->iPFrameNum > 255)
1155 pTOverRc->iPFrameNum = 255;
1156 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
1157 "RcUpdateFrameComplexity iFrameDqBits = %d,iQStep= %d,pWelsSvcRc->iQStep= %d,pTOverRc->iLinearCmplx = %" PRId64,
1158 pWelsSvcRc->iFrameDqBits,
1159 iQStep, pWelsSvcRc->iQStep, pTOverRc->iLinearCmplx);
1160 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "iFrameCmplxMean = %" PRId64 ",iFrameComplexity = %" PRId64,
1161 pTOverRc->iFrameCmplxMean, iFrameComplexity);
1162}
1163
1164int32_t RcCalculateCascadingQp (struct TagWelsEncCtx* pEncCtx, int32_t iQp) {
1165 int32_t iTemporalQp = 0;

Callers 2

Calls 2

RcConvertQp2QStepFunction · 0.85
WelsLogFunction · 0.85

Tested by

no test coverage detected