From: Paul Brossier Date: Sat, 16 Mar 2013 20:38:21 +0000 (-0500) Subject: src/pitch/pitchyinfft.c: simplify a bit, preparing for #7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8da0033faf8dacd4a227d3fee5d98a64abcb9c4f;p=aubio.git src/pitch/pitchyinfft.c: simplify a bit, preparing for #7 --- diff --git a/src/pitch/pitchyinfft.c b/src/pitch/pitchyinfft.c index b627ef2c..d4e9905d 100644 --- a/src/pitch/pitchyinfft.c +++ b/src/pitch/pitchyinfft.c @@ -109,17 +109,14 @@ aubio_pitchyinfft_do (aubio_pitchyinfft_t * p, fvec_t * input, fvec_t * output) 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.;