Skip to content

Commit

Permalink
Merge pull request #1262 from willcode/perf/volk-optimization
Browse files Browse the repository at this point in the history
plotter: use volk kernels for some calculations
  • Loading branch information
argilo authored Jun 23, 2023
2 parents 1f1f6d6 + 5d0b4cf commit 9da7616
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/qtgui/plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "bandplan.h"
#include "bookmarks.h"
#include "dxc_spots.h"
#include <volk/volk.h>

Q_LOGGING_CATEGORY(plotter, "plotter")

Expand Down Expand Up @@ -1876,6 +1877,7 @@ void CPlotter::setNewFftData(const float *fftData, int size)
// Reallocate and invalidate IIRs
m_fftData.resize(size);
m_fftIIR.resize(size);
m_X.resize(size);

m_MaxHoldValid = false;
m_MinHoldValid = false;
Expand Down Expand Up @@ -1934,12 +1936,9 @@ void CPlotter::setNewFftData(const float *fftData, int size)
&& a != 1.0; // IIR is NOP

if (needIIR) {
for (int i = 0; i < size; ++i)
{
const float v = m_fftData[i];
const float iir = m_fftIIR[i];
m_fftIIR[i] = iir * powf(v / iir, a);
}
volk_32f_x2_divide_32f(m_X.data(), m_fftData.data(), m_fftIIR.data(), size);
volk_32f_s32f_power_32f(m_X.data(), m_X.data(), a, size);
volk_32f_x2_multiply_32f(m_fftIIR.data(), m_fftIIR.data(), m_X.data(), size);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/qtgui/plotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public slots:
double m_histMaxIIR;
std::vector<float> m_fftIIR;
std::vector<float> m_fftData;
std::vector<float> m_X; // scratch array of matching size for local calculation
double m_wfbuf[MAX_SCREENSIZE]{}; // used for accumulating waterfall data at high time spans
float m_fftMaxHoldBuf[MAX_SCREENSIZE]{};
float m_fftMinHoldBuf[MAX_SCREENSIZE]{};
Expand Down

0 comments on commit 9da7616

Please sign in to comment.