History

complete parameter checking related to loop-filter-idc

Sijia Chen committed 11 years ago

Commit 94d19761 parent 5a1aedb2 files · +23 −8Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+12−8
@@ -185,7 +185,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 184 unmodified lines
185185 if (pCfg->bEnableSceneChangeDetect == false) {
186186 pCfg->bEnableSceneChangeDetect = true;
187187 WelsLog (pLogCtx, WELS_LOG_WARNING,
188− "ParamValidation(), screen change detection should be turned on,change bEnableSceneChangeDetect as true");
188+ "ParamValidation(), screen change detection should be turned on, change bEnableSceneChangeDetect as true");
189189 }
190190
191191 }
@@ -196,12 +196,22 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 4 unmodified lines
196196 SSpatialLayerConfig* fDlp = &pCfg->sSpatialLayers[i];
197197 if ((fDlp->iVideoWidth > iFinalWidth) || (fDlp->iVideoHeight > iFinalHeight)) {
198198 WelsLog (pLogCtx, WELS_LOG_ERROR,
199− "ParamValidation,Invalid resolution layer(%d) resolution(%d x %d) shoudl be less than the highest spatial layer resolution(%d x %d) ",
199+ "ParamValidation,Invalid resolution layer(%d) resolution(%d x %d) should be less than the highest spatial layer resolution(%d x %d) ",
200200 i, fDlp->iVideoWidth, fDlp->iVideoHeight, iFinalWidth, iFinalHeight);
201201 return ENC_RETURN_UNSUPPORTED_PARA;
202202 }
203203 }
204204 }
205+
206+ if (!CheckInRangeCloseOpen (pCfg->iLoopFilterDisableIdc, DEBLOCKING_IDC_0, DEBLOCKING_IDC_2 + 1) ||
207+ !CheckInRangeCloseOpen (pCfg->iLoopFilterAlphaC0Offset, DEBLOCKING_OFFSET_MINUS, DEBLOCKING_OFFSET + 1) ||
208+ !CheckInRangeCloseOpen (pCfg->iLoopFilterBetaOffset, DEBLOCKING_OFFSET_MINUS, DEBLOCKING_OFFSET + 1)) {
209+ WelsLog (pLogCtx, WELS_LOG_ERROR,
210+ "ParamValidation, Invalid iLoopFilterDisableIdc(%d) or iLoopFilterAlphaC0Offset(%d) or iLoopFilterBetaOffset(%d)!",
211+ pCfg->iLoopFilterDisableIdc, pCfg->iLoopFilterAlphaC0Offset, pCfg->iLoopFilterBetaOffset);
212+ return ENC_RETURN_UNSUPPORTED_PARA;
213+ }
214+
205215 for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
206216 SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i];
207217 SSpatialLayerConfig* pConfig = &pCfg->sSpatialLayers[i];
@@ -314,12 +324,6 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 106 unmodified lines
314324 pCodingParam->uiIntraPeriod, pCodingParam->uiGopSize);
315325 return ENC_RETURN_UNSUPPORTED_PARA;
316326 }
317− if (pCodingParam->iLoopFilterDisableIdc < 0 || pCodingParam->iLoopFilterDisableIdc > 6) {
318− WelsLog (pLogCtx, WELS_LOG_ERROR,
319− "ParamValidationExt(), iLoopFilterDisableIdc(%d) must be between 0 and 6",
320− pCodingParam->iLoopFilterDisableIdc);
321− return ENC_RETURN_UNSUPPORTED_PARA;
322− }
323327
324328 //about iMultipleThreadIdc, bDeblockingParallelFlag, iLoopFilterDisableIdc, & uiSliceMode
325329 // (1) Single Thread

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