static int update_dimensions(VP8Context *s, int width, int height)

{

    if (width  != s->avctx->width ||

        height != s->avctx->height) {

        if (av_image_check_size(width, height, 0, s->avctx))

            return AVERROR_INVALIDDATA;



        vp8_decode_flush_impl(s->avctx, 1, 0, 1);



        avcodec_set_dimensions(s->avctx, width, height);

    }



    s->mb_width  = (s->avctx->coded_width +15) / 16;

    s->mb_height = (s->avctx->coded_height+15) / 16;



    s->macroblocks_base        = av_mallocz((s->mb_width+s->mb_height*2+1)*sizeof(*s->macroblocks));

    s->filter_strength         = av_mallocz(s->mb_width*sizeof(*s->filter_strength));

    s->intra4x4_pred_mode_top  = av_mallocz(s->mb_width*4);

    s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));

    s->top_border              = av_mallocz((s->mb_width+1)*sizeof(*s->top_border));



    if (!s->macroblocks_base || !s->filter_strength || !s->intra4x4_pred_mode_top ||

        !s->top_nnz || !s->top_border)

        return AVERROR(ENOMEM);



    s->macroblocks        = s->macroblocks_base + 1;



    return 0;

}

static int update_dimensions(VP8Context *s, int width, int height)

{

    if (width  != s->avctx->width ||

        height != s->avctx->height) {

        if (av_image_check_size(width, height, 0, s->avctx))

            return AVERROR_INVALIDDATA;



        vp8_decode_flush_impl(s->avctx, 1, 0, 1);



        avcodec_set_dimensions(s->avctx, width, height);

    }



    s->mb_width  = (s->avctx->coded_width +15) / 16;

    s->mb_height = (s->avctx->coded_height+15) / 16;



    s->macroblocks_base        = av_mallocz((s->mb_width+s->mb_height*2+1)*sizeof(*s->macroblocks));

    s->filter_strength         = av_mallocz(s->mb_width*sizeof(*s->filter_strength));

    s->intra4x4_pred_mode_top  = av_mallocz(s->mb_width*4);

    s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));

    s->top_border              = av_mallocz((s->mb_width+1)*sizeof(*s->top_border));



    if (!s->macroblocks_base || !s->filter_strength || !s->intra4x4_pred_mode_top ||

        !s->top_nnz || !s->top_border)

        return AVERROR(ENOMEM);



    s->macroblocks        = s->macroblocks_base + 1;



    return 0;

}

    if (width  != s->avctx->width ||
static int FUNC_0(VP8Context *VAR_0, int VAR_1, int VAR_2)

{

    if (VAR_1  != VAR_0->avctx->VAR_1 ||

        VAR_2 != VAR_0->avctx->VAR_2) {

        if (av_image_check_size(VAR_1, VAR_2, 0, VAR_0->avctx))

            return AVERROR_INVALIDDATA;



        vp8_decode_flush_impl(VAR_0->avctx, 1, 0, 1);



        avcodec_set_dimensions(VAR_0->avctx, VAR_1, VAR_2);

    }



    VAR_0->mb_width  = (VAR_0->avctx->coded_width +15) / 16;

    VAR_0->mb_height = (VAR_0->avctx->coded_height+15) / 16;



    VAR_0->macroblocks_base        = av_mallocz((VAR_0->mb_width+VAR_0->mb_height*2+1)*sizeof(*VAR_0->macroblocks));

    VAR_0->filter_strength         = av_mallocz(VAR_0->mb_width*sizeof(*VAR_0->filter_strength));

    VAR_0->intra4x4_pred_mode_top  = av_mallocz(VAR_0->mb_width*4);

    VAR_0->top_nnz                 = av_mallocz(VAR_0->mb_width*sizeof(*VAR_0->top_nnz));

    VAR_0->top_border              = av_mallocz((VAR_0->mb_width+1)*sizeof(*VAR_0->top_border));



    if (!VAR_0->macroblocks_base || !VAR_0->filter_strength || !VAR_0->intra4x4_pred_mode_top ||

        !VAR_0->top_nnz || !VAR_0->top_border)

        return AVERROR(ENOMEM);



    VAR_0->macroblocks        = VAR_0->macroblocks_base + 1;



    return 0;

}

static int FUNC_0(VP8Context *VAR_0, int VAR_1, int VAR_2)
{ if (VAR_1  != VAR_0->avctx->VAR_1 ||
VAR_2 != VAR_0->avctx->VAR_2) { if (av_image_check_size(VAR_1, VAR_2, 0, VAR_0->avctx))
return AVERROR_INVALIDDATA; vp8_decode_flush_impl(VAR_0->avctx, 1, 0, 1); avcodec_set_dimensions(VAR_0->avctx, VAR_1, VAR_2); } VAR_0->mb_width  = (VAR_0->avctx->coded_width +15) / 16; VAR_0->mb_height = (VAR_0->avctx->coded_height+15) / 16; VAR_0->macroblocks_base        = av_mallocz((VAR_0->mb_width+VAR_0->mb_height*2+1)*sizeof(*VAR_0->macroblocks)); VAR_0->filter_strength         = av_mallocz(VAR_0->mb_width*sizeof(*VAR_0->filter_strength)); VAR_0->intra4x4_pred_mode_top  = av_mallocz(VAR_0->mb_width*4); VAR_0->top_nnz                 = av_mallocz(VAR_0->mb_width*sizeof(*VAR_0->top_nnz)); VAR_0->top_border              = av_mallocz((VAR_0->mb_width+1)*sizeof(*VAR_0->top_border)); if (!VAR_0->macroblocks_base || !VAR_0->filter_strength || !VAR_0->intra4x4_pred_mode_top ||
!VAR_0->top_nnz || !VAR_0->top_border)
return AVERROR(ENOMEM); VAR_0->macroblocks        = VAR_0->macroblocks_base + 1; return 0; }