shithub: libvpx

Download patch

ref: a439f5af5f4702320e2491c0319be524abbcbaac
parent: 79303c993ae09390b6e636943f2f44c545f41928
parent: 513743bd2ced4831495d90e3ab0f4f218666d59b
author: Dmitry Kovalev <dkovalev@google.com>
date: Mon Apr 21 08:21:06 EDT 2014

Merge "Inlining and removing encoder_common_init()."

--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -521,7 +521,8 @@
 #undef MAP
 }
 
-static vpx_codec_err_t encoder_common_init(vpx_codec_ctx_t *ctx) {
+static vpx_codec_err_t encoder_init(vpx_codec_ctx_t *ctx,
+                                    vpx_codec_priv_enc_mr_cfg_t *data) {
   vpx_codec_err_t res = VPX_CODEC_OK;
 
   if (ctx->priv == NULL) {
@@ -529,7 +530,8 @@
     vpx_codec_enc_cfg_t *cfg;
     struct vpx_codec_alg_priv *priv = calloc(1, sizeof(*priv));
 
-    if (priv == NULL) return VPX_CODEC_MEM_ERROR;
+    if (priv == NULL)
+      return VPX_CODEC_MEM_ERROR;
 
     ctx->priv = &priv->base;
     ctx->priv->sz = sizeof(*ctx->priv);
@@ -539,8 +541,7 @@
     ctx->priv->enc.total_encoders = 1;
 
     if (ctx->config.enc) {
-      // Update the reference to the config structure to an
-      // internal copy.
+      // Update the reference to the config structure to an internal copy.
       ctx->priv->alg_priv->cfg = *ctx->config.enc;
       ctx->config.enc = &ctx->priv->alg_priv->cfg;
     }
@@ -556,11 +557,11 @@
 
     priv->extra_cfg = extracfg_map[i].cfg;
     priv->extra_cfg.pkt_list = &priv->pkt_list.head;
-
-    // Maximum buffer size approximated based on having multiple ARF.
+     // Maximum buffer size approximated based on having multiple ARF.
     priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 8;
 
-    if (priv->cx_data_sz < 4096) priv->cx_data_sz = 4096;
+    if (priv->cx_data_sz < 4096)
+      priv->cx_data_sz = 4096;
 
     priv->cx_data = (unsigned char *)malloc(priv->cx_data_sz);
     if (priv->cx_data == NULL)
@@ -573,8 +574,8 @@
     if (res == VPX_CODEC_OK) {
       VP9_COMP *cpi;
       set_encoder_config(&ctx->priv->alg_priv->oxcf,
-                      &ctx->priv->alg_priv->cfg,
-                      &ctx->priv->alg_priv->extra_cfg);
+                         &ctx->priv->alg_priv->cfg,
+                         &ctx->priv->alg_priv->extra_cfg);
       cpi = vp9_create_compressor(&ctx->priv->alg_priv->oxcf);
       if (cpi == NULL)
         res = VPX_CODEC_MEM_ERROR;
@@ -586,12 +587,6 @@
   return res;
 }
 
-
-static vpx_codec_err_t encoder_init(vpx_codec_ctx_t *ctx,
-                                    vpx_codec_priv_enc_mr_cfg_t *data) {
-  return encoder_common_init(ctx);
-}
-
 static vpx_codec_err_t encoder_destroy(vpx_codec_alg_priv_t *ctx) {
   free(ctx->cx_data);
   vp9_remove_compressor(ctx->cpi);
@@ -865,7 +860,6 @@
 
   return res;
 }
-
 
 static const vpx_codec_cx_pkt_t *encoder_get_cxdata(vpx_codec_alg_priv_t  *ctx,
                                                     vpx_codec_iter_t *iter) {