decoding WIP

This commit is contained in:
jaseg 2020-03-09 10:17:14 +01:00
parent 55ebbcbdbc
commit b4d5293d04
5 changed files with 120 additions and 25 deletions

View file

@ -5,6 +5,8 @@
#define DSSS_GOLD_CODE_COUNT ((1<<DSSS_GOLD_CODE_NBITS) + 1)
#define DSSS_CORRELATION_LENGTH (DSSS_GOLD_CODE_LENGTH * DSSS_DECIMATION)
#define PAYLOAD_DATA_BYTE ((PAYLOAD_DATA_BIT+7)/8)
struct iir_biquad {
float a[2];
float b[3];
@ -18,6 +20,24 @@ struct cwt_iir_filter_state {
struct iir_biquad_state st[3];
};
struct {
int len; /* length of group in samples */
float max; /* signed value of largest peak in group on any channel */
uint64_t max_ts; /* absolute position of above peak */
int max_ch; /* channel (gold sequence index) of above peak */
} group;
struct decoder_state {
int last_phase;
int candidate_phase;
float last_score;
float candidate_score;
uint8_t data[PAYLOAD_DATA_BYTE];
int data_pos;
};
struct dsss_demod_state {
float signal[DSSS_CORRELATION_LENGTH];
size_t signal_wpos;
@ -27,18 +47,15 @@ struct dsss_demod_state {
struct cwt_iir_filter_state cwt_filter[DSSS_GOLD_CODE_COUNT];
struct {
int len; /* length of group in samples */
float max; /* signed value of largest peak in group on any channel */
int max_idx; /* position of above peak counted from start of group */
int max_ch; /* channel (gold sequence index) of above peak */
} group;
struct group group;
struct group group_cache[DSSS_GROUP_CACHE_SIZE];
};
#ifdef SIMULATION
void dsss_demod_step(struct dsss_demod_state *st, float new_value, size_t sim_pos, int record_channel);
void dsss_demod_step(struct dsss_demod_state *st, float new_value, uint64_t ts, int record_channel);
#else /* SIMULATION */
void dsss_demod_step(struct dsss_demod_state *st, float new_value);
void dsss_demod_step(struct dsss_demod_state *st, float new_value, uint64_t ts);
#endif /* SIMULATION */
#endif /* __DSSS_DEMOD_H__ */