diff --git a/audio/sinc.c b/audio/sinc.c index 45550cf50d..b04b77a4ea 100644 --- a/audio/sinc.c +++ b/audio/sinc.c @@ -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; diff --git a/audio/test/snr.c b/audio/test/snr.c index f7602baa5f..3d96375ccd 100644 --- a/audio/test/snr.c +++ b/audio/test/snr.c @@ -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)