aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-08-18 03:09:36 -0700
committerChris Robinson <[email protected]>2017-08-18 03:09:36 -0700
commitd2e485cc6d04e0c75bd570c196edd12fa49ec053 (patch)
tree27410e1c7131cfe66ae77e873f4b2ee980dbad32
parentfdd5070c3b1945eec3553e5395faf1a99c5883f3 (diff)
Simplify bsincgen's Kaiser function
-rw-r--r--utils/bsincgen.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/utils/bsincgen.c b/utils/bsincgen.c
index 138f7a68..e4683ded 100644
--- a/utils/bsincgen.c
+++ b/utils/bsincgen.c
@@ -51,7 +51,7 @@
#define BSINC_REJECTION (60.0)
#define BSINC_POINTS_MIN (12)
-#define BSINC_ORDER (11)
+#define BSINC_ORDER (BSINC_POINTS_MIN - 1)
static double MinDouble(double a, double b)
{ return (a <= b) ? a : b; }
@@ -98,14 +98,9 @@ static double BesselI_0(const double x)
*/
static double Kaiser(const double b, const double k)
{
- double k2;
-
- if((k < -1.0) || (k > 1.0))
+ if(!(k >= -1.0 && k <= 1.0))
return 0.0;
-
- k2 = MaxDouble(1.0 - (k * k), 0.0);
-
- return BesselI_0(b * sqrt(k2)) / BesselI_0(b);
+ return BesselI_0(b * sqrt(1.0 - k*k)) / BesselI_0(b);
}
/* NOTE: Calculates the transition width of the Kaiser window. Rejection is