Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 7 files). Show all
Unified · Split
| @@ -202,7 +202,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 201 unmodified lines | |||
| 202 | if (pCfg->iSpatialLayerNum > 1) { | 202 | if (pCfg->iSpatialLayerNum > 1) { |
| 203 | for (i = pCfg->iSpatialLayerNum - 1; i > 0; i--) { | 203 | for (i = pCfg->iSpatialLayerNum - 1; i > 0; i--) { |
| 204 | SSpatialLayerConfig* fDlpUp = &pCfg->sSpatialLayers[i]; | 204 | SSpatialLayerConfig* fDlpUp = &pCfg->sSpatialLayers[i]; |
| 205 | SSpatialLayerConfig* fDlp = &pCfg->sSpatialLayers[i-1]; | 205 | SSpatialLayerConfig* fDlp = &pCfg->sSpatialLayers[i - 1]; |
| 206 | if ((fDlp->iVideoWidth > fDlpUp->iVideoWidth) || (fDlp->iVideoHeight > fDlpUp->iVideoHeight)) { | 206 | if ((fDlp->iVideoWidth > fDlpUp->iVideoWidth) || (fDlp->iVideoHeight > fDlpUp->iVideoHeight)) { |
| 207 | WelsLog (pLogCtx, WELS_LOG_ERROR, | 207 | WelsLog (pLogCtx, WELS_LOG_ERROR, |
| 208 | "ParamValidation,Invalid resolution layer(%d) resolution(%d x %d) should be less than the upper spatial layer resolution(%d x %d) ", | 208 | "ParamValidation,Invalid resolution layer(%d) resolution(%d x %d) should be less than the upper spatial layer resolution(%d x %d) ", |
| @@ -271,6 +271,18 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 62 unmodified lines | |||
| 271 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 271 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 272 | "bEnableFrameSkip = %d,bitrate can't be controlled for RC_QUALITY_MODE,RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame.", | 272 | "bEnableFrameSkip = %d,bitrate can't be controlled for RC_QUALITY_MODE,RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame.", |
| 273 | pCfg->bEnableFrameSkip); | 273 | pCfg->bEnableFrameSkip); |
| 274 | if (pCfg->iRCMode == RC_QUALITY_MODE) { | ||
| 275 | pCfg->iMinQp = WELS_CLIP3 (pCfg->iMinQp , GOM_MIN_QP_MODE, GOM_MAX_QP_MODE); | ||
| 276 | pCfg->iMaxQp = WELS_CLIP3 (pCfg->iMaxQp , GOM_MIN_QP_MODE, GOM_MAX_QP_MODE); | ||
| 277 | if (pCfg->iMaxQp < pCfg->iMinQp) | ||
| 278 | pCfg->iMaxQp = GOM_MAX_QP_MODE; | ||
| 279 | } else { | ||
| 280 | pCfg->iMinQp = WELS_CLIP3 (pCfg->iMinQp , 0, 51); | ||
| 281 | pCfg->iMaxQp = WELS_CLIP3 (pCfg->iMaxQp , 0, 51); | ||
| 282 | if (pCfg->iMaxQp < pCfg->iMinQp) | ||
| 283 | pCfg->iMaxQp = 51; | ||
| 284 | |||
| 285 | } | ||
| 274 | } | 286 | } |
| 275 | // ref-frames validation | 287 | // ref-frames validation |
| 276 | if (((pCfg->iUsageType == CAMERA_VIDEO_REAL_TIME) || (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME)) | 288 | if (((pCfg->iUsageType == CAMERA_VIDEO_REAL_TIME) || (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME)) |
| @@ -3709,7 +3721,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3432 unmodified lines | |||
| 3709 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) | 3721 | if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate) |
| 3710 | ++ pCtx->iCodingIndex; | 3722 | ++ pCtx->iCodingIndex; |
| 3711 | pFbi->eFrameType = videoFrameTypeSkip; | 3723 | pFbi->eFrameType = videoFrameTypeSkip; |
| 3712 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame due to preprocessing return (temporal layer settings or else), continual skipped %d frames", | 3724 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 3725 | "[Rc] Frame timestamp = %lld, skip one frame due to preprocessing return (temporal layer settings or else), continual skipped %d frames", | ||
| 3713 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); | 3726 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); |
| 3714 | return ENC_RETURN_SUCCESS; | 3727 | return ENC_RETURN_SUCCESS; |
| 3715 | } | 3728 | } |
| @@ -3719,7 +3732,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3 unmodified lines | |||
| 3719 | if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip) | 3732 | if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip) |
| 3720 | pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iSpatialNum); | 3733 | pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iSpatialNum); |
| 3721 | pFbi->eFrameType = eFrameType; | 3734 | pFbi->eFrameType = eFrameType; |
| 3722 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame due to target_br, continual skipped %d frames", | 3735 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 3736 | "[Rc] Frame timestamp = %lld, skip one frame due to target_br, continual skipped %d frames", | ||
| 3723 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); | 3737 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); |
| 3724 | return ENC_RETURN_SUCCESS; | 3738 | return ENC_RETURN_SUCCESS; |
| 3725 | } | 3739 | } |
| @@ -3730,7 +3744,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 4 unmodified lines | |||
| 3730 | (uint32_t)pSrcPic->uiTimeStamp); | 3744 | (uint32_t)pSrcPic->uiTimeStamp); |
| 3731 | if (bSkip) { | 3745 | if (bSkip) { |
| 3732 | pFbi->eFrameType = videoFrameTypeSkip; | 3746 | pFbi->eFrameType = videoFrameTypeSkip; |
| 3733 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "[Rc] Frame timestamp = %lld, skip one frame due to max_br, continual skipped %d frames", | 3747 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 3748 | "[Rc] Frame timestamp = %lld, skip one frame due to max_br, continual skipped %d frames", | ||
| 3734 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); | 3749 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); |
| 3735 | return ENC_RETURN_SUCCESS; | 3750 | return ENC_RETURN_SUCCESS; |
| 3736 | } | 3751 | } |