[FFmpeg-devel] [PATCH] vf_boxblur: fix slice-drawing

Stefano Sabatini stefasab at gmail.com
Sun Oct 23 19:08:55 CEST 2011


This filter does not support slice-drawing, the whole blurred image needs
to be written in end_frame().
---
 libavfilter/vf_boxblur.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c
index 8d82c43..1f8e0f6 100644
--- a/libavfilter/vf_boxblur.c
+++ b/libavfilter/vf_boxblur.c
@@ -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}},
-};
\ No newline at end of file
+};
-- 
1.7.4.1



More information about the ffmpeg-devel mailing list