Commit 28743f18 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/vf_median: implement percentile option

parent d9751a11
......@@ -13289,6 +13289,11 @@ Set which planes to process. Default is @code{15}, which is all available planes
Set vertical radius size. Default value is @code{0}.
Allowed range is integer from 0 to 127.
If it is 0, value will be picked from horizontal @code{radius} option.
@item percentile
Set median percentile. Default value is @code{0.5}.
Default value of @code{0.5} will pick always median values, while @code{0} will pick
minimum values, and @code{1} maximum values.
@end table
@subsection Commands
......
......@@ -31,6 +31,7 @@ typedef struct MedianContext {
int planes;
int radius;
int radiusV;
float percentile;
int planewidth[4];
int planeheight[4];
......
......@@ -60,6 +60,7 @@ static const AVOption median_options[] = {
{ "radius", "set median radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64=1}, 1, 127, FLAGS },
{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
{ "radiusV", "set median vertical radius", OFFSET(radiusV), AV_OPT_TYPE_INT, {.i64=0},0, 127, FLAGS },
{ "percentile", "set median percentile", OFFSET(percentile), AV_OPT_TYPE_FLOAT, {.dbl=.5}, 0., 1., FLAGS },
{ NULL }
};
......@@ -127,7 +128,7 @@ static void check_params(MedianContext *s, AVFilterLink *inlink)
}
}
s->t = 2 * s->radius * s->radiusV + 2 * s->radius;
s->t = (2 * s->radius * s->radiusV + s->radiusV + s->radius) * 2.f * s->percentile;
}
static int config_input(AVFilterLink *inlink)
......
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