Rename filter -> iir_filter (file name and instance name)
This is useful when using fir_filter in the future.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "../common/sample.h"
|
||||
#include "../common/filter.h"
|
||||
#include "../common/iir_filter.h"
|
||||
#include "../common/emphasis.h"
|
||||
#include "../common/debug.h"
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#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)
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#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;
|
||||
|
Reference in New Issue
Block a user