shithub: aubio

Download patch

ref: ac5f22ca55c59c732ac71f7c256fa21cf2cf349a
parent: 2d8880d5099451bcd23f551f7327df74067567fb
author: Paul Brossier <piem@piem.org>
date: Sat Nov 3 15:03:58 EDT 2007

src/fft.c: fix norm computation when HAVE_COMPLEX_H is undefined

--- a/src/fft.c
+++ b/src/fft.c
@@ -120,9 +120,9 @@
 
 void aubio_fft_getnorm(smpl_t * norm, fft_data_t * spectrum, uint_t size) {
   uint_t i;
-  norm[0] = SQR(spectrum[0]);
-  for (i=1;i<size/2;i++) norm[i] = (SQR(spectrum[i]) + SQR(spectrum[size-i]));
-  norm[size/2] = SQR(spectrum[size/2]);
+  norm[0] = spectrum[0];
+  for (i=1;i<size/2;i++) norm[i] = SQRT((SQR(spectrum[i]) + SQR(spectrum[size-i])));
+  norm[size/2] = spectrum[size/2];
 }
 
 void aubio_fft_getphas(smpl_t * phas, fft_data_t * spectrum, uint_t size) {