Mercurial > hg > svcore
comparison data/fft/FFTFileCacheReader.cpp @ 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 | 027d8b943be5 |
comparison
equal
deleted
inserted
replaced
1037:bf0e5944289b | 1038:cc27f35aa75c |
---|---|
38 m_storageType(writer->getStorageType()), | 38 m_storageType(writer->getStorageType()), |
39 m_factorSize(m_storageType == FFTCache::Compact ? 2 : 1), | 39 m_factorSize(m_storageType == FFTCache::Compact ? 2 : 1), |
40 m_mfc(new MatrixFile | 40 m_mfc(new MatrixFile |
41 (writer->getFileBase(), | 41 (writer->getFileBase(), |
42 MatrixFile::ReadOnly, | 42 MatrixFile::ReadOnly, |
43 m_storageType == FFTCache::Compact ? sizeof(uint16_t) : sizeof(float), | 43 int((m_storageType == FFTCache::Compact) ? sizeof(uint16_t) : sizeof(float)), |
44 writer->getWidth(), | 44 writer->getWidth(), |
45 writer->getHeight() * 2 + m_factorSize)) | 45 writer->getHeight() * 2 + m_factorSize)) |
46 { | 46 { |
47 // cerr << "FFTFileCacheReader: storage type is " << (storageType == FFTCache::Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << endl; | 47 // cerr << "FFTFileCacheReader: storage type is " << (storageType == FFTCache::Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << endl; |
48 } | 48 } |
75 float value = 0.f; | 75 float value = 0.f; |
76 | 76 |
77 switch (m_storageType) { | 77 switch (m_storageType) { |
78 | 78 |
79 case FFTCache::Compact: | 79 case FFTCache::Compact: |
80 value = (getFromReadBufCompactUnsigned(x, y * 2) / 65535.0) | 80 value = (getFromReadBufCompactUnsigned(x, y * 2) / 65535.f) |
81 * getNormalizationFactor(x); | 81 * getNormalizationFactor(x); |
82 break; | 82 break; |
83 | 83 |
84 case FFTCache::Rectangular: | 84 case FFTCache::Rectangular: |
85 { | 85 { |
103 float value = 0.f; | 103 float value = 0.f; |
104 | 104 |
105 switch (m_storageType) { | 105 switch (m_storageType) { |
106 | 106 |
107 case FFTCache::Compact: | 107 case FFTCache::Compact: |
108 value = getFromReadBufCompactUnsigned(x, y * 2) / 65535.0; | 108 value = getFromReadBufCompactUnsigned(x, y * 2) / 65535.f; |
109 break; | 109 break; |
110 | 110 |
111 case FFTCache::Rectangular: | 111 case FFTCache::Rectangular: |
112 case FFTCache::Polar: | 112 case FFTCache::Polar: |
113 { | 113 { |
134 float value = 0.f; | 134 float value = 0.f; |
135 | 135 |
136 switch (m_storageType) { | 136 switch (m_storageType) { |
137 | 137 |
138 case FFTCache::Compact: | 138 case FFTCache::Compact: |
139 value = (getFromReadBufCompactSigned(x, y * 2 + 1) / 32767.0) * M_PI; | 139 value = (getFromReadBufCompactSigned(x, y * 2 + 1) / 32767.f) * float(M_PI); |
140 break; | 140 break; |
141 | 141 |
142 case FFTCache::Rectangular: | 142 case FFTCache::Rectangular: |
143 { | 143 { |
144 float real, imag; | 144 float real, imag; |
185 switch (m_storageType) { | 185 switch (m_storageType) { |
186 | 186 |
187 case FFTCache::Compact: | 187 case FFTCache::Compact: |
188 for (int i = 0; i < count; ++i) { | 188 for (int i = 0; i < count; ++i) { |
189 int y = minbin + i * step; | 189 int y = minbin + i * step; |
190 values[i] = (getFromReadBufCompactUnsigned(x, y * 2) / 65535.0) | 190 values[i] = (getFromReadBufCompactUnsigned(x, y * 2) / 65535.f) |
191 * getNormalizationFactor(x); | 191 * getNormalizationFactor(x); |
192 } | 192 } |
193 break; | 193 break; |
194 | 194 |
195 case FFTCache::Rectangular: | 195 case FFTCache::Rectangular: |
222 return true; | 222 return true; |
223 } | 223 } |
224 return m_mfc->haveSetColumnAt(x); | 224 return m_mfc->haveSetColumnAt(x); |
225 } | 225 } |
226 | 226 |
227 int | 227 size_t |
228 FFTFileCacheReader::getCacheSize(int width, int height, | 228 FFTFileCacheReader::getCacheSize(int width, int height, |
229 FFTCache::StorageType type) | 229 FFTCache::StorageType type) |
230 { | 230 { |
231 return (height * 2 + (type == FFTCache::Compact ? 2 : 1)) * width * | 231 return (height * 2 + (type == FFTCache::Compact ? 2 : 1)) * width * |
232 (type == FFTCache::Compact ? sizeof(uint16_t) : sizeof(float)) + | 232 (type == FFTCache::Compact ? sizeof(uint16_t) : sizeof(float)) + |