]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_lagfun: add timeline support
authorPaul B Mahol <onemda@gmail.com>
Wed, 10 Feb 2021 23:30:07 +0000 (00:30 +0100)
committerPaul B Mahol <onemda@gmail.com>
Wed, 10 Feb 2021 23:45:08 +0000 (00:45 +0100)
libavfilter/vf_lagfun.c

index 8f088888411380ba25dc55920068b40046d54818..9e2e0726c73f3783539cc24fa6e2b3847a820865 100644 (file)
@@ -104,7 +104,11 @@ static int lagfun_frame8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
                 float v = FFMAX(src[x], osrc[x] * decay);
 
                 osrc[x] = v;
-                dst[x] = lrintf(v);
+                if (ctx->is_disabled) {
+                    dst[x] = src[x];
+                } else {
+                    dst[x] = lrintf(v);
+                }
             }
 
             src += in->linesize[p];
@@ -143,7 +147,11 @@ static int lagfun_frame16(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
                 float v = FFMAX(src[x], osrc[x] * decay);
 
                 osrc[x] = v;
-                dst[x] = lrintf(v);
+                if (ctx->is_disabled) {
+                    dst[x] = src[x];
+                } else {
+                    dst[x] = lrintf(v);
+                }
             }
 
             src += in->linesize[p] / 2;
@@ -256,6 +264,6 @@ AVFilter ff_vf_lagfun = {
     .uninit        = uninit,
     .outputs       = outputs,
     .inputs        = inputs,
-    .flags         = AVFILTER_FLAG_SLICE_THREADS,
+    .flags         = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
     .process_command = ff_filter_process_command,
 };