ref: 8da0033faf8dacd4a227d3fee5d98a64abcb9c4f
parent: de5d3f123debc4c03dad0ad15f2af5b7a444e0c0
author: Paul Brossier <piem@piem.org>
date: Sat Mar 16 11:38:21 EDT 2013
src/pitch/pitchyinfft.c: simplify a bit, preparing for #7
--- a/src/pitch/pitchyinfft.c
+++ b/src/pitch/pitchyinfft.c
@@ -109,17 +109,14 @@
p->winput->data[l] = p->win->data[l] * input->data[l];
}
aubio_fft_do (p->fft, p->winput, p->fftout);
- for (l = 0; l < p->fftout->length; l++) {
+ p->sqrmag->data[0] = SQR (p->fftout->norm[0]);
+ p->sqrmag->data[0] *= p->weight->data[0];
+ for (l = 1; l < p->fftout->length; l++) {
p->sqrmag->data[l] = SQR (p->fftout->norm[l]);
p->sqrmag->data[l] *= p->weight->data[l];
+ p->sqrmag->data[p->sqrmag->length - l] = p->sqrmag->data[l];
}
- for (l = 1; l < p->fftout->length; l++) {
- p->sqrmag->data[(p->fftout->length - 1) * 2 - l] =
- SQR (p->fftout->norm[l]);
- p->sqrmag->data[(p->fftout->length - 1) * 2 - l] *=
- p->weight->data[l];
- }
- for (l = 0; l < p->sqrmag->length / 2 + 1; l++) {
+ for (l = 0; l < p->fftout->length; l++) {
sum += p->sqrmag->data[l];
}
sum *= 2.;