diff data/fft/FFTDataServer.cpp @ 556:53e5dc8439e7

* get whole columns at a time from fft model when running transform
author Chris Cannam
date Mon, 09 Feb 2009 11:53:29 +0000
parents 107d3f3705c9
children dfc4dd561bb6
line wrap: on
line diff
--- a/data/fft/FFTDataServer.cpp	Mon Feb 09 11:38:08 2009 +0000
+++ b/data/fft/FFTDataServer.cpp	Mon Feb 09 11:53:29 2009 +0000
@@ -1083,6 +1083,36 @@
 }
 
 bool
+FFTDataServer::getValuesAt(size_t x, float *reals, float *imaginaries, size_t minbin, size_t count, size_t step)
+{
+    Profiler profiler("FFTDataServer::getValuesAt", false);
+
+    if (x >= m_width) return false;
+
+    if (minbin >= m_height) minbin = m_height - 1;
+    if (count == 0) count = (m_height - minbin) / step;
+    else if (minbin + count * step > m_height) {
+        count = (m_height - minbin) / step;
+    }
+
+    size_t col;
+    FFTCacheReader *cache = getCacheReader(x, col);
+    if (!cache) return false;
+
+    //!!! n.b. can throw
+    if (!cache->haveSetColumnAt(col)) {
+        Profiler profiler("FFTDataServer::getValuesAt: filling");
+        fillColumn(x);
+    }
+
+    for (size_t i = 0; i < count; ++i) {
+        cache->getValuesAt(col, i * step + minbin, reals[i], imaginaries[i]);
+    }
+
+    return true;
+}
+
+bool
 FFTDataServer::isColumnReady(size_t x)
 {
     Profiler profiler("FFTDataServer::isColumnReady", false);