Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 2 files). Show all
Unified · Split
| @@ -642,10 +642,11 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid · 641 unmodified lines | ||
| 642 | 642 | int64_t iTimeDiff = kiCurrentFrameTs - m_pEncContext->iLastStatisticsLogTs; |
| 643 | 643 | if ((iTimeDiff > m_pEncContext->iStatisticsLogInterval) || (0 == pStatistics->uiInputFrameCount % 300)) { |
| 644 | 644 | if (iTimeDiff) { |
| 645 | − pStatistics->fLatestFrameRate = static_cast<float> ((pStatistics->uiInputFrameCount - m_pEncContext->iLastStatisticsFrameCount) * 1000 / | |
| 646 | − iTimeDiff); | |
| 645 | + pStatistics->fLatestFrameRate = static_cast<float> ((pStatistics->uiInputFrameCount - | |
| 646 | + m_pEncContext->iLastStatisticsFrameCount) * 1000 / | |
| 647 | + iTimeDiff); | |
| 647 | 648 | pStatistics->uiBitRate = static_cast<unsigned int> ((m_pEncContext->iTotalEncodedBits - |
| 648 | − m_pEncContext->iLastStatisticsBits) * 1000 / iTimeDiff); | |
| 649 | + m_pEncContext->iLastStatisticsBits) * 1000 / iTimeDiff); | |
| 649 | 650 | } |
| 650 | 651 | |
| 651 | 652 | // update variables |
| @@ -727,6 +728,30 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 75 unmodified lines | ||
| 727 | 728 | m_pEncContext->pSvcParam->uiIntraPeriod = (uint32_t)iValue; |
| 728 | 729 | } |
| 729 | 730 | break; |
| 731 | + case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter | |
| 732 | + SEncParamBase sEncodingParam; | |
| 733 | + SWelsSvcCodingParam sConfig; | |
| 734 | + int32_t iTargetWidth = 0; | |
| 735 | + int32_t iTargetHeight = 0; | |
| 736 | + | |
| 737 | + memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage | |
| 738 | + if (sConfig.ParamBaseTranscode (sEncodingParam)) { | |
| 739 | + return cmInitParaError; | |
| 740 | + } | |
| 741 | + /* New configuration available here */ | |
| 742 | + iTargetWidth = sConfig.iPicWidth; | |
| 743 | + iTargetHeight = sConfig.iPicHeight; | |
| 744 | + if (m_iMaxPicWidth != iTargetWidth | |
| 745 | + || m_iMaxPicHeight != iTargetHeight) { | |
| 746 | + m_iMaxPicWidth = iTargetWidth; | |
| 747 | + m_iMaxPicHeight = iTargetHeight; | |
| 748 | + } | |
| 749 | + if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) { | |
| 750 | + return cmInitParaError; | |
| 751 | + } | |
| 752 | + } | |
| 753 | + break; | |
| 754 | + | |
| 730 | 755 | case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter |
| 731 | 756 | SEncParamExt sEncodingParam; |
| 732 | 757 | SWelsSvcCodingParam sConfig; |