diff options
author | Clément Bœsch <ubitux@gmail.com> | 2013-04-03 00:21:11 +0200 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2013-04-03 00:30:48 +0200 |
commit | e366aec0305299f8f3e2057cc5a856c737944bc5 (patch) | |
tree | 3dc77ca5adaed8245edef3d6fdacb2b9b1e7a10e /libavfilter | |
parent | ccc25378bd1bb42b89deaef49febb06ce0e1a44b (diff) | |
download | ffmpeg-e366aec0305299f8f3e2057cc5a856c737944bc5.tar.gz |
lavfi/edgedetect: add direct path.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_edgedetect.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavfilter/vf_edgedetect.c b/libavfilter/vf_edgedetect.c index b582ab9685..16c6414211 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); } |