#include "../external/kiss_fft/tools/kiss_fftr.h"
}
+#include <QDebug>
#include <QTime>
-#include <iostream>
#include <algorithm>
void FFTCorrelation::correlate(const int64_t *left, const int leftSize,
// Dividing by the max value is maybe not the best solution, but the
// maximum value after correlation should not be larger than the longest
// vector since each value should be at most 1
- int64_t maxLeft = 0;
- int64_t maxRight = 0;
+ int64_t maxLeft = 1;
+ int64_t maxRight = 1;
for (int i = 0; i < leftSize; ++i) {
if (labs(left[i]) > maxLeft) {
maxLeft = labs(left[i]);
// Now we can convolve to get the correlation
convolve(leftF, leftSize, rightF, rightSize, out_correlated);
- std::cout << "Correlation (FFT based) computed in " << t.elapsed() << " ms." << std::endl;
+ qDebug() << "Correlation (FFT based) computed in " << t.elapsed() << " ms.";
}
void FFTCorrelation::convolve(const float *left, const int leftSize,
kiss_fftr_free(fftConfig);
kiss_fftr_free(ifftConfig);
- std::cout << "FFT convolution computed. Time taken: " << time.elapsed() << " ms" << std::endl;
+ qDebug() << "FFT convolution computed. Time taken: " << time.elapsed() << " ms";
}