Mercurial > hg > svcore
changeset 1136:e94719f941ba tony-2.0-integration
Return maximum through getNormalizedMagnitudesAt to avoid having to make more than one call
author | Chris Cannam |
---|---|
date | Tue, 20 Oct 2015 12:54:06 +0100 |
parents | 7fb1a7199e5b |
children | 444d133b5ab7 659372323b45 |
files | data/fft/FFTapi.h data/model/FFTModel.cpp data/model/FFTModel.h |
diffstat | 3 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/data/fft/FFTapi.h Wed Oct 14 10:19:48 2015 +0100 +++ b/data/fft/FFTapi.h Tue Oct 20 12:54:06 2015 +0100 @@ -75,7 +75,7 @@ fftf_free(m_output); } - std::vector<std::complex<float> > process(std::vector<float> in) const { + std::vector<std::complex<float> > process(const std::vector<float> &in) const { const int hs = m_size/2; for (int i = 0; i < hs; ++i) { m_input[i] = in[i + hs];
--- a/data/model/FFTModel.cpp Wed Oct 14 10:19:48 2015 +0100 +++ b/data/model/FFTModel.cpp Tue Oct 20 12:54:06 2015 +0100 @@ -155,7 +155,7 @@ return true; } -bool +float FFTModel::getNormalizedMagnitudesAt(int x, float *values, int minbin, int count) const { if (!getMagnitudesAt(x, values, minbin, count)) return false; @@ -169,7 +169,7 @@ values[i] /= max; } } - return true; + return max; } bool
--- a/data/model/FFTModel.h Wed Oct 14 10:19:48 2015 +0100 +++ b/data/model/FFTModel.h Tue Oct 20 12:54:06 2015 +0100 @@ -102,7 +102,7 @@ void getValuesAt(int x, int y, float &real, float &imaginary) const; bool isColumnAvailable(int x) const; bool getMagnitudesAt(int x, float *values, int minbin = 0, int count = 0) const; - bool getNormalizedMagnitudesAt(int x, float *values, int minbin = 0, int count = 0) const; + float getNormalizedMagnitudesAt(int x, float *values, int minbin = 0, int count = 0) const; // returns maximum of unnormalized magnitudes bool getPhasesAt(int x, float *values, int minbin = 0, int count = 0) const; bool getValuesAt(int x, float *reals, float *imaginaries, int minbin = 0, int count = 0) const;