diff data/fft/FFTFileCache.cpp @ 183:146eb9e35baa

* Improve output from Profiler class and make it incur less (no) overhead in release builds with NO_TIMING defined * Fix a lock contention issue in spectrogram * Marginal optimisations elsewhere
author Chris Cannam
date Tue, 10 Oct 2006 14:51:17 +0000
parents b23eea68357e
children 91fdc752e540
line wrap: on
line diff
--- a/data/fft/FFTFileCache.cpp	Mon Oct 09 10:49:46 2006 +0000
+++ b/data/fft/FFTFileCache.cpp	Tue Oct 10 14:51:17 2006 +0000
@@ -89,6 +89,8 @@
 float
 FFTFileCache::getMagnitudeAt(size_t x, size_t y) const
 {
+    Profiler profiler("FFTFileCache::getMagnitudeAt", false);
+
     float value = 0.f;
 
     switch (m_storageType) {
@@ -294,3 +296,22 @@
         2 * sizeof(size_t); // matrix file header size
 }
 
+void
+FFTFileCache::populateReadBuf(size_t x) const
+{
+    Profiler profiler("FFTFileCache::populateReadBuf", false);
+
+    if (!m_readbuf) {
+        m_readbuf = new char[m_mfc->getHeight() * 2 * m_mfc->getCellSize()];
+    }
+    m_mfc->getColumnAt(x, m_readbuf);
+    if (m_mfc->haveSetColumnAt(x + 1)) {
+        m_mfc->getColumnAt
+            (x + 1, m_readbuf + m_mfc->getCellSize() * m_mfc->getHeight());
+        m_readbufWidth = 2;
+    } else {
+        m_readbufWidth = 1;
+    }
+    m_readbufCol = x;
+}
+