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

Function RcUpdateIntraComplexity

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

Source from the content-addressed store, hash-verified

1087}
1088
1089void RcUpdateIntraComplexity (sWelsEncCtx* pEncCtx) {
1090 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
1091 int32_t iAlpha = WELS_DIV_ROUND (INT_MULTIPLY, (1 + pWelsSvcRc->iIdrNum));
1092 if (iAlpha < (INT_MULTIPLY / 4)) iAlpha = INT_MULTIPLY / 4;
1093 int32_t iQStep = RcConvertQp2QStep (pWelsSvcRc->iAverageFrameQp);
1094 int64_t iIntraCmplx = iQStep * static_cast<int64_t> (pWelsSvcRc->iFrameDqBits);
1095 int64_t iFrameComplexity = pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity;
1096 if (pEncCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
1097 SVAAFrameInfoExt* pVaa = static_cast<SVAAFrameInfoExt*> (pEncCtx->pVaa);
1098 iFrameComplexity = pVaa->sComplexityScreenParam.iFrameComplexity;
1099 }
1100 if (pWelsSvcRc->iIdrNum == 0) {
1101 pWelsSvcRc->iIntraComplexity = iIntraCmplx;
1102 pWelsSvcRc->iIntraComplxMean = iFrameComplexity;
1103 } else {
1104 pWelsSvcRc->iIntraComplexity = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * pWelsSvcRc->iIntraComplexity +
1105 (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) *
1106 iIntraCmplx), INT_MULTIPLY);
1107
1108
1109 pWelsSvcRc->iIntraComplxMean = WELS_DIV_ROUND64 (((LINEAR_MODEL_DECAY_FACTOR) * static_cast<int64_t>
1110 (pWelsSvcRc->iIntraComplxMean)
1111 + (INT_MULTIPLY - LINEAR_MODEL_DECAY_FACTOR) * (iFrameComplexity)),
1112 INT_MULTIPLY);
1113 }
1114
1115 pWelsSvcRc->iIntraMbCount = pWelsSvcRc->iNumberMbFrame;
1116 pWelsSvcRc->iIdrNum++;
1117 if (pWelsSvcRc->iIdrNum > 255)
1118 pWelsSvcRc->iIdrNum = 255;
1119 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
1120 "RcUpdateIntraComplexity iFrameDqBits = %d,iQStep= %d,iIntraCmplx = %" PRId64,
1121 pWelsSvcRc->iFrameDqBits, pWelsSvcRc->iQStep, pWelsSvcRc->iIntraComplexity);
1122
1123}
1124
1125void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) {
1126 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];

Callers 2

Calls 2

RcConvertQp2QStepFunction · 0.85
WelsLogFunction · 0.85

Tested by

no test coverage detected