Index: source/libvpx/vp8/vp8_cx_iface.c |
=================================================================== |
--- source/libvpx/vp8/vp8_cx_iface.c (revision 291857) |
+++ source/libvpx/vp8/vp8_cx_iface.c (working copy) |
@@ -14,6 +14,7 @@ |
#include "vpx/vpx_codec.h" |
#include "vpx/internal/vpx_codec_internal.h" |
#include "vpx_version.h" |
+#include "vpx_mem/vpx_mem.h" |
#include "vp8/encoder/onyx_int.h" |
#include "vpx/vp8cx.h" |
#include "vp8/encoder/firstpass.h" |
@@ -39,40 +40,28 @@ |
}; |
-struct extraconfig_map |
-{ |
- int usage; |
- struct vp8_extracfg cfg; |
-}; |
- |
-static const struct extraconfig_map extracfg_map[] = |
-{ |
- { |
- 0, |
- { |
- NULL, |
+static struct vp8_extracfg default_extracfg = { |
+ NULL, |
#if !(CONFIG_REALTIME_ONLY) |
- 0, /* cpu_used */ |
+ 0, /* cpu_used */ |
#else |
- 4, /* cpu_used */ |
+ 4, /* cpu_used */ |
#endif |
- 0, /* enable_auto_alt_ref */ |
- 0, /* noise_sensitivity */ |
- 0, /* Sharpness */ |
- 0, /* static_thresh */ |
+ 0, /* enable_auto_alt_ref */ |
+ 0, /* noise_sensitivity */ |
+ 0, /* Sharpness */ |
+ 0, /* static_thresh */ |
#if (CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING) |
- VP8_EIGHT_TOKENPARTITION, |
+ VP8_EIGHT_TOKENPARTITION, |
#else |
- VP8_ONE_TOKENPARTITION, /* token_partitions */ |
+ VP8_ONE_TOKENPARTITION, /* token_partitions */ |
#endif |
- 0, /* arnr_max_frames */ |
- 3, /* arnr_strength */ |
- 3, /* arnr_type*/ |
- 0, /* tuning*/ |
- 10, /* cq_level */ |
- 0, /* rc_max_intra_bitrate_pct */ |
- } |
- } |
+ 0, /* arnr_max_frames */ |
+ 3, /* arnr_strength */ |
+ 3, /* arnr_type*/ |
+ 0, /* tuning*/ |
+ 10, /* cq_level */ |
+ 0, /* rc_max_intra_bitrate_pct */ |
}; |
struct vpx_codec_alg_priv |
@@ -631,26 +620,21 @@ |
vpx_codec_priv_enc_mr_cfg_t *mr_cfg) |
{ |
vpx_codec_err_t res = VPX_CODEC_OK; |
- struct vpx_codec_alg_priv *priv; |
- vpx_codec_enc_cfg_t *cfg; |
- unsigned int i; |
- struct VP8_COMP *optr; |
vp8_rtcd(); |
if (!ctx->priv) |
{ |
- priv = calloc(1, sizeof(struct vpx_codec_alg_priv)); |
+ struct vpx_codec_alg_priv *priv = |
+ (struct vpx_codec_alg_priv *)vpx_calloc(1, sizeof(*priv)); |
if (!priv) |
{ |
return VPX_CODEC_MEM_ERROR; |
} |
- ctx->priv = &priv->base; |
- ctx->priv->sz = sizeof(*ctx->priv); |
- ctx->priv->alg_priv = priv; |
+ ctx->priv = (vpx_codec_priv_t *)priv; |
ctx->priv->init_flags = ctx->init_flags; |
if (ctx->config.enc) |
@@ -658,21 +642,11 @@ |
/* 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; |
+ priv->cfg = *ctx->config.enc; |
+ ctx->config.enc = &priv->cfg; |
} |
- cfg = &ctx->priv->alg_priv->cfg; |
- |
- /* Select the extra vp8 configuration table based on the current |
- * usage value. If the current usage value isn't found, use the |
- * values for usage case 0. |
- */ |
- for (i = 0; |
- extracfg_map[i].usage && extracfg_map[i].usage != cfg->g_usage; |
- i++); |
- |
- priv->vp8_cfg = extracfg_map[i].cfg; |
+ priv->vp8_cfg = default_extracfg; |
priv->vp8_cfg.pkt_list = &priv->pkt_list.head; |
priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 2; |
@@ -695,17 +669,10 @@ |
if (!res) |
{ |
- set_vp8e_config(&ctx->priv->alg_priv->oxcf, |
- ctx->priv->alg_priv->cfg, |
- ctx->priv->alg_priv->vp8_cfg, |
- mr_cfg); |
- |
- optr = vp8_create_compressor(&ctx->priv->alg_priv->oxcf); |
- |
- if (!optr) |
+ set_vp8e_config(&priv->oxcf, priv->cfg, priv->vp8_cfg, mr_cfg); |
+ priv->cpi = vp8_create_compressor(&priv->oxcf); |
+ if (!priv->cpi) |
res = VPX_CODEC_MEM_ERROR; |
- else |
- ctx->priv->alg_priv->cpi = optr; |
} |
} |
@@ -726,7 +693,7 @@ |
free(ctx->cx_data); |
vp8_remove_compressor(&ctx->cpi); |
- free(ctx); |
+ vpx_free(ctx); |
return VPX_CODEC_OK; |
} |
@@ -1278,6 +1245,9 @@ |
320, /* g_width */ |
240, /* g_height */ |
+ VPX_BITS_8, /* g_bit_depth */ |
+ 8, /* g_input_bit_depth */ |
+ |
{1, 30}, /* g_timebase */ |
0, /* g_error_resilient */ |
@@ -1346,10 +1316,10 @@ |
vp8e_destroy, /* vpx_codec_destroy_fn_t destroy; */ |
vp8e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ |
{ |
- NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */ |
- NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */ |
- NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */ |
- NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */ |
+ NULL, /* vpx_codec_peek_si_fn_t peek_si; */ |
+ NULL, /* vpx_codec_get_si_fn_t get_si; */ |
+ NULL, /* vpx_codec_decode_fn_t decode; */ |
+ NULL, /* vpx_codec_frame_get_fn_t frame_get; */ |
}, |
{ |
1, /* 1 cfg map */ |
@@ -1357,7 +1327,7 @@ |
vp8e_encode, /* vpx_codec_encode_fn_t encode; */ |
vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ |
vp8e_set_config, |
- NOT_IMPLEMENTED, |
+ NULL, |
vp8e_get_preview, |
vp8e_mr_alloc_mem, |
} /* encoder functions */ |