shithub: aubio

Download patch

ref: 8d388411b00a89d76fccf60abe1b2c5ccc2897c4
parent: 54eba9d8f30fdb122ba9d3903fdc9aa4d1bb046a
author: Paul Brossier <piem@piem.org>
date: Mon Oct 3 16:58:22 EDT 2016

src/spectral/ooura_fft8g.c: add cast to avoid conversion warnings

--- a/src/spectral/ooura_fft8g.c
+++ b/src/spectral/ooura_fft8g.c
@@ -2,7 +2,8 @@
 //  - replace all 'double' with 'smpl_t'
 //  - include "aubio_priv.h" (for config.h and types.h)
 //  - add missing prototypes
-//  - use COS and SIN macros
+//  - use COS, SIN, and ATAN macros
+//  - add cast to (smpl_t) to avoid float conversion warnings
 //  - declare initialization as static
 //  - prefix public function with aubio_ooura_
 
@@ -363,7 +364,7 @@
         a[0] += a[1];
         a[1] = xi;
     } else {
-        a[1] = 0.5 * (a[0] - a[1]);
+        a[1] = (smpl_t)0.5 * (a[0] - a[1]);
         a[0] -= a[1];
         if (n > 4) {
             rftbsub(n, a, nc, w + nw);
@@ -692,7 +693,7 @@
     ip[1] = 1;
     if (nw > 2) {
         nwh = nw >> 1;
-        delta = atan(1.0) / nwh;
+        delta = ATAN(1.0) / nwh;
         w[0] = 1;
         w[1] = 0;
         w[nwh] = COS(delta * nwh);
@@ -726,12 +727,12 @@
     ip[1] = nc;
     if (nc > 1) {
         nch = nc >> 1;
-        delta = atan(1.0) / nch;
-        c[0] = cos(delta * nch);
-        c[nch] = 0.5 * c[0];
+        delta = ATAN(1.0) / nch;
+        c[0] = COS(delta * nch);
+        c[nch] = (smpl_t)0.5 * c[0];
         for (j = 1; j < nch; j++) {
-            c[j] = 0.5 * cos(delta * j);
-            c[nc - j] = 0.5 * sin(delta * j);
+            c[j] = (smpl_t)0.5 * COS(delta * j);
+            c[nc - j] = (smpl_t)0.5 * SIN(delta * j);
         }
     }
 }
@@ -1587,7 +1588,7 @@
     for (j = 2; j < m; j += 2) {
         k = n - j;
         kk += ks;
-        wkr = 0.5 - c[nc - kk];
+        wkr = (smpl_t)0.5 - c[nc - kk];
         wki = c[kk];
         xr = a[j] - a[k];
         xi = a[j + 1] + a[k + 1];
@@ -1613,7 +1614,7 @@
     for (j = 2; j < m; j += 2) {
         k = n - j;
         kk += ks;
-        wkr = 0.5 - c[nc - kk];
+        wkr = (smpl_t)0.5 - c[nc - kk];
         wki = c[kk];
         xr = a[j] - a[k];
         xi = a[j + 1] + a[k + 1];