36 int width,
int height) :
39 m_storageType(storageType),
44 width, height * 2 + m_factorSize))
46 #ifdef DEBUG_FFT_FILE_CACHE_WRITER 47 cerr <<
"FFTFileCacheWriter: storage type is " << (storageType ==
FFTCache::Compact ?
"Compact" : storageType ==
FFTCache::Polar ?
"Polar" :
"Rectangular") <<
", size " << width <<
"x" << height << endl;
93 for (
int y = 0; y < h; ++y) {
94 ((uint16_t *)
m_writebuf)[y * 2] = uint16_t((mags[y] / factor) * 65535.0);
95 ((uint16_t *)
m_writebuf)[y * 2 + 1] = uint16_t(int16_t((phases[y] * 32767) / M_PI));
100 for (
int y = 0; y < h; ++y) {
101 ((
float *)
m_writebuf)[y * 2] = mags[y] * cosf(phases[y]);
102 ((
float *)
m_writebuf)[y * 2 + 1] = mags[y] * sinf(phases[y]);
107 for (
int y = 0; y < h; ++y) {
114 static float maxFactor = 0;
115 if (factor > maxFactor) maxFactor = factor;
116 #ifdef DEBUG_FFT_FILE_CACHE_WRITER 117 cerr <<
"Column " << x <<
": normalization factor: " << factor <<
", max " << maxFactor <<
" (height " <<
getHeight() <<
")" << endl;
135 for (
int y = 0; y < h; ++y) {
136 float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]);
137 if (mag > factor) factor = mag;
139 for (
int y = 0; y < h; ++y) {
140 float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]);
141 float phase = atan2f(imag[y], real[y]);
142 ((uint16_t *)
m_writebuf)[y * 2] = uint16_t((mag / factor) * 65535.0);
143 ((uint16_t *)
m_writebuf)[y * 2 + 1] = uint16_t(int16_t((phase * 32767) / M_PI));
148 for (
int y = 0; y < h; ++y) {
151 float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]);
152 if (mag > factor) factor = mag;
157 for (
int y = 0; y < h; ++y) {
158 float mag = sqrtf(real[y] * real[y] + imag[y] * imag[y]);
159 if (mag > factor) factor = mag;
161 float phase = atan2f(imag[y], real[y]);
167 static float maxFactor = 0;
168 if (factor > maxFactor) maxFactor = factor;
169 #ifdef DEBUG_FFT_FILE_CACHE_WRITER 170 cerr <<
"[RI] Column " << x <<
": normalization factor: " << factor <<
", max " << maxFactor <<
" (height " <<
getHeight() <<
")" << endl;
190 #ifdef DEBUG_FFT_FILE_CACHE_WRITER 191 SVDEBUG <<
"FFTFileCacheWriter::allColumnsWritten" << endl;
void setAutoClose(bool a)
If this is set true on a write-mode MatrixFile, then the file will close() itself when all columns ha...
void setColumnAt(int x, const void *data)
FFTFileCacheWriter(QString fileBase, FFTCache::StorageType storageType, int width, int height)
bool haveSetColumnAt(int x) const
QString getFileBase() const
void setColumnAt(int x, float *mags, float *phases, float factor)
bool haveSetColumnAt(int x) const
FFTCache::StorageType m_storageType
void setNormalizationFactorToWritebuf(float newfactor)
static int getCacheSize(int width, int height, FFTCache::StorageType type)