Commit 4c55144e authored by Paul B Mahol's avatar Paul B Mahol

avfilter/vf_deflicker: add bypass option

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 9bebad86
...@@ -6394,6 +6394,9 @@ Power mean ...@@ -6394,6 +6394,9 @@ Power mean
@item median @item median
Median Median
@end table @end table
@item bypass
Do not actually modify frame. Useful when one only wants metadata.
@end table @end table
@section dejudder @section dejudder
......
...@@ -49,6 +49,7 @@ typedef struct DeflickerContext { ...@@ -49,6 +49,7 @@ typedef struct DeflickerContext {
int size; int size;
int mode; int mode;
int bypass;
int eof; int eof;
int depth; int depth;
...@@ -84,6 +85,7 @@ static const AVOption deflicker_options[] = { ...@@ -84,6 +85,7 @@ static const AVOption deflicker_options[] = {
{ "cm", "cubic mean", 0, AV_OPT_TYPE_CONST, {.i64=CUBIC_MEAN}, 0, 0, FLAGS, "mode" }, { "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" }, { "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" }, { "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 } { NULL }
}; };
...@@ -377,9 +379,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) ...@@ -377,9 +379,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
} }
s->get_factor(ctx, &f); s->get_factor(ctx, &f);
s->deflicker(ctx, in->data[0], in->linesize[0], out->data[0], out->linesize[0], if (!s->bypass)
outlink->w, outlink->h, f); s->deflicker(ctx, in->data[0], in->linesize[0], out->data[0], out->linesize[0],
for (y = 1; y < s->nb_planes; y++) { 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], av_image_copy_plane(out->data[y], out->linesize[y],
in->data[y], in->linesize[y], in->data[y], in->linesize[y],
s->planewidth[y] * (1 + (s->depth > 8)), s->planeheight[y]); s->planewidth[y] * (1 + (s->depth > 8)), s->planeheight[y]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment