[Reformat] format cpp files for next release
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 14 files). Show all
Unified · Split
| @@ -156,9 +156,9 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 155 unmodified lines | |||
| 156 | } | 156 | } |
| 157 | if (pSpatialLayer->iMaxSpatialBitrate < pSpatialLayer->iSpatialBitrate * 1.1f) { | 157 | if (pSpatialLayer->iMaxSpatialBitrate < pSpatialLayer->iSpatialBitrate * 1.1f) { |
| 158 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 158 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 159 | "MaxSpatialBitrate (%d) should set be larger than 1.1 times of SpatialBitrate (%d)", | 159 | "MaxSpatialBitrate (%d) should set be larger than 1.1 times of SpatialBitrate (%d)", |
| 160 | pSpatialLayer->iMaxSpatialBitrate, pSpatialLayer->iSpatialBitrate); | 160 | pSpatialLayer->iMaxSpatialBitrate, pSpatialLayer->iSpatialBitrate); |
| 161 | // pSpatialLayer->iSpatialBitrate = (int32_t) (pSpatialLayer->iMaxSpatialBitrate/1.1f); | 161 | // pSpatialLayer->iSpatialBitrate = (int32_t) (pSpatialLayer->iMaxSpatialBitrate/1.1f); |
| 162 | } | 162 | } |
| 163 | } | 163 | } |
| 164 | if (iTotalBitrate > pCfg->iTargetBitrate) { | 164 | if (iTotalBitrate > pCfg->iTargetBitrate) { |
| @@ -1357,7 +1357,9 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 1192 unmodified lines | |||
| 1357 | iTargetSpatialBsSize = iLayerBsSize; | 1357 | iTargetSpatialBsSize = iLayerBsSize; |
| 1358 | iCountBsLen = iNonVclLayersBsSizeCount + iVclLayersBsSizeCount; | 1358 | iCountBsLen = iNonVclLayersBsSizeCount + iVclLayersBsSizeCount; |
| 1359 | 1359 | ||
| 1360 | pParam->iNumRefFrame = WELS_CLIP3 (pParam->iNumRefFrame, MIN_REF_PIC_COUNT, (pParam->iUsageType==CAMERA_VIDEO_REAL_TIME?MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA:MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN)); | 1360 | pParam->iNumRefFrame = WELS_CLIP3 (pParam->iNumRefFrame, MIN_REF_PIC_COUNT, |
| 1361 | (pParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA : | ||
| 1362 | MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN)); | ||
| 1361 | 1363 | ||
| 1362 | // Output | 1364 | // Output |
| 1363 | (*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMalloc (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput"); | 1365 | (*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMalloc (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput"); |
| @@ -2015,7 +2017,9 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 651 unmodified lines | |||
| 2015 | } | 2017 | } |
| 2016 | iRet = pCodingParam->DetermineTemporalSettings(); | 2018 | iRet = pCodingParam->DetermineTemporalSettings(); |
| 2017 | if (iRet != ENC_RETURN_SUCCESS) { | 2019 | if (iRet != ENC_RETURN_SUCCESS) { |
| 2018 | WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), DetermineTemporalSettings failed return %d (check in/out frame rate and temporal layer setting!)", iRet); | 2020 | WelsLog (pLogCtx, WELS_LOG_ERROR, |
| 2021 | "WelsInitEncoderExt(), DetermineTemporalSettings failed return %d (check in/out frame rate and temporal layer setting!)", | ||
| 2022 | iRet); | ||
| 2019 | return iRet; | 2023 | return iRet; |
| 2020 | } | 2024 | } |
| 2021 | iRet = GetMultipleThreadIdc (pLogCtx, pCodingParam, iSliceNum, iCacheLineSize, uiCpuFeatureFlags); | 2025 | iRet = GetMultipleThreadIdc (pLogCtx, pCodingParam, iSliceNum, iCacheLineSize, uiCpuFeatureFlags); |
| @@ -3031,21 +3035,24 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1009 unmodified lines | |||
| 3031 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) | 3035 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) |
| 3032 | ++ pCtx->iCodingIndex; | 3036 | ++ pCtx->iCodingIndex; |
| 3033 | pFbi->eFrameType = videoFrameTypeSkip; | 3037 | pFbi->eFrameType = videoFrameTypeSkip; |
| 3034 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp); | 3038 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %8" PRId64", skip one frame", |
| 3039 | (int64_t)pSrcPic->uiTimeStamp); | ||
| 3035 | return ENC_RETURN_SUCCESS; | 3040 | return ENC_RETURN_SUCCESS; |
| 3036 | } | 3041 | } |
| 3037 | 3042 | ||
| 3038 | eFrameType = DecideFrameType (pCtx, iSpatialNum); | 3043 | eFrameType = DecideFrameType (pCtx, iSpatialNum); |
| 3039 | if (eFrameType == videoFrameTypeSkip) { | 3044 | if (eFrameType == videoFrameTypeSkip) { |
| 3040 | pFbi->eFrameType = eFrameType; | 3045 | pFbi->eFrameType = eFrameType; |
| 3041 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp); | 3046 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %8" PRId64", skip one frame", |
| 3047 | (int64_t)pSrcPic->uiTimeStamp); | ||
| 3042 | return ENC_RETURN_SUCCESS; | 3048 | return ENC_RETURN_SUCCESS; |
| 3043 | } | 3049 | } |
| 3044 | 3050 | ||
| 3045 | //loop each layer to check if have skip frame when RC and frame skip enable | 3051 | //loop each layer to check if have skip frame when RC and frame skip enable |
| 3046 | if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, (uint32_t)pSrcPic->uiTimeStamp)) { | 3052 | if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, (uint32_t)pSrcPic->uiTimeStamp)) { |
| 3047 | pFbi->eFrameType = videoFrameTypeSkip; | 3053 | pFbi->eFrameType = videoFrameTypeSkip; |
| 3048 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp); | 3054 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %8" PRId64", skip one frame", |
| 3055 | (int64_t)pSrcPic->uiTimeStamp); | ||
| 3049 | return ENC_RETURN_SUCCESS; | 3056 | return ENC_RETURN_SUCCESS; |
| 3050 | } | 3057 | } |
| 3051 | 3058 | ||
| @@ -3429,7 +3436,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 377 unmodified lines | |||
| 3429 | } | 3436 | } |
| 3430 | 3437 | ||
| 3431 | pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize); | 3438 | pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize); |
| 3432 | RcTraceFrameBits (pCtx,pSrcPic->uiTimeStamp); | 3439 | RcTraceFrameBits (pCtx, pSrcPic->uiTimeStamp); |
| 3433 | pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc->iAverageFrameQp; | 3440 | pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc->iAverageFrameQp; |
| 3434 | 3441 | ||
| 3435 | //update scc related | 3442 | //update scc related |
| @@ -3760,7 +3767,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 324 unmodified lines | |||
| 3760 | } else { | 3767 | } else { |
| 3761 | /* maybe adjustment introduced in bitrate or little settings adjustment and so on.. */ | 3768 | /* maybe adjustment introduced in bitrate or little settings adjustment and so on.. */ |
| 3762 | pNewParam->iNumRefFrame = WELS_CLIP3 (pNewParam->iNumRefFrame, MIN_REF_PIC_COUNT, | 3769 | pNewParam->iNumRefFrame = WELS_CLIP3 (pNewParam->iNumRefFrame, MIN_REF_PIC_COUNT, |
| 3763 | (pNewParam->iUsageType==CAMERA_VIDEO_REAL_TIME?MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA:MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN)); | 3770 | (pNewParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA : |
| 3771 | MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN)); | ||
| 3764 | pNewParam->iLoopFilterDisableIdc = WELS_CLIP3 (pNewParam->iLoopFilterDisableIdc, 0, 6); | 3772 | pNewParam->iLoopFilterDisableIdc = WELS_CLIP3 (pNewParam->iLoopFilterDisableIdc, 0, 6); |
| 3765 | pNewParam->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pNewParam->iLoopFilterAlphaC0Offset, -6, 6); | 3773 | pNewParam->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pNewParam->iLoopFilterAlphaC0Offset, -6, 6); |
| 3766 | pNewParam->iLoopFilterBetaOffset = WELS_CLIP3 (pNewParam->iLoopFilterBetaOffset, -6, 6); | 3774 | pNewParam->iLoopFilterBetaOffset = WELS_CLIP3 (pNewParam->iLoopFilterBetaOffset, -6, 6); |