mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-18 15:01:07 +00:00
Add tests for fixed point sinc.
This commit is contained in:
parent
7b12182a0f
commit
45481634f2
@ -1,6 +1,6 @@
|
||||
TESTS := test-hermite test-sinc test-snr-sinc test-snr-hermite
|
||||
TESTS := test-hermite test-sinc test-sinc-fixed test-snr-sinc test-snr-hermite
|
||||
|
||||
CFLAGS += -O3 -g -Wall -pedantic -std=gnu99 -DRESAMPLER_TEST -march=native
|
||||
CFLAGS += -O3 -g -Wall -pedantic -std=gnu99 -DRESAMPLER_TEST
|
||||
LDFLAGS += -lm
|
||||
|
||||
all: $(TESTS)
|
||||
@ -11,12 +11,18 @@ test-hermite: ../hermite.o ../utils.o main.o
|
||||
test-sinc: ../sinc.o ../utils.o main.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc-fixed: ../sinc-fixed.o main-fixed.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc: ../sinc.o ../utils.o snr.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-hermite: ../hermite.o ../utils.o snr.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
%-fixed.o: %.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DHAVE_FIXED_POINT
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
|
@ -24,9 +24,12 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int16_t input_i[1024];
|
||||
float input_f[1024];
|
||||
int16_t output_i[1024 * 8];
|
||||
|
||||
#ifndef HAVE_FIXED_POINT
|
||||
float input_f[1024];
|
||||
float output_f[1024 * 8];
|
||||
#endif
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
@ -56,19 +59,30 @@ int main(int argc, char *argv[])
|
||||
if (fread(input_i, sizeof(int16_t), 1024, stdin) != 1024)
|
||||
break;
|
||||
|
||||
#ifndef HAVE_FIXED_POINT
|
||||
audio_convert_s16_to_float(input_f, input_i, 1024);
|
||||
#endif
|
||||
|
||||
struct resampler_data data = {
|
||||
#ifdef HAVE_FIXED_POINT
|
||||
.data_in = input_i,
|
||||
.data_out = output_i,
|
||||
.input_frames = sizeof(input_i) / (2 * sizeof(int16_t)),
|
||||
#else
|
||||
.data_in = input_f,
|
||||
.data_out = output_f,
|
||||
.input_frames = sizeof(input_f) / (2 * sizeof(float)),
|
||||
#endif
|
||||
.ratio = ratio,
|
||||
};
|
||||
|
||||
resampler_process(resamp, &data);
|
||||
|
||||
size_t output_samples = data.output_frames * 2;
|
||||
|
||||
#ifndef HAVE_FIXED_POINT
|
||||
audio_convert_float_to_s16(output_i, output_f, output_samples);
|
||||
#endif
|
||||
|
||||
if (fwrite(output_i, sizeof(int16_t), output_samples, stdout) != output_samples)
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user