shithub: openh264

Download patch

ref: b770bb80c031d10a621f2d74869a839063da09ab
parent: c5ea53f0af788533e16c1b6925736b0bbb518037
author: volvet <qizh@cisco.com>
date: Thu Feb 13 07:00:02 EST 2014

Clean spatial picture alloc code

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -590,8 +590,8 @@
 /*!
  * \brief	alloc spatial layers pictures (I420 based source pictures)
  */
-int32_t AllocSpatialPictures (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pParam) {
-  CMemoryAlign* pMa						= (*ppCtx)->pMemAlign;
+int32_t AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCodingParam* pParam) {
+  CMemoryAlign* pMa						= pCtx->pMemAlign;
   const int32_t kiDlayerCount					= pParam->iNumDependencyLayer;
   int32_t iDlayerIndex							= 0;
 
@@ -606,13 +606,13 @@
 
     do {
       SPicture* pPic = AllocPicture (pMa, kiPicWidth, kiPicHeight, false);
-      WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pPic), FreeMemorySvc (ppCtx); *ppCtx = NULL)
-      (*ppCtx)->pSpatialPic[iDlayerIndex][i] = pPic;
+      WELS_VERIFY_RETURN_IF(1, (NULL == pPic))
+      pCtx->pSpatialPic[iDlayerIndex][i] = pPic;
       ++ i;
     } while (i < kuiRefNumInTemporal);
 
-    (*ppCtx)->uiSpatialLayersInTemporal[iDlayerIndex] = kuiLayerInTemporal;
-    (*ppCtx)->uiSpatialPicNum[iDlayerIndex] = kuiRefNumInTemporal;
+    pCtx->uiSpatialLayersInTemporal[iDlayerIndex] = kuiLayerInTemporal;
+    pCtx->uiSpatialPicNum[iDlayerIndex] = kuiRefNumInTemporal;
     ++ iDlayerIndex;
   } while (iDlayerIndex < kiDlayerCount);
 
@@ -864,7 +864,7 @@
   }
 
   // for I420 based source spatial pictures
-  if (AllocSpatialPictures (ppCtx, pParam)) {
+  if (AllocSpatialPictures (*ppCtx, pParam)) {
     FreeMemorySvc (ppCtx);
     return 1;
   }