History

decoder statictis adding

mem mem decstatictis time change time change set decTime=0

zhuling13 committed 12 years ago

Commit 45ef8031 parent 8ed4e839 files · +210 −3Browse files

Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 9 files). Show all

Unified · Split

codec/decoder/plus/src/welsDecoderExt.cpp+50−0
@@ -53,6 +53,7 @@ · 52 unmodified lines
5353 #include "decoder_core.h"
5454 #include "error_concealment.h"
5555
56+#include "measure_time.h"
5657 extern "C" {
5758 #include "decoder_core.h"
5859 #include "manage_dec_ref.h"
@@ -301,8 +302,13 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) { · 242 unmodified lines
301302 m_pWelsTrace->SetTraceCallbackContext (ctx);
302303 }
303304 return cmResultSuccess;
305+ } else if (eOptID == DECODER_OPTION_GET_STATISTICS) {
306+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING,
307+ "CWelsDecoder::SetOption():DECODER_OPTION_GET_STATISTICS: this option is get-only!");
308+ return cmInitParaError;
304309 }
305310
311+
306312 return cmInitParaError;
307313 }
308314
@@ -358,6 +364,16 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) { · 49 unmodified lines
358364 iVal = (int) m_pDecContext->eErrorConMethod;
359365 * ((int*)pOption) = iVal;
360366 return cmResultSuccess;
367+ } else if (DECODER_OPTION_GET_STATISTICS == eOptID) { // get decoder statistics info for real time debugging
368+ SDecoderStatistics* pDecoderStatistics = (static_cast<SDecoderStatistics*> (pOption));
369+
370+ memcpy (pDecoderStatistics, &m_pDecContext->sDecoderStatistics, sizeof (SDecoderStatistics));
371+
372+ pDecoderStatistics->fAverageFrameSpeedInMs = (m_pDecContext->dDecTime) /
373+ (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount);
374+ memset (&m_pDecContext->sDecoderStatistics, 0, sizeof (SDecoderStatistics));
375+ m_pDecContext->dDecTime = 0;
376+ return cmResultSuccess;
361377 }
362378
363379 return cmInitParaError;
@@ -389,6 +405,8 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 25 unmodified lines
389405 m_pDecContext->bInstantDecFlag = true;
390406 }
391407
408+ int64_t iStart, iEnd;
409+ iStart = WelsTime();
392410 ppDst[0] = ppDst[1] = ppDst[2] = NULL;
393411 m_pDecContext->iErrorCode = dsErrorFree; //initialize at the starting of AU decoding.
394412 m_pDecContext->iFeedbackVclNalInAu = FEEDBACK_UNKNOWN_NAL; //initialize
@@ -439,11 +457,43 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 44 unmodified lines
439457 if ((m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE) && (pDstInfo->iBufferStatus == 1)) {
440458 //TODO after dec status updated
441459 m_pDecContext->iErrorCode |= dsDataErrorConcealed;
460+ if (m_pDecContext->eErrorConMethod == ERROR_CON_FRAME_COPY)
461+
462+ m_pDecContext->sDecoderStatistics.uiAvgEcRatio = (m_pDecContext->sDecoderStatistics.uiAvgEcRatio *
463+ m_pDecContext->sDecoderStatistics.uiEcFrameNum) + 100;
464+
465+ //
466+ if ((m_pDecContext->sDecoderStatistics.uiWidth != pDstInfo->UsrData.sSystemBuffer.iWidth)
467+ || (m_pDecContext->sDecoderStatistics.uiHeight != pDstInfo->UsrData.sSystemBuffer.iHeight)) {
468+ m_pDecContext->sDecoderStatistics.uiResolutionChangeTimes++;
469+ m_pDecContext->sDecoderStatistics.uiWidth = pDstInfo->UsrData.sSystemBuffer.iWidth;
470+ m_pDecContext->sDecoderStatistics.uiHeight = pDstInfo->UsrData.sSystemBuffer.iHeight;
471+
472+ }
473+ m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++;
474+ m_pDecContext->sDecoderStatistics.uiEcFrameNum++;
475+ m_pDecContext->sDecoderStatistics.uiAvgEcRatio = m_pDecContext->sDecoderStatistics.uiAvgEcRatio /
476+ m_pDecContext->sDecoderStatistics.uiEcFrameNum;
442477 }
478+ iEnd = WelsTime();
479+ m_pDecContext->dDecTime += (iEnd - iStart) / 1e3;
443480 return (DECODING_STATE) m_pDecContext->iErrorCode;
444481 }
445482 // else Error free, the current codec works well
446483
484+ if (pDstInfo->iBufferStatus == 1) {
485+
486+ if ((m_pDecContext->sDecoderStatistics.uiWidth != pDstInfo->UsrData.sSystemBuffer.iWidth)
487+ || (m_pDecContext->sDecoderStatistics.uiHeight != pDstInfo->UsrData.sSystemBuffer.iHeight)) {
488+ m_pDecContext->sDecoderStatistics.uiResolutionChangeTimes++;
489+ m_pDecContext->sDecoderStatistics.uiWidth = pDstInfo->UsrData.sSystemBuffer.iWidth;
490+ m_pDecContext->sDecoderStatistics.uiHeight = pDstInfo->UsrData.sSystemBuffer.iHeight;
491+
492+ }
493+ m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++;
494+ }
495+ iEnd = WelsTime();
496+ m_pDecContext->dDecTime += (iEnd - iStart) / 1e3;
447497 return dsErrorFree;
448498 }
449499

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