Added pip command and fixed waterfall bug

This commit is contained in:
Alexandre 2021-11-16 13:23:52 -06:00
parent 7f6c555310
commit 10733f7a5d
3 changed files with 37 additions and 37 deletions

View File

@ -87,7 +87,7 @@ jobs:
run: brew update
- name: Install dependencies
run: brew install fftw glew glfw airspy airspyhf portaudio hackrf rtl-sdr libbladerf codec2
run: brew install fftw glew glfw airspy airspyhf portaudio hackrf rtl-sdr libbladerf codec2 && pip3 install mako
- name: Install volk
run: git clone --recursive https://github.com/gnuradio/volk && cd volk && mkdir build && cd build && cmake .. && make && sudo make install && cd ../../

View File

@ -25,42 +25,6 @@ float DEFAULT_COLOR_MAP[][3] = {
{0x4A, 0x00, 0x00}
};
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;
}
if (width > 524288) {
width = 524288;
}
float factor = (float)width / (float)outWidth;
if (fast) {
for (int i = 0; i < outWidth; i++) {
out[i] = data[(int)(offset + ((float)i * factor))];
}
}
else {
float sFactor = ceilf(factor);
float uFactor;
float id = offset;
float val, maxVal;
int sId;
uint32_t maxId;
for (int i = 0; i < outWidth; i++) {
maxVal = -INFINITY;
sId = (int)id;
uFactor = (sId + sFactor > width) ? sFactor - ((sId + sFactor) - width) : sFactor;
for (int j = 0; j < uFactor; j++) {
if (data[sId + j] > maxVal) { maxVal = data[sId + j]; }
}
out[i] = maxVal;
id += factor;
}
}
}
// TODO: Fix this hacky BS
double freq_ranges[] = {

View File

@ -81,6 +81,42 @@ namespace ImGui {
float* getFFTBuffer();
void pushFFT();
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;
}
if (width > 524288) {
width = 524288;
}
float factor = (float)width / (float)outWidth;
if (fast) {
for (int i = 0; i < outWidth; i++) {
out[i] = data[(int)(offset + ((float)i * factor))];
}
}
else {
float sFactor = ceilf(factor);
float uFactor;
float id = offset;
float val, maxVal;
int sId;
uint32_t maxId;
for (int i = 0; i < outWidth; i++) {
maxVal = -INFINITY;
sId = (int)id;
uFactor = (sId + sFactor > rawFFTSize) ? sFactor - ((sId + sFactor) - rawFFTSize) : sFactor;
for (int j = 0; j < uFactor; j++) {
if (data[sId + j] > maxVal) { maxVal = data[sId + j]; }
}
out[i] = maxVal;
id += factor;
}
}
}
void updatePallette(float colors[][3], int colorCount);
void updatePalletteFromArray(float* colors, int colorCount);