shithub: openh264

Download patch

ref: 607d814e0f8c59ca26f91ea6ad0f339e01d7b6f0
parent: 852ed8a2d0cd7df39686548db0a1ccff4d393edb
parent: a100fb80311e59d63eaa44c3eee68dee6da724e5
author: sijchen <sijchen@cisco.com>
date: Mon Dec 1 06:36:24 EST 2014

Merge pull request #1577 from ruil2/set_param

modify log info(remove unuseful log and add some new logs)

--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -133,12 +133,6 @@
 CWelsH264SVCEncoder::~CWelsH264SVCEncoder() {
   if (m_pWelsTrace) {
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::~CWelsH264SVCEncoder()");
-
-#ifdef REC_FRAME_COUNT
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::~CWelsH264SVCEncoder(), m_uiCountFrameNum= %d, m_iCspInternal= 0x%x", m_uiCountFrameNum,
-             m_iCspInternal);
-#endif
   }
 
 #ifdef REC_FRAME_COUNT
@@ -176,10 +170,6 @@
   m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
   WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::InitEncoder(), openh264 codec version = %s",
            VERSION_NUMBER);
-#ifdef REC_FRAME_COUNT
-  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-           "CWelsH264SVCEncoder::InitEncoder, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x", m_uiCountFrameNum, m_iCspInternal);
-#endif
 }
 
 /* Interfaces override from ISVCEncoder */
@@ -253,14 +243,6 @@
              m_bInitialFlag);
     Uninitialize();
   }
-
-#ifdef REC_FRAME_COUNT
-  SWelsSvcCodingParam& sEncodingParam = *pCfg;
-  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-           "CWelsH264SVCEncoder::Initialize, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-           m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
-
   // Check valid parameters
   const int32_t iNumOfLayers = pCfg->iSpatialLayerNum;
   if (iNumOfLayers < 1 || iNumOfLayers > MAX_DEPENDENCY_LAYER) {
@@ -373,11 +355,6 @@
   WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::Uninitialize(), openh264 codec version = %s.",
            VERSION_NUMBER);
 
-#ifdef REC_FRAME_COUNT
-  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-           "CWelsH264SVCEncoder::Uninitialize, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x", m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
-
   if (NULL != m_pEncContext) {
     WelsUninitEncoderExt (&m_pEncContext);
     m_pEncContext	= NULL;
@@ -407,7 +384,7 @@
 #ifdef REC_FRAME_COUNT
   ++ m_uiCountFrameNum;
   WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-           "CWelsH264SVCEncoder::EncodeFrame(), m_uiCountFrameNum= %d, m_iCspInternal= 0x%x", m_uiCountFrameNum, m_iCspInternal);
+           "CWelsH264SVCEncoder::EncodeFrame(), m_uiCountFrameNum= %d,", m_uiCountFrameNum);
 #endif//REC_FRAME_COUNT
 
 #ifdef DUMP_SRC_PICTURE
@@ -495,13 +472,8 @@
   if (! (m_pEncContext && m_bInitialFlag)) {
     return 1;
   }
-
-#ifdef REC_FRAME_COUNT
   WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-           "CWelsH264SVCEncoder::ForceIntraFrame(), bIDR= %d, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x", bIDR,
-           m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
-
+           "CWelsH264SVCEncoder::ForceIntraFrame(), bIDR= %d", bIDR);
   ForceCodingIDR (m_pEncContext);
 
   m_pEncContext->sEncoderStatistics.uiIDRReqNum++;
@@ -696,35 +668,20 @@
       return cmInitParaError;
     }
 
-#ifdef REC_FRAME_COUNT
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d",
-             m_uiCountFrameNum, m_iCspInternal, iValue);
-#endif//REC_FRAME_COUNT
-
     m_iCspInternal = iColorspace;
-#ifdef REC_FRAME_COUNT
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
+             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal= 0x%x", m_iCspInternal);
   }
   break;
   case ENCODER_OPTION_IDR_INTERVAL: {	// IDR Interval
     int32_t iValue	= * ((int32_t*)pOption);
-#ifdef REC_FRAME_COUNT
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_IDR_INTERVAL, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d",
-             m_uiCountFrameNum, m_iCspInternal, iValue);
-#endif//REC_FRAME_COUNT
-
+             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_IDR_INTERVAL iValue= %d", iValue);
     if (iValue < -1 || iValue == 0)
       iValue = 1;
     if (iValue == (int32_t)m_pEncContext->pSvcParam->uiIntraPeriod) {
       return cmResultSuccess;
     }
-
-
     m_pEncContext->pSvcParam->uiIntraPeriod	= (uint32_t)iValue;
   }
   break;
@@ -746,6 +703,14 @@
       m_iMaxPicWidth	= iTargetWidth;
       m_iMaxPicHeight	= iTargetHeight;
     }
+    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;fMaxFrameRate=  %.6ff;iRCMode= %d",
+             sEncodingParam.iUsageType,
+             sEncodingParam.iPicWidth,
+             sEncodingParam.iPicHeight,
+             sEncodingParam.iTargetBitrate,
+             sEncodingParam.fMaxFrameRate,
+             sEncodingParam.iRCMode);
     if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) {
       return cmInitParaError;
     }
@@ -790,12 +755,6 @@
       m_iMaxPicWidth	= iTargetWidth;
       m_iMaxPicHeight	= iTargetHeight;
     }
-#ifdef REC_FRAME_COUNT
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
-
     /* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */
     if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) {
       return cmInitParaError;
@@ -804,11 +763,6 @@
   break;
   case ENCODER_OPTION_FRAME_RATE: {	// Maximal input frame rate
     float iValue	= * ((float*)pOption);
-#ifdef REC_FRAME_COUNT
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_FRAME_RATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %f",
-             m_uiCountFrameNum, m_iCspInternal, iValue);
-#endif//REC_FRAME_COUNT
     if (iValue <= 0) {
       return cmInitParaError;
     }
@@ -823,11 +777,6 @@
   case ENCODER_OPTION_BITRATE: {	// Target bit-rate
     SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
     int32_t iBitrate = pInfo->iBitrate;
-#ifdef REC_FRAME_COUNT
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d",
-             m_uiCountFrameNum, m_iCspInternal, iValue);
-#endif//REC_FRAME_COUNT
     if (iBitrate <= 0) {
       WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
                "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iBitrate = %d",
@@ -874,12 +823,6 @@
   case ENCODER_OPTION_MAX_BITRATE: {	// Target bit-rate
     SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
     int32_t iBitrate = pInfo->iBitrate;
-
-#ifdef REC_FRAME_COUNT
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d",
-             m_uiCountFrameNum, m_iCspInternal, iValue);
-#endif//REC_FRAME_COUNT
     if (iBitrate <= 0) {
       WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
                "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iBitrate = %d",
@@ -1127,58 +1070,40 @@
   }
   break;
   case ENCODER_OPTION_DATAFORMAT: {	// Input color space
-#ifdef REC_FRAME_COUNT
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_DATAFORMAT, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
-
+             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal= 0x%x", m_iCspInternal);
     * ((int32_t*)pOption)	= m_iCspInternal;
   }
   break;
   case ENCODER_OPTION_IDR_INTERVAL: {	// IDR Interval
-#ifdef REC_FRAME_COUNT
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_IDR_INTERVAL, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
+             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_IDR_INTERVAL, uiIntraPeriod= %d",
+             m_pEncContext->pSvcParam->uiIntraPeriod);
     * ((int32_t*)pOption) = m_pEncContext->pSvcParam->uiIntraPeriod;
   }
   break;
   case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: {	// SVC Encoding Parameter
-#ifdef REC_FRAME_COUNT
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
+             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT");
     memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SEncParamExt));	// confirmed_safe_unsafe_usage
   }
   break;
   case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: {	// SVC Encoding Parameter
-#ifdef REC_FRAME_COUNT
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
+             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE");
     m_pEncContext->pSvcParam->GetBaseParams ((SEncParamBase*) pOption);
   }
   break;
 
   case ENCODER_OPTION_FRAME_RATE: {	// Maximal input frame rate
-#ifdef REC_FRAME_COUNT
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_FRAME_RATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
+             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_FRAME_RATE, fMaxFrameRate = %.6ff",
+             m_pEncContext->pSvcParam->fMaxFrameRate);
     * ((float*)pOption)	= m_pEncContext->pSvcParam->fMaxFrameRate;
   }
   break;
   case ENCODER_OPTION_BITRATE: {	// Target bit-rate
-#ifdef REC_FRAME_COUNT
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
+
     SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
     if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)
         && (pInfo->iLayer != SPATIAL_LAYER_2) && (pInfo->iLayer != SPATIAL_LAYER_3))
@@ -1188,14 +1113,12 @@
     } else {
       pInfo->iBitrate = m_pEncContext->pSvcParam->sSpatialLayers[pInfo->iLayer].iSpatialBitrate;
     }
+    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_BITRATE, layerId =%d,iBitrate = %d",
+             pInfo->iLayer, pInfo->iBitrate);
   }
   break;
   case ENCODER_OPTION_MAX_BITRATE: {	// Target bit-rate
-#ifdef REC_FRAME_COUNT
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_MAX_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
-             m_uiCountFrameNum, m_iCspInternal);
-#endif//REC_FRAME_COUNT
     SBitrateInfo* pInfo = (static_cast<SBitrateInfo*> (pOption));
     if ((pInfo->iLayer != SPATIAL_LAYER_ALL) && (pInfo->iLayer != SPATIAL_LAYER_0) && (pInfo->iLayer != SPATIAL_LAYER_1)
         && (pInfo->iLayer != SPATIAL_LAYER_2) && (pInfo->iLayer != SPATIAL_LAYER_3))
@@ -1205,6 +1128,9 @@
     } else {
       pInfo->iBitrate = m_pEncContext->pSvcParam->sSpatialLayers[pInfo->iLayer].iMaxSpatialBitrate;
     }
+    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+             "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_MAX_BITRATE,, layerId =%d,iBitrate = %d",
+             pInfo->iLayer, pInfo->iBitrate);
   }
   break;
   case ENCODER_OPTION_GET_STATISTICS: {