NMT: Rework on FSK process, no more requirement for special sample rates

This commit is contained in:
Andreas Eversberg
2017-01-07 06:13:31 +01:00
parent 2d0bc92cde
commit d447be5e26
6 changed files with 112 additions and 85 deletions

View File

@@ -91,17 +91,17 @@ typedef struct nmt {
/* dsp states */
enum dsp_mode dsp_mode; /* current mode: audio, durable tone 0 or 1, paging */
int samples_per_bit; /* number of samples for one bit (1200 Baud) */
double fsk_samples_per_bit; /* number of samples for one bit (1200 Baud) */
double fsk_bits_per_sample; /* fraction of a bit per sample */
int super_samples; /* number of samples in buffer for supervisory detection */
int fsk_coeff[2]; /* coefficient k = 2*cos(2*PI*f/samplerate), k << 15 */
int super_coeff[5]; /* coefficient for supervisory signal */
int16_t *fsk_sine[2][2]; /* 4 pointers to 4 precalc. sine curves */
int fsk_polarity; /* current polarity state of bit */
int samples_per_chunk; /* how many samples lasts one chunk */
int16_t *fsk_filter_spl; /* array with samples_per_chunk */
int fsk_filter_pos; /* current sample position in filter_spl */
int fsk_filter_step; /* number of samples for each analyzation */
int fsk_filter_bit; /* last bit, so we detect a bit change */
int16_t *fsk_filter_spl; /* array to hold ring buffer for bit decoding */
int fsk_filter_size; /* size of ring buffer */
int fsk_filter_pos; /* position to write next sample */
double fsk_filter_step; /* counts bit duration, to trigger decoding every 10th bit */
int fsk_filter_bit; /* last bit state, so we detect a bit change */
int fsk_filter_sample; /* count until it is time to sample bit */
uint16_t fsk_filter_sync; /* shift register to detect sync */
int fsk_filter_in_sync; /* if we are in sync and receive bits */
@@ -116,12 +116,15 @@ typedef struct nmt {
double super_phase256; /* current phase */
double dial_phaseshift256; /* how much the phase of sine wave changes per sample */
double dial_phase256; /* current phase */
int frame; /* set, if there is a valid frame */
int16_t *frame_spl; /* 166 * fsk_bit_length */
double fsk_phaseshift256; /* how much the phase of fsk synbol changes per sample */
double fsk_phase256; /* current phase */
int16_t *frame_spl; /* samples to store a complete rendered frame */
int frame_size; /* total size of sample buffer */
int frame_length; /* current length of data in sample buffer */
int frame_pos; /* current sample position in frame_spl */
uint64_t rx_sample_count; /* sample counter */
uint64_t rx_sample_count_current;/* sample counter of current frame */
uint64_t rx_sample_count_last; /* sample counter of last frame */
double rx_bits_count; /* sample counter */
double rx_bits_count_current; /* sample counter of current frame */
double rx_bits_count_last; /* sample counter of last frame */
int super_detected; /* current detection state flag */
int super_detect_count; /* current number of consecutive detections/losses */