22 #ifndef EDSP_BLACKMANHARRIS_HARRIS_HPP 23 #define EDSP_BLACKMANHARRIS_HARRIS_HPP 26 #include <edsp/meta/iterator.hpp> 29 namespace edsp {
namespace windowing {
45 template <
typename OutputIt>
47 using value_type = meta::value_type_t<OutputIt>;
48 using size_type = meta::diff_type_t<OutputIt>;
49 constexpr
auto a0 =
static_cast<value_type
>(0.35875);
50 constexpr
auto a1 =
static_cast<value_type
>(0.48829);
51 constexpr
auto a2 =
static_cast<value_type
>(0.14128);
52 constexpr
auto a3 =
static_cast<value_type
>(0.01168);
53 const auto size =
static_cast<size_type
>(
std::distance(first, last));
55 for (size_type i = 0; i < size; ++i, ++first) {
56 const value_type tmp = factor * i;
57 *first = a0 - a1 * std::cos(tmp) + a2 * std::cos(2 * tmp) - a3 * std::cos(3 * tmp);
63 #endif // EDSP_BLACKMANHARRIS_HARRIS_HPP constexpr void blackman_harris(OutputIt first, OutputIt last)
Computes a Blackman-Harris window of length N and stores the result in the range, beginning at d_firs...
Definition: blackman_harris.hpp:46
constexpr T distance(T x, T y) noexcept
Computes the distance between x and y.
Definition: numeric.hpp:328
Definition: constant.hpp:30
Definition: amplifier.hpp:29