rtl_adsb: remove floats for more speed

Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
Howard Su 2013-10-23 06:12:44 +00:00 committed by Steve Markgraf
parent b70720b9b6
commit 53775a2ebf

View File

@ -68,7 +68,7 @@ uint16_t squares[256];
uint8_t *buffer; /* also abused for uint16_t */ uint8_t *buffer; /* also abused for uint16_t */
int verbose_output = 0; int verbose_output = 0;
int short_output = 0; int short_output = 0;
double quality = 1.0; int quality = 10;
int allowed_errors = 5; int allowed_errors = 5;
FILE *file; FILE *file;
int adsb_frame[14]; int adsb_frame[14];
@ -126,7 +126,7 @@ void display(int *frame, int len)
if (!short_output && len <= short_frame) { if (!short_output && len <= short_frame) {
return;} return;}
df = (frame[0] >> 3) & 0x1f; df = (frame[0] >> 3) & 0x1f;
if (quality == 0.0 && !(df==11 || df==17 || df==18 || df==19)) { if (quality == 0 && !(df==11 || df==17 || df==18 || df==19)) {
return;} return;}
fprintf(file, "*"); fprintf(file, "*");
for (i=0; i<((len+7)/8); i++) { for (i=0; i<((len+7)/8); i++) {
@ -181,10 +181,10 @@ inline uint16_t single_manchester(uint16_t a, uint16_t b, uint16_t c, uint16_t d
bit_p = a > b; bit_p = a > b;
bit = c > d; bit = c > d;
if (quality == 0.0) { if (quality == 0) {
return bit;} return bit;}
if (quality == 0.5) { if (quality == 5) {
if ( bit && bit_p && b > c) { if ( bit && bit_p && b > c) {
return BADSAMPLE;} return BADSAMPLE;}
if (!bit && !bit_p && b < c) { if (!bit && !bit_p && b < c) {
@ -192,7 +192,7 @@ inline uint16_t single_manchester(uint16_t a, uint16_t b, uint16_t c, uint16_t d
return bit; return bit;
} }
if (quality == 1.0) { if (quality == 10) {
if ( bit && bit_p && c > b) { if ( bit && bit_p && c > b) {
return 1;} return 1;}
if ( bit && !bit_p && d < b) { if ( bit && !bit_p && d < b) {
@ -391,7 +391,7 @@ int main(int argc, char **argv)
allowed_errors = atoi(optarg); allowed_errors = atoi(optarg);
break; break;
case 'Q': case 'Q':
quality = atof(optarg); quality = (int)(atof(optarg) * 10);
break; break;
default: default:
usage(); usage();