fsk: new confidence algo
This commit is contained in:
parent
2b014b50fb
commit
3a22116159
20
src/fsk.c
20
src/fsk.c
|
@ -214,7 +214,7 @@ fsk_frame_analyze( fsk_plan *fskp, float *samples, float samples_per_bit,
|
|||
fsk_bits_analyze(fskp, samples+begin_databits, samples_per_bit,
|
||||
bits_outp, databit_strengths);
|
||||
|
||||
// computer average bit strength 'v'
|
||||
// compute average bit strength 'v'
|
||||
int i;
|
||||
for ( i=0; i<fskp->n_data_bits; i++ )
|
||||
v += databit_strengths[i];
|
||||
|
@ -224,6 +224,10 @@ fsk_frame_analyze( fsk_plan *fskp, float *samples, float samples_per_bit,
|
|||
if ( v < FSK_MIN_STRENGTH )
|
||||
return 0.0;
|
||||
|
||||
#define CONFIDENCE_ALGO 2
|
||||
|
||||
#if ( CONFIDENCE_ALGO == 1 )
|
||||
|
||||
float confidence = 0;
|
||||
confidence += 1.0 - fabs(i_str - v);
|
||||
confidence += 1.0 - fabs(s_str - v);
|
||||
|
@ -232,6 +236,20 @@ fsk_frame_analyze( fsk_plan *fskp, float *samples, float samples_per_bit,
|
|||
confidence += 1.0 - fabs(databit_strengths[i] - v);
|
||||
confidence /= (fskp->n_data_bits + 3);
|
||||
|
||||
#elif ( CONFIDENCE_ALGO == 2 )
|
||||
|
||||
float confidence = 0;
|
||||
confidence += i_str;
|
||||
confidence += s_str;
|
||||
confidence += p_str;
|
||||
for ( i=0; i<fskp->n_data_bits; i++ )
|
||||
confidence += databit_strengths[i];
|
||||
confidence /= (fskp->n_data_bits + 3);
|
||||
|
||||
#endif
|
||||
|
||||
debug_log(" frame confidence (algo #%u) = %f\n",
|
||||
CONFIDENCE_ALGO, confidence);
|
||||
return confidence;
|
||||
}
|
||||
|
||||
|
|
|
@ -525,7 +525,6 @@ main( int argc, char*argv[] )
|
|||
if ( samples_nvalid < frame_nsamples )
|
||||
break;
|
||||
|
||||
// FIXME: explain
|
||||
unsigned int try_max_nsamples = nsamples_per_bit;
|
||||
#define FSK_ANALYZE_NSTEPS 8 /* accuracy vs. performance */
|
||||
unsigned int try_step_nsamples = nsamples_per_bit / FSK_ANALYZE_NSTEPS;
|
||||
|
@ -545,7 +544,7 @@ main( int argc, char*argv[] )
|
|||
&frame_start_sample
|
||||
);
|
||||
|
||||
#define FSK_MIN_CONFIDENCE 0.5 /* not critical */
|
||||
#define FSK_MIN_CONFIDENCE 0.05
|
||||
#define FSK_MAX_NOCONFIDENCE_BITS 20
|
||||
|
||||
if ( confidence <= FSK_MIN_CONFIDENCE ) {
|
||||
|
@ -600,9 +599,9 @@ main( int argc, char*argv[] )
|
|||
* advance = 1 prev_stop + 1 start + N data bits == n_data_bits+2
|
||||
*
|
||||
* but actually advance just a bit less than that to allow
|
||||
* for clock skew, so ...
|
||||
* for clock skew, hence FSK_SCAN_LAG.
|
||||
*/
|
||||
#define FSK_SCAN_LAG 0.4
|
||||
#define FSK_SCAN_LAG 0.2
|
||||
advance = frame_start_sample +
|
||||
nsamples_per_bit * (float)(fskp->n_data_bits + 2 - FSK_SCAN_LAG);
|
||||
|
||||
|
|
Loading…
Reference in New Issue