comparison data/fft/FFTMemoryCache.h @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents 59e7fe1b1003
children
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
64 } 64 }
65 65
66 float getNormalizedMagnitudeAt(int x, int y) const { 66 float getNormalizedMagnitudeAt(int x, int y) const {
67 if (m_storageType == FFTCache::Rectangular) return getMagnitudeAt(x, y) / m_factor[x]; 67 if (m_storageType == FFTCache::Rectangular) return getMagnitudeAt(x, y) / m_factor[x];
68 else if (m_storageType == FFTCache::Polar) return m_fmagnitude[x][y]; 68 else if (m_storageType == FFTCache::Polar) return m_fmagnitude[x][y];
69 else return float(m_magnitude[x][y]) / 65535.0; 69 else return float(m_magnitude[x][y]) / 65535.f;
70 } 70 }
71 71
72 float getMaximumMagnitudeAt(int x) const { 72 float getMaximumMagnitudeAt(int x) const {
73 return m_factor[x]; 73 return m_factor[x];
74 } 74 }
79 return atan2f(m_fimag[x][y], m_freal[x][y]); 79 return atan2f(m_fimag[x][y], m_freal[x][y]);
80 } else if (m_storageType == FFTCache::Polar) { 80 } else if (m_storageType == FFTCache::Polar) {
81 return m_fphase[x][y]; 81 return m_fphase[x][y];
82 } else { 82 } else {
83 int16_t i = (int16_t)m_phase[x][y]; 83 int16_t i = (int16_t)m_phase[x][y];
84 return (float(i) / 32767.0) * M_PI; 84 return float(i / 32767.0 * M_PI);
85 } 85 }
86 } 86 }
87 87
88 void getValuesAt(int x, int y, float &real, float &imag) const { 88 void getValuesAt(int x, int y, float &real, float &imag) const {
89 if (m_storageType == FFTCache::Rectangular) { 89 if (m_storageType == FFTCache::Rectangular) {
112 values[i] = m_fmagnitude[x][y] * m_factor[x]; 112 values[i] = m_fmagnitude[x][y] * m_factor[x];
113 } 113 }
114 } else { 114 } else {
115 for (int i = 0; i < count; ++i) { 115 for (int i = 0; i < count; ++i) {
116 int y = i * step + minbin; 116 int y = i * step + minbin;
117 values[i] = (float(m_magnitude[x][y]) * m_factor[x]) / 65535.0; 117 values[i] = float(double(m_magnitude[x][y]) * m_factor[x] / 65535.0);
118 } 118 }
119 } 119 }
120 } 120 }
121 121
122 bool haveSetColumnAt(int x) const { 122 bool haveSetColumnAt(int x) const {
130 130
131 void setColumnAt(int x, float *reals, float *imags); 131 void setColumnAt(int x, float *reals, float *imags);
132 132
133 void allColumnsWritten() { } 133 void allColumnsWritten() { }
134 134
135 static int getCacheSize(int width, int height, 135 static size_t getCacheSize(int width, int height,
136 FFTCache::StorageType type); 136 FFTCache::StorageType type);
137 137
138 FFTCache::StorageType getStorageType() const { return m_storageType; } 138 FFTCache::StorageType getStorageType() const { return m_storageType; }
139 139
140 private: 140 private: