mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-24 10:24:55 +00:00
Add cutoff.
This commit is contained in:
parent
60edff831a
commit
afa6776b1d
@ -45,8 +45,9 @@
|
||||
#define PHASES_WRAP (1 << (PHASE_BITS + SUBPHASE_BITS))
|
||||
#define FRAMES_SHIFT (PHASE_BITS + SUBPHASE_BITS)
|
||||
|
||||
#define SIDELOBES 16
|
||||
#define SIDELOBES 32
|
||||
#define TAPS (SIDELOBES * 2)
|
||||
#define CUTOFF 0.9
|
||||
|
||||
#define PHASE_INDEX 0
|
||||
#define DELTA_INDEX 1
|
||||
@ -94,7 +95,7 @@ static void init_sinc_table(ssnes_resampler_t *resamp)
|
||||
{
|
||||
double p = (double)i / PHASES;
|
||||
double sinc_phase = M_PI * (p + (SIDELOBES - 1 - j));
|
||||
resamp->phase_table[i][PHASE_INDEX][j] = sinc(sinc_phase) *
|
||||
resamp->phase_table[i][PHASE_INDEX][j] = CUTOFF * sinc(CUTOFF * sinc_phase) *
|
||||
lanzcos(sinc_phase / SIDELOBES);
|
||||
}
|
||||
}
|
||||
@ -114,7 +115,7 @@ static void init_sinc_table(ssnes_resampler_t *resamp)
|
||||
{
|
||||
double p = 1.0;
|
||||
double sinc_phase = M_PI * (p + (SIDELOBES - 1 - j));
|
||||
double phase = sinc(sinc_phase) * lanzcos(sinc_phase / SIDELOBES);
|
||||
double phase = CUTOFF * sinc(CUTOFF * sinc_phase) * lanzcos(sinc_phase / SIDELOBES);
|
||||
|
||||
float result = (phase - resamp->phase_table[PHASES - 1][PHASE_INDEX][j]) / SUBPHASES;
|
||||
resamp->phase_table[PHASES - 1][DELTA_INDEX][j] = result;
|
||||
|
@ -75,6 +75,8 @@ struct snr_result
|
||||
double phase;
|
||||
};
|
||||
|
||||
// This doesn't yet take account for slight phase distortions,
|
||||
// so reported SNR is lower than reality.
|
||||
static void calculate_snr(struct snr_result *res,
|
||||
double omega,
|
||||
float *orig, const float *resamp, size_t samples)
|
||||
|
Loading…
x
Reference in New Issue
Block a user