Commit 1679a40b authored by Stefano Sabatini's avatar Stefano Sabatini

vf_boxblur: fix slice-drawing

This filter does not support slice-drawing, the whole blurred image needs
to be written in end_frame().
parent 9eb867e1
...@@ -298,7 +298,9 @@ static void vblur(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_li ...@@ -298,7 +298,9 @@ static void vblur(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_li
h, radius, power, temp); 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; AVFilterContext *ctx = inlink->dst;
BoxBlurContext *boxblur = ctx->priv; BoxBlurContext *boxblur = ctx->priv;
...@@ -306,9 +308,9 @@ static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir) ...@@ -306,9 +308,9 @@ static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)
AVFilterBufferRef *inpicref = inlink ->cur_buf; AVFilterBufferRef *inpicref = inlink ->cur_buf;
AVFilterBufferRef *outpicref = outlink->out_buf; AVFilterBufferRef *outpicref = outlink->out_buf;
int plane; 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 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++) for (plane = 0; inpicref->data[plane] && plane < 4; plane++)
hblur(outpicref->data[plane], outpicref->linesize[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) ...@@ -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], w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane],
boxblur->temp); 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 = { AVFilter avfilter_vf_boxblur = {
...@@ -336,10 +339,11 @@ AVFilter avfilter_vf_boxblur = { ...@@ -336,10 +339,11 @@ AVFilter avfilter_vf_boxblur = {
.inputs = (AVFilterPad[]) {{ .name = "default", .inputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.config_props = config_input, .config_props = config_input,
.draw_slice = draw_slice, .draw_slice = null_draw_slice,
.end_frame = end_frame,
.min_perms = AV_PERM_READ }, .min_perms = AV_PERM_READ },
{ .name = NULL}}, { .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default", .outputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO, }, .type = AVMEDIA_TYPE_VIDEO, },
{ .name = NULL}}, { .name = NULL}},
}; };
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment