[FFmpeg-devel] [PATCH] Native VP9 decoder.

Kieran Kunhya kierank at obe.tv
Sun Sep 29 18:41:47 CEST 2013


>
> +    DECLARE_ALIGNED(16, uint8_t, edge_emu_buffer)[71*80];
> +
> +    DECLARE_ALIGNED(16, int16_t, block)[4096];
> +    uint8_t eob[256];
> +    DECLARE_ALIGNED(16, int16_t, uvblock)[2][1024];
> +    uint8_t uveob[2][64];
> +    VP56mv min_mv, max_mv;
> +    DECLARE_ALIGNED(16, uint8_t, tmp_y)[64*64];
> +    DECLARE_ALIGNED(16, uint8_t, tmp_uv)[2][32*32];
> +} VP9Context;
>

Presumably you'll be writing AVX2 from the beginning so perhaps make these
32-byte aligned?


> +static int update_size(AVCodecContext *ctx, int w, int h)
> +{
> +    VP9Context *s = ctx->priv_data;
> +
> +    if (s->above_partition_ctx && w == ctx->width && h == ctx->height)
> +        return 0;
> +
> +    ctx->width  = w;
> +    ctx->height = h;
> +    s->sb_cols  = (w + 63) >> 6;
> +    s->sb_rows  = (h + 63) >> 6;
> +    s->cols     = (w + 7) >> 3;
> +    s->rows     = (h + 7) >> 3;
> +    av_free(s->above_partition_ctx);
> +    s->above_partition_ctx = av_malloc(s->sb_cols * 368);
>
> Maybe want to #define some of these random numbers


> +    s->above_mv_ctx = (void *) (s->above_filter_ctx + s->sb_cols * 8);
> +    s->segmentation_map = av_malloc(s->sb_cols * s->sb_rows * 64);
> +    s->mv[0] = av_malloc(sizeof(*s->mv[0]) * s->sb_cols * s->sb_rows *
> 64);
> +    s->mv[1] = av_malloc(sizeof(*s->mv[1]) * s->sb_cols * s->sb_rows *
> 64);
> +    s->lflvl = av_malloc(sizeof(*s->lflvl) * s->sb_cols);
> +
> +    return 0;
> +}
>

unchecked mallocs

Looks good otherwise.


More information about the ffmpeg-devel mailing list