diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-28 17:33:07 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-28 17:33:42 +0100 |
commit | 250b122e3ab12baeef4fb65c4d76df4fc506b899 (patch) | |
tree | b72087db2c8af864e01191f3d68cd589e379be1a /libavfilter/vf_boxblur.c | |
parent | 05945c7f8827d0309892a6eaf14696b686a0e41d (diff) | |
download | ffmpeg-250b122e3ab12baeef4fb65c4d76df4fc506b899.tar.gz |
vf_boxblur: switch to filter_frame, boxblur did not support slices
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_boxblur.c')
-rw-r--r-- | libavfilter/vf_boxblur.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c index 0989d1632d..9eea9b0e59 100644 --- a/libavfilter/vf_boxblur.c +++ b/libavfilter/vf_boxblur.c @@ -302,34 +302,39 @@ static void vblur(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_li h, radius, power, temp); } -static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { return 0; } - -static int end_frame(AVFilterLink *inlink) +static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in) { AVFilterContext *ctx = inlink->dst; BoxBlurContext *boxblur = ctx->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; - AVFilterBufferRef *inpicref = inlink ->cur_buf; - AVFilterBufferRef *outpicref = outlink->out_buf; + AVFilterBufferRef *out; int plane; - int cw = inlink->w >> boxblur->hsub, ch = inlink->h >> boxblur->vsub; + int cw = inlink->w >> boxblur->hsub, ch = in->video->h >> boxblur->vsub; int w[4] = { inlink->w, cw, cw, inlink->w }; - int h[4] = { inlink->h, ch, ch, inlink->h }; + int h[4] = { in->video->h, ch, ch, in->video->h }; - for (plane = 0; inpicref->data[plane] && plane < 4; plane++) - hblur(outpicref->data[plane], outpicref->linesize[plane], - inpicref ->data[plane], inpicref ->linesize[plane], + 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); + + for (plane = 0; in->data[plane] && plane < 4; plane++) + hblur(out->data[plane], out->linesize[plane], + in ->data[plane], in ->linesize[plane], w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane], boxblur->temp); - for (plane = 0; inpicref->data[plane] && plane < 4; plane++) - vblur(outpicref->data[plane], outpicref->linesize[plane], - outpicref->data[plane], outpicref->linesize[plane], + for (plane = 0; in->data[plane] && plane < 4; plane++) + vblur(out->data[plane], out->linesize[plane], + out->data[plane], out->linesize[plane], w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane], boxblur->temp); - ff_draw_slice(outlink, 0, inlink->h, 1); - return ff_end_frame(outlink); + avfilter_unref_bufferp(&in); + + return ff_filter_frame(outlink, out); } static const AVFilterPad avfilter_vf_boxblur_inputs[] = { @@ -337,8 +342,7 @@ static const AVFilterPad avfilter_vf_boxblur_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, - .draw_slice = null_draw_slice, - .end_frame = end_frame, + .filter_frame = filter_frame, .min_perms = AV_PERM_READ }, { NULL } |