mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 20:43:10 +00:00
(sinc.c) Cleanup
This commit is contained in:
parent
9358114b9c
commit
7961d82e3c
@ -132,7 +132,6 @@ static INLINE double besseli0(double x)
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
|
|
||||||
double factorial = 1.0;
|
double factorial = 1.0;
|
||||||
double factorial_mult = 0.0;
|
double factorial_mult = 0.0;
|
||||||
double x_pow = 1.0;
|
double x_pow = 1.0;
|
||||||
@ -174,10 +173,10 @@ static void init_sinc_table(rarch_sinc_resampler_t *resamp, double cutoff,
|
|||||||
{
|
{
|
||||||
for (j = 0; j < taps; j++)
|
for (j = 0; j < taps; j++)
|
||||||
{
|
{
|
||||||
double window_phase, sinc_phase;
|
double sinc_phase;
|
||||||
float val;
|
float val;
|
||||||
int n = j * phases + i;
|
int n = j * phases + i;
|
||||||
window_phase = (double)n / (phases * taps); /* [0, 1). */
|
double window_phase = (double)n / (phases * taps); /* [0, 1). */
|
||||||
window_phase = 2.0 * window_phase - 1.0; /* [-1, 1) */
|
window_phase = 2.0 * window_phase - 1.0; /* [-1, 1) */
|
||||||
sinc_phase = sidelobes * window_phase;
|
sinc_phase = sidelobes * window_phase;
|
||||||
|
|
||||||
@ -190,6 +189,7 @@ static void init_sinc_table(rarch_sinc_resampler_t *resamp, double cutoff,
|
|||||||
if (calculate_delta)
|
if (calculate_delta)
|
||||||
{
|
{
|
||||||
int phase;
|
int phase;
|
||||||
|
|
||||||
for (p = 0; p < phases - 1; p++)
|
for (p = 0; p < phases - 1; p++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < taps; j++)
|
for (j = 0; j < taps; j++)
|
||||||
@ -204,9 +204,9 @@ static void init_sinc_table(rarch_sinc_resampler_t *resamp, double cutoff,
|
|||||||
for (j = 0; j < taps; j++)
|
for (j = 0; j < taps; j++)
|
||||||
{
|
{
|
||||||
float val, delta;
|
float val, delta;
|
||||||
double window_phase, sinc_phase;
|
double sinc_phase;
|
||||||
int n = j * phases + (phase + 1);
|
int n = j * phases + (phase + 1);
|
||||||
window_phase = (double)n / (phases * taps); /* (0, 1]. */
|
double window_phase = (double)n / (phases * taps); /* (0, 1]. */
|
||||||
window_phase = 2.0 * window_phase - 1.0; /* (-1, 1] */
|
window_phase = 2.0 * window_phase - 1.0; /* (-1, 1] */
|
||||||
sinc_phase = sidelobes * window_phase;
|
sinc_phase = sidelobes * window_phase;
|
||||||
|
|
||||||
@ -431,7 +431,6 @@ static void resampler_sinc_process(void *re_, struct resampler_data *data)
|
|||||||
rarch_sinc_resampler_t *re = (rarch_sinc_resampler_t*)re_;
|
rarch_sinc_resampler_t *re = (rarch_sinc_resampler_t*)re_;
|
||||||
|
|
||||||
uint32_t ratio = PHASES / data->ratio;
|
uint32_t ratio = PHASES / data->ratio;
|
||||||
|
|
||||||
const float *input = data->data_in;
|
const float *input = data->data_in;
|
||||||
float *output = data->data_out;
|
float *output = data->data_out;
|
||||||
size_t frames = data->input_frames;
|
size_t frames = data->input_frames;
|
||||||
@ -480,12 +479,11 @@ static void *resampler_sinc_new(const struct resampler_config *config,
|
|||||||
double cutoff;
|
double cutoff;
|
||||||
rarch_sinc_resampler_t *re = (rarch_sinc_resampler_t*)
|
rarch_sinc_resampler_t *re = (rarch_sinc_resampler_t*)
|
||||||
calloc(1, sizeof(*re));
|
calloc(1, sizeof(*re));
|
||||||
(void)config;
|
|
||||||
|
|
||||||
if (!re)
|
if (!re)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(re, 0, sizeof(*re));
|
(void)config;
|
||||||
|
|
||||||
re->taps = TAPS;
|
re->taps = TAPS;
|
||||||
cutoff = CUTOFF;
|
cutoff = CUTOFF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user