]> granicus.if.org Git - libvpx/commitdiff
multi-res: modify memory allocation code
authorYunqing Wang <yunqingwang@google.com>
Wed, 23 May 2012 17:40:24 +0000 (13:40 -0400)
committerYunqing Wang <yunqingwang@google.com>
Wed, 23 May 2012 17:40:24 +0000 (13:40 -0400)
Reverted part of change in memory alllocation code, which ensures
that the function returns 0 and encoder works correctly when
CONFIG_MULTI_RES_ENCODING isn't turned on.

Change-Id: Id5d5e7f2c8bd9e961a6dca79d257e8185f0d592a

vp8/vp8_cx_iface.c

index 22d39b75477acfe314c71dfa373e6bc561011532..9a6bc301a96cb03792e9c16ec7b2719677e8df2b 100644 (file)
@@ -539,6 +539,8 @@ static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx,
 static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg,
                                         void **mem_loc)
 {
+    vpx_codec_err_t res = 0;
+
 #if CONFIG_MULTI_RES_ENCODING
     LOWER_RES_FRAME_INFO *shared_mem_loc;
     int mb_rows = ((cfg->g_w + 15) >>4);
@@ -547,20 +549,21 @@ static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg,
     shared_mem_loc = calloc(1, sizeof(LOWER_RES_FRAME_INFO));
     if(!shared_mem_loc)
     {
-        return VPX_CODEC_MEM_ERROR;
+        res = VPX_CODEC_MEM_ERROR;
     }
 
     shared_mem_loc->mb_info = calloc(mb_rows*mb_cols, sizeof(LOWER_RES_MB_INFO));
     if(!(shared_mem_loc->mb_info))
     {
-        return VPX_CODEC_MEM_ERROR;
+        res = VPX_CODEC_MEM_ERROR;
     }
     else
     {
         *mem_loc = (void *)shared_mem_loc;
-        return VPX_CODEC_OK;
+        res = VPX_CODEC_OK;
     }
 #endif
+    return res;
 }
 
 static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,