From ca10048e5caa77d8ed4c4902336f8ef88738a5e0 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sat, 13 May 2017 16:04:00 +0200 Subject: Rename filter -> iir_filter (file name and instance name) This is useful when using fir_filter in the future. --- src/test/test_emphasis.c | 2 +- src/test/test_filter.c | 22 +++++++++++----------- src/test/test_performance.c | 16 ++++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/test') diff --git a/src/test/test_emphasis.c b/src/test/test_emphasis.c index 445a7d7..eda8d8e 100644 --- a/src/test/test_emphasis.c +++ b/src/test/test_emphasis.c @@ -3,7 +3,7 @@ #include #include #include "../common/sample.h" -#include "../common/filter.h" +#include "../common/iir_filter.h" #include "../common/emphasis.h" #include "../common/debug.h" diff --git a/src/test/test_filter.c b/src/test/test_filter.c index e74b403..2cae141 100644 --- a/src/test/test_filter.c +++ b/src/test/test_filter.c @@ -3,7 +3,7 @@ #include #include #include "../common/sample.h" -#include "../common/filter.h" +#include "../common/iir_filter.h" #include "../common/debug.h" #define level2db(level) (20 * log10(level)) @@ -36,8 +36,8 @@ static void gen_samples(sample_t *samples, double freq) int main(void) { - filter_t filter_low; - filter_t filter_high; + iir_filter_t filter_low; + iir_filter_t filter_high; sample_t samples[SAMPLERATE]; double level; int iter = 2; @@ -47,11 +47,11 @@ int main(void) printf("testing low-pass filter with %d iterations\n", iter); - filter_lowpass_init(&filter_low, 1000.0, SAMPLERATE, iter); + iir_lowpass_init(&filter_low, 1000.0, SAMPLERATE, iter); for (i = 0; i < 4001; i += 100) { gen_samples(samples, (double)i); - filter_process(&filter_low, samples, SAMPLERATE); + iir_process(&filter_low, samples, SAMPLERATE); level = get_level(samples); printf("%s%4d Hz: %.1f dB", debug_db(level), i, level2db(level)); if (i == 1000) @@ -66,11 +66,11 @@ int main(void) printf("testing high-pass filter with %d iterations\n", iter); - filter_highpass_init(&filter_high, 2000.0, SAMPLERATE, iter); + iir_highpass_init(&filter_high, 2000.0, SAMPLERATE, iter); for (i = 0; i < 4001; i += 100) { gen_samples(samples, (double)i); - filter_process(&filter_high, samples, SAMPLERATE); + iir_process(&filter_high, samples, SAMPLERATE); level = get_level(samples); printf("%s%4d Hz: %.1f dB", debug_db(level), i, level2db(level)); if (i == 2000) @@ -85,13 +85,13 @@ int main(void) printf("testing band-pass filter with %d iterations\n", iter); - filter_lowpass_init(&filter_low, 2000.0, SAMPLERATE, iter); - filter_highpass_init(&filter_high, 1000.0, SAMPLERATE, iter); + iir_lowpass_init(&filter_low, 2000.0, SAMPLERATE, iter); + iir_highpass_init(&filter_high, 1000.0, SAMPLERATE, iter); for (i = 0; i < 4001; i += 100) { gen_samples(samples, (double)i); - filter_process(&filter_low, samples, SAMPLERATE); - filter_process(&filter_high, samples, SAMPLERATE); + iir_process(&filter_low, samples, SAMPLERATE); + iir_process(&filter_high, samples, SAMPLERATE); level = get_level(samples); printf("%s%4d Hz: %.1f dB", debug_db(level), i, level2db(level)); if (i == 1000) diff --git a/src/test/test_performance.c b/src/test/test_performance.c index 622df67..3f9cb40 100644 --- a/src/test/test_performance.c +++ b/src/test/test_performance.c @@ -4,7 +4,7 @@ #include #include #include "../common/sample.h" -#include "../common/filter.h" +#include "../common/iir_filter.h" #include "../common/fm_modulation.h" #include "../common/debug.h" @@ -33,7 +33,7 @@ sample_t samples[SAMPLES]; float buff[SAMPLES * 2]; fm_mod_t mod; fm_demod_t demod; -filter_t lp; +iir_filter_t lp; int main(void) { @@ -47,19 +47,19 @@ int main(void) fm_demodulate(&demod, samples, SAMPLES, buff); T_STOP("FM demodulate", SAMPLES) - filter_lowpass_init(&lp, 10000.0 / 2.0, 50000, 1); + iir_lowpass_init(&lp, 10000.0 / 2.0, 50000, 1); T_START() - filter_process(&lp, samples, SAMPLES); + iir_process(&lp, samples, SAMPLES); T_STOP("low-pass filter (second order)", SAMPLES) - filter_lowpass_init(&lp, 10000.0 / 2.0, 50000, 2); + iir_lowpass_init(&lp, 10000.0 / 2.0, 50000, 2); T_START() - filter_process(&lp, samples, SAMPLES); + iir_process(&lp, samples, SAMPLES); T_STOP("low-pass filter (fourth order)", SAMPLES) - filter_lowpass_init(&lp, 10000.0 / 2.0, 50000, 4); + iir_lowpass_init(&lp, 10000.0 / 2.0, 50000, 4); T_START() - filter_process(&lp, samples, SAMPLES); + iir_process(&lp, samples, SAMPLES); T_STOP("low-pass filter (eigth order)", SAMPLES) return 0; -- cgit v1.2.3