Merge pull request #284 from volvet/clean_spatial_picture_code

Clean spatial picture alloc code
This commit is contained in:
Ethan Hugg 2014-02-13 15:18:02 -08:00
commit dbb894442f

View File

@ -573,8 +573,8 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara
/*! /*!
* \brief alloc spatial layers pictures (I420 based source pictures) * \brief alloc spatial layers pictures (I420 based source pictures)
*/ */
int32_t AllocSpatialPictures (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam) { int32_t AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodingParam* pParam) {
CMemoryAlign* pMa = (*ppCtx)->pMemAlign; CMemoryAlign* pMa = pCtx->pMemAlign;
const int32_t kiDlayerCount = pParam->iNumDependencyLayer; const int32_t kiDlayerCount = pParam->iNumDependencyLayer;
int32_t iDlayerIndex = 0; int32_t iDlayerIndex = 0;
@ -589,13 +589,13 @@ int32_t AllocSpatialPictures (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam)
do { do {
SPicture* pPic = AllocPicture (pMa, kiPicWidth, kiPicHeight, false); SPicture* pPic = AllocPicture (pMa, kiPicWidth, kiPicHeight, false);
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pPic), FreeMemorySvc (ppCtx); *ppCtx = NULL) WELS_VERIFY_RETURN_IF(1, (NULL == pPic))
(*ppCtx)->pSpatialPic[iDlayerIndex][i] = pPic; pCtx->pSpatialPic[iDlayerIndex][i] = pPic;
++ i; ++ i;
} while (i < kuiRefNumInTemporal); } while (i < kuiRefNumInTemporal);
(*ppCtx)->uiSpatialLayersInTemporal[iDlayerIndex] = kuiLayerInTemporal; pCtx->uiSpatialLayersInTemporal[iDlayerIndex] = kuiLayerInTemporal;
(*ppCtx)->uiSpatialPicNum[iDlayerIndex] = kuiRefNumInTemporal; pCtx->uiSpatialPicNum[iDlayerIndex] = kuiRefNumInTemporal;
++ iDlayerIndex; ++ iDlayerIndex;
} while (iDlayerIndex < kiDlayerCount); } while (iDlayerIndex < kiDlayerCount);
@ -847,7 +847,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) {
} }
// for I420 based source spatial pictures // for I420 based source spatial pictures
if (AllocSpatialPictures (ppCtx, pParam)) { if (AllocSpatialPictures (*ppCtx, pParam)) {
FreeMemorySvc (ppCtx); FreeMemorySvc (ppCtx);
return 1; return 1;
} }