shithub: openh264

Download patch

ref: dbb894442f31e070dbffe5ec0ac9e78d4e5efc6a
parent: 3343b1996b797ffbf497b44210c3b14604897d05
parent: b770bb80c031d10a621f2d74869a839063da09ab
author: Ethan Hugg <[email protected]>
date: Thu Feb 13 10:18:02 EST 2014

Merge pull request #284 from volvet/clean_spatial_picture_code

Clean spatial picture alloc code

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -573,8 +573,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;
 
@@ -589,13 +589,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);
 
@@ -847,7 +847,7 @@
   }
 
   // for I420 based source spatial pictures
-  if (AllocSpatialPictures (ppCtx, pParam)) {
+  if (AllocSpatialPictures (*ppCtx, pParam)) {
     FreeMemorySvc (ppCtx);
     return 1;
   }