diff options
author | Clément Bœsch <ubitux@gmail.com> | 2012-11-29 12:49:03 +0100 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-11-29 12:49:03 +0100 |
commit | ea3bad0e9e3e7253f3770946d61dfecc855244e5 (patch) | |
tree | c0e11db85c4c757e827dd36989b3152d782ade51 | |
parent | 9262f13269b1dfdd01deee4104a233f8916c1597 (diff) | |
download | ffmpeg-ea3bad0e9e3e7253f3770946d61dfecc855244e5.tar.gz |
lavfi/smartblur: switch to filter_frame.
-rw-r--r-- | libavfilter/vf_smartblur.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c index 2a83cd09c8..54ab2094fc 100644 --- a/libavfilter/vf_smartblur.c +++ b/libavfilter/vf_smartblur.c @@ -246,16 +246,21 @@ static void blur(uint8_t *dst, const int dst_linesize, } } -static int end_frame(AVFilterLink *inlink) +static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpic) { - int ret; SmartblurContext *sblur = inlink->dst->priv; - AVFilterBufferRef *inpic = inlink->cur_buf; AVFilterLink *outlink = inlink->dst->outputs[0]; - AVFilterBufferRef *outpic = outlink->out_buf; + AVFilterBufferRef *outpic; int cw = inlink->w >> sblur->hsub; int ch = inlink->h >> sblur->vsub; + outpic = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); + if (!outpic) { + avfilter_unref_bufferp(&inpic); + return AVERROR(ENOMEM); + } + avfilter_copy_buffer_ref_props(outpic, inpic); + blur(outpic->data[0], outpic->linesize[0], inpic->data[0], inpic->linesize[0], inlink->w, inlink->h, sblur->luma.threshold, @@ -272,16 +277,15 @@ static int end_frame(AVFilterLink *inlink) sblur->chroma.filter_context); } - if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0) - return ret; - return ff_end_frame(outlink); + avfilter_unref_bufferp(&inpic); + return ff_filter_frame(outlink, outpic); } static const AVFilterPad smartblur_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .end_frame = end_frame, + .filter_frame = filter_frame, .config_props = config_props, .min_perms = AV_PERM_READ, }, |