diff options
author | Bin Jin <bjin1990@gmail.com> | 2014-08-26 01:26:48 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-08-26 22:19:32 +0200 |
commit | 08b5dccd1212e442fa3105fc9f14ebe2e8fc445b (patch) | |
tree | 3b61f3ffde183ddc6f88b9bf889e6cea42c048f7 /video/out/filter_kernels.c | |
parent | b3e788d3f462e4f8acaf4ea9bf0cb07f8d622c7c (diff) | |
download | mpv-08b5dccd1212e442fa3105fc9f14ebe2e8fc445b.tar.bz2 mpv-08b5dccd1212e442fa3105fc9f14ebe2e8fc445b.tar.xz |
vo_opengl: add parameter to gaussian filter
Add a new parameter 'p' to gaussian filter. The new formula used
a different base taken from fmtconv plugin, so that the
new parameter is exactly same as the one used in Avisynth and
Vapoursynth.
The new default value is 2 / log(2) * 10, with the default value it
conforms to the original kernel taken from vector-agg.
Diffstat (limited to 'video/out/filter_kernels.c')
-rw-r--r-- | video/out/filter_kernels.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c index 66116ce18b..217bb25730 100644 --- a/video/out/filter_kernels.c +++ b/video/out/filter_kernels.c @@ -244,7 +244,12 @@ static double spline64(kernel *k, double x) static double gaussian(kernel *k, double x) { - return exp(-2.0 * x * x) * sqrt(2.0 / M_PI); + double p = k->params[0]; + if (p > 100.0) + p = 100.0; + if (p < 1.0) + p = 1.0; + return pow(2.0, -(p / 10.0) * x * x); } static double sinc(kernel *k, double x) @@ -292,7 +297,7 @@ const struct filter_kernel mp_filter_kernels[] = { {"spline16", 2, spline16}, {"spline36", 3, spline36}, {"spline64", 4, spline64}, - {"gaussian", 2, gaussian}, + {"gaussian", -1, gaussian, .params = {28.85390081777927, NAN} }, {"sinc2", 2, sinc}, {"sinc3", 3, sinc}, {"sinc4", 4, sinc}, |