aboutsummaryrefslogtreecommitdiffstats
path: root/examples/3_fir.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2022-05-22 13:37:49 -0400
committerClyne Sullivan <clyne@bitgloo.com>2022-05-22 13:37:49 -0400
commitf211f9628854b417000192c59d6ab22b946119b1 (patch)
tree9cd7ae6cb2a6598b056087389e0497026ad9d4c5 /examples/3_fir.cpp
parent660d967ec0ac79ea2a43946be4c056ef2d21ffc4 (diff)
make helper funcs inline; drop std::span for algo
Diffstat (limited to 'examples/3_fir.cpp')
-rw-r--r--examples/3_fir.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/3_fir.cpp b/examples/3_fir.cpp
index 3a68500..b6d8751 100644
--- a/examples/3_fir.cpp
+++ b/examples/3_fir.cpp
@@ -7,9 +7,9 @@
* within the available execution time. Samples are also normalized so that they center around zero.
*/
-Sample *process_data(Samples samples)
+Sample* process_data(Samples samples)
{
- static Sample buffer[samples.size()];
+ static Samples buffer;
// Define the filter:
constexpr unsigned int filter_size = 3;
@@ -21,7 +21,7 @@ Sample *process_data(Samples samples)
// Do an overlap-save convolution
static Sample prev[filter_size];
- for (int n = 0; n < samples.size(); n++) {
+ for (int n = 0; n < SIZE; n++) {
// Using a float variable for accumulation allows for better code optimization
float v = 0;
@@ -40,7 +40,7 @@ Sample *process_data(Samples samples)
// Save samples for next convolution
for (int i = 0; i < filter_size; i++)
- prev[i] = samples[samples.size() - filter_size + i];
+ prev[i] = samples[SIZE - filter_size + i];
return buffer;
}