diff options
author | Niklas Haas <git@nand.wakku.to> | 2015-03-27 06:36:27 +0100 |
---|---|---|
committer | Niklas Haas <git@nand.wakku.to> | 2015-04-04 15:36:14 +0200 |
commit | 13efec228ba3f01b45e397421eb6c7e498edd0a5 (patch) | |
tree | 632008d0ec5d542e9f063a892c9ccdb096b4ce57 /video | |
parent | 068ff812e4f958a83098e9ed27b2b96ffcab1eb2 (diff) |
filter_kernels: add bartlett, blackman and welch windows
Diffstat (limited to 'video')
-rw-r--r-- | video/out/filter_kernels.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c index 12ecd9edf4..b1e34a78e8 100644 --- a/video/out/filter_kernels.c +++ b/video/out/filter_kernels.c @@ -225,6 +225,19 @@ static double kaiser(params *p, double x) return bessel_i0(epsilon, a * sqrt(1 - x * x)) * i0a; } +static double blackman(params *p, double x) +{ + double a = p->params[0]; + double a0 = (1-a)/2.0, a1 = 1/2.0, a2 = a/2.0; + double pix = M_PI * x; + return a0 + a1*cos(pix) + a2*cos(2 * pix); +} + +static double welch(params *p, double x) +{ + return 1.0 - x*x; +} + // Family of cubic B/C splines static double cubic_bc(params *p, double x) { @@ -309,12 +322,15 @@ static double sphinx(params *p, double x) const struct filter_window mp_filter_windows[] = { {"box", 1, box}, {"triangle", 1, triangle}, + {"bartlett", 1, triangle}, {"hanning", 1, hanning}, {"hamming", 1, hamming}, {"quadric", 1.5, quadric}, + {"welch", 1, welch}, {"kaiser", 1, kaiser, .params = {6.33, NAN} }, {"hermite", 1, cubic_bc, .params = {0.0, 0.0} }, - {"gaussian", 2, gaussian, .params = {1.0, NAN} }, + {"blackman", 1, blackman, .params = {0.16, NAN} }, + {"gaussian", 2, gaussian, .params = {1.0, NAN} }, {"sinc", 1, sinc}, {"jinc", 1.2196698912665045, jinc}, {"sphinx", 1.4302966531242027, sphinx}, |