shithub: openh264

Download patch

ref: cebf586c3a9cb74147ab29d72d123c73875c7a41
parent: 9b9713878633a27f04225d3cbc8898d20e7b3f0e
author: ruil2 <[email protected]>
date: Thu Aug 28 07:04:25 EDT 2014

update trace output

--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -709,9 +709,7 @@
       || (dIncPercent > pWelsSvcRc->iRcVaryPercentage)) {
     pEncCtx->iSkipFrameFlag = 1;
     pWelsSvcRc->iBufferFullnessSkip = pWelsSvcRc->iBufferFullnessSkip - kiOutputBits;
-#ifdef FRAME_INFO_OUTPUT
-    fprintf (stderr, "skip one frame\n");
-#endif
+    WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_INFO,"skip one frame");
   }
 
   if (pWelsSvcRc->iBufferFullnessSkip < 0)
@@ -759,7 +757,7 @@
 void RcTraceFrameBits (sWelsEncCtx* pEncCtx) {
   SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
 
-  WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_INFO,
+  WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
            "[Rc] encoding_qp%d, qp = %3d, index = %8d, iTid = %1d, used = %8d, target = %8d, remaingbits = %8d",
            pEncCtx->uiDependencyId, pWelsSvcRc->iAverageFrameQp, pEncCtx->iFrameIndex, pEncCtx->uiTemporalId,
            pWelsSvcRc->iFrameDqBits,
@@ -888,10 +886,7 @@
   }
   pWelsSvcRc->iRemainingBits -= pWelsSvcRc->iFrameDqBits;
 
-#if GOM_TRACE_FLAG
   RcTraceFrameBits (pEncCtx);
-#endif
-
 
   if (pEncCtx->pSvcParam->bEnableFrameSkip /*&&
       pEncCtx->uiDependencyId == pEncCtx->pSvcParam->iSpatialLayerNum - 1*/) {
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -1071,7 +1071,7 @@
     iVaaFrameSceneChangeIdc = SIMILAR_SCENE;
   }
 
-  WelsLog (pLogCtx, WELS_LOG_INFO, "iVaaFrameSceneChangeIdc = %d,codingIdx = %d", iVaaFrameSceneChangeIdc,
+  WelsLog (pLogCtx, WELS_LOG_DEBUG, "iVaaFrameSceneChangeIdc = %d,codingIdx = %d", iVaaFrameSceneChangeIdc,
            pCtx->iCodingIndex);
 
   SaveBestRefToVaa (sLtrSaved, & (pVaaExt->sVaaStrBestRefCandidate[0]));
--- a/codec/encoder/plus/inc/welsEncoderExt.h
+++ b/codec/encoder/plus/inc/welsEncoderExt.h
@@ -101,6 +101,7 @@
   void CheckProfileSetting (int32_t iLayer, EProfileIdc uiProfileIdc);
   void CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc);
   void CheckReferenceNumSetting (int32_t iNumRef);
+  void TraceParamInfo(SEncParamExt *pParam);
   sWelsEncCtx*	m_pEncContext;
 
   welsCodecTrace*			m_pWelsTrace;
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -256,41 +256,6 @@
   WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
            "CWelsH264SVCEncoder::Initialize, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x",
            m_uiCountFrameNum, m_iCspInternal);
-  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-           "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d;coding_param->iRCMode= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;coding_param->iInputCsp= %d;coding_param->uiIntraPeriod= %d;coding_param->bEnableSpsPpsIdAddition = %d;coding_param->bPrefixNalAddingCtrl = %d;coding_param->bEnableDenoise= %d;coding_param->bEnableBackgroundDetection= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableFrameSkip= %d;coding_param->bEnableCropPic= %d;coding_param->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;",
-           sEncodingParam.iPicWidth,
-           sEncodingParam.iPicHeight,
-           sEncodingParam.iTargetBitrate,
-           sEncodingParam.iRCMode,
-           sEncodingParam.iTemporalLayerNum,
-           sEncodingParam.iSpatialLayerNum,
-           sEncodingParam.fMaxFrameRate,
-           sEncodingParam.iInputCsp,
-           sEncodingParam.uiIntraPeriod,
-           sEncodingParam.bEnableSpsPpsIdAddition,
-           sEncodingParam.bPrefixNalAddingCtrl,
-           sEncodingParam.bEnableDenoise,
-           sEncodingParam.bEnableBackgroundDetection,
-           sEncodingParam.bEnableAdaptiveQuant,
-           sEncodingParam.bEnableFrameSkip,
-           sEncodingParam.bEnableCropPic,
-           sEncodingParam.bEnableLongTermReference,
-           sEncodingParam.iLtrMarkPeriod);
-  int32_t i = 0;
-  while (i < sEncodingParam.iSpatialLayerNum) {
-    SSpatialLayerConfig* spatial_cfg = &sEncodingParam.sSpatialLayers[i];
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "coding_param->sSpatialLayers[%d]: .iVideoWidth= %d; .iVideoHeight= %d; .fFrameRate= %.6ff; .iSpatialBitrate= %d; .sSliceCfg.uiSliceMode= %d; .sSliceCfg.sSliceArgument.uiSliceNum= %d; .sSliceCfg.sSliceArgument.uiSliceSizeConstraint= %d;",
-             i, spatial_cfg->iVideoWidth,
-             spatial_cfg->iVideoHeight,
-             spatial_cfg->fFrameRate,
-             spatial_cfg->iSpatialBitrate,
-             spatial_cfg->sSliceCfg.uiSliceMode,
-             spatial_cfg->sSliceCfg.sSliceArgument.uiSliceNum,
-             spatial_cfg->sSliceCfg.sSliceArgument.uiSliceSizeConstraint
-            );
-    ++ i;
-  }
 #endif//REC_FRAME_COUNT
 
   // Check valid parameters
@@ -378,6 +343,7 @@
   m_iMaxPicWidth	= pCfg->iPicWidth;
   m_iMaxPicHeight	= pCfg->iPicHeight;
 
+  TraceParamInfo(pCfg);
   if (WelsInitEncoderExt (&m_pEncContext, pCfg, &m_pWelsTrace->m_sLogCtx)) {
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), WelsInitEncoderExt failed.");
     Uninitialize();
@@ -559,6 +525,60 @@
              "doesn't support the number of reference frame(%d) change to auto select mode", iNumRef);
   }
 }
+void CWelsH264SVCEncoder::TraceParamInfo(SEncParamExt *pParam){
+    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+             "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;\
+             bEnableSpsPpsIdAddition = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableAdaptiveQuant= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;\
+             iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;bEnableFrameSkip = %d;uiMaxNalSize = %d;bEnableLongTermReference = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d",
+             pParam->iUsageType,
+             pParam->iPicWidth,
+             pParam->iPicHeight,
+             pParam->iTargetBitrate,
+             pParam->iMaxBitrate,
+             pParam->iRCMode,
+             pParam->iPaddingFlag,
+             pParam->iTemporalLayerNum,
+             pParam->iSpatialLayerNum,
+             pParam->fMaxFrameRate,
+             pParam->uiIntraPeriod,
+             pParam->bEnableSpsPpsIdAddition,
+             pParam->bPrefixNalAddingCtrl,
+             pParam->bEnableDenoise,
+             pParam->bEnableBackgroundDetection,
+             pParam->bEnableAdaptiveQuant,
+             pParam->bEnableFrameSkip,
+             pParam->bEnableLongTermReference,
+             pParam->iLtrMarkPeriod,
+             pParam->iComplexityMode,
+             pParam->iNumRefFrame,
+             pParam->iEntropyCodingModeFlag,
+             pParam->bEnableFrameSkip,
+             pParam->uiMaxNalSize,
+             pParam->bEnableLongTermReference,
+             pParam->iLTRRefNum,
+             pParam->iMultipleThreadIdc,
+             pParam->iLoopFilterDisableIdc
+             );
+    int32_t i = 0;
+    while (i < pParam->iSpatialLayerNum) {
+      SSpatialLayerConfig* pSpatialCfg = &pParam->sSpatialLayers[i];
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+               "sSpatialLayers[%d]: .iVideoWidth= %d; .iVideoHeight= %d; .fFrameRate= %.6ff; .iSpatialBitrate= %d; .iMaxSpatialBitrate= %d; .sSliceCfg.uiSliceMode= %d; .sSliceCfg.sSliceArgument.iSliceNum= %d; .sSliceCfg.sSliceArgument.uiSliceSizeConstraint= %d;\
+               uiProfileIdc = %d;uiLevelIdc = %d",
+               i, pSpatialCfg->iVideoWidth,
+               pSpatialCfg->iVideoHeight,
+               pSpatialCfg->fFrameRate,
+               pSpatialCfg->iSpatialBitrate,
+               pSpatialCfg->iMaxSpatialBitrate,
+               pSpatialCfg->sSliceCfg.uiSliceMode,
+               pSpatialCfg->sSliceCfg.sSliceArgument.uiSliceNum,
+               pSpatialCfg->sSliceCfg.sSliceArgument.uiSliceSizeConstraint,
+               pSpatialCfg->uiProfileIdc,
+               pSpatialCfg->uiLevelIdc
+              );
+      ++ i;
+    }
+}
 /************************************************************************
 * InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..
 ************************************************************************/
@@ -624,42 +644,7 @@
     int32_t iTargetHeight = 0;
 
     memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt));	// confirmed_safe_unsafe_usage
-    WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-             "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d; coding_param->iMaxBitrate= %d; coding_param->iRCMode= %d;coding_param->iPaddingFlag= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;coding_param->uiIntraPeriod= %d;coding_param->bEnableSpsPpsIdAddition = %d;coding_param->bPrefixNalAddingCtrl = %d;coding_param->bEnableDenoise= %d;coding_param->bEnableBackgroundDetection= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;",
-             sEncodingParam.iPicWidth,
-             sEncodingParam.iPicHeight,
-             sEncodingParam.iTargetBitrate,
-             sEncodingParam.iMaxBitrate,
-             sEncodingParam.iRCMode,
-             sEncodingParam.iPaddingFlag,
-             sEncodingParam.iTemporalLayerNum,
-             sEncodingParam.iSpatialLayerNum,
-             sEncodingParam.fMaxFrameRate,
-             sEncodingParam.uiIntraPeriod,
-             sEncodingParam.bEnableSpsPpsIdAddition,
-             sEncodingParam.bPrefixNalAddingCtrl,
-             sEncodingParam.bEnableDenoise,
-             sEncodingParam.bEnableBackgroundDetection,
-             sEncodingParam.bEnableAdaptiveQuant,
-             sEncodingParam.bEnableFrameSkip,
-             sEncodingParam.bEnableLongTermReference,
-             sEncodingParam.iLtrMarkPeriod);
-    int32_t i = 0;
-    while (i < sEncodingParam.iSpatialLayerNum) {
-      SSpatialLayerConfig* pSpatialCfg = &sEncodingParam.sSpatialLayers[i];
-      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
-               "coding_param->sSpatialLayers[%d]: .iVideoWidth= %d; .iVideoHeight= %d; .fFrameRate= %.6ff; .iSpatialBitrate= %d; .iMaxSpatialBitrate= %d; .sSliceCfg.uiSliceMode= %d; .sSliceCfg.sSliceArgument.iSliceNum= %d; .sSliceCfg.sSliceArgument.uiSliceSizeConstraint= %d;",
-               i, pSpatialCfg->iVideoWidth,
-               pSpatialCfg->iVideoHeight,
-               pSpatialCfg->fFrameRate,
-               pSpatialCfg->iSpatialBitrate,
-               pSpatialCfg->iMaxSpatialBitrate,
-               pSpatialCfg->sSliceCfg.uiSliceMode,
-               pSpatialCfg->sSliceCfg.sSliceArgument.uiSliceNum,
-               pSpatialCfg->sSliceCfg.sSliceArgument.uiSliceSizeConstraint
-              );
-      ++ i;
-    }
+    TraceParamInfo(&sEncodingParam);
 #ifdef OUTPUT_BIT_STREAM
     if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth !=
         m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iActualWidth) {