[FFmpeg-cvslog] avfilter/vf_lut2: add timeline support to tlut2 filter
Paul B Mahol
git at videolan.org
Mon May 14 19:28:50 EEST 2018
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon May 14 18:26:16 2018 +0200| [2bde38c0ab6c06aca6a5460055c5b1e1296732f3] | committer: Paul B Mahol
avfilter/vf_lut2: add timeline support to tlut2 filter
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2bde38c0ab6c06aca6a5460055c5b1e1296732f3
---
libavfilter/vf_lut2.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c
index 1385cba9b1..66c481e570 100644
--- a/libavfilter/vf_lut2.c
+++ b/libavfilter/vf_lut2.c
@@ -401,18 +401,26 @@ static av_cold int init(AVFilterContext *ctx)
static int tlut2_filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
- LUT2Context *s = inlink->dst->priv;
- AVFilterLink *outlink = inlink->dst->outputs[0];
+ AVFilterContext *ctx = inlink->dst;
+ LUT2Context *s = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
if (s->prev_frame) {
- AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
- if (!out) {
- av_frame_free(&s->prev_frame);
- s->prev_frame = frame;
- return AVERROR(ENOMEM);
+ AVFrame *out;
+
+ if (ctx->is_disabled) {
+ out = av_frame_clone(frame);
+ } else {
+ out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
+ if (!out) {
+ av_frame_free(&s->prev_frame);
+ s->prev_frame = frame;
+ return AVERROR(ENOMEM);
+ }
+
+ av_frame_copy_props(out, frame);
+ s->lut2(s, out, frame, s->prev_frame);
}
- av_frame_copy_props(out, frame);
- s->lut2(s, out, frame, s->prev_frame);
av_frame_free(&s->prev_frame);
s->prev_frame = frame;
return ff_filter_frame(outlink, out);
@@ -454,6 +462,7 @@ AVFilter ff_vf_tlut2 = {
.uninit = uninit,
.inputs = tlut2_inputs,
.outputs = tlut2_outputs,
+ .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
};
#endif
More information about the ffmpeg-cvslog
mailing list