Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 1 file). Show all
Unified · Split
| @@ -730,7 +730,18 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 729 unmodified lines | |||
| 730 | int32_t iTargetHeight = 0; | 730 | int32_t iTargetHeight = 0; |
| 731 | 731 | ||
| 732 | memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage | 732 | memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage |
| 733 | #ifdef OUTPUT_BIT_STREAM | ||
| 734 | if ((sEncodingParam.iPicWidth != m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum | ||
| 735 | - 1].iActualWidth) || | ||
| 736 | (sEncodingParam.iPicHeight != m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - | ||
| 737 | 1].iActualHeight)) { | ||
| 738 | ++m_iSwitchTimes; | ||
| 739 | m_bSwitch = true; | ||
| 740 | } | ||
| 741 | #endif//OUTPUT_BIT_STREAM | ||
| 733 | if (sConfig.ParamBaseTranscode (sEncodingParam)) { | 742 | if (sConfig.ParamBaseTranscode (sEncodingParam)) { |
| 743 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, | ||
| 744 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, ParamTranscode failed!"); | ||
| 734 | return cmInitParaError; | 745 | return cmInitParaError; |
| 735 | } | 746 | } |
| 736 | /* New configuration available here */ | 747 | /* New configuration available here */ |
| @@ -742,7 +753,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 5 unmodified lines | |||
| 742 | m_iMaxPicHeight = iTargetHeight; | 753 | m_iMaxPicHeight = iTargetHeight; |
| 743 | } | 754 | } |
| 744 | if (sConfig.DetermineTemporalSettings()) { | 755 | if (sConfig.DetermineTemporalSettings()) { |
| 745 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 756 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 746 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, DetermineTemporalSettings failed!"); | 757 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, DetermineTemporalSettings failed!"); |
| 747 | return cmInitParaError; | 758 | return cmInitParaError; |
| 748 | } | 759 | } |
| @@ -757,6 +768,11 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 8 unmodified lines | |||
| 757 | if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) { | 768 | if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) { |
| 758 | return cmInitParaError; | 769 | return cmInitParaError; |
| 759 | } | 770 | } |
| 771 | |||
| 772 | //LogStatistics | ||
| 773 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | ||
| 774 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, LogStatisticsBeforeNewEncoding"); | ||
| 775 | LogStatistics (m_pEncContext->iLastStatisticsLogTs, 0); | ||
| 760 | } | 776 | } |
| 761 | break; | 777 | break; |
| 762 | 778 | ||
| @@ -769,33 +785,35 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 6 unmodified lines | |||
| 769 | memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage | 785 | memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage |
| 770 | TraceParamInfo (&sEncodingParam); | 786 | TraceParamInfo (&sEncodingParam); |
| 771 | #ifdef OUTPUT_BIT_STREAM | 787 | #ifdef OUTPUT_BIT_STREAM |
| 772 | if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth != | 788 | if ((sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth != |
| 773 | m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iActualWidth) { | 789 | m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iActualWidth) || |
| 790 | (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoHeight != | ||
| 791 | m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iActualHeight)) { | ||
| 774 | ++ m_iSwitchTimes; | 792 | ++ m_iSwitchTimes; |
| 775 | m_bSwitch = true; | 793 | m_bSwitch = true; |
| 776 | } | 794 | } |
| 777 | #endif//OUTPUT_BIT_STREAM | 795 | #endif//OUTPUT_BIT_STREAM |
| 778 | if (sEncodingParam.iSpatialLayerNum < 1 | 796 | if (sEncodingParam.iSpatialLayerNum < 1 |
| 779 | || sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer | 797 | || sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer |
| 780 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 798 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 781 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!", | 799 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!", |
| 782 | sEncodingParam.iSpatialLayerNum); | 800 | sEncodingParam.iSpatialLayerNum); |
| 783 | return cmInitParaError; | 801 | return cmInitParaError; |
| 784 | } | 802 | } |
| 785 | 803 | ||
| 786 | if (sConfig.ParamTranscode (sEncodingParam)) { | 804 | if (sConfig.ParamTranscode (sEncodingParam)) { |
| 787 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 805 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 788 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, ParamTranscode failed!"); | 806 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, ParamTranscode failed!"); |
| 789 | return cmInitParaError; | 807 | return cmInitParaError; |
| 790 | } | 808 | } |
| 791 | if (sConfig.iSpatialLayerNum < 1) { | 809 | if (sConfig.iSpatialLayerNum < 1) { |
| 792 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 810 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 793 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!", | 811 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!", |
| 794 | sConfig.iSpatialLayerNum); | 812 | sConfig.iSpatialLayerNum); |
| 795 | return cmInitParaError; | 813 | return cmInitParaError; |
| 796 | } | 814 | } |
| 797 | if (sConfig.DetermineTemporalSettings()) { | 815 | if (sConfig.DetermineTemporalSettings()) { |
| 798 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 816 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 799 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, DetermineTemporalSettings failed!"); | 817 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, DetermineTemporalSettings failed!"); |
| 800 | return cmInitParaError; | 818 | return cmInitParaError; |
| 801 | } | 819 | } |