History

Merge pull request #985 from ruil2/encoder_check

input parameters validation

dongzha committed 12 years ago

Commit b750a3b2 parents 0dcb758 15e225a1 file · +23 −3Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+23−3
@@ -84,6 +84,26 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 83 unmodified lines
84 WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidation(),Invalid usage type = %d\n", pCfg->iUsageType);84 WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidation(),Invalid usage type = %d\n", pCfg->iUsageType);
85 return ENC_RETURN_UNSUPPORTED_PARA;85 return ENC_RETURN_UNSUPPORTED_PARA;
86 }86 }
87 if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) {
88 if (pCfg->iSpatialLayerNum > 1) {
89 WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidation(),Invalid the number of Spatial layer(%d)for screen content\n",
90 pCfg->iSpatialLayerNum);
91 return ENC_RETURN_UNSUPPORTED_PARA;
92 }
93 }
94 if (pCfg->iSpatialLayerNum > 1) {
95 int32_t iFinalWidth = pCfg->sSpatialLayers[pCfg->iSpatialLayerNum - 1].iVideoWidth;
96 int32_t iFinalHeight = pCfg->sSpatialLayers[pCfg->iSpatialLayerNum - 1].iVideoWidth;
97 for (i = 0; i < (pCfg->iSpatialLayerNum - 1); i++) {
98 SSpatialLayerConfig* fDlp = &pCfg->sSpatialLayers[i];
99 if ((fDlp->iVideoWidth > iFinalWidth) || (fDlp->iVideoHeight > iFinalHeight)) {
100 WelsLog (pLogCtx, WELS_LOG_ERROR,
101 "ParamValidation,Invalid resolution layer(%d) resolution(%d x %d) shoudl be less than the highest spatial layer resolution(%d x %d)\n ",
102 i, fDlp->iVideoWidth, fDlp->iVideoHeight, iFinalWidth, iFinalHeight);
103 return ENC_RETURN_UNSUPPORTED_PARA;
104 }
105 }
106 }
87 for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {107 for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
88 SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i];108 SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i];
89 if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn109 if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn
@@ -2941,9 +2961,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2851 unmodified lines
2941 //loop each layer to check if have skip frame when RC and frame skip enable2961 //loop each layer to check if have skip frame when RC and frame skip enable
2942 if (RC_OFF_MODE != pCtx->pSvcParam->iRCMode && true == pCtx->pSvcParam->bEnableFrameSkip) {2962 if (RC_OFF_MODE != pCtx->pSvcParam->iRCMode && true == pCtx->pSvcParam->bEnableFrameSkip) {
2943 bool bSkipMustFlag = false;2963 bool bSkipMustFlag = false;
2944 for (int32_t i = 0; i< iSpatialNum; i++) {2964 for (int32_t i = 0; i < iSpatialNum; i++) {
2945 pCtx->uiDependencyId = (uint8_t)(pSpatialIndexMap+i)->iDid;2965 pCtx->uiDependencyId = (uint8_t) (pSpatialIndexMap + i)->iDid;
2946 pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge(pCtx);2966 pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge (pCtx);
2947 if (true == pCtx->pWelsSvcRc[pCtx->uiDependencyId].bSkipFlag) {2967 if (true == pCtx->pWelsSvcRc[pCtx->uiDependencyId].bSkipFlag) {
2948 bSkipMustFlag = true;2968 bSkipMustFlag = true;
2949 }2969 }

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