mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
added Lanczos window
This commit is contained in:
parent
f1f34d1123
commit
573f52a574
1 changed files with 18 additions and 0 deletions
18
window.hh
18
window.hh
|
|
@ -53,6 +53,24 @@ public:
|
|||
inline operator const TYPE * () const { return w; }
|
||||
};
|
||||
|
||||
template <int TAPS, typename TYPE>
|
||||
class Lanczos
|
||||
{
|
||||
TYPE w[TAPS];
|
||||
TYPE sinc(TYPE x)
|
||||
{
|
||||
return TYPE(0) == x ? TYPE(1) : std::sin(TYPE(M_PI) * x) / (TYPE(M_PI) * x);
|
||||
}
|
||||
public:
|
||||
Lanczos()
|
||||
{
|
||||
for (int n = 0; n < TAPS; ++n)
|
||||
w[n] = sinc(TYPE(2 * n) / TYPE(TAPS - 1) - TYPE(1));
|
||||
}
|
||||
inline TYPE operator () (int n) { return n >= 0 && n < TAPS ? w[n] : 0; }
|
||||
inline operator const TYPE * () const { return w; }
|
||||
};
|
||||
|
||||
template <int TAPS, typename TYPE>
|
||||
class Gauss
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue