[FFmpeg-cvslog] avfilter/vf_deflicker: add bypass option

Paul B Mahol git at videolan.org
Mon May 15 22:34:27 EEST 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon May 15 21:32:44 2017 +0200| [4c55144ee969a63bb5e469e3ebd7179b7b3616e8] | committer: Paul B Mahol

avfilter/vf_deflicker: add bypass option

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c55144ee969a63bb5e469e3ebd7179b7b3616e8
---

 doc/filters.texi           | 3 +++
 libavfilter/vf_deflicker.c | 9 ++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index a86127f261..9611a41e28 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6394,6 +6394,9 @@ Power mean
 @item median
 Median
 @end table
+
+ at item bypass
+Do not actually modify frame. Useful when one only wants metadata.
 @end table
 
 @section dejudder
diff --git a/libavfilter/vf_deflicker.c b/libavfilter/vf_deflicker.c
index e748109c8b..2a33adc503 100644
--- a/libavfilter/vf_deflicker.c
+++ b/libavfilter/vf_deflicker.c
@@ -49,6 +49,7 @@ typedef struct DeflickerContext {
 
     int size;
     int mode;
+    int bypass;
 
     int eof;
     int depth;
@@ -84,6 +85,7 @@ static const AVOption deflicker_options[] = {
         { "cm",      "cubic mean",      0, AV_OPT_TYPE_CONST, {.i64=CUBIC_MEAN},       0, 0, FLAGS, "mode" },
         { "pm",      "power mean",      0, AV_OPT_TYPE_CONST, {.i64=POWER_MEAN},       0, 0, FLAGS, "mode" },
         { "median",  "median",          0, AV_OPT_TYPE_CONST, {.i64=MEDIAN},           0, 0, FLAGS, "mode" },
+    { "bypass", "leave frames unchanged",  OFFSET(bypass), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
     { NULL }
 };
 
@@ -377,9 +379,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
     }
 
     s->get_factor(ctx, &f);
-    s->deflicker(ctx, in->data[0], in->linesize[0], out->data[0], out->linesize[0],
-                 outlink->w, outlink->h, f);
-    for (y = 1; y < s->nb_planes; y++) {
+    if (!s->bypass)
+        s->deflicker(ctx, in->data[0], in->linesize[0], out->data[0], out->linesize[0],
+                     outlink->w, outlink->h, f);
+    for (y = 1 - s->bypass; y < s->nb_planes; y++) {
         av_image_copy_plane(out->data[y], out->linesize[y],
                             in->data[y], in->linesize[y],
                             s->planewidth[y] * (1 + (s->depth > 8)), s->planeheight[y]);



More information about the ffmpeg-cvslog mailing list