comparison data/fft/FFTFileCache.cpp @ 259:dc46851837d6

* Fix many compile warnings, remove some debug output
author Chris Cannam
date Mon, 30 Apr 2007 13:36:23 +0000
parents 91fdc752e540
children 2268963dabd1
comparison
equal deleted inserted replaced
258:96a6dd889c68 259:dc46851837d6
38 (fileBase, mode, 38 (fileBase, mode,
39 storageType == Compact ? sizeof(uint16_t) : sizeof(float), 39 storageType == Compact ? sizeof(uint16_t) : sizeof(float),
40 mode == MatrixFile::ReadOnly)), 40 mode == MatrixFile::ReadOnly)),
41 m_storageType(storageType) 41 m_storageType(storageType)
42 { 42 {
43 std::cerr << "FFTFileCache: storage type is " << (storageType == Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << std::endl; 43 // std::cerr << "FFTFileCache: storage type is " << (storageType == Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << std::endl;
44 } 44 }
45 45
46 FFTFileCache::~FFTFileCache() 46 FFTFileCache::~FFTFileCache()
47 { 47 {
48 if (m_readbuf) delete[] m_readbuf; 48 if (m_readbuf) delete[] m_readbuf;
232 static float maxFactor = 0; 232 static float maxFactor = 0;
233 if (factor > maxFactor) maxFactor = factor; 233 if (factor > maxFactor) maxFactor = factor;
234 // std::cerr << "Normalization factor: " << factor << ", max " << maxFactor << " (height " << getHeight() << ")" << std::endl; 234 // std::cerr << "Normalization factor: " << factor << ", max " << maxFactor << " (height " << getHeight() << ")" << std::endl;
235 235
236 if (m_storageType == Compact) { 236 if (m_storageType == Compact) {
237 ((uint16_t *)m_writebuf)[h * 2] = factor * 65535.0; 237 if (factor < 0.f || factor > 1.f) {
238 std::cerr << "WARNING: FFTFileCache::setColumnAt: Normalization factor " << factor << " out of range" << std::endl;
239 if (factor < 0.f) factor = 0.f;
240 if (factor > 1.f) factor = 1.f;
241 }
242 ((uint16_t *)m_writebuf)[h * 2] = (uint16_t)(factor * 65535.0);
238 } else { 243 } else {
239 ((float *)m_writebuf)[h * 2] = factor; 244 ((float *)m_writebuf)[h * 2] = factor;
240 } 245 }
241 m_mfc->setColumnAt(x, m_writebuf); 246 m_mfc->setColumnAt(x, m_writebuf);
242 } 247 }