Mercurial > hg > svcore
diff data/fft/FFTFileCache.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 | 3e0f1f7bec85 |
line wrap: on
line diff
--- a/data/fft/FFTFileCache.cpp Tue Apr 29 15:34:17 2008 +0000 +++ b/data/fft/FFTFileCache.cpp Thu May 08 14:46:22 2008 +0000 @@ -18,11 +18,10 @@ #include "fileio/MatrixFile.h" #include "base/Profiler.h" +#include "base/Thread.h" #include <iostream> -#include <QMutexLocker> - // The underlying matrix has height (m_height * 2 + 1). In each // column we store magnitude at [0], [2] etc and phase at [1], [3] @@ -69,7 +68,7 @@ void FFTFileCache::resize(size_t width, size_t height) { - QMutexLocker locker(&m_writeMutex); + MutexLocker locker(&m_writeMutex, "FFTFileCache::resize::m_writeMutex"); m_mfc->resize(width, height * 2 + m_factorSize); if (m_readbuf) { @@ -163,7 +162,7 @@ { float real, imag; getValuesAt(x, y, real, imag); - value = princargf(atan2f(imag, real)); + value = atan2f(imag, real); break; } @@ -203,7 +202,7 @@ void FFTFileCache::setColumnAt(size_t x, float *mags, float *phases, float factor) { - QMutexLocker locker(&m_writeMutex); + MutexLocker locker(&m_writeMutex, "FFTFileCache::setColumnAt::m_writeMutex"); size_t h = getHeight(); @@ -243,7 +242,7 @@ void FFTFileCache::setColumnAt(size_t x, float *real, float *imag) { - QMutexLocker locker(&m_writeMutex); + MutexLocker locker(&m_writeMutex, "FFTFileCache::setColumnAt::m_writeMutex"); size_t h = getHeight(); @@ -258,7 +257,7 @@ } for (size_t y = 0; y < h; ++y) { float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]); - float phase = princargf(atan2f(imag[y], real[y])); + float phase = atan2f(imag[y], real[y]); ((uint16_t *)m_writebuf)[y * 2] = uint16_t((mag / factor) * 65535.0); ((uint16_t *)m_writebuf)[y * 2 + 1] = uint16_t(int16_t((phase * 32767) / M_PI)); } @@ -278,7 +277,7 @@ float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]); if (mag > factor) factor = mag; ((float *)m_writebuf)[y * 2] = mag; - float phase = princargf(atan2f(imag[y], real[y])); + float phase = atan2f(imag[y], real[y]); ((float *)m_writebuf)[y * 2 + 1] = phase; } break;