ref: ee01b3afafee7ad4ca8ef567b6106f4d510e9c53
parent: 762d1812bb83d597439fecf6e8f3064ddab3a8c9
parent: b2d4a95537fa17e32968b53ff34c78667ce8cc94
author: HaiboZhu <[email protected]>
date: Mon Dec 14 05:26:16 EST 2015
Merge pull request #2307 from huili2/fix_decstat fix iAvgLumaQp in decStat
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -1017,10 +1017,15 @@
//update QP info
int32_t iTotalQp = 0;
const int32_t kiMbNum = pCurDq->iMbWidth * pCurDq->iMbHeight;
+ int32_t iCorrectMbNum = 0;
for (int32_t iMb = 0; iMb < kiMbNum; ++iMb) {
+ iCorrectMbNum += (int32_t) pCurDq->pMbCorrectlyDecodedFlag[iMb];
iTotalQp += pCurDq->pLumaQp[iMb] * pCurDq->pMbCorrectlyDecodedFlag[iMb];
}
- iTotalQp /= kiMbNum;
+ if (iCorrectMbNum == 0) //non MB is correct, should remain QP statistic info
+ iTotalQp = pDecStat->iAvgLumaQp;
+ else
+ iTotalQp /= iCorrectMbNum;
if (pDecStat->uiDecodedFrameCount + 1 == 0) { //maximum uint32_t reached
ResetDecStatNums (pDecStat);
pDecStat->iAvgLumaQp = iTotalQp;
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -403,11 +403,13 @@
memcpy (pDecoderStatistics, &m_pDecContext->sDecoderStatistics, sizeof (SDecoderStatistics));
- pDecoderStatistics->fAverageFrameSpeedInMs = (float) (m_pDecContext->dDecTime) /
- (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount);
- pDecoderStatistics->fActualAverageFrameSpeedInMs = (float) (m_pDecContext->dDecTime) /
- (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount + m_pDecContext->sDecoderStatistics.uiFreezingIDRNum +
- m_pDecContext->sDecoderStatistics.uiFreezingNonIDRNum);
+ if (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount != 0) { //not original status
+ pDecoderStatistics->fAverageFrameSpeedInMs = (float) (m_pDecContext->dDecTime) /
+ (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount);
+ pDecoderStatistics->fActualAverageFrameSpeedInMs = (float) (m_pDecContext->dDecTime) /
+ (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount + m_pDecContext->sDecoderStatistics.uiFreezingIDRNum +
+ m_pDecContext->sDecoderStatistics.uiFreezingNonIDRNum);
+ }
return cmResultSuccess;
}
--- a/test/decoder/DecUT_DecExt.cpp
+++ b/test/decoder/DecUT_DecExt.cpp
@@ -105,7 +105,7 @@
m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC) (rand() & 7);
m_sDecParam.sVideoProperty.size = sizeof (SVideoProperty);
m_sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
-
+
m_pData[0] = m_pData[1] = m_pData[2] = NULL;
m_szBuffer[0] = m_szBuffer[1] = m_szBuffer[2] = 0;
m_szBuffer[3] = 1;
@@ -502,6 +502,10 @@
int32_t iError = 0;
ValidInit();
+ //GetOption before decoding
+ m_pDec->GetOption (DECODER_OPTION_GET_STATISTICS, &sDecStatic);
+ EXPECT_EQ (0u, sDecStatic.uiDecodedFrameCount);
+ EXPECT_TRUE (-1 == sDecStatic.iAvgLumaQp);
// setoption not support,
eRet = (CM_RETURN)m_pDec->SetOption (DECODER_OPTION_GET_STATISTICS, NULL);
EXPECT_EQ (eRet, cmInitParaError);