Really use 64 data types for demodulation

[ kamal: cleanup ]
This commit is contained in:
Marcos Vives Del Sol 2014-08-15 19:37:22 +02:00 committed by Kamal Mostafa
parent 2cdf2d29e4
commit ff0346f5a8
3 changed files with 8 additions and 7 deletions

View File

@ -438,7 +438,7 @@ fsk_frame_analyze( fsk_plan *fskp, float *samples, float samples_per_bit,
// into the bits_outp word. // into the bits_outp word.
*bits_outp = 0; *bits_outp = 0;
for ( bitnum=0; bitnum<n_bits; bitnum++ ) for ( bitnum=0; bitnum<n_bits; bitnum++ )
*bits_outp |= bit_values[bitnum] << bitnum; *bits_outp |= (unsigned long long) bit_values[bitnum] << bitnum;
debug_log(" frame algo=%u confidence=%f ampl=%f\n", debug_log(" frame algo=%u confidence=%f ampl=%f\n",
CONFIDENCE_ALGO, confidence, *ampl_outp); CONFIDENCE_ALGO, confidence, *ampl_outp);
@ -455,7 +455,7 @@ fsk_find_frame( fsk_plan *fskp, float *samples, unsigned int frame_nsamples,
const char *expect_bits_string, const char *expect_bits_string,
unsigned long long *bits_outp, unsigned long long *bits_outp,
float *ampl_outp, float *ampl_outp,
unsigned long long *frame_start_outp unsigned int *frame_start_outp
) )
{ {
int expect_n_bits = strlen(expect_bits_string); int expect_n_bits = strlen(expect_bits_string);
@ -466,7 +466,7 @@ fsk_find_frame( fsk_plan *fskp, float *samples, unsigned int frame_nsamples,
unsigned int best_t = 0; unsigned int best_t = 0;
float best_c = 0.0, best_a = 0.0; float best_c = 0.0, best_a = 0.0;
unsigned int best_bits = 0; unsigned long long best_bits = 0;
// Scan the frame positions starting with the one try_first_sample, // Scan the frame positions starting with the one try_first_sample,
// alternating between a step above that, a step below that, above, below, // alternating between a step above that, a step below that, above, below,

View File

@ -67,7 +67,7 @@ fsk_find_frame( fsk_plan *fskp, float *samples, unsigned int frame_nsamples,
const char *expect_bits_string, const char *expect_bits_string,
unsigned long long *bits_outp, unsigned long long *bits_outp,
float *ampl_outp, float *ampl_outp,
unsigned long long *frame_start_outp unsigned int *frame_start_outp
); );
int int

View File

@ -1089,7 +1089,7 @@ main( int argc, char*argv[] )
unsigned long long bits = 0; unsigned long long bits = 0;
/* Note: frame_start_sample is actually the sample where the /* Note: frame_start_sample is actually the sample where the
* prev_stop bit begins (since the "frame" includes the prev_stop). */ * prev_stop bit begins (since the "frame" includes the prev_stop). */
unsigned long long frame_start_sample = 0; unsigned int frame_start_sample = 0;
unsigned int try_first_sample; unsigned int try_first_sample;
float try_confidence_search_limit; float try_confidence_search_limit;
@ -1204,7 +1204,7 @@ main( int argc, char*argv[] )
try_confidence_search_limit = INFINITY; try_confidence_search_limit = INFINITY;
float confidence2, amplitude2; float confidence2, amplitude2;
unsigned long long bits2; unsigned long long bits2;
unsigned long long frame_start_sample2; unsigned int frame_start_sample2;
confidence2 = fsk_find_frame(fskp, samplebuf, expect_nsamples, confidence2 = fsk_find_frame(fskp, samplebuf, expect_nsamples,
try_first_sample, try_first_sample,
try_max_nsamples, try_max_nsamples,
@ -1258,7 +1258,8 @@ main( int argc, char*argv[] )
// chop off framing bits // chop off framing bits
unsigned int frame_bits_shift = bfsk_nstartbits; unsigned int frame_bits_shift = bfsk_nstartbits;
unsigned int frame_bits_mask = (int)(1<<bfsk_n_data_bits) - 1; unsigned long long frame_bits_mask = (long long)(1ULL<<bfsk_n_data_bits) - 1;
debug_log("Input: %08x%08x - Databits: %i - Shift: %i - Mask: %08x\n", (unsigned int)(bits >> 32), (unsigned int)bits, bfsk_n_data_bits, bfsk_nstartbits, (unsigned int)(frame_bits_mask >> 32), (unsigned int)(frame_bits_mask));
bits = ( bits >> frame_bits_shift ) & frame_bits_mask; bits = ( bits >> frame_bits_shift ) & frame_bits_mask;
unsigned int dataout_size = 4096; unsigned int dataout_size = 4096;