Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 6 files). Show all
Unified · Split
| @@ -346,6 +346,8 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) { · 345 unmodified lines | |||
| 346 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, | 346 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, |
| 347 | "CWelsDecoder::SetOption():DECODER_OPTION_GET_STATISTICS: this option is get-only!"); | 347 | "CWelsDecoder::SetOption():DECODER_OPTION_GET_STATISTICS: this option is get-only!"); |
| 348 | return cmInitParaError; | 348 | return cmInitParaError; |
| 349 | } else if (eOptID == DECODER_OPTION_STATISTICS_LOG_INTERVAL) { | ||
| 350 | m_pDecContext->sDecoderStatistics.iStatisticsLogInterval = (* ((unsigned int*)pOption)); | ||
| 349 | } else if (eOptID == DECODER_OPTION_GET_SAR_INFO) { | 351 | } else if (eOptID == DECODER_OPTION_GET_SAR_INFO) { |
| 350 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, | 352 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, |
| 351 | "CWelsDecoder::SetOption():DECODER_OPTION_GET_SAR_INFO: this option is get-only!"); | 353 | "CWelsDecoder::SetOption():DECODER_OPTION_GET_SAR_INFO: this option is get-only!"); |
| @@ -415,6 +417,9 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) { · 63 unmodified lines | |||
| 415 | m_pDecContext->sDecoderStatistics.uiFreezingNonIDRNum); | 417 | m_pDecContext->sDecoderStatistics.uiFreezingNonIDRNum); |
| 416 | } | 418 | } |
| 417 | return cmResultSuccess; | 419 | return cmResultSuccess; |
| 420 | } else if (eOptID == DECODER_OPTION_STATISTICS_LOG_INTERVAL) { | ||
| 421 | iVal = m_pDecContext->sDecoderStatistics.iStatisticsLogInterval; | ||
| 422 | * ((unsigned int*)pOption) = iVal; | ||
| 418 | } else if (DECODER_OPTION_GET_SAR_INFO == eOptID) { //get decoder SAR info in VUI | 423 | } else if (DECODER_OPTION_GET_SAR_INFO == eOptID) { //get decoder SAR info in VUI |
| 419 | PVuiSarInfo pVuiSarInfo = (static_cast<PVuiSarInfo> (pOption)); | 424 | PVuiSarInfo pVuiSarInfo = (static_cast<PVuiSarInfo> (pOption)); |
| 420 | memset (pVuiSarInfo, 0, sizeof (SVuiSarInfo)); | 425 | memset (pVuiSarInfo, 0, sizeof (SVuiSarInfo)); |
| @@ -625,9 +630,56 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 204 unmodified lines | |||
| 625 | } | 630 | } |
| 626 | iEnd = WelsTime(); | 631 | iEnd = WelsTime(); |
| 627 | m_pDecContext->dDecTime += (iEnd - iStart) / 1e3; | 632 | m_pDecContext->dDecTime += (iEnd - iStart) / 1e3; |
| 633 | |||
| 634 | OutputStatisticsLog(m_pDecContext->sDecoderStatistics); | ||
| 635 | |||
| 628 | return dsErrorFree; | 636 | return dsErrorFree; |
| 629 | } | 637 | } |
| 630 | 638 | ||
| 639 | void CWelsDecoder::OutputStatisticsLog(SDecoderStatistics& sDecoderStatistics) { | ||
| 640 | if ((sDecoderStatistics.uiDecodedFrameCount > 0) && (sDecoderStatistics.iStatisticsLogInterval > 0) && ((sDecoderStatistics.uiDecodedFrameCount % sDecoderStatistics.iStatisticsLogInterval) == 0)) { | ||
| 641 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | ||
| 642 | "uiWidth=%d, uiHeight=%d, fAverageFrameSpeedInMs=%.1f, fActualAverageFrameSpeedInMs=%.1f, \ | ||
| 643 | uiDecodedFrameCount=%d, uiResolutionChangeTimes=%d, uiIDRCorrectNum=%d, \ | ||
| 644 | uiAvgEcRatio=%d, uiAvgEcPropRatio=%d, uiEcIDRNum=%d, uiEcFrameNum=%d, \ | ||
| 645 | uiIDRLostNum=%d, uiFreezingIDRNum=%d, uiFreezingNonIDRNum=%d, iAvgLumaQp=%d, \ | ||
| 646 | iSpsReportErrorNum=%d, iSubSpsReportErrorNum=%d, iPpsReportErrorNum=%d, iSpsNoExistNalNum=%d, iSubSpsNoExistNalNum=%d, iPpsNoExistNalNum=%d, \ | ||
| 647 | uiProfile=%d, uiLevel=%d, \ | ||
| 648 | iCurrentActiveSpsId=%d, iCurrentActivePpsId=%d,", | ||
| 649 | sDecoderStatistics.uiWidth, | ||
| 650 | sDecoderStatistics.uiHeight, | ||
| 651 | sDecoderStatistics.fAverageFrameSpeedInMs, | ||
| 652 | sDecoderStatistics.fActualAverageFrameSpeedInMs, | ||
| 653 | |||
| 654 | sDecoderStatistics.uiDecodedFrameCount, | ||
| 655 | sDecoderStatistics.uiResolutionChangeTimes, | ||
| 656 | sDecoderStatistics.uiIDRCorrectNum, | ||
| 657 | |||
| 658 | sDecoderStatistics.uiAvgEcRatio, | ||
| 659 | sDecoderStatistics.uiAvgEcPropRatio, | ||
| 660 | sDecoderStatistics.uiEcIDRNum, | ||
| 661 | sDecoderStatistics.uiEcFrameNum, | ||
| 662 | |||
| 663 | sDecoderStatistics.uiIDRLostNum, | ||
| 664 | sDecoderStatistics.uiFreezingIDRNum, | ||
| 665 | sDecoderStatistics.uiFreezingNonIDRNum, | ||
| 666 | sDecoderStatistics.iAvgLumaQp, | ||
| 667 | |||
| 668 | sDecoderStatistics.iSpsReportErrorNum, | ||
| 669 | sDecoderStatistics.iSubSpsReportErrorNum, | ||
| 670 | sDecoderStatistics.iPpsReportErrorNum, | ||
| 671 | sDecoderStatistics.iSpsNoExistNalNum, | ||
| 672 | sDecoderStatistics.iSubSpsNoExistNalNum, | ||
| 673 | sDecoderStatistics.iPpsNoExistNalNum, | ||
| 674 | |||
| 675 | sDecoderStatistics.uiProfile, | ||
| 676 | sDecoderStatistics.uiLevel, | ||
| 677 | |||
| 678 | sDecoderStatistics.iCurrentActiveSpsId, | ||
| 679 | sDecoderStatistics.iCurrentActivePpsId); | ||
| 680 | } | ||
| 681 | } | ||
| 682 | |||
| 631 | DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc, | 683 | DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc, |
| 632 | const int kiSrcLen, | 684 | const int kiSrcLen, |
| 633 | SParserBsInfo* pDstInfo) { | 685 | SParserBsInfo* pDstInfo) { |