spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit 4db271d148c2afd8d8b41d89524b5e13ae397ac3
parent 9fa493b97352a0c69837442a44cc49c3bfebf8f2
Author: Stefan Kost <ensonic@users.sf.net>
Date:   Sun, 13 Mar 2011 12:15:09 +0800

Avoid unneccesary extra fft runs

Before it was possible that we run an extra fft when the time for
sending a new message is due. Only do this if we have not run the
for the interval at all.

Ported from gst-plugins-good/1a32265

Diffstat:
Msrc/spek-pipeline.vala | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/spek-pipeline.vala b/src/spek-pipeline.vala @@ -228,13 +228,11 @@ namespace Spek { } frames++; - // If we have enough frames for an FFT or we - // have all frames required for the interval run - // an FFT. In the last case we probably take the - // FFT of frames that we already handled. + // If we have enough frames for an FFT or we have + // all frames required for the interval run and FFT. bool int_full = acc_error < cx.error_base && frames == cx.frames_per_interval; bool int_over = acc_error >= cx.error_base && frames == 1 + cx.frames_per_interval; - if (frames % nfft == 0 || int_full || int_over) { + if (frames % nfft == 0 || ((int_full || int_over) && num_fft == 0)) { prev_head = head; for (int i = 0; i < nfft; i++) { float val = input[(input_size + head - nfft + i) % input_size];