int av_image_alloc(uint8_t *pointers[4], int linesizes[4],

                   int w, int h, enum PixelFormat pix_fmt, int align)

{

    int i, ret;

    uint8_t *buf;



    if ((ret = av_image_check_size(w, h, 0, NULL)) < 0)

        return ret;

    if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, w)) < 0)

        return ret;



    for (i = 0; i < 4; i++)

        linesizes[i] = FFALIGN(linesizes[i], align);



    if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, NULL, linesizes)) < 0)

        return ret;

    buf = av_malloc(ret + align);

    if (!buf)

        return AVERROR(ENOMEM);

    if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, buf, linesizes)) < 0) {

        av_free(buf);

        return ret;

    }

    if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL)

        ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);



    return ret;

}

int av_image_alloc(uint8_t *pointers[4], int linesizes[4],

                   int w, int h, enum PixelFormat pix_fmt, int align)

{

    int i, ret;

    uint8_t *buf;



    if ((ret = av_image_check_size(w, h, 0, NULL)) < 0)

        return ret;

    if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, w)) < 0)

        return ret;



    for (i = 0; i < 4; i++)

        linesizes[i] = FFALIGN(linesizes[i], align);



    if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, NULL, linesizes)) < 0)

        return ret;

    buf = av_malloc(ret + align);

    if (!buf)

        return AVERROR(ENOMEM);

    if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, buf, linesizes)) < 0) {

        av_free(buf);

        return ret;

    }

    if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL)

        ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);



    return ret;

}

    if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL)
int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],

                   int VAR_2, int VAR_3, enum PixelFormat VAR_4, int VAR_5)

{

    int VAR_6, VAR_7;

    uint8_t *buf;



    if ((VAR_7 = av_image_check_size(VAR_2, VAR_3, 0, NULL)) < 0)

        return VAR_7;

    if ((VAR_7 = av_image_fill_linesizes(VAR_1, VAR_4, VAR_2)) < 0)

        return VAR_7;



    for (VAR_6 = 0; VAR_6 < 4; VAR_6++)

        VAR_1[VAR_6] = FFALIGN(VAR_1[VAR_6], VAR_5);



    if ((VAR_7 = av_image_fill_pointers(VAR_0, VAR_4, VAR_3, NULL, VAR_1)) < 0)

        return VAR_7;

    buf = av_malloc(VAR_7 + VAR_5);

    if (!buf)

        return AVERROR(ENOMEM);

    if ((VAR_7 = av_image_fill_pointers(VAR_0, VAR_4, VAR_3, buf, VAR_1)) < 0) {

        av_free(buf);

        return VAR_7;

    }

    if (av_pix_fmt_descriptors[VAR_4].flags & PIX_FMT_PAL)

        ff_set_systematic_pal2((uint32_t*)VAR_0[1], VAR_4);



    return VAR_7;

}

int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],
int VAR_2, int VAR_3, enum PixelFormat VAR_4, int VAR_5)
{ int VAR_6, VAR_7; uint8_t *buf; if ((VAR_7 = av_image_check_size(VAR_2, VAR_3, 0, NULL)) < 0)
return VAR_7; if ((VAR_7 = av_image_fill_linesizes(VAR_1, VAR_4, VAR_2)) < 0)
return VAR_7; for (VAR_6 = 0; VAR_6 < 4; VAR_6++) VAR_1[VAR_6] = FFALIGN(VAR_1[VAR_6], VAR_5); if ((VAR_7 = av_image_fill_pointers(VAR_0, VAR_4, VAR_3, NULL, VAR_1)) < 0)
return VAR_7; buf = av_malloc(VAR_7 + VAR_5); if (!buf)
return AVERROR(ENOMEM); if ((VAR_7 = av_image_fill_pointers(VAR_0, VAR_4, VAR_3, buf, VAR_1)) < 0) { av_free(buf); return VAR_7; } if (av_pix_fmt_descriptors[VAR_4].flags & PIX_FMT_PAL)
ff_set_systematic_pal2((uint32_t*)VAR_0[1], VAR_4); return VAR_7; }