Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 2 files). Show all
Unified · Split
| @@ -541,6 +541,21 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { · 540 unmodified lines | |||
| 541 | } | 541 | } |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | void CWelsH264SVCEncoder::LogStatistics (const int64_t kiCurrentFrameTs) { | ||
| 545 | SEncoderStatistics* pStatistics = & (m_pEncContext->sEncoderStatistics); | ||
| 546 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | ||
| 547 | "EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, " | ||
| 548 | "LastFrameRate=%f, LatestBitRate=%d, LastFrameQP=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, " | ||
| 549 | "uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA, iTotalEncodedBytes=%" PRId64 | ||
| 550 | " at Ts = %" PRId64, | ||
| 551 | pStatistics->uiWidth, pStatistics->uiHeight, | ||
| 552 | pStatistics->fAverageFrameSpeedInMs, pStatistics->fAverageFrameRate, | ||
| 553 | pStatistics->fLatestFrameRate, pStatistics->uiBitRate, pStatistics->uiAverageFrameQP, | ||
| 554 | pStatistics->uiInputFrameCount, pStatistics->uiSkippedFrameCount, | ||
| 555 | pStatistics->uiResolutionChangeTimes, pStatistics->uiIDRReqNum, pStatistics->uiIDRSentNum, | ||
| 556 | m_pEncContext->iTotalEncodedBytes, kiCurrentFrameTs); | ||
| 557 | } | ||
| 558 | |||
| 544 | void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVideoFrameType eFrameType, | 559 | void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVideoFrameType eFrameType, |
| 545 | const int32_t kiCurrentFrameSize, const int64_t kiCurrentFrameMs) { | 560 | const int32_t kiCurrentFrameSize, const int64_t kiCurrentFrameMs) { |
| 546 | SEncoderStatistics* pStatistics = & (m_pEncContext->sEncoderStatistics); | 561 | SEncoderStatistics* pStatistics = & (m_pEncContext->sEncoderStatistics); |
| @@ -624,21 +639,12 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid · 77 unmodified lines | |||
| 624 | if ((kiTimeDiff > m_pEncContext->iStatisticsLogInterval) || (0 == pStatistics->uiInputFrameCount % 300)) { | 639 | if ((kiTimeDiff > m_pEncContext->iStatisticsLogInterval) || (0 == pStatistics->uiInputFrameCount % 300)) { |
| 625 | if (WELS_ABS (pStatistics->fAverageFrameRate - m_pEncContext->pSvcParam->fMaxFrameRate) > 30) { | 640 | if (WELS_ABS (pStatistics->fAverageFrameRate - m_pEncContext->pSvcParam->fMaxFrameRate) > 30) { |
| 626 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, | 641 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, |
| 627 | "Actual input framerate fAverageFrameRate = %f is quite different from framerate in setting %f, please check setting or timestamp unit (ms), start_Ts = %" PRId64, | 642 | "Actual input framerate fAverageFrameRate = %f is quite different from framerate in setting %f, please check setting or timestamp unit (ms), start_Ts = %" |
| 643 | PRId64, | ||
| 628 | pStatistics->fAverageFrameRate, m_pEncContext->pSvcParam->fMaxFrameRate, m_pEncContext->uiStartTimestamp); | 644 | pStatistics->fAverageFrameRate, m_pEncContext->pSvcParam->fMaxFrameRate, m_pEncContext->uiStartTimestamp); |
| 629 | } | 645 | } |
| 630 | 646 | ||
| 631 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 647 | LogStatistics (kiCurrentFrameTs); |
| 632 | "EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, " | ||
| 633 | "LastFrameRate=%f, LatestBitRate=%d, LastFrameQP=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, " | ||
| 634 | "uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA, iTotalEncodedBytes=%" PRId64 | ||
| 635 | " at Ts = %" PRId64, | ||
| 636 | pStatistics->uiWidth, pStatistics->uiHeight, | ||
| 637 | pStatistics->fAverageFrameSpeedInMs, pStatistics->fAverageFrameRate, | ||
| 638 | pStatistics->fLatestFrameRate, pStatistics->uiBitRate, pStatistics->uiAverageFrameQP, | ||
| 639 | pStatistics->uiInputFrameCount, pStatistics->uiSkippedFrameCount, | ||
| 640 | pStatistics->uiResolutionChangeTimes, pStatistics->uiIDRReqNum, pStatistics->uiIDRSentNum, | ||
| 641 | m_pEncContext->iTotalEncodedBytes, kiCurrentFrameTs); | ||
| 642 | m_pEncContext->iLastStatisticsLogTs = kiCurrentFrameTs; | 648 | m_pEncContext->iLastStatisticsLogTs = kiCurrentFrameTs; |
| 643 | } | 649 | } |
| 644 | } | 650 | } |
| @@ -772,6 +778,11 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 127 unmodified lines | |||
| 772 | if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) { | 778 | if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) { |
| 773 | return cmInitParaError; | 779 | return cmInitParaError; |
| 774 | } | 780 | } |
| 781 | |||
| 782 | //LogStatistics | ||
| 783 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | ||
| 784 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, LogStatisticsBeforeNewEncoding"); | ||
| 785 | LogStatistics (m_pEncContext->iLastStatisticsLogTs); | ||
| 775 | } | 786 | } |
| 776 | break; | 787 | break; |
| 777 | case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate | 788 | case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate |