From 6d5ef0ba2dc56ce9afec9d9f77663cef89d52d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 8 May 2015 14:32:00 +0300 Subject: [PATCH 1/2] Use separate string literals instead of line continuation for multiline log messages This avoids including excessive spacing from the indentation in the actual message. --- codec/encoder/core/src/ratectl.cpp | 4 ++-- codec/encoder/plus/src/welsEncoderExt.cpp | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/codec/encoder/core/src/ratectl.cpp b/codec/encoder/core/src/ratectl.cpp index 78e9f9a6..39e3e30a 100644 --- a/codec/encoder/core/src/ratectl.cpp +++ b/codec/encoder/core/src/ratectl.cpp @@ -889,8 +889,8 @@ void RcTraceFrameBits (sWelsEncCtx* pEncCtx, long long uiTimeStamp) { pWelsSvcRc->iPredFrameBit = pWelsSvcRc->iFrameDqBits; WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, - "[Rc] Frame timestamp = %lld, Frame type =%d, encoding_qp = %d, average qp = %3d, max qp = %3d, min qp = %3d, index = %8d,\ - iTid = %1d, used = %8d, bitsperframe = %8d, target = %8d, remaingbits = %8d, skipbuffersize = %8d", + "[Rc] Frame timestamp = %lld, Frame type =%d, encoding_qp = %d, average qp = %3d, max qp = %3d, min qp = %3d, index = %8d, " + "iTid = %1d, used = %8d, bitsperframe = %8d, target = %8d, remaingbits = %8d, skipbuffersize = %8d", uiTimeStamp, pEncCtx->eSliceType, pEncCtx->iGlobalQp, pWelsSvcRc->iAverageFrameQp, pWelsSvcRc->iMaxFrameQp, pWelsSvcRc->iMinFrameQp, pEncCtx->iFrameIndex, pEncCtx->uiTemporalId, pWelsSvcRc->iFrameDqBits, pWelsSvcRc->iBitsPerFrame, diff --git a/codec/encoder/plus/src/welsEncoderExt.cpp b/codec/encoder/plus/src/welsEncoderExt.cpp index a29c5f4d..5163d62f 100644 --- a/codec/encoder/plus/src/welsEncoderExt.cpp +++ b/codec/encoder/plus/src/welsEncoderExt.cpp @@ -486,9 +486,9 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) { } 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;\ - eSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;\ - iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d (offset(alpha/beta): %d,%d)", + "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;" + "eSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;" + "iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d (offset(alpha/beta): %d,%d)", pParam->iUsageType, pParam->iPicWidth, pParam->iPicHeight, @@ -524,8 +524,8 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) { while (i < iSpatialLayers) { 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", + "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, @@ -608,10 +608,10 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid const int64_t kiTimeDiff = kiCurrentFrameTs - m_pEncContext->iLastStatisticsLogTs; if ((kiTimeDiff > m_pEncContext->iStatisticsLogInterval) || (0 == pStatistics->uiInputFrameCount % 300)) { WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, - "EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, \ - LastFrameRate=%f, LatestBitRate=%d, LastFrameQP=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, \ - uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA, iTotalEncodedBytes=%"PRId64"\ - at Ts = %"PRId64, + "EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, " + "LastFrameRate=%f, LatestBitRate=%d, LastFrameQP=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, " + "uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA, iTotalEncodedBytes=%"PRId64 + "at Ts = %"PRId64, pStatistics->uiWidth, pStatistics->uiHeight, pStatistics->fAverageFrameSpeedInMs, pStatistics->fAverageFrameRate, pStatistics->fLatestFrameRate, pStatistics->uiBitRate, pStatistics->uiAverageFrameQP, From 9ac4c8208e819c29024654e13ff91765b5cb4161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 4 May 2015 12:20:23 -0700 Subject: [PATCH 2/2] Add spaces around PRId64 macros in format strings This does the same cleanup as was done in 4fc27714bd on new occurrances in the code base. This fixes building with MSVC 2015 (which is still only a release candidate). --- codec/decoder/core/src/decode_slice.cpp | 4 ++-- codec/encoder/core/src/encoder_ext.cpp | 2 +- codec/encoder/core/src/ratectl.cpp | 20 ++++++++++---------- codec/encoder/plus/src/welsEncoderExt.cpp | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/codec/decoder/core/src/decode_slice.cpp b/codec/decoder/core/src/decode_slice.cpp index fcdd07e1..9159ea6d 100644 --- a/codec/decoder/core/src/decode_slice.cpp +++ b/codec/decoder/core/src/decode_slice.cpp @@ -1570,7 +1570,7 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin if (iUsedBits > (pBs->iBits - 1)) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash. WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, - "WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%"PRId64" > pBs->iBits:%d, MUST stop decoding.", + "WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%" PRId64 " > pBs->iBits:%d, MUST stop decoding.", (int64_t) iUsedBits, pBs->iBits); return -1; } @@ -1993,7 +1993,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin if (iUsedBits > (pBs->iBits - 1)) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash. WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, - "WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%"PRId64" > pBs->iBits:%d, MUST stop decoding.", + "WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%" PRId64 " > pBs->iBits:%d, MUST stop decoding.", (int64_t) iUsedBits, pBs->iBits); return -1; } diff --git a/codec/encoder/core/src/encoder_ext.cpp b/codec/encoder/core/src/encoder_ext.cpp index 310a8328..953aa4fa 100644 --- a/codec/encoder/core/src/encoder_ext.cpp +++ b/codec/encoder/core/src/encoder_ext.cpp @@ -3968,7 +3968,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour t_bs_append = WelsTime() - t_bs_append; if (pCtx->pSliceThreading->pFSliceDiff) { fprintf (pCtx->pSliceThreading->pFSliceDiff, - "%6"PRId64" us consumed at AppendSliceToFrameBs() for coding_idx: %d iDid: %d qid: %d\n", + "%6" PRId64 " us consumed at AppendSliceToFrameBs() for coding_idx: %d iDid: %d qid: %d\n", t_bs_append, pCtx->iCodingIndex, iCurDid, 0); } #endif//MT_DEBUG diff --git a/codec/encoder/core/src/ratectl.cpp b/codec/encoder/core/src/ratectl.cpp index 39e3e30a..174b5e62 100644 --- a/codec/encoder/core/src/ratectl.cpp +++ b/codec/encoder/core/src/ratectl.cpp @@ -694,7 +694,7 @@ void RcVBufferCalculationSkip (sWelsEncCtx* pEncCtx) { pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW] += (pWelsSvcRc->iFrameDqBits - kiOutputMaxBits); pWelsSvcRc->iBufferMaxBRFullness[ODD_TIME_WINDOW] += (pWelsSvcRc->iFrameDqBits - kiOutputMaxBits); - WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] bits in buffer = %"PRId64", bits in Max bitrate buffer = %"PRId64, + WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] bits in buffer = %" PRId64 ", bits in Max bitrate buffer = %" PRId64, pWelsSvcRc->iBufferFullnessSkip, pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW]); //condition 2: VGOP bits constraint int64_t iVGopBitsPred = 0; @@ -764,7 +764,7 @@ void WelsRcFrameDelayJudge (sWelsEncCtx* pEncCtx, EVideoFrameType eFrameType, lo pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW] -= kiOutputMaxBits; pWelsSvcRc->iBufferMaxBRFullness[ODD_TIME_WINDOW] -= kiOutputMaxBits; WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, - "[Rc] bits in buffer = %"PRId64", bits in Max bitrate buffer = %"PRId64", Predict skip frames = %d and %d", + "[Rc] bits in buffer = %" PRId64 ", bits in Max bitrate buffer = %" PRId64 ", Predict skip frames = %d and %d", pWelsSvcRc->iBufferFullnessSkip, pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW], iPredSkipFramesTarBr, iPredSkipFramesMaxBr); pWelsSvcRc->iBufferFullnessSkip = WELS_MAX (pWelsSvcRc->iBufferFullnessSkip, 0); @@ -808,7 +808,7 @@ void UpdateBufferWhenFrameSkipped (sWelsEncCtx* pEncCtx, int32_t iSpatialNum) { pWelsSvcRc->iBufferFullnessSkip = pWelsSvcRc->iBufferFullnessSkip - kiOutputBits; pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW] -= kiOutputMaxBits; pWelsSvcRc->iBufferMaxBRFullness[ODD_TIME_WINDOW] -= kiOutputMaxBits; - WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] bits in buffer = %"PRId64", bits in Max bitrate buffer = %"PRId64, + WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] bits in buffer = %" PRId64 ", bits in Max bitrate buffer = %" PRId64, pWelsSvcRc->iBufferFullnessSkip, pWelsSvcRc->iBufferMaxBRFullness[EVEN_TIME_WINDOW]); pWelsSvcRc->iBufferFullnessSkip = WELS_MAX (pWelsSvcRc->iBufferFullnessSkip, 0); @@ -936,7 +936,7 @@ void RcUpdateIntraComplexity (sWelsEncCtx* pEncCtx) { if (pWelsSvcRc->iIdrNum > 255) pWelsSvcRc->iIdrNum = 255; WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_INFO, - "RcUpdateIntraComplexity iFrameDqBits = %d,iQStep= %d,iIntraCmplx = %"PRId64, + "RcUpdateIntraComplexity iFrameDqBits = %d,iQStep= %d,iIntraCmplx = %" PRId64, pWelsSvcRc->iFrameDqBits, pWelsSvcRc->iQStep, pWelsSvcRc->iIntraComplexity); } @@ -963,7 +963,7 @@ void RcUpdateFrameComplexity (sWelsEncCtx* pEncCtx) { if (pTOverRc->iPFrameNum > 255) pTOverRc->iPFrameNum = 255; WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, - "RcUpdateFrameComplexity iFrameDqBits = %d,iQStep= %d,pTOverRc->iLinearCmplx = %"PRId64, pWelsSvcRc->iFrameDqBits, + "RcUpdateFrameComplexity iFrameDqBits = %d,iQStep= %d,pTOverRc->iLinearCmplx = %" PRId64, pWelsSvcRc->iFrameDqBits, pWelsSvcRc->iQStep, pTOverRc->iLinearCmplx); } @@ -1203,7 +1203,7 @@ void WelsRcDropFrameUpdate (sWelsEncCtx* pEncCtx, uint32_t iDropSize) { pWelsSvcRc->iBufferFullnessSkip -= (int32_t)iDropSize; pWelsSvcRc->iBufferFullnessSkip = WELS_MAX (0, pWelsSvcRc->iBufferFullnessSkip); - WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_INFO, "[WelsRcDropFrameUpdate:\tdrop:%d\t%"PRId64"\n", iDropSize, + WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_INFO, "[WelsRcDropFrameUpdate:\tdrop:%d\t%" PRId64 "\n", iDropSize, pWelsSvcRc->iBufferFullnessSkip); } @@ -1273,7 +1273,7 @@ void WelsRcFrameDelayJudgeTimeStamp (sWelsEncCtx* pEncCtx, EVideoFrameType eFram } } WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, - "WelsRcFrameDelayJudgeTimeStamp iSkipFrameNum = %d,buffer = %"PRId64",threadhold = %d,bitrate = %d,iSentBits = %d,lasttimestamp = %lld,timestamp=%lld\n", + "WelsRcFrameDelayJudgeTimeStamp iSkipFrameNum = %d,buffer = %" PRId64 ",threadhold = %d,bitrate = %d,iSentBits = %d,lasttimestamp = %lld,timestamp=%lld\n", pWelsSvcRc->iSkipFrameNum, pWelsSvcRc->iBufferFullnessSkip, pWelsSvcRc->iBufferSizeSkip, iBitRate, iSentBits, pWelsSvcRc->uiLastTimeStamp, uiTimeStamp); } @@ -1298,7 +1298,7 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp IDR_BITRATE_RATIO)); WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, - "[Rc] First IDR iSpatialBitrate = %d,iBufferFullnessSkip = %"PRId64",iTargetBits= %d,dBpp = %f,initQp = %d", + "[Rc] First IDR iSpatialBitrate = %d,iBufferFullnessSkip = %" PRId64 ",iTargetBits= %d,dBpp = %f,initQp = %d", pDLayerParam->iSpatialBitrate, pWelsSvcRc->iBufferFullnessSkip, pWelsSvcRc->iTargetBits, dBpp, pWelsSvcRc->iInitialQp); @@ -1322,7 +1322,7 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp } iLumaQp = WELS_CLIP3 (iLumaQp, MIN_IDR_QP, MAX_IDR_QP); WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, - "[Rc]I iLumaQp = %d,iQStep = %d,iTargetBits = %d,iBufferFullnessSkip =%"PRId64",iMaxTh=%d,iMinTh = %d,iFrameComplexity= %"PRId64, + "[Rc]I iLumaQp = %d,iQStep = %d,iTargetBits = %d,iBufferFullnessSkip =%" PRId64 ",iMaxTh=%d,iMinTh = %d,iFrameComplexity= %" PRId64, iLumaQp, pWelsSvcRc->iQStep, pWelsSvcRc->iTargetBits, pWelsSvcRc->iBufferFullnessSkip, iMaxTh, iMinTh, pWelsSvcRc->iIntraComplexity); @@ -1361,7 +1361,7 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp iLumaQp = WELS_CLIP3 (iLumaQp, GOM_MIN_QP_MODE, GOM_MAX_QP_MODE); WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG, - "[Rc]P iTl = %d,iLumaQp = %d,iQStep = %d,iTargetBits = %d,iBufferFullnessSkip =%"PRId64",iMaxTh=%d,iMinTh = %d,iFrameComplexity= %lld,iCmplxRatio=%"PRId64, + "[Rc]P iTl = %d,iLumaQp = %d,iQStep = %d,iTargetBits = %d,iBufferFullnessSkip =%" PRId64 ",iMaxTh=%d,iMinTh = %d,iFrameComplexity= %lld,iCmplxRatio=%" PRId64, iTl, iLumaQp, pWelsSvcRc->iQStep, pWelsSvcRc->iTargetBits, pWelsSvcRc->iBufferFullnessSkip, iMaxTh, iMinTh, pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity, iCmplxRatio); } diff --git a/codec/encoder/plus/src/welsEncoderExt.cpp b/codec/encoder/plus/src/welsEncoderExt.cpp index 5163d62f..26a992a3 100644 --- a/codec/encoder/plus/src/welsEncoderExt.cpp +++ b/codec/encoder/plus/src/welsEncoderExt.cpp @@ -610,8 +610,8 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, " "LastFrameRate=%f, LatestBitRate=%d, LastFrameQP=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, " - "uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA, iTotalEncodedBytes=%"PRId64 - "at Ts = %"PRId64, + "uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA, iTotalEncodedBytes=%" PRId64 + "at Ts = %" PRId64, pStatistics->uiWidth, pStatistics->uiHeight, pStatistics->fAverageFrameSpeedInMs, pStatistics->fAverageFrameRate, pStatistics->fLatestFrameRate, pStatistics->uiBitRate, pStatistics->uiAverageFrameQP,