0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

filter_kernels: gaussian: redefine the parameter

Previously, this was based on some arbitrary range 1-100, cut off for
no particular reason, and also defined in such a way that higher values
= *less* smoothness. Since it wasn't multiplied by e in the code, the
default had to be 10*e = 28.8539...

Now, it's sane: 1.0 = default, higher = blurrier.
This commit is contained in:
Niklas Haas 2015-02-23 18:20:06 +01:00
parent a3733b53d3
commit 6765a7549b
No known key found for this signature in database
GPG Key ID: 3BA77D4BFDB10BCE

View File

@ -259,11 +259,7 @@ static double spline64(kernel *k, double x)
static double gaussian(kernel *k, double x) static double gaussian(kernel *k, double x)
{ {
double p = k->params[0]; double p = k->params[0];
if (p > 100.0) return pow(2.0, -(M_E / p) * x * x);
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) static double sinc(kernel *k, double x)
@ -347,7 +343,7 @@ const struct filter_kernel mp_filter_kernels[] = {
{"spline16", 2, spline16}, {"spline16", 2, spline16},
{"spline36", 3, spline36}, {"spline36", 3, spline36},
{"spline64", 4, spline64}, {"spline64", 4, spline64},
{"gaussian", -1, gaussian, .params = {28.85390081777927, NAN} }, {"gaussian", -1, gaussian, .params = {1.0, NAN} },
{"sinc", -1, sinc}, {"sinc", -1, sinc},
{"ewa_lanczos", -1, ewa_lanczos, .polar = true}, {"ewa_lanczos", -1, ewa_lanczos, .polar = true},
{"ewa_hanning", -1, ewa_hanning, .polar = true}, {"ewa_hanning", -1, ewa_hanning, .polar = true},