aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2018-11-10 15:16:20 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2018-11-10 15:18:28 +0100
commit32025915d564d999c33e73a4b6084d9df0dbd42a (patch)
tree718328859560d735f40d7a71ac3e75e0c339202e /src/test
parente8429166c3bfa5077d0dc353f345834e831f3e34 (diff)
Make run faster on ARM CPUs using fast math approximation
Use --fast-math to use sine/cosine tables and approximate atan2.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_dtmf.c4
-rw-r--r--src/test/test_performance.c24
2 files changed, 27 insertions, 1 deletions
diff --git a/src/test/test_dtmf.c b/src/test/test_dtmf.c
index 8f56e5c..6640c59 100644
--- a/src/test/test_dtmf.c
+++ b/src/test/test_dtmf.c
@@ -63,6 +63,8 @@ int main(void)
int f, i;
double target;
+ fm_init(0);
+
dtmf_decode_init(&dtmf_dec, NULL, recv_digit, SAMPLERATE, db2level(0), db2level(-30.0));
for (f = 0; f < 8; f++) {
@@ -109,6 +111,8 @@ int main(void)
dtmf_decode_exit(&dtmf_dec);
+ fm_exit();
+
return 0;
}
diff --git a/src/test/test_performance.c b/src/test/test_performance.c
index 5732b8b..2f9b062 100644
--- a/src/test/test_performance.c
+++ b/src/test/test_performance.c
@@ -22,7 +22,7 @@ int tot_samples;
duration = (double)tv.tv_sec + (double)tv.tv_usec / 1e6; \
duration -= (double)start_tv.tv_sec + (double)start_tv.tv_usec / 1e6; \
tot_samples += samples; \
- if (duration >= 0.5) \
+ if (duration >= 2) \
break; \
} \
printf("%s: %.3f mega samples/sec\n", what, (double)tot_samples / duration / 1e6); \
@@ -39,15 +39,35 @@ iir_filter_t lp;
int main(void)
{
memset(power, 1, sizeof(power));
+
+ fm_init(0);
+
fm_mod_init(&mod, 50000, 0, 0.333);
T_START()
fm_modulate_complex(&mod, samples, power, SAMPLES, buff);
T_STOP("FM modulate", SAMPLES)
+ fm_mod_exit(&mod);
fm_demod_init(&demod, 50000, 0, 10000.0);
T_START()
fm_demodulate_complex(&demod, samples, SAMPLES, buff, I, Q);
T_STOP("FM demodulate", SAMPLES)
+ fm_demod_exit(&demod);
+
+ fm_exit();
+ fm_init(1);
+
+ fm_mod_init(&mod, 50000, 0, 0.333);
+ T_START()
+ fm_modulate_complex(&mod, samples, power, SAMPLES, buff);
+ T_STOP("FM modulate (fast math)", SAMPLES)
+ fm_mod_exit(&mod);
+
+ fm_demod_init(&demod, 50000, 0, 10000.0);
+ T_START()
+ fm_demodulate_complex(&demod, samples, SAMPLES, buff, I, Q);
+ T_STOP("FM demodulate (fast math)", SAMPLES)
+ fm_demod_exit(&demod);
iir_lowpass_init(&lp, 10000.0 / 2.0, 50000, 1);
T_START()
@@ -64,6 +84,8 @@ int main(void)
iir_process(&lp, samples, SAMPLES);
T_STOP("low-pass filter (eigth order)", SAMPLES)
+ fm_exit();
+
return 0;
}