From c2c96f9b10e24f9975814f9079943c92c5856b88 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Mon, 23 Feb 2015 16:30:22 +0100 Subject: [PATCH] filter_kernels: add ewa_hanning This is suggested in a thesis by Andreas Gustafsson, and seems to produce very a bit less ringing than lanczos at high radius. --- video/out/filter_kernels.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c index 11aed8e1c2..a498234c7d 100644 --- a/video/out/filter_kernels.c +++ b/video/out/filter_kernels.c @@ -313,6 +313,15 @@ static double ewa_lanczos(kernel *k, double x) return jinc(k, x) * jinc(k, x * jinc_zero / radius); } +static double ewa_hanning(kernel *k, double x) +{ + double radius = k->radius; + if (fabs(x) >= radius) + return 0.0; + // Jinc windowed by the hanning window + return jinc(k, x) * hanning(k, x / radius); +} + static double blackman(kernel *k, double x) { double radius = k->size / 2; @@ -342,6 +351,7 @@ const struct filter_kernel mp_filter_kernels[] = { {"gaussian", -1, gaussian, .params = {28.85390081777927, NAN} }, {"sinc", -1, sinc}, {"ewa_lanczos", -1, ewa_lanczos, .polar = true}, + {"ewa_hanning", -1, ewa_hanning, .polar = true}, {"ginseng", -1, ginseng, .polar = true}, {"lanczos", -1, lanczos}, {"blackman", -1, blackman},