diff options
author | Clément Bœsch <ubitux@gmail.com> | 2013-04-17 14:07:46 +0400 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2013-04-17 21:18:08 +0400 |
commit | 3db3b278f2dcb16a710ff7052bbb40e99ba9c73a (patch) | |
tree | bb75086691d631db4158f2b809560db9c36c372a /libavfilter | |
parent | 7f2253078d3ea3051703358de9bde8c8ea16024a (diff) |
lavfi/lut: add direct path.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_lut.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 76db0f31db..be497ac14f 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -260,14 +260,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out; uint8_t *inrow, *outrow, *inrow0, *outrow0; - int i, j, plane; + int i, j, plane, direct = 0; + if (av_frame_is_writable(in)) { + direct = 1; + out = in; + } else { + /* TODO reindent */ 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 (lut->is_rgb) { /* packed */ @@ -316,7 +322,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } } - av_frame_free(&in); + if (!direct) + av_frame_free(&in); + return ff_filter_frame(outlink, out); } |