Mercurial > hg > svcore
diff data/fft/FFTMemoryCache.cpp @ 408:115f60df1e4d
* Speed up spectrogram painting by releasing mutex in FFTDataServer
while calculating data prior to writing it, and by adding whole-column
value query methods to FFT objects
* Add paint cache to Thumbwheel -- repaints of this widget were slowing
down the whole spectrogram repaint
* More uses of MutexLocker (named and with debug) and more profile
points
* Make startup much quicker some of the time, with OSC server in place
author | Chris Cannam |
---|---|
date | Thu, 08 May 2008 14:46:22 +0000 |
parents | 7cc6b7b0d819 |
children | 3cc4b7cd2aa5 |
line wrap: on
line diff
--- a/data/fft/FFTMemoryCache.cpp Tue Apr 29 15:34:17 2008 +0000 +++ b/data/fft/FFTMemoryCache.cpp Thu May 08 14:46:22 2008 +0000 @@ -65,6 +65,8 @@ void FFTMemoryCache::resize(size_t width, size_t height) { + Profiler profiler("FFTMemoryCache::resize"); + #ifdef DEBUG_FFT_MEMORY_CACHE std::cerr << "FFTMemoryCache[" << this << "]::resize(" << width << "x" << height << " = " << width*height << ")" << std::endl; #endif @@ -182,9 +184,12 @@ void FFTMemoryCache::setColumnAt(size_t x, float *mags, float *phases, float factor) { + Profiler profiler("FFTMemoryCache::setColumnAt: from polar"); + setNormalizationFactor(x, factor); if (m_storageType == Rectangular) { + Profiler subprof("FFTMemoryCache::setColumnAt: polar to cart"); for (size_t y = 0; y < m_height; ++y) { m_freal[x][y] = mags[y] * cosf(phases[y]); m_fimag[x][y] = mags[y] * sinf(phases[y]); @@ -202,6 +207,8 @@ void FFTMemoryCache::setColumnAt(size_t x, float *reals, float *imags) { + Profiler profiler("FFTMemoryCache::setColumnAt: from cart"); + float max = 0.0; switch (m_storageType) { @@ -217,15 +224,17 @@ case Compact: case Polar: + { + Profiler subprof("FFTMemoryCache::setColumnAt: cart to polar"); for (size_t y = 0; y < m_height; ++y) { float mag = sqrtf(reals[y] * reals[y] + imags[y] * imags[y]); float phase = atan2f(imags[y], reals[y]); - phase = princargf(phase); reals[y] = mag; imags[y] = phase; if (mag > max) max = mag; } break; + } }; if (m_storageType == Rectangular) {