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

Function UpdateDecStatNoFreezingInfo

codec/decoder/core/src/decoder.cpp:1208–1248  ·  view source on GitHub ↗

update information when no freezing occurs, including QP, correct IDR number, ECed IDR number

Source from the content-addressed store, hash-verified

1206
1207//update information when no freezing occurs, including QP, correct IDR number, ECed IDR number
1208void UpdateDecStatNoFreezingInfo (PWelsDecoderContext pCtx) {
1209 PDqLayer pCurDq = pCtx->pCurDqLayer;
1210 PPicture pPic = pCtx->pDec;
1211 SDecoderStatistics* pDecStat = pCtx->pDecoderStatistics;
1212
1213 if (pDecStat->iAvgLumaQp == -1) //first correct frame received
1214 pDecStat->iAvgLumaQp = 0;
1215
1216 //update QP info
1217 int32_t iTotalQp = 0;
1218 const int32_t kiMbNum = pCurDq->iMbWidth * pCurDq->iMbHeight;
1219 if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) { //all correct
1220 for (int32_t iMb = 0; iMb < kiMbNum; ++iMb) {
1221 iTotalQp += pCurDq->pLumaQp[iMb];
1222 }
1223 iTotalQp /= kiMbNum;
1224 } else {
1225 int32_t iCorrectMbNum = 0;
1226 for (int32_t iMb = 0; iMb < kiMbNum; ++iMb) {
1227 iCorrectMbNum += (int32_t) pCurDq->pMbCorrectlyDecodedFlag[iMb];
1228 iTotalQp += pCurDq->pLumaQp[iMb] * pCurDq->pMbCorrectlyDecodedFlag[iMb];
1229 }
1230 if (iCorrectMbNum == 0) //non MB is correct, should remain QP statistic info
1231 iTotalQp = pDecStat->iAvgLumaQp;
1232 else
1233 iTotalQp /= iCorrectMbNum;
1234 }
1235 if (pDecStat->uiDecodedFrameCount + 1 == 0) { //maximum uint32_t reached
1236 ResetDecStatNums (pDecStat);
1237 pDecStat->iAvgLumaQp = iTotalQp;
1238 } else
1239 pDecStat->iAvgLumaQp = (int) ((uint64_t) (pDecStat->iAvgLumaQp * pDecStat->uiDecodedFrameCount + iTotalQp) /
1240 (pDecStat->uiDecodedFrameCount + 1));
1241
1242 //update IDR number
1243 if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag) {
1244 pDecStat->uiIDRCorrectNum += (pPic->bIsComplete);
1245 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE)
1246 pDecStat->uiEcIDRNum += (!pPic->bIsComplete);
1247 }
1248}
1249
1250//update decoder statistics information
1251void UpdateDecStat (PWelsDecoderContext pCtx, const bool kbOutput) {

Callers 2

UpdateDecStatFunction · 0.85
DecodeFrameConstructionFunction · 0.85

Calls 1

ResetDecStatNumsFunction · 0.85

Tested by

no test coverage detected