shithub: aubio

Download patch

ref: 6ab6611c26210d823233796d41b61a326ccaa06d
parent: 7cdabbe183f6b66bc8626db5b383aa418a496321
author: Paul Brossier <piem@piem.org>
date: Tue Feb 16 12:50:19 EST 2016

src/mathutils.c: use smpl_t for constants

--- a/src/mathutils.c
+++ b/src/mathutils.c
@@ -442,6 +442,7 @@
 
 smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t pos) {
   smpl_t s0, s1, s2; uint_t x0, x2;
+  smpl_t half = .5, two = 2.;
   if (pos == 0 || pos == x->length - 1) return pos;
   x0 = (pos < 1) ? pos : pos - 1;
   x2 = (pos + 1 < x->length) ? pos + 1 : pos;
@@ -450,7 +451,7 @@
   s0 = x->data[x0];
   s1 = x->data[pos];
   s2 = x->data[x2];
-  return pos + 0.5 * (s0 - s2 ) / (s0 - 2.* s1 + s2);
+  return pos + half * (s0 - s2 ) / (s0 - two * s1 + s2);
 }
 
 smpl_t fvec_quadratic_peak_mag (fvec_t *x, smpl_t pos) {