comparison data/fft/FFTFileCacheReader.cpp @ 1081:027d8b943be5

Do not attempt to switch from read-only to read-write mode if an error is pending (may cause mutex deadlock)
author Chris Cannam
date Wed, 10 Jun 2015 13:12:29 +0100
parents cc27f35aa75c
children 9f4505ac9072
comparison
equal deleted inserted replaced
1080:f35c1f9bfaa2 1081:027d8b943be5
21 #include "base/Profiler.h" 21 #include "base/Profiler.h"
22 #include "base/Thread.h" 22 #include "base/Thread.h"
23 #include "base/Exceptions.h" 23 #include "base/Exceptions.h"
24 24
25 #include <iostream> 25 #include <iostream>
26
27 //#define DEBUG_FFT_FILE_CACHE_READER 1
26 28
27 29
28 // The underlying matrix has height (m_height * 2 + 1). In each 30 // The underlying matrix has height (m_height * 2 + 1). In each
29 // column we store magnitude at [0], [2] etc and phase at [1], [3] 31 // column we store magnitude at [0], [2] etc and phase at [1], [3]
30 // etc, and then store the normalization factor (maximum magnitude) at 32 // etc, and then store the normalization factor (maximum magnitude) at
42 MatrixFile::ReadOnly, 44 MatrixFile::ReadOnly,
43 int((m_storageType == FFTCache::Compact) ? sizeof(uint16_t) : sizeof(float)), 45 int((m_storageType == FFTCache::Compact) ? sizeof(uint16_t) : sizeof(float)),
44 writer->getWidth(), 46 writer->getWidth(),
45 writer->getHeight() * 2 + m_factorSize)) 47 writer->getHeight() * 2 + m_factorSize))
46 { 48 {
47 // cerr << "FFTFileCacheReader: storage type is " << (storageType == FFTCache::Compact ? "Compact" : storageType == Polar ? "Polar" : "Rectangular") << endl; 49 #ifdef DEBUG_FFT_FILE_CACHE_READER
50 cerr << "FFTFileCacheReader: storage type is " << (m_storageType == FFTCache::Compact ? "Compact" : m_storageType == FFTCache::Polar ? "Polar" : "Rectangular") << endl;
51 #endif
48 } 52 }
49 53
50 FFTFileCacheReader::~FFTFileCacheReader() 54 FFTFileCacheReader::~FFTFileCacheReader()
51 { 55 {
52 if (m_readbuf) delete[] m_readbuf; 56 if (m_readbuf) delete[] m_readbuf;