resampler: better bessel function
Applied fix from RBJ to Bessel polynomial.
Benchmarked various implementations.
Chose HyperbolicCosineWindow because it is faster to compute and cleaner.
diff --git a/src/flowgraph/resampler/KaiserWindow.h b/src/flowgraph/resampler/KaiserWindow.h
index f45aced..9232917 100644
--- a/src/flowgraph/resampler/KaiserWindow.h
+++ b/src/flowgraph/resampler/KaiserWindow.h
@@ -17,11 +17,10 @@
#ifndef RESAMPLER_KAISER_WINDOW_H
#define RESAMPLER_KAISER_WINDOW_H
-#include "Math.h"
+#include <math.h>
namespace resampler {
-
/**
* Calculate a Kaiser window centered at 0.
*/
@@ -62,6 +61,10 @@
return bessel(w) * mInverseBesselBeta;
}
+ // Approximation of a
+ // modified zero order Bessel function of the first kind.
+ // Based on:
+ // https://dsp.stackexchange.com/questions/37714/kaiser-window-approximation
static double bessel(double x) {
double y = cosh(0.970941817426052 * x);
y += cosh(0.8854560256532099 * x);