ref: 74a4865ea20987d9adf612ca88f4c832905fffb8
parent: 4f4299de894cee1b49238114c80f5c865a1a6026
author: Paul Brossier <piem@piem.org>
date: Sun Oct 11 08:47:43 EDT 2009
src/spectral/fft.c: fix imag boundaries, including for odd fft sizes
--- a/src/spectral/fft.c
+++ b/src/spectral/fft.c
@@ -224,7 +224,7 @@
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_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]);
}