From 565e4993c63f797e2d50ad2f1e8f62fdbe299666 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 27 Nov 2012 07:49:45 +0100 Subject: lavfi: merge start_frame/draw_slice/end_frame Any alleged performance benefits gained from the split are purely mythological and do not justify added code complexity. --- libavfilter/vf_unsharp.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'libavfilter/vf_unsharp.c') diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 7e50bb8609..b446937898 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -214,36 +214,34 @@ static av_cold void uninit(AVFilterContext *ctx) free_filter_param(&unsharp->chroma); } -static int end_frame(AVFilterLink *link) +static int filter_frame(AVFilterLink *link, AVFilterBufferRef *in) { UnsharpContext *unsharp = link->dst->priv; - AVFilterBufferRef *in = link->cur_buf; - AVFilterBufferRef *out = link->dst->outputs[0]->out_buf; + AVFilterLink *outlink = link->dst->outputs[0]; + AVFilterBufferRef *out; int cw = SHIFTUP(link->w, unsharp->hsub); int ch = SHIFTUP(link->h, unsharp->vsub); - int ret; + + out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); + if (!out) { + avfilter_unref_bufferp(&in); + return AVERROR(ENOMEM); + } + avfilter_copy_buffer_ref_props(out, in); apply_unsharp(out->data[0], out->linesize[0], in->data[0], in->linesize[0], link->w, link->h, &unsharp->luma); apply_unsharp(out->data[1], out->linesize[1], in->data[1], in->linesize[1], cw, ch, &unsharp->chroma); apply_unsharp(out->data[2], out->linesize[2], in->data[2], in->linesize[2], cw, ch, &unsharp->chroma); - if ((ret = ff_draw_slice(link->dst->outputs[0], 0, link->h, 1)) < 0 || - (ret = ff_end_frame(link->dst->outputs[0])) < 0) - return ret; - return 0; -} - -static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir) -{ - return 0; + avfilter_unref_bufferp(&in); + return ff_filter_frame(outlink, out); } static const AVFilterPad avfilter_vf_unsharp_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .draw_slice = draw_slice, - .end_frame = end_frame, + .filter_frame = filter_frame, .config_props = config_props, .min_perms = AV_PERM_READ, }, -- cgit v1.2.3