From 74a4865ea20987d9adf612ca88f4c832905fffb8 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 11 Oct 2009 12:47:43 +0200 Subject: [PATCH] src/spectral/fft.c: fix imag boundaries, including for odd fft sizes --- src/spectral/fft.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spectral/fft.c b/src/spectral/fft.c index 71acca64..b79fc064 100644 --- a/src/spectral/fft.c +++ b/src/spectral/fft.c @@ -224,7 +224,7 @@ void aubio_fft_get_norm(fvec_t * compspec, cvec_t * spectrum) { void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec) { uint_t i, j; for (i = 0; i < compspec->channels; i++) { - for (j = 1; j < compspec->length / 2 + 1; j++) { + for (j = 1; j < ( compspec->length + 1 ) / 2 /*- 1 + 1*/; j++) { compspec->data[i][compspec->length - j] = spectrum->norm[i][j]*SIN(spectrum->phas[i][j]); } @@ -234,7 +234,7 @@ void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec) { void aubio_fft_get_real(cvec_t * spectrum, fvec_t * compspec) { uint_t i, j; for (i = 0; i < compspec->channels; i++) { - for (j = 0; j< compspec->length / 2 + 1; j++) { + for (j = 0; j < compspec->length / 2 + 1; j++) { compspec->data[i][j] = spectrum->norm[i][j]*COS(spectrum->phas[i][j]); } -- 2.26.2