[FFmpeg-cvslog] lavfi/edgedetect: add direct path.
Clément Bœsch
git at videolan.org
Wed Apr 3 00:34:43 CEST 2013
ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Wed Apr 3 00:21:11 2013 +0200| [e366aec0305299f8f3e2057cc5a856c737944bc5] | committer: Clément Bœsch
lavfi/edgedetect: add direct path.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e366aec0305299f8f3e2057cc5a856c737944bc5
---
libavfilter/vf_edgedetect.c | 9 ++++++++-
tests/lavfi-regression.sh | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_edgedetect.c b/libavfilter/vf_edgedetect.c
index b582ab9..16c6414 100644
--- a/libavfilter/vf_edgedetect.c
+++ b/libavfilter/vf_edgedetect.c
@@ -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);
}
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh
index 6460742..bb023e4 100755
--- a/tests/lavfi-regression.sh
+++ b/tests/lavfi-regression.sh
@@ -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 at 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"
More information about the ffmpeg-cvslog
mailing list