Minor cleanup to filter interfaces.

m17_demod_updates
Rob Riggs 2021-06-23 20:53:14 -05:00
rodzic 9050b65bfb
commit 514db60bc7
2 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -1,14 +1,14 @@
// Copyright 2015-2020 Mobilinkd LLC.
// Copyright 2015-2021 Mobilinkd LLC.
#pragma once
namespace mobilinkd
{
template <typename FloatType>
template <typename NumericType>
struct FilterBase
{
virtual FloatType operator()(FloatType input) = 0;
virtual NumericType operator()(NumericType input) = 0;
};
} // mobilinkd

Wyświetl plik

@ -13,7 +13,6 @@ namespace mobilinkd
template <typename FloatType, size_t N>
struct BaseFirFilter : FilterBase<FloatType>
{
using float_type = FloatType;
using array_t = std::array<FloatType, N>;
const array_t& taps_;
@ -26,12 +25,12 @@ struct BaseFirFilter : FilterBase<FloatType>
history_.fill(0.0);
}
float_type operator()(float_type input) override
FloatType operator()(FloatType input) override
{
history_[pos_++] = input;
if (pos_ == N) pos_ = 0;
float_type result = 0.0;
FloatType result = 0.0;
size_t index = pos_;
for (size_t i = 0; i != N; ++i)
@ -56,4 +55,5 @@ BaseFirFilter<FloatType, N> makeFirFilter(const std::array<FloatType, N>& taps)
return std::move(BaseFirFilter<FloatType, N>(taps));
}
} // mobilinkd