Remove unused coefficient arrays and option.

webcam_dev
bob 2018-08-13 10:40:19 +10:00
rodzic c3a620037d
commit 670376fcbc
3 zmienionych plików z 41 dodań i 169 usunięć

Wyświetl plik

@ -21,126 +21,10 @@
/* Driver exported variables. */
/*===========================================================================*/
/* TODO: Remove or recalculate Matlab/Octave filter coefficients. */
#if MAG_FILTER_GEN_COEFF == TRUE
float32_t mag_filter_coeff_f32[MAG_FILTER_NUM_TAPS] useCCM;
#else
/*
* Magnitude (LPF) coefficients.
* Fs=28800, f1 = 1400, number of taps = 29
* Matlab/Octave parameters:
* hc = fir1(28, 1400/(Fs/2), 'low');
*/
float32_t mag_filter_coeff_f32[MAG_FILTER_NUM_TAPS] = {
-0.0016890122f, -0.0016647590f, -0.0016305187f, -0.0010016907f,
0.0009925971f, 0.0051420766f, 0.0120550411f, 0.0219694930f,
0.0346207799f, 0.0492010182f, 0.0644272330f, 0.0787120655f,
0.0904082200f, 0.0980807163f, 0.1007534795f, 0.0980807163f,
0.0904082200f, 0.0787120655f, 0.0644272330f, 0.0492010182f,
0.0346207799f, 0.0219694930f, 0.0120550411f, 0.0051420766f,
0.0009925971f, -0.0010016907f, -0.0016305187f, -0.0016647590f,
-0.0016890122f
};
#endif /* PREQ_FILTER_GEN_COEFF == TRUE */
#if PRE_FILTER_GEN_COEFF == TRUE
/* AFSK FIR filters. */
float32_t pre_filter_coeff_f32[PRE_FILTER_NUM_TAPS] useCCM;
#else
/*
* Pre-filter (BPF) coefficients.
* Fs=28800, f1 = 925, f2 = 2475, number of taps = 311
* Matlab/Octave parameters:
* hc = fir1(310, [925, 2475]/(Fs/2), 'pass');
*/
float32_t pre_filter_coeff_f32[PRE_FILTER_NUM_TAPS] = {
0.0002630141f, 0.0002628323f, 0.0002174784f, 0.0001439800f,
0.0000662689f, 0.0000087403f, -0.0000104737f, 0.0000152369f,
0.0000786174f, 0.0001598901f, 0.0002316217f, 0.0002660169f,
0.0002428125f, 0.0001556541f, 0.0000150847f, -0.0001529389f,
-0.0003129410f, -0.0004289345f, -0.0004742560f, -0.0004395107f,
-0.0003362076f, -0.0001946865f, -0.0000564585f, 0.0000372882f,
0.0000579911f, -0.0000007155f, -0.0001192216f, -0.0002555907f,
-0.0003562318f, -0.0003710739f, -0.0002691589f, -0.0000500718f,
0.0002525572f, 0.0005772283f, 0.0008494657f, 0.0010017974f,
0.0009933667f, 0.0008233662f, 0.0005338281f, 0.0002000953f,
-0.0000891793f, -0.0002573906f, -0.0002635755f, -0.0001170745f,
0.0001218157f, 0.0003565040f, 0.0004809200f, 0.0004114493f,
0.0001148717f, -0.0003763382f, -0.0009669091f, -0.0015204528f,
-0.0018949887f, -0.0019829034f, -0.0017439270f, -0.0012209388f,
-0.0005327554f, 0.0001555675f, 0.0006777111f, 0.0009141328f,
0.0008292156f, 0.0004858414f, 0.0000315873f, -0.0003412629f,
-0.0004518110f, -0.0001872172f, 0.0004567840f, 0.0013646274f,
0.0023242755f, 0.0030807181f, 0.0034059854f, 0.0031663042f,
0.0023666159f, 0.0011580344f, -0.0001962396f, -0.0013891652f,
-0.0021544494f, -0.0023437972f, -0.0019738661f, -0.0012274564f,
-0.0004059321f, 0.0001560330f, 0.0001905957f, -0.0004167487f,
-0.0015805414f, -0.0030247966f, -0.0043492747f, -0.0051368262f,
-0.0050731091f, -0.0040446519f, -0.0021854927f, 0.0001442042f,
0.0024453937f, 0.0042118692f, 0.0050709497f, 0.0048929927f,
0.0038363447f, 0.0023111613f, 0.0008681171f, 0.0000401684f,
0.0001807741f, 0.0013455353f, 0.0032543614f, 0.0053501112f,
0.0069426437f, 0.0074018164f, 0.0063466090f, 0.0037754712f,
0.0000966124f, -0.0039567264f, -0.0075087956f, -0.0097752826f,
-0.0102847504f, -0.0090233718f, -0.0064569060f, -0.0034162907f,
-0.0008715304f, 0.0003478556f, -0.0001914293f, -0.0023698932f,
-0.0055096823f, -0.0085320077f, -0.0102437760f, -0.0096804313f,
-0.0064109478f, -0.0007150685f, 0.0064272605f, 0.0135454918f,
0.0190429897f, 0.0216254883f, 0.0206778373f, 0.0164791731f,
0.0101834165f, 0.0035516810f, -0.0015090359f, -0.0034886155f,
-0.0017541991f, 0.0031705084f, 0.0096227405f, 0.0151387937f,
0.0170529057f, 0.0132228528f, 0.0027036543f, -0.0138107229f,
-0.0339131039f, -0.0538295639f, -0.0691388898f, -0.0757219326f,
-0.0707320414f, -0.0533595170f, -0.0251988255f, 0.0098893389f,
0.0464165977f, 0.0782860621f, 0.0999812724f, 0.1076699117f,
0.0999812724f, 0.0782860621f, 0.0464165977f, 0.0098893389f,
-0.0251988255f, -0.0533595170f, -0.0707320414f, -0.0757219326f,
-0.0691388898f, -0.0538295639f, -0.0339131039f, -0.0138107229f,
0.0027036543f, 0.0132228528f, 0.0170529057f, 0.0151387937f,
0.0096227405f, 0.0031705084f, -0.0017541991f, -0.0034886155f,
-0.0015090359f, 0.0035516810f, 0.0101834165f, 0.0164791731f,
0.0206778373f, 0.0216254883f, 0.0190429897f, 0.0135454918f,
0.0064272605f, -0.0007150685f, -0.0064109478f, -0.0096804313f,
-0.0102437760f, -0.0085320077f, -0.0055096823f, -0.0023698932f,
-0.0001914293f, 0.0003478556f, -0.0008715304f, -0.0034162907f,
-0.0064569060f, -0.0090233718f, -0.0102847504f, -0.0097752826f,
-0.0075087956f, -0.0039567264f, 0.0000966124f, 0.0037754712f,
0.0063466090f, 0.0074018164f, 0.0069426437f, 0.0053501112f,
0.0032543614f, 0.0013455353f, 0.0001807741f, 0.0000401684f,
0.0008681171f, 0.0023111613f, 0.0038363447f, 0.0048929927f,
0.0050709497f, 0.0042118692f, 0.0024453937f, 0.0001442042f,
-0.0021854927f, -0.0040446519f, -0.0050731091f, -0.0051368262f,
-0.0043492747f, -0.0030247966f, -0.0015805414f, -0.0004167487f,
0.0001905957f, 0.0001560330f, -0.0004059321f, -0.0012274564f,
-0.0019738661f, -0.0023437972f, -0.0021544494f, -0.0013891652f,
-0.0001962396f, 0.0011580344f, 0.0023666159f, 0.0031663042f,
0.0034059854f, 0.0030807181f, 0.0023242755f, 0.0013646274f,
0.0004567840f, -0.0001872172f, -0.0004518110f, -0.0003412629f,
0.0000315873f, 0.0004858414f, 0.0008292156f, 0.0009141328f,
0.0006777111f, 0.0001555675f, -0.0005327554f, -0.0012209388f,
-0.0017439270f, -0.0019829034f, -0.0018949887f, -0.0015204528f,
-0.0009669091f, -0.0003763382f, 0.0001148717f, 0.0004114493f,
0.0004809200f, 0.0003565040f, 0.0001218157f, -0.0001170745f,
-0.0002635755f, -0.0002573906f, -0.0000891793f, 0.0002000953f,
0.0005338281f, 0.0008233662f, 0.0009933667f, 0.0010017974f,
0.0008494657f, 0.0005772283f, 0.0002525572f, -0.0000500718f,
-0.0002691589f, -0.0003710739f, -0.0003562318f, -0.0002555907f,
-0.0001192216f, -0.0000007155f, 0.0000579911f, 0.0000372882f,
-0.0000564585f, -0.0001946865f, -0.0003362076f, -0.0004395107f,
-0.0004742560f, -0.0004289345f, -0.0003129410f, -0.0001529389f,
0.0000150847f, 0.0001556541f, 0.0002428125f, 0.0002660169f,
0.0002316217f, 0.0001598901f, 0.0000786174f, 0.0000152369f,
-0.0000104737f, 0.0000087403f, 0.0000662689f, 0.0001439800f,
0.0002174784f, 0.0002628323f, 0.0002630141f
};
#endif
float32_t mag_filter_coeff_f32[MAG_FILTER_NUM_TAPS] useCCM;
/*
* Data structure for AFSK decoding.
@ -565,23 +449,18 @@ AFSKDemodDriver *pktCreateAFSKDecoder(packet_svc_t *pktHandler) {
/ (pwm_accum_t)AFSK_BAUD_RATE)
/ (pwm_accum_t)SYMBOL_DECIMATION;
/* Generate the BPF and LPF filter coordinates. */
#if PRE_FILTER_GEN_COEFF == TRUE
/* Generate the pre-filter and mag-filter coordinates. */
gen_fir_bpf((float32_t)PRE_FILTER_LOW / (float32_t)FILTER_SAMPLE_RATE,
(float32_t)PRE_FILTER_HIGH / (float32_t)FILTER_SAMPLE_RATE,
pre_filter_coeff_f32,
PRE_FILTER_NUM_TAPS,
TD_WINDOW_NONE);
#endif
#if MAG_FILTER_GEN_COEFF == TRUE
gen_fir_lpf((float32_t)MAG_FILTER_HIGH / (float32_t)FILTER_SAMPLE_RATE,
mag_filter_coeff_f32,
MAG_FILTER_NUM_TAPS,
TD_WINDOW_NONE);
#endif
return myDriver;
}

Wyświetl plik

@ -62,11 +62,11 @@
#define AFSK_ERROR_TYPE AFSK_NO_ERROR
#define PRE_FILTER_GEN_COEFF TRUE
//#define PRE_FILTER_GEN_COEFF TRUE
#define PRE_FILTER_LOW 925
#define PRE_FILTER_HIGH 2475
#define MAG_FILTER_GEN_COEFF TRUE
//#define MAG_FILTER_GEN_COEFF TRUE
#define MAG_FILTER_HIGH 1400
#define PRE_FILTER_NUM_TAPS 55U
@ -89,27 +89,27 @@
/* BPF followed by fixed point IQ correlation decoder.
* Changing decimation changes the filter sample rate.
* Coefficients created dynamically are calculated at run-time.
* Coefficients generated externally in Matlab/Octave need to be re-done.
* Coefficients for fixed arrays can be generated externally in Matlab/Octave.
*
* Pre-filter (BPF) coefficients.
* Fs=sample_rate, f1 = low_corner, f2 = high_corner, number of taps = N
* Matlab/Octave parameters:
* hc = fir1(N-1, [low_corner, high_corner]/(Fs/2), 'pass');
*
* Magnitude (LPF) coefficients.
* Fs=sample_rate, f1 = high_corner, number of taps = N
* Matlab/Octave parameters:
* hc = fir1(N-1, high_corner/(Fs/2), 'low');
*
*/
#define SYMBOL_DECIMATION (12U)
/* Sample rate in Hz. */
#define FILTER_SAMPLE_RATE (SYMBOL_DECIMATION * AFSK_BAUD_RATE)
#define DECODE_FILTER_LENGTH (2U * SYMBOL_DECIMATION)
#elif
/* BPF followed by floating point IQ correlation decoder. */
#define SYMBOL_DECIMATION (24U)
/* Sample rate in Hz. */
#define FILTER_SAMPLE_RATE (SYMBOL_DECIMATION * AFSK_BAUD_RATE)
#define DECODE_FILTER_LENGTH (2U * SYMBOL_DECIMATION)
#else
/* Any other decoder. */
#define SYMBOL_DECIMATION (24U)
/* Sample rate in Hz. */
#define FILTER_SAMPLE_RATE (SYMBOL_DECIMATION * AFSK_BAUD_RATE)
#define DECODE_FILTER_LENGTH (2U * SYMBOL_DECIMATION)
#endif
/* Named services. */
#define PKT_PWM_QUEUE_PREFIX "pwmx_"
#define PKT_PWM_MBOX_PREFIX "pwmd_"
#define PKT_AFSK_THREAD_NAME_PREFIX "rxafsk_"

Wyświetl plik

@ -37,7 +37,7 @@ qcorr_tone_t qcorr_bins[QCORR_FILTER_BINS] useCCM;
* @note Allocate a pre-filter FIR record.
*/
qfir_filter_t AFSK_PWM_QFILTER useCCM;
qfir_filter_t QPRE1 useCCM;
/*
* Allocate data for prefilter FIR.
@ -50,12 +50,10 @@ q31_t pre_filter_coeff_q31[PRE_FILTER_NUM_TAPS] useCCM;
#if USE_QCORR_MAG_LPF == TRUE
/* Allocate the FIR filter structures. */
qfir_filter_t QFILT_M_MAG useCCM;
qfir_filter_t QFILT_S_MAG useCCM;
qfir_filter_t QMAGM1 useCCM;
qfir_filter_t QMAGS1 useCCM;
/*
* Allocate data for mag FIR filter.
*/
/* Allocate data for mag FIR filter. */
q31_t mag_filter_coeff_q31[MAG_FILTER_NUM_TAPS] useCCM;
arm_fir_instance_q31 m_mag_filter_instance_q31 useCCM;
@ -69,15 +67,13 @@ q31_t s_mag_filter_state_q31[MAG_FILTER_BLOCK_SIZE
#endif /* USE_QCORR_MAG_LPF == TRUE */
/* Mark and Space correlation filter instances. */
qfir_filter_t QFILT_M_COS useCCM;
qfir_filter_t QFILT_M_SIN useCCM;
qfir_filter_t QCORRMC1 useCCM;
qfir_filter_t QCORRMS1 useCCM;
qfir_filter_t QFILT_S_COS useCCM;
qfir_filter_t QFILT_S_SIN useCCM;
qfir_filter_t QCORRSC1 useCCM;
qfir_filter_t QCORRSS1 useCCM;
/*
* Allocate data for Mark and Space correlation filters.
*/
/* Allocate data for Mark and Space correlation filters. */
/* q31 filter coefficient arrays. */
q31_t m_cos_filter_coeff_q31[DECODE_FILTER_LENGTH] useCCM;
@ -103,8 +99,6 @@ q31_t s_cos_filter_state_q31[QCORR_FILTER_BLOCK_SIZE
q31_t s_sin_filter_state_q31[QCORR_FILTER_BLOCK_SIZE
+ DECODE_FILTER_LENGTH - 1] useCCM;
/*===========================================================================*/
/* Module local types. */
/*===========================================================================*/
@ -121,7 +115,6 @@ q31_t s_sin_filter_state_q31[QCORR_FILTER_BLOCK_SIZE
/* Module local functions. */
/*===========================================================================*/
/**
* @brief Resets the correlator state.
* @post Filter state is reset.
@ -632,7 +625,7 @@ void evaluate_qcorr_tone(AFSKDemodDriver *myDriver) {
*/
static void setup_qcorr_prefilter(qcorr_decoder_t *decoder) {
decoder->input_filter = &AFSK_PWM_QFILTER;
decoder->input_filter = &QPRE1;
/*
* Initialise the pre-filter.
*/
@ -679,15 +672,15 @@ void setup_qcorr_IQfilters(qcorr_decoder_t *decoder) {
/* Set COS and SIN filters for Mark and Space. */
decoder->filter_bins[AFSK_MARK_INDEX].tone_filter[QCORR_COS_INDEX]
= &QFILT_M_COS;
= &QCORRMC1;
decoder->filter_bins[AFSK_MARK_INDEX].tone_filter[QCORR_SIN_INDEX]
= &QFILT_M_SIN;
= &QCORRMS1;
decoder->filter_bins[AFSK_SPACE_INDEX].tone_filter[QCORR_COS_INDEX]
= &QFILT_S_COS;
= &QCORRSC1;
decoder->filter_bins[AFSK_SPACE_INDEX].tone_filter[QCORR_SIN_INDEX]
= &QFILT_S_SIN;
= &QCORRSS1;
/* Temporary float coeff arrays. */
float32_t cos_table[decoder->decode_length];
@ -702,7 +695,7 @@ void setup_qcorr_IQfilters(qcorr_decoder_t *decoder) {
/*
* Create the Mark correlation filters.
*/
create_qfir_filter(&QFILT_M_COS,
create_qfir_filter(&QCORRMC1,
&m_cos_filter_instance_q31,
DECODE_FILTER_LENGTH,
m_cos_filter_coeff_q31,
@ -710,7 +703,7 @@ void setup_qcorr_IQfilters(qcorr_decoder_t *decoder) {
QCORR_FILTER_BLOCK_SIZE,
cos_table);
create_qfir_filter(&QFILT_M_SIN,
create_qfir_filter(&QCORRMS1,
&m_sin_filter_instance_q31,
DECODE_FILTER_LENGTH,
m_sin_filter_coeff_q31,
@ -728,7 +721,7 @@ void setup_qcorr_IQfilters(qcorr_decoder_t *decoder) {
/*
* Create the Space correlation filters.
*/
create_qfir_filter(&QFILT_S_COS,
create_qfir_filter(&QCORRSC1,
&s_cos_filter_instance_q31,
DECODE_FILTER_LENGTH,
s_cos_filter_coeff_q31,
@ -736,7 +729,7 @@ void setup_qcorr_IQfilters(qcorr_decoder_t *decoder) {
QCORR_FILTER_BLOCK_SIZE,
cos_table);
create_qfir_filter(&QFILT_S_SIN,
create_qfir_filter(&QCORRSS1,
&s_sin_filter_instance_q31,
DECODE_FILTER_LENGTH,
s_sin_filter_coeff_q31,
@ -759,7 +752,7 @@ static void setup_qcorr_magfilter(qcorr_decoder_t *decoder) {
/*
* Initialise the magnitude filters.
*/
create_qfir_filter(&QFILT_M_MAG,
create_qfir_filter(&QMAGM1,
&m_mag_filter_instance_q31,
MAG_FILTER_NUM_TAPS,
mag_filter_coeff_q31,
@ -767,7 +760,7 @@ static void setup_qcorr_magfilter(qcorr_decoder_t *decoder) {
MAG_FILTER_BLOCK_SIZE,
mag_filter_coeff_f32);
create_qfir_filter(&QFILT_S_MAG,
create_qfir_filter(&QMAGS1,
&s_mag_filter_instance_q31,
MAG_FILTER_NUM_TAPS,
mag_filter_coeff_q31,
@ -846,8 +839,8 @@ void init_qcorr_decoder(AFSKDemodDriver *myDriver) {
#if USE_QCORR_MAG_LPF == TRUE
/* Setup the IQ magnitude LPFs. */
decoder->filter_bins[AFSK_MARK_INDEX].mag_filter = &QFILT_M_MAG;
decoder->filter_bins[AFSK_SPACE_INDEX].mag_filter = &QFILT_S_MAG;
decoder->filter_bins[AFSK_MARK_INDEX].mag_filter = &QMAGM1;
decoder->filter_bins[AFSK_SPACE_INDEX].mag_filter = &QMAGS1;
setup_qcorr_magfilter(decoder);
#endif
}