input parameters validation
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -84,6 +84,26 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 83 unmodified lines | ||
| 84 | 84 | WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidation(),Invalid usage type = %d\n", pCfg->iUsageType); |
| 85 | 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 | 107 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { |
| 88 | 108 | SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i]; |
| 89 | 109 | 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 | 2961 | //loop each layer to check if have skip frame when RC and frame skip enable |
| 2942 | 2962 | if (RC_OFF_MODE != pCtx->pSvcParam->iRCMode && true == pCtx->pSvcParam->bEnableFrameSkip) { |
| 2943 | 2963 | bool bSkipMustFlag = false; |
| 2944 | − for (int32_t i = 0; i< iSpatialNum; i++) { | |
| 2945 | − pCtx->uiDependencyId = (uint8_t)(pSpatialIndexMap+i)->iDid; | |
| 2946 | − pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge(pCtx); | |
| 2964 | + for (int32_t i = 0; i < iSpatialNum; i++) { | |
| 2965 | + pCtx->uiDependencyId = (uint8_t) (pSpatialIndexMap + i)->iDid; | |
| 2966 | + pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge (pCtx); | |
| 2947 | 2967 | if (true == pCtx->pWelsSvcRc[pCtx->uiDependencyId].bSkipFlag) { |
| 2948 | 2968 | bSkipMustFlag = true; |
| 2949 | 2969 | } |