diff options
author | Niklas Haas <git@nand.wakku.to> | 2016-01-07 11:43:14 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-01-07 12:17:34 +0100 |
commit | 82e81421d737dae9a54098d8dc9d174c764340be (patch) | |
tree | 6a9a27998a5eb6d10e4b1e7a8090c9c92b2e21f9 | |
parent | 0d05038790b3cd1725263a199bd4adb2334e837e (diff) | |
download | mpv-82e81421d737dae9a54098d8dc9d174c764340be.tar.bz2 mpv-82e81421d737dae9a54098d8dc9d174c764340be.tar.xz |
filter_kernels: improve the gaussian function
Commit 3909e4cd ended up losing the ability to tune the gaussian window,
which this commit trivially reintroduces.
The constant scaling factor (present in the code copied from glumpy)
also goes against filter_kernels.c conventions, which is that f(0.0) = 1
(and the invoking code takes care of normalization), and has been
removed.
The values of this new gaussian function corresponds to different
functions when compared against the old version. To translate the old
values p1 to the new values p2 requires solving 2^(e/p1) = e^(2/p2) or
p2 = p1 * 2/(e * ln(2)) ≈ p1 * 1.0615
In other words, to get the old default in the new function requires
setting scale-param1 to 1.0615. (The new function is *slightly* sharper
by default)
(Though most users should probably not notice the change)
-rw-r--r-- | video/out/filter_kernels.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c index fa3cb68041..fe5265c70c 100644 --- a/video/out/filter_kernels.c +++ b/video/out/filter_kernels.c @@ -289,7 +289,7 @@ static double spline64(params *p, double x) static double gaussian(params *p, double x) { - return exp(-2.0 * x * x) * sqrt(2.0 / M_PI); + return exp(-2.0 * x * x / p->params[0]); } static double sinc(params *p, double x) @@ -326,7 +326,7 @@ const struct filter_window mp_filter_windows[] = { {"welch", 1, welch}, {"kaiser", 1, kaiser, .params = {6.33, NAN} }, {"blackman", 1, blackman, .params = {0.16, NAN} }, - {"gaussian", 2, gaussian}, + {"gaussian", 2, gaussian, .params = {1.00, NAN} }, {"sinc", 1, sinc}, {"jinc", 1.2196698912665045, jinc}, {"sphinx", 1.4302966531242027, sphinx}, |