diff options
| author | drowe67 <[email protected]> | 2023-07-20 08:59:48 +0930 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-20 08:59:48 +0930 |
| commit | 06d4c11e699b0351765f10398abb4f663a984f36 (patch) | |
| tree | 33e22af0814c5b6c3d676f096ae8c2ac8a3ed9f0 /src/codec2_fdmdv.h | |
| parent | 6588e77f38bdebd7adffe091b22e7760d95d0ccb (diff) | |
| parent | 4d6c143c0abec15e1d6ed1fd95d36f80e6cb7df8 (diff) | |
Merge pull request #3 from drowe67/dr-cleanup21.2.0
Cleanup Part 2
Diffstat (limited to 'src/codec2_fdmdv.h')
| -rw-r--r-- | src/codec2_fdmdv.h | 98 |
1 files changed, 57 insertions, 41 deletions
diff --git a/src/codec2_fdmdv.h b/src/codec2_fdmdv.h index b93e13e..79e699d 100644 --- a/src/codec2_fdmdv.h +++ b/src/codec2_fdmdv.h @@ -58,62 +58,78 @@ extern "C" { #define CODEC2_WIN32SUPPORT #endif -#define FDMDV_NC 14 /* default number of data carriers */ -#define FDMDV_NC_MAX 20 /* maximum number of data carriers */ -#define FDMDV_BITS_PER_FRAME 28 /* 20ms frames, for nominal 1400 bit/s */ -#define FDMDV_NOM_SAMPLES_PER_FRAME 160 /* modulator output samples/frame and nominal demod samples/frame */ - /* at 8000 Hz sample rate */ -#define FDMDV_MAX_SAMPLES_PER_FRAME 200 /* max demod samples/frame, use this to allocate storage */ -#define FDMDV_SCALE 825 /* suggested scaling for 16 bit shorts */ -#define FDMDV_FCENTRE 1500 /* Centre frequency, Nc/2 carriers below this, Nc/2 carriers above (Hz) */ +#define FDMDV_NC \ + 14 /* default number of data carriers */ +#define FDMDV_NC_MAX \ + 20 /* maximum number of data carriers */ +#define FDMDV_BITS_PER_FRAME \ + 28 /* 20ms frames, for nominal 1400 bit/s */ +#define FDMDV_NOM_SAMPLES_PER_FRAME \ + 160 /* modulator output samples/frame and nominal demod samples/frame */ + /* at 8000 Hz sample rate */ +#define FDMDV_MAX_SAMPLES_PER_FRAME \ + 200 /* max demod samples/frame, use this to allocate storage */ +#define FDMDV_SCALE \ + 825 /* suggested scaling for 16 bit shorts */ +#define FDMDV_FCENTRE \ + 1500 /* Centre frequency, Nc/2 carriers below this, Nc/2 carriers above (Hz) \ + */ /* 8 to 18 kHz sample rate conversion */ -#define FDMDV_OS 2 /* oversampling rate */ -#define FDMDV_OS_TAPS_16K 48 /* number of OS filter taps at 16kHz */ -#define FDMDV_OS_TAPS_8K (FDMDV_OS_TAPS_16K/FDMDV_OS) /* number of OS filter taps at 8kHz */ +#define FDMDV_OS 2 /* oversampling rate */ +#define FDMDV_OS_TAPS_16K 48 /* number of OS filter taps at 16kHz */ +#define FDMDV_OS_TAPS_8K \ + (FDMDV_OS_TAPS_16K / FDMDV_OS) /* number of OS filter taps at 8kHz */ /* 8 to 48 kHz sample rate conversion */ -#define FDMDV_OS_48 6 /* oversampling rate */ -#define FDMDV_OS_TAPS_48K 48 /* number of OS filter taps at 48kHz */ -#define FDMDV_OS_TAPS_48_8K (FDMDV_OS_TAPS_48K/FDMDV_OS_48) /* number of OS filter taps at 8kHz */ +#define FDMDV_OS_48 6 /* oversampling rate */ +#define FDMDV_OS_TAPS_48K 48 /* number of OS filter taps at 48kHz */ +#define FDMDV_OS_TAPS_48_8K \ + (FDMDV_OS_TAPS_48K / FDMDV_OS_48) /* number of OS filter taps at 8kHz */ /* FDMDV states and stats structures */ struct FDMDV; -struct FDMDV * fdmdv_create(int Nc); -void fdmdv_destroy(struct FDMDV *fdmdv_state); -void fdmdv_use_old_qpsk_mapping(struct FDMDV *fdmdv_state); -int fdmdv_bits_per_frame(struct FDMDV *fdmdv_state); -float fdmdv_get_fsep(struct FDMDV *fdmdv_state); -void fdmdv_set_fsep(struct FDMDV *fdmdv_state, float fsep); - -void fdmdv_mod(struct FDMDV *fdmdv_state, COMP tx_fdm[], int tx_bits[], int *sync_bit); -void fdmdv_demod(struct FDMDV *fdmdv_state, int rx_bits[], int *reliable_sync_bit, COMP rx_fdm[], int *nin); - -void fdmdv_get_test_bits(struct FDMDV *fdmdv_state, int tx_bits[]); -int fdmdv_error_pattern_size(struct FDMDV *fdmdv_state); -void fdmdv_put_test_bits(struct FDMDV *f, int *sync, short error_pattern[], int *bit_errors, int *ntest_bits, int rx_bits[]); - -void fdmdv_get_demod_stats(struct FDMDV *fdmdv_state, struct MODEM_STATS *stats); - -void fdmdv_8_to_16(float out16k[], float in8k[], int n); -void fdmdv_8_to_16_short(short out16k[], short in8k[], int n); -void fdmdv_16_to_8(float out8k[], float in16k[], int n); -void fdmdv_16_to_8_short(short out8k[], short in16k[], int n); -void fdmdv_8_to_48(float out48k[], float in8k[], int n); -void fdmdv_48_to_8(float out8k[], float in48k[], int n); -void fdmdv_8_to_48_short(short out48k[], short in8k[], int n); -void fdmdv_48_to_8_short(short out8k[], short in48k[], int n); - -void fdmdv_freq_shift(COMP rx_fdm_fcorr[], COMP rx_fdm[], float foff, COMP *foff_phase_rect, int nin); +struct FDMDV *fdmdv_create(int Nc); +void fdmdv_destroy(struct FDMDV *fdmdv_state); +void fdmdv_use_old_qpsk_mapping(struct FDMDV *fdmdv_state); +int fdmdv_bits_per_frame(struct FDMDV *fdmdv_state); +float fdmdv_get_fsep(struct FDMDV *fdmdv_state); +void fdmdv_set_fsep(struct FDMDV *fdmdv_state, float fsep); + +void fdmdv_mod(struct FDMDV *fdmdv_state, COMP tx_fdm[], int tx_bits[], + int *sync_bit); +void fdmdv_demod(struct FDMDV *fdmdv_state, int rx_bits[], + int *reliable_sync_bit, COMP rx_fdm[], int *nin); + +void fdmdv_get_test_bits(struct FDMDV *fdmdv_state, int tx_bits[]); +int fdmdv_error_pattern_size(struct FDMDV *fdmdv_state); +void fdmdv_put_test_bits(struct FDMDV *f, int *sync, short error_pattern[], + int *bit_errors, int *ntest_bits, int rx_bits[]); + +void fdmdv_get_demod_stats(struct FDMDV *fdmdv_state, + struct MODEM_STATS *stats); + +void fdmdv_8_to_16(float out16k[], float in8k[], int n); +void fdmdv_8_to_16_short(short out16k[], short in8k[], int n); +void fdmdv_16_to_8(float out8k[], float in16k[], int n); +void fdmdv_16_to_8_short(short out8k[], short in16k[], int n); +void fdmdv_8_to_48(float out48k[], float in8k[], int n); +void fdmdv_48_to_8(float out8k[], float in48k[], int n); +void fdmdv_8_to_48_short(short out48k[], short in8k[], int n); +void fdmdv_48_to_8_short(short out8k[], short in48k[], int n); + +void fdmdv_freq_shift(COMP rx_fdm_fcorr[], COMP rx_fdm[], float foff, + COMP *foff_phase_rect, int nin); /* debug/development function(s) */ void fdmdv_dump_osc_mags(struct FDMDV *f); -void fdmdv_simulate_channel(float *sig_pwr_av, COMP samples[], int nin, float target_snr); +void fdmdv_simulate_channel(float *sig_pwr_av, COMP samples[], int nin, + float target_snr); #ifdef __cplusplus } |
