mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Create kaiser_window_function/lanzcos_window_function
This commit is contained in:
parent
c4d46ce09f
commit
7f9761afb6
2 changed files with 12 additions and 2 deletions
|
@ -118,9 +118,9 @@ typedef struct rarch_sinc_resampler
|
|||
} rarch_sinc_resampler_t;
|
||||
|
||||
#if defined(SINC_WINDOW_LANCZOS)
|
||||
#define window_function(idx) (sinc(M_PI * (idx)))
|
||||
#define window_function(idx) (lanzcos_window_function(idx))
|
||||
#elif defined(SINC_WINDOW_KAISER)
|
||||
#define window_function(idx) (besseli0(SINC_WINDOW_KAISER_BETA * sqrt(1 - (idx) * (idx))))
|
||||
#define window_function(idx) (kaiser_window_function(idx, SINC_WINDOW_KAISER_BETA))
|
||||
#else
|
||||
#error "No SINC window function defined."
|
||||
#endif
|
||||
|
|
|
@ -60,4 +60,14 @@ static INLINE double besseli0(double x)
|
|||
return sum;
|
||||
}
|
||||
|
||||
static INLINE double kaiser_window_function(double index, double beta)
|
||||
{
|
||||
return besseli0(beta * sqrtf(1 - index * index));
|
||||
}
|
||||
|
||||
static INLINE double lanzcos_window_function(double index)
|
||||
{
|
||||
return sinc(M_PI * index);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue