Skip to content
  • Dmitry Kovalev's avatar
    Removing alg_priv from vpx_codec_priv struct. · 73edeb03
    Dmitry Kovalev authored
    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
    73edeb03