diff options
author | Clément Bœsch <u@pkh.me> | 2014-05-16 08:53:18 +0400 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2014-05-16 08:53:18 +0400 |
commit | ed7bc5471b63b7e2f94047c2ff5d23486a068dce (patch) | |
tree | ccfa2f2ccf9b312bcffc481d43070a7c8c1a1e38 /libavfilter/vf_vignette.c | |
parent | 8a0ba44e1ac1707b9993504175b052e24bbf2b8c (diff) |
avfilter/vignette: add direct rendering.
Diffstat (limited to 'libavfilter/vf_vignette.c')
-rw-r--r-- | libavfilter/vf_vignette.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c index 647051a07f..049bfa646a 100644 --- a/libavfilter/vf_vignette.c +++ b/libavfilter/vf_vignette.c @@ -197,18 +197,23 @@ static inline double get_dither_value(VignetteContext *s) static int filter_frame(AVFilterLink *inlink, AVFrame *in) { - unsigned x, y; + unsigned x, y, direct = 0; AVFilterContext *ctx = inlink->dst; VignetteContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[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); + } if (s->eval_mode == EVAL_MODE_FRAME) update_context(s, inlink, in); @@ -268,7 +273,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } } - av_frame_free(&in); + if (!direct) + av_frame_free(&in); return ff_filter_frame(outlink, out); } |