Mercurial > hg > svcore
comparison base/FFTCache.h @ 108:0c19e50bad7c
* add a column bitmap to the matrix file object to record which columns
are available (optimisation for refreshing during fft creation)
author | Chris Cannam |
---|---|
date | Mon, 08 May 2006 13:51:16 +0000 |
parents | c4e163f911dd |
children | 534373d65f39 |
comparison
equal
deleted
inserted
replaced
107:f258fd1f74b4 | 108:0c19e50bad7c |
---|---|
34 | 34 |
35 virtual float getMagnitudeAt(size_t x, size_t y) const = 0; | 35 virtual float getMagnitudeAt(size_t x, size_t y) const = 0; |
36 virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const = 0; | 36 virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const = 0; |
37 virtual float getPhaseAt(size_t x, size_t y) const = 0; | 37 virtual float getPhaseAt(size_t x, size_t y) const = 0; |
38 | 38 |
39 virtual void setNormalizationFactor(size_t x, float factor) = 0; | 39 virtual bool haveColumnAt(size_t x) const = 0; |
40 virtual void setMagnitudeAt(size_t x, size_t y, float mag) = 0; | |
41 virtual void setNormalizedMagnitudeAt(size_t x, size_t y, float norm) = 0; | |
42 virtual void setPhaseAt(size_t x, size_t y, float phase) = 0; | |
43 | |
44 virtual void setColumnAt(size_t x, float *mags, float *phases, float factor) = 0; | 40 virtual void setColumnAt(size_t x, float *mags, float *phases, float factor) = 0; |
45 | 41 |
46 bool isLocalPeak(size_t x, size_t y) const { | 42 bool isLocalPeak(size_t x, size_t y) const { |
47 float mag = getMagnitudeAt(x, y); | 43 float mag = getMagnitudeAt(x, y); |
48 if (y > 0 && mag < getMagnitudeAt(x, y - 1)) return false; | 44 if (y > 0 && mag < getMagnitudeAt(x, y - 1)) return false; |
122 if (x < m_width && y < m_height) { | 118 if (x < m_width && y < m_height) { |
123 m_phase[x][y] = uint16_t(int16_t((phase * 32767) / M_PI)); | 119 m_phase[x][y] = uint16_t(int16_t((phase * 32767) / M_PI)); |
124 } | 120 } |
125 } | 121 } |
126 | 122 |
123 virtual bool haveColumnAt(size_t x) const { | |
124 return true; | |
125 } | |
126 | |
127 virtual void setColumnAt(size_t x, float *mags, float *phases, float factor) { | 127 virtual void setColumnAt(size_t x, float *mags, float *phases, float factor) { |
128 setNormalizationFactor(x, factor); | 128 setNormalizationFactor(x, factor); |
129 for (size_t y = 0; y < m_height; ++y) { | 129 for (size_t y = 0; y < m_height; ++y) { |
130 setMagnitudeAt(x, y, mags[y]); | 130 setMagnitudeAt(x, y, mags[y]); |
131 setPhaseAt(x, y, phases[y]); | 131 setPhaseAt(x, y, phases[y]); |