Make run faster on ARM CPUs using fast math approximation

Use --fast-math to use sine/cosine tables and approximate atan2.
This commit is contained in:
Andreas Eversberg
2018-11-10 15:16:20 +01:00
parent e8429166c3
commit 32025915d5
17 changed files with 386 additions and 194 deletions

View File

@@ -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;
}