From e2e106a4a452f35ffb22bd384f67616ccae4eb70 Mon Sep 17 00:00:00 2001 From: volvet Date: Thu, 3 Apr 2014 17:14:56 -0700 Subject: [PATCH] remove redundant protect code --- codec/encoder/core/inc/param_svc.h | 23 +++++++++++------------ codec/encoder/core/src/encoder_ext.cpp | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/codec/encoder/core/inc/param_svc.h b/codec/encoder/core/inc/param_svc.h index 5738be9e..c8eb1382 100644 --- a/codec/encoder/core/inc/param_svc.h +++ b/codec/encoder/core/inc/param_svc.h @@ -495,19 +495,18 @@ pMa->WelsFree (*pParam, "SWelsSvcCodingParam"); return 0; } -static inline int32_t AllocCodingParam (SWelsSvcCodingParam** pParam, CMemoryAlign* pMa, - const int32_t kiRequestNumSpatial) { -if (pParam == NULL || pMa == NULL || kiRequestNumSpatial < 1 || kiRequestNumSpatial > MAX_SPATIAL_LAYER_NUM) - return 1; -if (*pParam != NULL) { - FreeCodingParam (pParam, pMa); -} -SWelsSvcCodingParam* pCodingParam = (SWelsSvcCodingParam*)pMa->WelsMalloc (sizeof (SWelsSvcCodingParam), +static inline int32_t AllocCodingParam (SWelsSvcCodingParam** pParam, CMemoryAlign* pMa) { + if (pParam == NULL || pMa == NULL) + return 1; + if (*pParam != NULL) { + FreeCodingParam (pParam, pMa); + } + SWelsSvcCodingParam* pCodingParam = (SWelsSvcCodingParam*)pMa->WelsMalloc (sizeof (SWelsSvcCodingParam), "SWelsSvcCodingParam"); -if (NULL == pCodingParam) - return 1; -*pParam = pCodingParam; -return 0; + if (NULL == pCodingParam) + return 1; + *pParam = pCodingParam; + return 0; } }//end of namespace WelsSVCEnc diff --git a/codec/encoder/core/src/encoder_ext.cpp b/codec/encoder/core/src/encoder_ext.cpp index 097e64e9..288f84e5 100644 --- a/codec/encoder/core/src/encoder_ext.cpp +++ b/codec/encoder/core/src/encoder_ext.cpp @@ -1892,7 +1892,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar #endif//ENABLE_TRACE_FILE pCodingParam->DetermineTemporalSettings(); - iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign, pCodingParam->iSpatialLayerNum); + iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign); if (iRet != 0) { FreeMemorySvc (&pCtx); return iRet;