Mercurial > hg > svcore
diff data/fft/FFTDataServer.h @ 383:94fc0591ea43 1.2-stable
* merge from trunk (1.2 ended up being tracked from trunk, but we may want
this branch for fixes later)
author | Chris Cannam |
---|---|
date | Wed, 27 Feb 2008 10:32:45 +0000 |
parents | aa8dbac62024 |
children | 115f60df1e4d |
line wrap: on
line diff
--- a/data/fft/FFTDataServer.h Fri Nov 30 17:36:14 2007 +0000 +++ b/data/fft/FFTDataServer.h Wed Feb 27 10:32:45 2008 +0000 @@ -135,8 +135,22 @@ size_t m_cacheWidth; size_t m_cacheWidthPower; size_t m_cacheWidthMask; - bool m_memoryCache; - bool m_compactCache; + + int m_lastUsedCache; + FFTCache *getCache(size_t x, size_t &col) { + col = x & m_cacheWidthMask; + int c = x >> m_cacheWidthPower; + // The only use of m_lastUsedCache without a lock is to + // establish whether a cache has been created at all (they're + // created on demand, but not destroyed until the server is). + if (c == m_lastUsedCache) return m_caches[c]; + else return getCacheAux(c); + } + bool haveCache(size_t x) { + int c = x >> m_cacheWidthPower; + if (c == m_lastUsedCache) return true; + else return (m_caches[c] != 0); + } typedef std::vector<FFTCache *> CacheVector; CacheVector m_caches; @@ -144,21 +158,9 @@ typedef std::deque<int> IntQueue; IntQueue m_dormantCaches; - int m_lastUsedCache; - FFTCache *getCache(size_t x, size_t &col) { - col = x % m_cacheWidth; - int c = x / m_cacheWidth; - // The only use of m_lastUsedCache without a lock is to - // establish whether a cache has been created at all (they're - // created on demand, but not destroyed until the server is). - if (c == m_lastUsedCache) return m_caches[c]; - else return getCacheAux(c); - } - bool haveCache(size_t x) { - int c = x / m_cacheWidth; - if (c == m_lastUsedCache) return true; - else return (m_caches[c] != 0); - } + StorageAdviser::Criteria m_criteria; + + void getStorageAdvice(size_t w, size_t h, bool &memory, bool &compact); FFTCache *getCacheAux(size_t c); QMutex m_writeMutex;