Mercurial > hg > svcore
diff data/fft/FFTMemoryCache.h @ 509:6066bde1c126
* Cut back on the locking and general workload in
FFTDataServer::getMagnitudes(). This stuff is far too complicated!
author | Chris Cannam |
---|---|
date | Mon, 08 Dec 2008 11:15:13 +0000 |
parents | 115f60df1e4d |
children | 3cc4b7cd2aa5 |
line wrap: on
line diff
--- a/data/fft/FFTMemoryCache.h Fri Dec 05 16:18:04 2008 +0000 +++ b/data/fft/FFTMemoryCache.h Mon Dec 08 11:15:13 2008 +0000 @@ -55,8 +55,8 @@ virtual float getMagnitudeAt(size_t x, size_t y) const { if (m_storageType == Rectangular) { Profiler profiler("FFTMemoryCache::getMagnitudeAt: cart to polar"); - return sqrt(m_freal[x][y] * m_freal[x][y] + - m_fimag[x][y] * m_fimag[x][y]); + return sqrtf(m_freal[x][y] * m_freal[x][y] + + m_fimag[x][y] * m_fimag[x][y]); } else { return getNormalizedMagnitudeAt(x, y) * m_factor[x]; } @@ -97,6 +97,27 @@ } } + virtual void getMagnitudesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) const + { + if (m_storageType == Rectangular) { + for (size_t i = 0; i < count; ++i) { + size_t y = i * step + minbin; + values[i] = sqrtf(m_freal[x][y] * m_freal[x][y] + + m_fimag[x][y] * m_fimag[x][y]); + } + } else if (m_storageType == Polar) { + for (size_t i = 0; i < count; ++i) { + size_t y = i * step + minbin; + values[i] = m_fmagnitude[x][y] * m_factor[x]; + } + } else { + for (size_t i = 0; i < count; ++i) { + size_t y = i * step + minbin; + values[i] = (float(m_magnitude[x][y]) * m_factor[x]) / 65535.0; + } + } + } + virtual bool haveSetColumnAt(size_t x) const { return m_colset.get(x); }