avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,

                                          int w, int h, enum PixelFormat format)

{

    AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));

    AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));



    if (!pic || !picref)

        goto fail;



    picref->buf = pic;

    picref->buf->free = ff_avfilter_default_free_buffer;

    if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))

        goto fail;



    picref->video->w = w;

    picref->video->h = h;



    /* make sure the buffer gets read permission or it's useless for output */

    picref->perms = perms | AV_PERM_READ;



    pic->refcount = 1;

    picref->type = AVMEDIA_TYPE_VIDEO;

    picref->format = format;



    memcpy(pic->data,        data,          sizeof(pic->data));

    memcpy(pic->linesize,    linesize,      sizeof(pic->linesize));

    memcpy(picref->data,     pic->data,     sizeof(picref->data));

    memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));



    return picref;



fail:

    if (picref && picref->video)

        av_free(picref->video);

    av_free(picref);

    av_free(pic);

    return NULL;

}

avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,

                                          int w, int h, enum PixelFormat format)

{

    AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));

    AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));



    if (!pic || !picref)

        goto fail;



    picref->buf = pic;

    picref->buf->free = ff_avfilter_default_free_buffer;

    if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))

        goto fail;



    picref->video->w = w;

    picref->video->h = h;



    

    picref->perms = perms | AV_PERM_READ;



    pic->refcount = 1;

    picref->type = AVMEDIA_TYPE_VIDEO;

    picref->format = format;



    memcpy(pic->data,        data,          sizeof(pic->data));

    memcpy(pic->linesize,    linesize,      sizeof(pic->linesize));

    memcpy(picref->data,     pic->data,     sizeof(picref->data));

    memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));



    return picref;



fail:

    if (picref && picref->video)

        av_free(picref->video);

    av_free(picref);

    av_free(pic);

    return NULL;

}

FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2,

                                          int VAR_3, int VAR_4, enum PixelFormat VAR_5)

{

    AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));

    AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));



    if (!pic || !picref)

        goto fail;



    picref->buf = pic;

    picref->buf->free = ff_avfilter_default_free_buffer;

    if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))

        goto fail;



    picref->video->VAR_3 = VAR_3;

    picref->video->VAR_4 = VAR_4;



    

    picref->VAR_2 = VAR_2 | AV_PERM_READ;



    pic->refcount = 1;

    picref->type = AVMEDIA_TYPE_VIDEO;

    picref->VAR_5 = VAR_5;



    memcpy(pic->VAR_0,        VAR_0,          sizeof(pic->VAR_0));

    memcpy(pic->VAR_1,    VAR_1,      sizeof(pic->VAR_1));

    memcpy(picref->VAR_0,     pic->VAR_0,     sizeof(picref->VAR_0));

    memcpy(picref->VAR_1, pic->VAR_1, sizeof(picref->VAR_1));



    return picref;



fail:

    if (picref && picref->video)

        av_free(picref->video);

    av_free(picref);

    av_free(pic);

    return NULL;

}

FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2,
int VAR_3, int VAR_4, enum PixelFormat VAR_5)
{ AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef)); if (!pic || !picref)
goto fail; picref->buf = pic; picref->buf->free = ff_avfilter_default_free_buffer; if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))
goto fail; picref->video->VAR_3 = VAR_3; picref->video->VAR_4 = VAR_4; picref->VAR_2 = VAR_2 | AV_PERM_READ; pic->refcount = 1; picref->type = AVMEDIA_TYPE_VIDEO; picref->VAR_5 = VAR_5; memcpy(pic->VAR_0,        VAR_0,          sizeof(pic->VAR_0)); memcpy(pic->VAR_1,    VAR_1,      sizeof(pic->VAR_1)); memcpy(picref->VAR_0,     pic->VAR_0,     sizeof(picref->VAR_0)); memcpy(picref->VAR_1, pic->VAR_1, sizeof(picref->VAR_1)); return picref; fail:
if (picref && picref->video)
av_free(picref->video); av_free(picref); av_free(pic); return NULL; }