mem mem decstatictis time change time change set decTime=0
Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 9 files). Show all
Unified · Split
| @@ -53,6 +53,7 @@ · 52 unmodified lines | |||
| 53 | #include "decoder_core.h" | 53 | #include "decoder_core.h" |
| 54 | #include "error_concealment.h" | 54 | #include "error_concealment.h" |
| 55 | 55 | ||
| 56 | #include "measure_time.h" | ||
| 56 | extern "C" { | 57 | extern "C" { |
| 57 | #include "decoder_core.h" | 58 | #include "decoder_core.h" |
| 58 | #include "manage_dec_ref.h" | 59 | #include "manage_dec_ref.h" |
| @@ -301,8 +302,13 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) { · 242 unmodified lines | |||
| 301 | m_pWelsTrace->SetTraceCallbackContext (ctx); | 302 | m_pWelsTrace->SetTraceCallbackContext (ctx); |
| 302 | } | 303 | } |
| 303 | return cmResultSuccess; | 304 | 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; | ||
| 304 | } | 309 | } |
| 305 | 310 | ||
| 311 | |||
| 306 | return cmInitParaError; | 312 | return cmInitParaError; |
| 307 | } | 313 | } |
| 308 | 314 | ||
| @@ -358,6 +364,16 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) { · 49 unmodified lines | |||
| 358 | iVal = (int) m_pDecContext->eErrorConMethod; | 364 | iVal = (int) m_pDecContext->eErrorConMethod; |
| 359 | * ((int*)pOption) = iVal; | 365 | * ((int*)pOption) = iVal; |
| 360 | return cmResultSuccess; | 366 | 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; | ||
| 361 | } | 377 | } |
| 362 | 378 | ||
| 363 | return cmInitParaError; | 379 | return cmInitParaError; |
| @@ -389,6 +405,8 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 25 unmodified lines | |||
| 389 | m_pDecContext->bInstantDecFlag = true; | 405 | m_pDecContext->bInstantDecFlag = true; |
| 390 | } | 406 | } |
| 391 | 407 | ||
| 408 | int64_t iStart, iEnd; | ||
| 409 | iStart = WelsTime(); | ||
| 392 | ppDst[0] = ppDst[1] = ppDst[2] = NULL; | 410 | ppDst[0] = ppDst[1] = ppDst[2] = NULL; |
| 393 | m_pDecContext->iErrorCode = dsErrorFree; //initialize at the starting of AU decoding. | 411 | m_pDecContext->iErrorCode = dsErrorFree; //initialize at the starting of AU decoding. |
| 394 | m_pDecContext->iFeedbackVclNalInAu = FEEDBACK_UNKNOWN_NAL; //initialize | 412 | m_pDecContext->iFeedbackVclNalInAu = FEEDBACK_UNKNOWN_NAL; //initialize |
| @@ -439,11 +457,43 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 44 unmodified lines | |||
| 439 | if ((m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE) && (pDstInfo->iBufferStatus == 1)) { | 457 | if ((m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE) && (pDstInfo->iBufferStatus == 1)) { |
| 440 | //TODO after dec status updated | 458 | //TODO after dec status updated |
| 441 | m_pDecContext->iErrorCode |= dsDataErrorConcealed; | 459 | 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; | ||
| 442 | } | 477 | } |
| 478 | iEnd = WelsTime(); | ||
| 479 | m_pDecContext->dDecTime += (iEnd - iStart) / 1e3; | ||
| 443 | return (DECODING_STATE) m_pDecContext->iErrorCode; | 480 | return (DECODING_STATE) m_pDecContext->iErrorCode; |
| 444 | } | 481 | } |
| 445 | // else Error free, the current codec works well | 482 | // else Error free, the current codec works well |
| 446 | 483 | ||
| 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; | ||
| 447 | return dsErrorFree; | 497 | return dsErrorFree; |
| 448 | } | 498 | } |
| 449 | 499 | ||