1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

vf_boxblur: fix slice-drawing

This filter does not support slice-drawing, the whole blurred image needs
to be written in end_frame().
This commit is contained in:
Stefano Sabatini 2011-10-23 18:57:07 +02:00
parent 9eb867e117
commit 1679a40b74

View File

@ -298,7 +298,9 @@ static void vblur(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_li
h, radius, power, temp);
}
static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)
static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
static void end_frame(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
BoxBlurContext *boxblur = ctx->priv;
@ -306,9 +308,9 @@ static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)
AVFilterBufferRef *inpicref = inlink ->cur_buf;
AVFilterBufferRef *outpicref = outlink->out_buf;
int plane;
int cw = inlink->w >> boxblur->hsub, ch = h0 >> boxblur->vsub;
int cw = inlink->w >> boxblur->hsub, ch = inlink->h >> boxblur->vsub;
int w[4] = { inlink->w, cw, cw, inlink->w };
int h[4] = { h0, ch, ch, h0 };
int h[4] = { inlink->h, ch, ch, inlink->h };
for (plane = 0; inpicref->data[plane] && plane < 4; plane++)
hblur(outpicref->data[plane], outpicref->linesize[plane],
@ -322,7 +324,8 @@ static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)
w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane],
boxblur->temp);
avfilter_draw_slice(outlink, y0, h0, slice_dir);
avfilter_draw_slice(outlink, 0, inlink->h, 1);
avfilter_end_frame(outlink);
}
AVFilter avfilter_vf_boxblur = {
@ -336,10 +339,11 @@ AVFilter avfilter_vf_boxblur = {
.inputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_input,
.draw_slice = draw_slice,
.draw_slice = null_draw_slice,
.end_frame = end_frame,
.min_perms = AV_PERM_READ },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO, },
{ .name = NULL}},
};
};