static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *cur_buf)

{

    AlphaExtractContext *extract = inlink->dst->priv;

    AVFilterLink *outlink = inlink->dst->outputs[0];

    AVFilterBufferRef *out_buf =

        ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);

    int ret;



    if (!out_buf) {

        ret = AVERROR(ENOMEM);

        goto end;

    }

    avfilter_copy_buffer_ref_props(out_buf, cur_buf);



    if (extract->is_packed_rgb) {

        int x, y;

        uint8_t *pin, *pout;

        for (y = 0; y < out_buf->video->h; y++) {

            pin = cur_buf->data[0] + y * cur_buf->linesize[0] + extract->rgba_map[A];

            pout = out_buf->data[0] + y * out_buf->linesize[0];

            for (x = 0; x < out_buf->video->w; x++) {

                *pout = *pin;

                pout += 1;

                pin += 4;

            }

        }

    } else {

        const int linesize = FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]);

        int y;

        for (y = 0; y < out_buf->video->h; y++) {

            memcpy(out_buf->data[Y] + y * out_buf->linesize[Y],

                   cur_buf->data[A] + y * cur_buf->linesize[A],

                   linesize);

        }

    }



    ret = ff_filter_frame(outlink, out_buf);



end:

    avfilter_unref_buffer(cur_buf);

    return ret;

}

static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *cur_buf)

{

    AlphaExtractContext *extract = inlink->dst->priv;

    AVFilterLink *outlink = inlink->dst->outputs[0];

    AVFilterBufferRef *out_buf =

        ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);

    int ret;



    if (!out_buf) {

        ret = AVERROR(ENOMEM);

        goto end;

    }

    avfilter_copy_buffer_ref_props(out_buf, cur_buf);



    if (extract->is_packed_rgb) {

        int x, y;

        uint8_t *pin, *pout;

        for (y = 0; y < out_buf->video->h; y++) {

            pin = cur_buf->data[0] + y * cur_buf->linesize[0] + extract->rgba_map[A];

            pout = out_buf->data[0] + y * out_buf->linesize[0];

            for (x = 0; x < out_buf->video->w; x++) {

                *pout = *pin;

                pout += 1;

                pin += 4;

            }

        }

    } else {

        const int linesize = FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]);

        int y;

        for (y = 0; y < out_buf->video->h; y++) {

            memcpy(out_buf->data[Y] + y * out_buf->linesize[Y],

                   cur_buf->data[A] + y * cur_buf->linesize[A],

                   linesize);

        }

    }



    ret = ff_filter_frame(outlink, out_buf);



end:

    avfilter_unref_buffer(cur_buf);

    return ret;

}

        const int linesize = FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]);
static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)

{

    AlphaExtractContext *extract = VAR_0->dst->priv;

    AVFilterLink *outlink = VAR_0->dst->outputs[0];

    AVFilterBufferRef *out_buf =

        ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);

    int VAR_2;



    if (!out_buf) {

        VAR_2 = AVERROR(ENOMEM);

        goto end;

    }

    avfilter_copy_buffer_ref_props(out_buf, VAR_1);



    if (extract->is_packed_rgb) {

        int VAR_3, VAR_6;

        uint8_t *pin, *pout;

        for (VAR_6 = 0; VAR_6 < out_buf->video->h; VAR_6++) {

            pin = VAR_1->data[0] + VAR_6 * VAR_1->VAR_5[0] + extract->rgba_map[A];

            pout = out_buf->data[0] + VAR_6 * out_buf->VAR_5[0];

            for (VAR_3 = 0; VAR_3 < out_buf->video->w; VAR_3++) {

                *pout = *pin;

                pout += 1;

                pin += 4;

            }

        }

    } else {

        const int VAR_5 = FFMIN(out_buf->VAR_5[Y], VAR_1->VAR_5[A]);

        int VAR_6;

        for (VAR_6 = 0; VAR_6 < out_buf->video->h; VAR_6++) {

            memcpy(out_buf->data[Y] + VAR_6 * out_buf->VAR_5[Y],

                   VAR_1->data[A] + VAR_6 * VAR_1->VAR_5[A],

                   VAR_5);

        }

    }



    VAR_2 = ff_filter_frame(outlink, out_buf);



end:

    avfilter_unref_buffer(VAR_1);

    return VAR_2;

}

static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)
{ AlphaExtractContext *extract = VAR_0->dst->priv; AVFilterLink *outlink = VAR_0->dst->outputs[0]; AVFilterBufferRef *out_buf =
ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); int VAR_2; if (!out_buf) { VAR_2 = AVERROR(ENOMEM); goto end; } avfilter_copy_buffer_ref_props(out_buf, VAR_1); if (extract->is_packed_rgb) { int VAR_3, VAR_6; uint8_t *pin, *pout; for (VAR_6 = 0; VAR_6 < out_buf->video->h; VAR_6++) { pin = VAR_1->data[0] + VAR_6 * VAR_1->VAR_5[0] + extract->rgba_map[A]; pout = out_buf->data[0] + VAR_6 * out_buf->VAR_5[0]; for (VAR_3 = 0; VAR_3 < out_buf->video->w; VAR_3++) { *pout = *pin; pout += 1; pin += 4; } } } else { const int VAR_5 = FFMIN(out_buf->VAR_5[Y], VAR_1->VAR_5[A]); int VAR_6; for (VAR_6 = 0; VAR_6 < out_buf->video->h; VAR_6++) { memcpy(out_buf->data[Y] + VAR_6 * out_buf->VAR_5[Y],
VAR_1->data[A] + VAR_6 * VAR_1->VAR_5[A],
VAR_5); } } VAR_2 = ff_filter_frame(outlink, out_buf); end:
avfilter_unref_buffer(VAR_1); return VAR_2; }