kopia lustrzana https://github.com/mobilinkd/m17-cxx-demod
Minor cleanup to filter interfaces.
rodzic
9050b65bfb
commit
514db60bc7
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Ładowanie…
Reference in New Issue