Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 4 files). Show all
Unified · Split
| @@ -585,14 +585,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 584 unmodified lines | |||
| 585 | //TODO after dec status updated | 585 | //TODO after dec status updated |
| 586 | m_pDecContext->iErrorCode |= dsDataErrorConcealed; | 586 | m_pDecContext->iErrorCode |= dsDataErrorConcealed; |
| 587 | 587 | ||
| 588 | // | ||
| 589 | if ((m_pDecContext->sDecoderStatistics.uiWidth != (unsigned int) pDstInfo->UsrData.sSystemBuffer.iWidth) | ||
| 590 | || (m_pDecContext->sDecoderStatistics.uiHeight != (unsigned int) pDstInfo->UsrData.sSystemBuffer.iHeight)) { | ||
| 591 | m_pDecContext->sDecoderStatistics.uiResolutionChangeTimes++; | ||
| 592 | m_pDecContext->sDecoderStatistics.uiWidth = pDstInfo->UsrData.sSystemBuffer.iWidth; | ||
| 593 | m_pDecContext->sDecoderStatistics.uiHeight = pDstInfo->UsrData.sSystemBuffer.iHeight; | ||
| 594 | |||
| 595 | } | ||
| 596 | m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++; | 588 | m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++; |
| 597 | if (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount == 0) { //exceed max value of uint32_t | 589 | if (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount == 0) { //exceed max value of uint32_t |
| 598 | ResetDecStatNums (&m_pDecContext->sDecoderStatistics); | 590 | ResetDecStatNums (&m_pDecContext->sDecoderStatistics); |
| @@ -626,24 +618,18 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 27 unmodified lines | |||
| 626 | ResetDecStatNums (&m_pDecContext->sDecoderStatistics); | 618 | ResetDecStatNums (&m_pDecContext->sDecoderStatistics); |
| 627 | m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++; | 619 | m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++; |
| 628 | } | 620 | } |
| 629 | |||
| 630 | if ((m_pDecContext->sDecoderStatistics.uiWidth != (unsigned int) pDstInfo->UsrData.sSystemBuffer.iWidth) | ||
| 631 | || (m_pDecContext->sDecoderStatistics.uiHeight != (unsigned int) pDstInfo->UsrData.sSystemBuffer.iHeight)) { | ||
| 632 | m_pDecContext->sDecoderStatistics.uiResolutionChangeTimes++; | ||
| 633 | m_pDecContext->sDecoderStatistics.uiWidth = pDstInfo->UsrData.sSystemBuffer.iWidth; | ||
| 634 | m_pDecContext->sDecoderStatistics.uiHeight = pDstInfo->UsrData.sSystemBuffer.iHeight; | ||
| 635 | } | ||
| 636 | } | 621 | } |
| 637 | iEnd = WelsTime(); | 622 | iEnd = WelsTime(); |
| 638 | m_pDecContext->dDecTime += (iEnd - iStart) / 1e3; | 623 | m_pDecContext->dDecTime += (iEnd - iStart) / 1e3; |
| 639 | 624 | ||
| 640 | OutputStatisticsLog(m_pDecContext->sDecoderStatistics); | 625 | OutputStatisticsLog (m_pDecContext->sDecoderStatistics); |
| 641 | 626 | ||
| 642 | return dsErrorFree; | 627 | return dsErrorFree; |
| 643 | } | 628 | } |
| 644 | 629 | ||
| 645 | void CWelsDecoder::OutputStatisticsLog(SDecoderStatistics& sDecoderStatistics) { | 630 | void CWelsDecoder::OutputStatisticsLog (SDecoderStatistics& sDecoderStatistics) { |
| 646 | if ((sDecoderStatistics.uiDecodedFrameCount > 0) && (sDecoderStatistics.iStatisticsLogInterval > 0) && ((sDecoderStatistics.uiDecodedFrameCount % sDecoderStatistics.iStatisticsLogInterval) == 0)) { | 631 | if ((sDecoderStatistics.uiDecodedFrameCount > 0) && (sDecoderStatistics.iStatisticsLogInterval > 0) |
| 632 | && ((sDecoderStatistics.uiDecodedFrameCount % sDecoderStatistics.iStatisticsLogInterval) == 0)) { | ||
| 647 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 633 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| 648 | "uiWidth=%d, uiHeight=%d, fAverageFrameSpeedInMs=%.1f, fActualAverageFrameSpeedInMs=%.1f, \ | 634 | "uiWidth=%d, uiHeight=%d, fAverageFrameSpeedInMs=%.1f, fActualAverageFrameSpeedInMs=%.1f, \ |
| 649 | uiDecodedFrameCount=%d, uiResolutionChangeTimes=%d, uiIDRCorrectNum=%d, \ | 635 | uiDecodedFrameCount=%d, uiResolutionChangeTimes=%d, uiIDRCorrectNum=%d, \ |
| @@ -652,37 +638,37 @@ void CWelsDecoder::OutputStatisticsLog(SDecoderStatistics& sDecoderStatistics) { · 2 unmodified lines | |||
| 652 | iSpsReportErrorNum=%d, iSubSpsReportErrorNum=%d, iPpsReportErrorNum=%d, iSpsNoExistNalNum=%d, iSubSpsNoExistNalNum=%d, iPpsNoExistNalNum=%d, \ | 638 | iSpsReportErrorNum=%d, iSubSpsReportErrorNum=%d, iPpsReportErrorNum=%d, iSpsNoExistNalNum=%d, iSubSpsNoExistNalNum=%d, iPpsNoExistNalNum=%d, \ |
| 653 | uiProfile=%d, uiLevel=%d, \ | 639 | uiProfile=%d, uiLevel=%d, \ |
| 654 | iCurrentActiveSpsId=%d, iCurrentActivePpsId=%d,", | 640 | iCurrentActiveSpsId=%d, iCurrentActivePpsId=%d,", |
| 655 | sDecoderStatistics.uiWidth, | 641 | sDecoderStatistics.uiWidth, |
| 656 | sDecoderStatistics.uiHeight, | 642 | sDecoderStatistics.uiHeight, |
| 657 | sDecoderStatistics.fAverageFrameSpeedInMs, | 643 | sDecoderStatistics.fAverageFrameSpeedInMs, |
| 658 | sDecoderStatistics.fActualAverageFrameSpeedInMs, | 644 | sDecoderStatistics.fActualAverageFrameSpeedInMs, |
| 659 | 645 | ||
| 660 | sDecoderStatistics.uiDecodedFrameCount, | 646 | sDecoderStatistics.uiDecodedFrameCount, |
| 661 | sDecoderStatistics.uiResolutionChangeTimes, | 647 | sDecoderStatistics.uiResolutionChangeTimes, |
| 662 | sDecoderStatistics.uiIDRCorrectNum, | 648 | sDecoderStatistics.uiIDRCorrectNum, |
| 663 | 649 | ||
| 664 | sDecoderStatistics.uiAvgEcRatio, | 650 | sDecoderStatistics.uiAvgEcRatio, |
| 665 | sDecoderStatistics.uiAvgEcPropRatio, | 651 | sDecoderStatistics.uiAvgEcPropRatio, |
| 666 | sDecoderStatistics.uiEcIDRNum, | 652 | sDecoderStatistics.uiEcIDRNum, |
| 667 | sDecoderStatistics.uiEcFrameNum, | 653 | sDecoderStatistics.uiEcFrameNum, |
| 668 | 654 | ||
| 669 | sDecoderStatistics.uiIDRLostNum, | 655 | sDecoderStatistics.uiIDRLostNum, |
| 670 | sDecoderStatistics.uiFreezingIDRNum, | 656 | sDecoderStatistics.uiFreezingIDRNum, |
| 671 | sDecoderStatistics.uiFreezingNonIDRNum, | 657 | sDecoderStatistics.uiFreezingNonIDRNum, |
| 672 | sDecoderStatistics.iAvgLumaQp, | 658 | sDecoderStatistics.iAvgLumaQp, |
| 673 | 659 | ||
| 674 | sDecoderStatistics.iSpsReportErrorNum, | 660 | sDecoderStatistics.iSpsReportErrorNum, |
| 675 | sDecoderStatistics.iSubSpsReportErrorNum, | 661 | sDecoderStatistics.iSubSpsReportErrorNum, |
| 676 | sDecoderStatistics.iPpsReportErrorNum, | 662 | sDecoderStatistics.iPpsReportErrorNum, |
| 677 | sDecoderStatistics.iSpsNoExistNalNum, | 663 | sDecoderStatistics.iSpsNoExistNalNum, |
| 678 | sDecoderStatistics.iSubSpsNoExistNalNum, | 664 | sDecoderStatistics.iSubSpsNoExistNalNum, |
| 679 | sDecoderStatistics.iPpsNoExistNalNum, | 665 | sDecoderStatistics.iPpsNoExistNalNum, |
| 680 | 666 | ||
| 681 | sDecoderStatistics.uiProfile, | 667 | sDecoderStatistics.uiProfile, |
| 682 | sDecoderStatistics.uiLevel, | 668 | sDecoderStatistics.uiLevel, |
| 683 | 669 | ||
| 684 | sDecoderStatistics.iCurrentActiveSpsId, | 670 | sDecoderStatistics.iCurrentActiveSpsId, |
| 685 | sDecoderStatistics.iCurrentActivePpsId); | 671 | sDecoderStatistics.iCurrentActivePpsId); |
| 686 | } | 672 | } |
| 687 | } | 673 | } |
| 688 | 674 | ||
| @@ -701,6 +687,7 @@ DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc, · 12 unmodified lines | |||
| 701 | m_pDecContext->iErrorCode |= dsInvalidArgument; | 687 | m_pDecContext->iErrorCode |= dsInvalidArgument; |
| 702 | return dsInvalidArgument; | 688 | return dsInvalidArgument; |
| 703 | } | 689 | } |
| 690 | int64_t iEnd, iStart = WelsTime(); | ||
| 704 | if (CheckBsBuffer (m_pDecContext, kiSrcLen)) { | 691 | if (CheckBsBuffer (m_pDecContext, kiSrcLen)) { |
| 705 | if (ResetDecoder()) | 692 | if (ResetDecoder()) |
| 706 | return dsOutOfMemory; | 693 | return dsOutOfMemory; |
| @@ -745,6 +732,14 @@ DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc, · 38 unmodified lines | |||
| 745 | 732 | ||
| 746 | if (!m_pDecContext->bFramePending && m_pDecContext->pParserBsInfo->iNalNum) { | 733 | if (!m_pDecContext->bFramePending && m_pDecContext->pParserBsInfo->iNalNum) { |
| 747 | memcpy (pDstInfo, m_pDecContext->pParserBsInfo, sizeof (SParserBsInfo)); | 734 | memcpy (pDstInfo, m_pDecContext->pParserBsInfo, sizeof (SParserBsInfo)); |
| 735 | |||
| 736 | if (m_pDecContext->iErrorCode == ERR_NONE) { //update statistics: decoding frame count | ||
| 737 | m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++; | ||
| 738 | if (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount == 0) { //exceed max value of uint32_t | ||
| 739 | ResetDecStatNums (&m_pDecContext->sDecoderStatistics); | ||
| 740 | m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++; | ||
| 741 | } | ||
| 742 | } | ||
| 748 | } | 743 | } |
| 749 | 744 | ||
| 750 | m_pDecContext->bInstantDecFlag = false; //reset no-delay flag | 745 | m_pDecContext->bInstantDecFlag = false; //reset no-delay flag |
| @@ -753,6 +748,8 @@ DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc, · 2 unmodified lines | |||
| 753 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n", m_pDecContext->iErrorCode); | 748 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n", m_pDecContext->iErrorCode); |
| 754 | m_pDecContext->bPrintFrameErrorTraceFlag = false; | 749 | m_pDecContext->bPrintFrameErrorTraceFlag = false; |
| 755 | } | 750 | } |
| 751 | iEnd = WelsTime(); | ||
| 752 | m_pDecContext->dDecTime += (iEnd - iStart) / 1e3; | ||
| 756 | 753 | ||
| 757 | return (DECODING_STATE) m_pDecContext->iErrorCode; | 754 | return (DECODING_STATE) m_pDecContext->iErrorCode; |
| 758 | } | 755 | } |