Slight performance improvement on detailed fft

This commit is contained in:
Ryzerth 2021-04-13 03:52:30 +02:00
parent cb8bbd7ccc
commit 58864b79e4

View File

@ -4,6 +4,7 @@
#include <GL/glew.h>
#include <imutils.h>
#include <algorithm>
#include <volk/volk.h>
#include <spdlog/spdlog.h>
@ -23,7 +24,7 @@ float DEFAULT_COLOR_MAP[][3] = {
{0x4A, 0x00, 0x00}
};
void doZoom(int offset, int width, int outWidth, float* data, float* out, bool fast) {
inline void doZoom(int offset, int width, int outWidth, float* data, float* out, bool fast) {
// NOTE: REMOVE THAT SHIT, IT'S JUST A HACKY FIX
if (offset < 0) {
offset = 0;
@ -38,21 +39,22 @@ void doZoom(int offset, int width, int outWidth, float* data, float* out, bool f
for (int i = 0; i < outWidth; i++) {
out[i] = data[(int)(offset + ((float)i * factor))];
}
return;
}
else {
float sFactor = ceilf(factor);
float id = offset;
float val, maxVal;
float next;
uint32_t maxId;
for (int i = 0; i < outWidth; i++) {
maxVal = -INFINITY;
for (int j = 0; j < factor; j++) {
for (int j = 0; j < sFactor; j++) {
if (data[(int)id + j] > maxVal) { maxVal = data[(int)id + j]; }
}
out[i] = maxVal;
id += factor;
}
}
}
// TODO: Fix this hacky BS