Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 8 files). Show all
Unified · Split
| @@ -242,7 +242,14 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 241 unmodified lines | |||
| 242 | "bEnableFrameSkip = %d,bitrate can't be controlled for RC_QUALITY_MODE,RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame.", | 242 | "bEnableFrameSkip = %d,bitrate can't be controlled for RC_QUALITY_MODE,RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame.", |
| 243 | pCfg->bEnableFrameSkip); | 243 | pCfg->bEnableFrameSkip); |
| 244 | } | 244 | } |
| 245 | return WelsCheckRefFrameLimitation (pLogCtx, pCfg); | 245 | // ref-frames validation |
| 246 | if (((pCfg->iUsageType == CAMERA_VIDEO_REAL_TIME) || (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME)) | ||
| 247 | ? WelsCheckRefFrameLimitationNumRefFirst (pLogCtx, pCfg) | ||
| 248 | : WelsCheckRefFrameLimitationLevelIdcFirst (pLogCtx, pCfg)) { | ||
| 249 | WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsCheckRefFrameLimitation failed"); | ||
| 250 | return ENC_RETURN_INVALIDINPUT; | ||
| 251 | } | ||
| 252 | return ENC_RETURN_SUCCESS; | ||
| 246 | } | 253 | } |
| 247 | 254 | ||
| 248 | 255 | ||
| @@ -4017,12 +4024,20 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 3768 unmodified lines | |||
| 4017 | iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA); | 4024 | iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA); |
| 4018 | 4025 | ||
| 4019 | } | 4026 | } |
| 4020 | if (sConfig.iNumRefFrame < iNumRefFrame) | 4027 | if (iNumRefFrame > sConfig.iMaxNumRefFrame) { |
| 4021 | sConfig.iNumRefFrame = iNumRefFrame; | 4028 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 4022 | if (sConfig.iNumRefFrame > sConfig.iMaxNumRefFrame) | 4029 | " CWelsH264SVCEncoder::SetOption LTR flag = %d and number = %d: Required number of reference increased to %d and iMaxNumRefFrame is adjusted", |
| 4023 | sConfig.iMaxNumRefFrame = sConfig.iNumRefFrame; | 4030 | sConfig.bEnableLongTermReference, sConfig.iLTRRefNum, iNumRefFrame, sConfig.iMaxNumRefFrame); |
| 4031 | sConfig.iMaxNumRefFrame = iNumRefFrame; | ||
| 4032 | } | ||
| 4024 | 4033 | ||
| 4025 | WelsLog (pLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption enable LTR = %d,ltrnum = %d", | 4034 | if (sConfig.iNumRefFrame < iNumRefFrame) { |
| 4035 | WelsLog (pLogCtx, WELS_LOG_WARNING, | ||
| 4036 | " CWelsH264SVCEncoder::SetOption LTR flag = %d and number = %d, Required number of reference increased from Old = %d to New = %d because of LTR setting", | ||
| 4037 | sConfig.bEnableLongTermReference, sConfig.iLTRRefNum, sConfig.iNumRefFrame, iNumRefFrame); | ||
| 4038 | sConfig.iNumRefFrame = iNumRefFrame; | ||
| 4039 | } | ||
| 4040 | WelsLog (pLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::SetOption enable LTR = %d,ltrnum = %d", | ||
| 4026 | sConfig.bEnableLongTermReference, sConfig.iLTRRefNum); | 4041 | sConfig.bEnableLongTermReference, sConfig.iLTRRefNum); |
| 4027 | iRet = WelsEncoderParamAdjust (ppCtx, &sConfig); | 4042 | iRet = WelsEncoderParamAdjust (ppCtx, &sConfig); |
| 4028 | return iRet; | 4043 | return iRet; |