summaryrefslogtreecommitdiff
path: root/vp9/vp9_dx_iface.c
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2014-08-20 17:02:10 -0700
committerDmitry Kovalev <dkovalev@google.com>2014-08-28 13:51:37 -0700
commit73edeb03ea1730d3a602a888fc9beb2141d951d4 (patch)
treeaba54022795b04f5773c3cbc6c50b88fed11012d /vp9/vp9_dx_iface.c
parente9d106bd4571010c2224b2fcfdb69e50aa888494 (diff)
downloadlibvpx-73edeb03ea1730d3a602a888fc9beb2141d951d4.tar
libvpx-73edeb03ea1730d3a602a888fc9beb2141d951d4.tar.gz
libvpx-73edeb03ea1730d3a602a888fc9beb2141d951d4.tar.bz2
libvpx-73edeb03ea1730d3a602a888fc9beb2141d951d4.zip
Removing alg_priv from vpx_codec_priv struct.
In order to understand memory layout consider the declaration of the following structs. The first one is a part of our API: struct vpx_codec_ctx { // ... struct vpx_codec_priv *priv; }; The second one is defined in vpx_codec_internal.h: struct vpx_codec_priv { // ... }; The following struct is defined 4 times for encoder/decoder VP8/VP9: struct vpx_codec_alg_priv { struct vpx_codec_priv base; // ... }; Private data allocation for the given ctx: struct vpx_codec_ctx *ctx = <get> struct vpx_codec_alg_priv *alg_priv = <allocate> ctx->priv = (struct vpx_codec_priv *)alg_priv; The cast works because vpx_codec_alg_priv has a vpx_codec_priv instance as a first member 'base'. Change-Id: I10d1afc8c9a7dfda50baade8c7b0296678bdb0d0
Diffstat (limited to 'vp9/vp9_dx_iface.c')
-rw-r--r--vp9/vp9_dx_iface.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c
index 05d61c8a0..7909f5392 100644
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -58,28 +58,25 @@ static vpx_codec_err_t decoder_init(vpx_codec_ctx_t *ctx,
(void)data;
if (!ctx->priv) {
- vpx_codec_alg_priv_t *alg_priv = vpx_memalign(32, sizeof(*alg_priv));
+ vpx_codec_alg_priv_t *const alg_priv = vpx_memalign(32, sizeof(*alg_priv));
if (alg_priv == NULL)
return VPX_CODEC_MEM_ERROR;
vp9_zero(*alg_priv);
ctx->priv = (vpx_codec_priv_t *)alg_priv;
- ctx->priv->sz = sizeof(*ctx->priv);
- ctx->priv->alg_priv = alg_priv;
- ctx->priv->alg_priv->si.sz = sizeof(ctx->priv->alg_priv->si);
+ ctx->priv->sz = sizeof(*alg_priv);
ctx->priv->init_flags = ctx->init_flags;
- ctx->priv->alg_priv->flushed = 0;
- ctx->priv->alg_priv->frame_parallel_decode =
- (ctx->init_flags & VPX_CODEC_USE_FRAME_THREADING);
- // Disable frame parallel decoding for now.
- ctx->priv->alg_priv->frame_parallel_decode = 0;
+ alg_priv->si.sz = sizeof(alg_priv->si);
+ alg_priv->flushed = 0;
+ alg_priv->frame_parallel_decode =
+ (ctx->init_flags & VPX_CODEC_USE_FRAME_THREADING);
+ alg_priv->frame_parallel_decode = 0; // Disable for now
if (ctx->config.dec) {
- // Update the reference to the config structure to an internal copy.
- ctx->priv->alg_priv->cfg = *ctx->config.dec;
- ctx->config.dec = &ctx->priv->alg_priv->cfg;
+ alg_priv->cfg = *ctx->config.dec;
+ ctx->config.dec = &alg_priv->cfg;
}
}