Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2013-04-03 02:21:11 +0400
committerClément Bœsch <ubitux@gmail.com>2013-04-03 02:30:48 +0400
commite366aec0305299f8f3e2057cc5a856c737944bc5 (patch)
tree3dc77ca5adaed8245edef3d6fdacb2b9b1e7a10e /libavfilter/vf_edgedetect.c
parentccc25378bd1bb42b89deaef49febb06ce0e1a44b (diff)
lavfi/edgedetect: add direct path.
Diffstat (limited to 'libavfilter/vf_edgedetect.c')
-rw-r--r--libavfilter/vf_edgedetect.c9
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);
}