3#include "common/dsp/block.h"
4#include "common/dsp/complex.h"
15 bool needs_reinit =
false;
16 std::vector<float> p_taps;
17 int p_buffer_size = 8192 * 8;
22 float **taps =
nullptr;
25 int aligned_tap_count;
41 for (
int i = 0; i < aligned_tap_count; i++)
45 if (buffer !=
nullptr)
49 buffer = dsp::create_volk_buffer<T>(p_buffer_size);
50 buffer_size = p_buffer_size;
53 align = volk_get_alignment();
54 aligned_tap_count = std::max<int>(1, align /
sizeof(T));
57 ntaps = p_taps.size();
60 this->taps = (
float **)volk_malloc(aligned_tap_count *
sizeof(
float *), align);
61 for (
int i = 0; i < aligned_tap_count; i++)
63 this->taps[i] = (
float *)volk_malloc((ntaps + aligned_tap_count - 1) *
sizeof(
float), align);
64 for (
int y = 0; y < ntaps + aligned_tap_count - 1; y++)
66 for (
int j = 0; j < ntaps; j++)
67 this->taps[i][i + j] = p_taps[(ntaps - 1) - j];
75 else if (key ==
"buffer_size")
78 throw satdump_exception(key);
85 p_taps = v.get<std::vector<float>>();
88 else if (key ==
"buffer_size")
91 throw satdump_exception(key);
cfg_res_t
set_cfg status.
Definition block.h:227
virtual bool work()=0
The actual looping work function meant to handle all the DSP (well, in most blocks)
Block(std::string id, std::vector< BlockIO > in={}, std::vector< BlockIO > out={})
Generic constructor, to be overloaded.
Definition block.h:206
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition fir.h:71
cfg_res_t set_cfg(std::string key, nlohmann::json v)
Set parameters of the block from JSON, including potentially IO configurations for blocks that may ha...
Definition fir.h:81
void init()
Applies current parameters to the block. This is called automatically once in start(),...
Definition fir.h:36