1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

M17: IirFilter code cleanup

This commit is contained in:
f4exb 2022-07-27 23:30:09 +02:00
parent 06a0f051e9
commit 820a5dc992

View File

@ -13,12 +13,9 @@ namespace modemm17
template <size_t N> template <size_t N>
struct BaseIirFilter : FilterBase<float> struct BaseIirFilter : FilterBase<float>
{ {
const std::array<float, N>& numerator_; BaseIirFilter(const std::array<float, N>& b, const std::array<float, N>& a) :
const std::array<float, N> denominator_; numerator_(b),
std::array<float, N> history_{0}; denominator_(a)
BaseIirFilter(const std::array<float, N>& b, const std::array<float, N>& a)
: numerator_(b), denominator_(a)
{ {
history_.fill(0.0); history_.fill(0.0);
} }
@ -40,11 +37,15 @@ struct BaseIirFilter : FilterBase<float>
return result; return result;
} }
private:
const std::array<float, N>& numerator_;
const std::array<float, N> denominator_;
std::array<float, N> history_{0};
}; };
template <size_t N> template <size_t N>
BaseIirFilter<N> makeIirFilter( BaseIirFilter<N> makeIirFilter(const std::array<float, N>& b, const std::array<float, N>& a)
const std::array<float, N>& b, const std::array<float, N>& a)
{ {
return std::move(BaseIirFilter<N>(b, a)); return std::move(BaseIirFilter<N>(b, a));
} }