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 | 585 | //TODO after dec status updated |
| 586 | 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 | 588 | m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++; |
| 597 | 589 | if (m_pDecContext->sDecoderStatistics.uiDecodedFrameCount == 0) { //exceed max value of uint32_t |
| 598 | 590 | ResetDecStatNums (&m_pDecContext->sDecoderStatistics); |
| @@ -626,24 +618,18 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 27 unmodified lines | ||
| 626 | 618 | ResetDecStatNums (&m_pDecContext->sDecoderStatistics); |
| 627 | 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 | 622 | iEnd = WelsTime(); |
| 638 | 623 | m_pDecContext->dDecTime += (iEnd - iStart) / 1e3; |
| 639 | 624 | |
| 640 | − OutputStatisticsLog(m_pDecContext->sDecoderStatistics); | |
| 625 | + OutputStatisticsLog (m_pDecContext->sDecoderStatistics); | |
| 641 | 626 | |
| 642 | 627 | return dsErrorFree; |
| 643 | 628 | } |
| 644 | 629 | |
| 645 | −void CWelsDecoder::OutputStatisticsLog(SDecoderStatistics& sDecoderStatistics) { | |
| 646 | − if ((sDecoderStatistics.uiDecodedFrameCount > 0) && (sDecoderStatistics.iStatisticsLogInterval > 0) && ((sDecoderStatistics.uiDecodedFrameCount % sDecoderStatistics.iStatisticsLogInterval) == 0)) { | |
| 630 | +void CWelsDecoder::OutputStatisticsLog (SDecoderStatistics& sDecoderStatistics) { | |
| 631 | + if ((sDecoderStatistics.uiDecodedFrameCount > 0) && (sDecoderStatistics.iStatisticsLogInterval > 0) | |
| 632 | + && ((sDecoderStatistics.uiDecodedFrameCount % sDecoderStatistics.iStatisticsLogInterval) == 0)) { | |
| 647 | 633 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| 648 | 634 | "uiWidth=%d, uiHeight=%d, fAverageFrameSpeedInMs=%.1f, fActualAverageFrameSpeedInMs=%.1f, \ |
| 649 | 635 | uiDecodedFrameCount=%d, uiResolutionChangeTimes=%d, uiIDRCorrectNum=%d, \ |
| @@ -652,37 +638,37 @@ void CWelsDecoder::OutputStatisticsLog(SDecoderStatistics& sDecoderStatistics) { · 2 unmodified lines | ||
| 652 | 638 | iSpsReportErrorNum=%d, iSubSpsReportErrorNum=%d, iPpsReportErrorNum=%d, iSpsNoExistNalNum=%d, iSubSpsNoExistNalNum=%d, iPpsNoExistNalNum=%d, \ |
| 653 | 639 | uiProfile=%d, uiLevel=%d, \ |
| 654 | 640 | iCurrentActiveSpsId=%d, iCurrentActivePpsId=%d,", |
| 655 | − sDecoderStatistics.uiWidth, | |
| 656 | − sDecoderStatistics.uiHeight, | |
| 657 | − sDecoderStatistics.fAverageFrameSpeedInMs, | |
| 658 | − sDecoderStatistics.fActualAverageFrameSpeedInMs, | |
| 659 | − | |
| 660 | − sDecoderStatistics.uiDecodedFrameCount, | |
| 661 | − sDecoderStatistics.uiResolutionChangeTimes, | |
| 662 | − sDecoderStatistics.uiIDRCorrectNum, | |
| 663 | − | |
| 664 | − sDecoderStatistics.uiAvgEcRatio, | |
| 665 | − sDecoderStatistics.uiAvgEcPropRatio, | |
| 666 | − sDecoderStatistics.uiEcIDRNum, | |
| 667 | − sDecoderStatistics.uiEcFrameNum, | |
| 668 | − | |
| 669 | − sDecoderStatistics.uiIDRLostNum, | |
| 670 | − sDecoderStatistics.uiFreezingIDRNum, | |
| 671 | − sDecoderStatistics.uiFreezingNonIDRNum, | |
| 672 | − sDecoderStatistics.iAvgLumaQp, | |
| 673 | − | |
| 674 | − sDecoderStatistics.iSpsReportErrorNum, | |
| 675 | − sDecoderStatistics.iSubSpsReportErrorNum, | |
| 676 | − sDecoderStatistics.iPpsReportErrorNum, | |
| 677 | − sDecoderStatistics.iSpsNoExistNalNum, | |
| 678 | − sDecoderStatistics.iSubSpsNoExistNalNum, | |
| 679 | − sDecoderStatistics.iPpsNoExistNalNum, | |
| 680 | − | |
| 681 | − sDecoderStatistics.uiProfile, | |
| 682 | − sDecoderStatistics.uiLevel, | |
| 683 | − | |
| 684 | − sDecoderStatistics.iCurrentActiveSpsId, | |
| 685 | − sDecoderStatistics.iCurrentActivePpsId); | |
| 641 | + sDecoderStatistics.uiWidth, | |
| 642 | + sDecoderStatistics.uiHeight, | |
| 643 | + sDecoderStatistics.fAverageFrameSpeedInMs, | |
| 644 | + sDecoderStatistics.fActualAverageFrameSpeedInMs, | |
| 645 | + | |
| 646 | + sDecoderStatistics.uiDecodedFrameCount, | |
| 647 | + sDecoderStatistics.uiResolutionChangeTimes, | |
| 648 | + sDecoderStatistics.uiIDRCorrectNum, | |
| 649 | + | |
| 650 | + sDecoderStatistics.uiAvgEcRatio, | |
| 651 | + sDecoderStatistics.uiAvgEcPropRatio, | |
| 652 | + sDecoderStatistics.uiEcIDRNum, | |
| 653 | + sDecoderStatistics.uiEcFrameNum, | |
| 654 | + | |
| 655 | + sDecoderStatistics.uiIDRLostNum, | |
| 656 | + sDecoderStatistics.uiFreezingIDRNum, | |
| 657 | + sDecoderStatistics.uiFreezingNonIDRNum, | |
| 658 | + sDecoderStatistics.iAvgLumaQp, | |
| 659 | + | |
| 660 | + sDecoderStatistics.iSpsReportErrorNum, | |
| 661 | + sDecoderStatistics.iSubSpsReportErrorNum, | |
| 662 | + sDecoderStatistics.iPpsReportErrorNum, | |
| 663 | + sDecoderStatistics.iSpsNoExistNalNum, | |
| 664 | + sDecoderStatistics.iSubSpsNoExistNalNum, | |
| 665 | + sDecoderStatistics.iPpsNoExistNalNum, | |
| 666 | + | |
| 667 | + sDecoderStatistics.uiProfile, | |
| 668 | + sDecoderStatistics.uiLevel, | |
| 669 | + | |
| 670 | + sDecoderStatistics.iCurrentActiveSpsId, | |
| 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 | 687 | m_pDecContext->iErrorCode |= dsInvalidArgument; |
| 702 | 688 | return dsInvalidArgument; |
| 703 | 689 | } |
| 690 | + int64_t iEnd, iStart = WelsTime(); | |
| 704 | 691 | if (CheckBsBuffer (m_pDecContext, kiSrcLen)) { |
| 705 | 692 | if (ResetDecoder()) |
| 706 | 693 | return dsOutOfMemory; |
| @@ -745,6 +732,14 @@ DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc, · 38 unmodified lines | ||
| 745 | 732 | |
| 746 | 733 | if (!m_pDecContext->bFramePending && m_pDecContext->pParserBsInfo->iNalNum) { |
| 747 | 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 | 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 | 748 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n", m_pDecContext->iErrorCode); |
| 754 | 749 | m_pDecContext->bPrintFrameErrorTraceFlag = false; |
| 755 | 750 | } |
| 751 | + iEnd = WelsTime(); | |
| 752 | + m_pDecContext->dDecTime += (iEnd - iStart) / 1e3; | |
| 756 | 753 | |
| 757 | 754 | return (DECODING_STATE) m_pDecContext->iErrorCode; |
| 758 | 755 | } |