diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2018-11-10 15:16:20 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2018-11-10 15:18:28 +0100 |
commit | 32025915d564d999c33e73a4b6084d9df0dbd42a (patch) | |
tree | 718328859560d735f40d7a71ac3e75e0c339202e /src/radio | |
parent | e8429166c3bfa5077d0dc353f345834e831f3e34 (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/radio')
-rw-r--r-- | src/radio/main.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/radio/main.c b/src/radio/main.c index 89b221c..acc430e 100644 --- a/src/radio/main.c +++ b/src/radio/main.c @@ -44,6 +44,7 @@ void *sender_head = NULL; int use_sdr = 0; int num_kanal = 1; /* only one channel used for debugging */ int rt_prio = 1; +int fast_math = 0; void *get_sender_by_empfangsfrequenz() { return NULL; } @@ -140,6 +141,8 @@ void print_help(const char *arg0) printf(" -S --stereo\n"); printf(" Enables stereo carrier for frequency modulated UHF broadcast.\n"); printf(" It uses the 'Pilot-tone' system.\n"); + printf(" --fast-math\n"); + printf(" Use fast math approximation for slow CPU / ARM based systems.\n"); printf(" --limesdr\n"); printf(" Auto-select several required options for LimeSDR\n"); printf(" --limesdr-mini\n"); @@ -147,6 +150,7 @@ void print_help(const char *arg0) sdr_config_print_help(); } +#define OPT_FAST_MATH 1007 #define OPT_LIMESDR 1100 #define OPT_LIMESDR_MINI 1101 @@ -166,6 +170,7 @@ static void add_options(void) option_add('I', "modulation-index", 1); option_add('E', "emphasis", 1); option_add('S', "stereo", 0); + option_add(OPT_FAST_MATH, "fast-math", 0); option_add(OPT_LIMESDR, "limesdr", 0); option_add(OPT_LIMESDR_MINI, "limesdr-mini", 0); sdr_config_add_options(); @@ -236,6 +241,9 @@ static int handle_options(int short_option, int argi, char **argv) case 'S': stereo = 1; break; + case OPT_FAST_MATH: + fast_math = 1; + break; case OPT_LIMESDR: { char *argv_lime[] = { argv[0], @@ -297,6 +305,10 @@ int main(int argc, char *argv[]) exit(0); } + /* global inits */ + fm_init(fast_math); + am_init(fast_math); + rc = sdr_configure(samplerate); if (rc < 0) return rc; @@ -482,6 +494,10 @@ error: sdr_close(sdr); radio_exit(&radio); + /* global exits */ + fm_exit(); + am_exit(); + return 0; } |