History

enhance param checking with num-ref and related logging

Sijia Chen committed 11 years ago

Commit ea06cbe1 parent 04cb9f38 files · +133 −54Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 8 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+21−6
@@ -242,7 +242,14 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 241 unmodified lines
242242 "bEnableFrameSkip = %d,bitrate can't be controlled for RC_QUALITY_MODE,RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame.",
243243 pCfg->bEnableFrameSkip);
244244 }
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;
246253 }
247254
248255
@@ -4017,12 +4024,20 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 3768 unmodified lines
40174024 iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA);
40184025
40194026 }
4020− if (sConfig.iNumRefFrame < iNumRefFrame)
4021− sConfig.iNumRefFrame = iNumRefFrame;
4022− if (sConfig.iNumRefFrame > sConfig.iMaxNumRefFrame)
4023− sConfig.iMaxNumRefFrame = sConfig.iNumRefFrame;
4027+ if (iNumRefFrame > sConfig.iMaxNumRefFrame) {
4028+ WelsLog (pLogCtx, WELS_LOG_WARNING,
4029+ " CWelsH264SVCEncoder::SetOption LTR flag = %d and number = %d: Required number of reference increased to %d and iMaxNumRefFrame is adjusted",
4030+ sConfig.bEnableLongTermReference, sConfig.iLTRRefNum, iNumRefFrame, sConfig.iMaxNumRefFrame);
4031+ sConfig.iMaxNumRefFrame = iNumRefFrame;
4032+ }
40244033
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",
40264041 sConfig.bEnableLongTermReference, sConfig.iLTRRefNum);
40274042 iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);
40284043 return iRet;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t