comparison data/fft/FFTMemoryCache.cpp @ 243:ff46f251139e

* Fix overzealous cacheing in waveform layer that was leading to inaccurate positioning of view rects & playback pointer on overview widget sometimes
author Chris Cannam
date Thu, 01 Mar 2007 17:12:50 +0000
parents b23eea68357e
children 260032c26c4f
comparison
equal deleted inserted replaced
242:2f7d27648806 243:ff46f251139e
27 { 27 {
28 } 28 }
29 29
30 FFTMemoryCache::~FFTMemoryCache() 30 FFTMemoryCache::~FFTMemoryCache()
31 { 31 {
32 std::cerr << "FFTMemoryCache[" << this << "]::~Cache" << std::endl; 32 // std::cerr << "FFTMemoryCache[" << this << "]::~Cache" << std::endl;
33 33
34 for (size_t i = 0; i < m_width; ++i) { 34 for (size_t i = 0; i < m_width; ++i) {
35 if (m_magnitude && m_magnitude[i]) free(m_magnitude[i]); 35 if (m_magnitude && m_magnitude[i]) free(m_magnitude[i]);
36 if (m_phase && m_phase[i]) free(m_phase[i]); 36 if (m_phase && m_phase[i]) free(m_phase[i]);
37 } 37 }
42 } 42 }
43 43
44 void 44 void
45 FFTMemoryCache::resize(size_t width, size_t height) 45 FFTMemoryCache::resize(size_t width, size_t height)
46 { 46 {
47 std::cerr << "FFTMemoryCache[" << this << "]::resize(" << width << "x" << height << " = " << width*height << ")" << std::endl; 47 // std::cerr << "FFTMemoryCache[" << this << "]::resize(" << width << "x" << height << " = " << width*height << ")" << std::endl;
48 48
49 if (m_width == width && m_height == height) return; 49 if (m_width == width && m_height == height) return;
50 50
51 resize(m_magnitude, width, height); 51 resize(m_magnitude, width, height);
52 resize(m_phase, width, height); 52 resize(m_phase, width, height);
55 m_factor = (float *)realloc(m_factor, width * sizeof(float)); 55 m_factor = (float *)realloc(m_factor, width * sizeof(float));
56 56
57 m_width = width; 57 m_width = width;
58 m_height = height; 58 m_height = height;
59 59
60 std::cerr << "done, width = " << m_width << " height = " << m_height << std::endl; 60 // std::cerr << "done, width = " << m_width << " height = " << m_height << std::endl;
61 } 61 }
62 62
63 void 63 void
64 FFTMemoryCache::resize(uint16_t **&array, size_t width, size_t height) 64 FFTMemoryCache::resize(uint16_t **&array, size_t width, size_t height)
65 { 65 {