Provides methods to generate interpolation filters using Kaiser windows.
More...
#include "interpolation_filter.h"
Provides methods to generate interpolation filters using Kaiser windows.
Definition at line 28 of file interpolation_filter.h.
◆ InterpFilter() [1/2]
◆ InterpFilter() [2/2]
◆ ~InterpFilter()
| interp::InterpFilter::~InterpFilter |
( |
| ) |
|
|
default |
◆ getFilter()
Retrieves a span of precomputed filter values for a given delay.
- Parameters
-
| delay | The delay value for which the filter is retrieved. |
- Returns
- A span of precomputed filter values.
- Exceptions
-
| std::runtime_error | If the delay value is out of range. |
Definition at line 138 of file interpolation_filter.cpp.
139 {
141 {
142 LOG(Level::FATAL,
"Requested delay filter value out of range: {}", delay);
143 throw std::runtime_error("Requested delay filter value out of range");
144 }
145
147 std::min(
static_cast<std::size_t
>((delay + 1.0) * (
static_cast<RealType>(_table_filters) / 2.0)),
148 _table_filters - 1);
149 return std::span{_filter_table.data() +
filt * _length, _length};
150 }
double RealType
Type for real numbers.
References LOG, and max.
◆ getInstance()
◆ interpFilter()
| std::expected< RealType, std::string > interp::InterpFilter::interpFilter |
( |
RealType |
x | ) |
const |
|
noexcept |
Computes the interpolation filter value for a given input.
- Parameters
-
| x | The input value for which the interpolation filter is computed. |
- Returns
- The computed filter value, or an error message if computation fails.
Definition at line 85 of file interpolation_filter.cpp.
86 {
89 {
91 }
92
93 return std::unexpected(
kaiser.error());
94 }
static constexpr RealType sinc(const RealType x) noexcept
Computes the sinc function for a given input.
std::expected< RealType, std::string > kaiserWinCompute(RealType x) const noexcept
Computes the Kaiser window function for a given input.
References max.
◆ kaiserWinCompute()
| std::expected< RealType, std::string > interp::InterpFilter::kaiserWinCompute |
( |
RealType |
x | ) |
const |
|
noexcept |
Computes the Kaiser window function for a given input.
- Parameters
-
| x | The input value for the Kaiser window calculation. |
- Returns
- The computed window value, or an error message if computation fails.
Definition at line 70 of file interpolation_filter.cpp.
71 {
73 {
74 return 0;
75 }
76 auto bessel =
besselI0(_beta * std::sqrt(1 - std::pow((x - _alpha) / _alpha, 2)));
78 {
79 return *
bessel / _bessel_beta;
80 }
81
82 return std::unexpected(
bessel.error());
83 }
References max.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ sinc()
Computes the sinc function for a given input.
- Parameters
-
| x | The input value for which the sinc function is computed. |
- Returns
- The computed sinc value.
Definition at line 43 of file interpolation_filter.h.
44 {
45 return x == 0.0 ? 1.0 : std::sin(x *
PI) / (x *
PI);
46 }
constexpr RealType PI
Mathematical constant π (pi).
References PI.
The documentation for this class was generated from the following files: