Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 3 files). Show all
Unified · Split
| @@ -167,6 +167,12 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 166 unmodified lines | |||
| 167 | pSpatialLayer->iSpatialBitrate); | 167 | pSpatialLayer->iSpatialBitrate); |
| 168 | return ENC_RETURN_INVALIDINPUT; | 168 | return ENC_RETURN_INVALIDINPUT; |
| 169 | } | 169 | } |
| 170 | if (pSpatialLayer->iMaxSpatialBitrate < pSpatialLayer->iSpatialBitrate * 1.1f) { | ||
| 171 | WelsLog (pLogCtx, WELS_LOG_WARNING, | ||
| 172 | "MaxSpatialBitrate (%d) should set be larger than 1.1 times of SpatialBitrate (%d)", | ||
| 173 | pSpatialLayer->iMaxSpatialBitrate, pSpatialLayer->iSpatialBitrate); | ||
| 174 | // pSpatialLayer->iSpatialBitrate = (int32_t) (pSpatialLayer->iMaxSpatialBitrate/1.1f); | ||
| 175 | } | ||
| 170 | } | 176 | } |
| 171 | if (iTotalBitrate > pCfg->iTargetBitrate) { | 177 | if (iTotalBitrate > pCfg->iTargetBitrate) { |
| 172 | WelsLog (pLogCtx, WELS_LOG_ERROR, | 178 | WelsLog (pLogCtx, WELS_LOG_ERROR, |
| @@ -3032,18 +3038,21 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2859 unmodified lines | |||
| 3032 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) | 3038 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) |
| 3033 | ++ pCtx->iCodingIndex; | 3039 | ++ pCtx->iCodingIndex; |
| 3034 | pFbi->eFrameType = videoFrameTypeSkip; | 3040 | pFbi->eFrameType = videoFrameTypeSkip; |
| 3041 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8d, skip one frame",pSrcPic->uiTimeStamp); | ||
| 3035 | return ENC_RETURN_SUCCESS; | 3042 | return ENC_RETURN_SUCCESS; |
| 3036 | } | 3043 | } |
| 3037 | 3044 | ||
| 3038 | eFrameType = DecideFrameType (pCtx, iSpatialNum); | 3045 | eFrameType = DecideFrameType (pCtx, iSpatialNum); |
| 3039 | if (eFrameType == videoFrameTypeSkip) { | 3046 | if (eFrameType == videoFrameTypeSkip) { |
| 3040 | pFbi->eFrameType = eFrameType; | 3047 | pFbi->eFrameType = eFrameType; |
| 3048 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8d, skip one frame",pSrcPic->uiTimeStamp); | ||
| 3041 | return ENC_RETURN_SUCCESS; | 3049 | return ENC_RETURN_SUCCESS; |
| 3042 | } | 3050 | } |
| 3043 | 3051 | ||
| 3044 | //loop each layer to check if have skip frame when RC and frame skip enable | 3052 | //loop each layer to check if have skip frame when RC and frame skip enable |
| 3045 | if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, (uint32_t)pSrcPic->uiTimeStamp)) { | 3053 | if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, (uint32_t)pSrcPic->uiTimeStamp)) { |
| 3046 | pFbi->eFrameType = videoFrameTypeSkip; | 3054 | pFbi->eFrameType = videoFrameTypeSkip; |
| 3055 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8d, skip one frame",pSrcPic->uiTimeStamp); | ||
| 3047 | return ENC_RETURN_SUCCESS; | 3056 | return ENC_RETURN_SUCCESS; |
| 3048 | } | 3057 | } |
| 3049 | 3058 | ||
| @@ -3427,6 +3436,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 377 unmodified lines | |||
| 3427 | } | 3436 | } |
| 3428 | 3437 | ||
| 3429 | pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize); | 3438 | pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize); |
| 3439 | RcTraceFrameBits (pCtx,pSrcPic->uiTimeStamp); | ||
| 3430 | pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc->iAverageFrameQp; | 3440 | pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc->iAverageFrameQp; |
| 3431 | 3441 | ||
| 3432 | //update scc related | 3442 | //update scc related |