shithub: openh264

Download patch

ref: dea22e8a9ac03a7e4058f8c3c1d5f0c4f0af2e21
parent: f421aab6a3bc615d3d1d3e496aeccde7b947f86b
parent: 75f242d49ab0f5da5f118a5aebc403f1eef74a9a
author: ruil2 <ruil2@cisco.com>
date: Fri Dec 23 06:12:01 EST 2016

Merge pull request #2626 from huili2/SetOptionEncBaseImprove

make BaseOption set align with extOption

--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -730,7 +730,18 @@
     int32_t iTargetHeight = 0;
 
     memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage
+#ifdef OUTPUT_BIT_STREAM
+    if ((sEncodingParam.iPicWidth  != m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum
+         - 1].iActualWidth) ||
+        (sEncodingParam.iPicHeight != m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum -
+            1].iActualHeight)) {
+      ++m_iSwitchTimes;
+      m_bSwitch = true;
+    }
+#endif//OUTPUT_BIT_STREAM
     if (sConfig.ParamBaseTranscode (sEncodingParam)) {
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
+               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, ParamTranscode failed!");
       return cmInitParaError;
     }
     /* New configuration available here */
@@ -742,7 +753,7 @@
       m_iMaxPicHeight   = iTargetHeight;
     }
     if (sConfig.DetermineTemporalSettings()) {
-      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
                "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, DetermineTemporalSettings failed!");
       return cmInitParaError;
     }
@@ -757,6 +768,11 @@
     if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) {
       return cmInitParaError;
     }
+
+    //LogStatistics
+    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, LogStatisticsBeforeNewEncoding");
+    LogStatistics (m_pEncContext->iLastStatisticsLogTs, 0);
   }
   break;
 
@@ -769,8 +785,10 @@
     memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
     TraceParamInfo (&sEncodingParam);
 #ifdef OUTPUT_BIT_STREAM
-    if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth !=
-        m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iActualWidth) {
+    if ((sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth !=
+         m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iActualWidth) ||
+        (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoHeight !=
+         m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iActualHeight)) {
       ++ m_iSwitchTimes;
       m_bSwitch = true;
     }
@@ -777,7 +795,7 @@
 #endif//OUTPUT_BIT_STREAM
     if (sEncodingParam.iSpatialLayerNum < 1
         || sEncodingParam.iSpatialLayerNum > MAX_SPATIAL_LAYER_NUM) { // verify number of spatial layer
-      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
                "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!",
                sEncodingParam.iSpatialLayerNum);
       return cmInitParaError;
@@ -784,18 +802,18 @@
     }
 
     if (sConfig.ParamTranscode (sEncodingParam)) {
-      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
                "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, ParamTranscode failed!");
       return cmInitParaError;
     }
     if (sConfig.iSpatialLayerNum < 1) {
-      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
                "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iSpatialLayerNum(%d) failed!",
                sConfig.iSpatialLayerNum);
       return cmInitParaError;
     }
     if (sConfig.DetermineTemporalSettings()) {
-      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
                "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, DetermineTemporalSettings failed!");
       return cmInitParaError;
     }