mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-19 05:40:56 +00:00
vf_boxblur: switch to filter_frame, boxblur did not support slices
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
05945c7f88
commit
250b122e3a
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user