aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_unsharp.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-27 07:49:45 +0100
committerAnton Khirnov <anton@khirnov.net>2012-11-28 08:50:19 +0100
commit565e4993c63f797e2d50ad2f1e8f62fdbe299666 (patch)
treebae5282b2ee875de4b01467f3cfaab54b0ab6ec0 /libavfilter/vf_unsharp.c
parentbb6c67bb36b136de10256f0999128df4a42f9ffc (diff)
downloadffmpeg-565e4993c63f797e2d50ad2f1e8f62fdbe299666.tar.gz
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.
Diffstat (limited to 'libavfilter/vf_unsharp.c')
-rw-r--r--libavfilter/vf_unsharp.c28
1 files changed, 13 insertions, 15 deletions
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,
},