History

Merge pull request #1714 from sijchen/fix_ref4

[Encoder] enhance param checking with num-ref and related logging

ruil2 committed 11 years ago

Commit cdd072e2 parents 47dd4de ea06cbe8 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
@@ -4012,12 +4019,20 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 3763 unmodified lines
40124019 iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA);
40134020
40144021 }
4015− if (sConfig.iNumRefFrame < iNumRefFrame)
4016− sConfig.iNumRefFrame = iNumRefFrame;
4017− if (sConfig.iNumRefFrame > sConfig.iMaxNumRefFrame)
4018− sConfig.iMaxNumRefFrame = sConfig.iNumRefFrame;
4022+ if (iNumRefFrame > sConfig.iMaxNumRefFrame) {
4023+ WelsLog (pLogCtx, WELS_LOG_WARNING,
4024+ " CWelsH264SVCEncoder::SetOption LTR flag = %d and number = %d: Required number of reference increased to %d and iMaxNumRefFrame is adjusted",
4025+ sConfig.bEnableLongTermReference, sConfig.iLTRRefNum, iNumRefFrame, sConfig.iMaxNumRefFrame);
4026+ sConfig.iMaxNumRefFrame = iNumRefFrame;
4027+ }
40194028
4020− WelsLog (pLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption enable LTR = %d,ltrnum = %d",
4029+ if (sConfig.iNumRefFrame < iNumRefFrame) {
4030+ WelsLog (pLogCtx, WELS_LOG_WARNING,
4031+ " CWelsH264SVCEncoder::SetOption LTR flag = %d and number = %d, Required number of reference increased from Old = %d to New = %d because of LTR setting",
4032+ sConfig.bEnableLongTermReference, sConfig.iLTRRefNum, sConfig.iNumRefFrame, iNumRefFrame);
4033+ sConfig.iNumRefFrame = iNumRefFrame;
4034+ }
4035+ WelsLog (pLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::SetOption enable LTR = %d,ltrnum = %d",
40214036 sConfig.bEnableLongTermReference, sConfig.iLTRRefNum);
40224037 iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);
40234038 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