Commit e366aec0 authored by Clément Bœsch's avatar Clément Bœsch

lavfi/edgedetect: add direct path.

parent ccc25378
......@@ -256,14 +256,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterLink *outlink = inlink->dst->outputs[0];
uint8_t *tmpbuf = edgedetect->tmpbuf;
uint16_t *gradients = edgedetect->gradients;
int direct = 0;
AVFrame *out;
if (av_frame_is_writable(in)) {
direct = 1;
out = in;
} else {
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
av_frame_free(&in);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out, in);
}
/* gaussian filter to reduce noise */
gaussian_blur(ctx, inlink->w, inlink->h,
......@@ -287,7 +293,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out->data[0], out->linesize[0],
tmpbuf, inlink->w);
av_frame_free(&in);
if (!direct)
av_frame_free(&in);
return ff_filter_frame(outlink, out);
}
......
......@@ -42,7 +42,7 @@ do_lavfi "crop_scale" "crop=iw-100:ih-100:100:100,scale=400:-1"
do_lavfi "crop_scale_vflip" "null,null,crop=iw-200:ih-200:200:200,crop=iw-20:ih-20:20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=iw-100:ih-100:100:100,vflip,scale=200:200,null,vflip,crop=iw-100:ih-100:100:100,null"
do_lavfi "crop_vflip" "crop=iw-100:ih-100:100:100,vflip"
do_lavfi "drawbox" "drawbox=224:24:88:72:#FF8010@0.5"
do_lavfi "edgedetect" "edgedetect"
do_lavfi "edgedetect" "format=gray,perms=random,edgedetect"
do_lavfi "fade" "fade=in:5:15,fade=out:30:15"
do_lavfi "hue" "perms=random,hue=s=sin(2*PI*t)+1"
do_lavfi "idet" "idet"
......
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