From 4db271d148c2afd8d8b41d89524b5e13ae397ac3 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Sun, 13 Mar 2011 12:15:09 +0800 Subject: [PATCH] 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 --- src/spek-pipeline.vala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/spek-pipeline.vala b/src/spek-pipeline.vala index 100147f..bed4be4 100644 --- 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];