My code is a template and can take any binary operator with associative and commutative properties (min/max, addition, multiplication, string concatenation…) Here it is, if anyone is interested:
SlidingOp.h
SlidingOp.hpp
Typical use:
Code: Select all
#include <algorithm>
#include "mfx/dsp/iir/SlidingOp.h"
struct MaxFtor { float operator () (float a, float b) { return std::max (a, b); } };
…
mfx::dsp::fir::SlidingOp <float, MaxFtor> sliding_max;
sliding_max.set_length (123);
…
output = sliding_max.process_sample (input);