* Noise suppression
    - Corrected decoder reset when noise detected
  * Filter coefficients
    - removed integer dependency
pull/1/head
David Freese 2013-01-08 15:51:22 -06:00
rodzic 0e27f1ce2f
commit d12f7da22f
1 zmienionych plików z 8 dodań i 10 usunięć

Wyświetl plik

@ -290,17 +290,18 @@ cw::cw() : modem()
bandwidth = progdefaults.CWbandwidth; bandwidth = progdefaults.CWbandwidth;
if (use_matched_filter) if (use_matched_filter)
progdefaults.CWbandwidth = bandwidth = 2.0 * progdefaults.CWspeed / 1.2 + 0.5; progdefaults.CWbandwidth = bandwidth = 2.0 * progdefaults.CWspeed / 1.2;
hilbert = new C_FIR_filter(); // hilbert transform used by FFT filter hilbert = new C_FIR_filter(); // hilbert transform used by FFT filter
hilbert->init_hilbert(37, 1); hilbert->init_hilbert(37, 1);
cw_FIR_filter = new C_FIR_filter(); cw_FIR_filter = new C_FIR_filter();
cw_FIR_filter->init_lowpass (CW_FIRLEN, DEC_RATIO, 0.5 * bandwidth / samplerate); cw_FIR_filter->init_lowpass (CW_FIRLEN, DEC_RATIO, progdefaults.CWspeed/(1.2 * samplerate));
//overlap and add filter length should be a factor of 2 //overlap and add filter length should be a factor of 2
// low pass implementation
FilterFFTLen = 4096; FilterFFTLen = 4096;
cw_FFT_filter = new fftfilt(0.5 * bandwidth / samplerate, FilterFFTLen); // low pass implementation cw_FFT_filter = new fftfilt(progdefaults.CWspeed/(1.2 * samplerate), FilterFFTLen);
// bit filter based on 10 msec rise time of CW waveform // bit filter based on 10 msec rise time of CW waveform
int bfv = (int)(samplerate * .010 / DEC_RATIO); int bfv = (int)(samplerate * .010 / DEC_RATIO);
@ -328,15 +329,15 @@ void cw::reset_rx_filter()
cw_send_speed = cw_speed = progdefaults.CWspeed; cw_send_speed = cw_speed = progdefaults.CWspeed;
if (use_matched_filter) if (use_matched_filter)
progdefaults.CWbandwidth = bandwidth = (int)(2.0 * progdefaults.CWspeed / 1.2 + .05); progdefaults.CWbandwidth = bandwidth = 2.0 * progdefaults.CWspeed / 1.2;
else else
bandwidth = progdefaults.CWbandwidth; bandwidth = progdefaults.CWbandwidth;
if (use_fft_filter) { // FFT filter if (use_fft_filter) { // FFT filter
cw_FFT_filter->create_lpf(0.5 * bandwidth / samplerate); cw_FFT_filter->create_lpf(progdefaults.CWspeed/(1.2 * samplerate));
FFTphase = 0; FFTphase = 0;
} else { // FIR filter } else { // FIR filter
cw_FIR_filter->init_lowpass (CW_FIRLEN, DEC_RATIO, 0.5 * bandwidth / samplerate); cw_FIR_filter->init_lowpass (CW_FIRLEN, DEC_RATIO, progdefaults.CWspeed/(1.2 * samplerate));
FIRphase = 0; FIRphase = 0;
} }
REQ(static_cast<void (waterfall::*)(int)>(&waterfall::Bandwidth), REQ(static_cast<void (waterfall::*)(int)>(&waterfall::Bandwidth),
@ -540,7 +541,6 @@ complex cw::mixer(complex in)
void cw::decode_stream(double value) void cw::decode_stream(double value)
{ {
const char *c, *somc; const char *c, *somc;
static int state = 0;
char *cptr; char *cptr;
@ -568,12 +568,10 @@ void cw::decode_stream(double value)
// upward trend means tone starting // upward trend means tone starting
if ((value > progdefaults.CWupper) && (cw_receive_state != RS_IN_TONE)) { if ((value > progdefaults.CWupper) && (cw_receive_state != RS_IN_TONE)) {
handle_event(CW_KEYDOWN_EVENT, NULL); handle_event(CW_KEYDOWN_EVENT, NULL);
state = 1;
} }
// downward trend means tone stopping // downward trend means tone stopping
if ((value < progdefaults.CWlower) && (cw_receive_state == RS_IN_TONE)) { if ((value < progdefaults.CWlower) && (cw_receive_state == RS_IN_TONE)) {
handle_event(CW_KEYUP_EVENT, NULL); handle_event(CW_KEYUP_EVENT, NULL);
state = 0;
} }
} }
@ -760,7 +758,7 @@ int cw::handle_event(int cw_event, const char **c)
// threshold that has been set, then ignore this tone. // threshold that has been set, then ignore this tone.
if (cw_noise_spike_threshold > 0 if (cw_noise_spike_threshold > 0
&& element_usec < cw_noise_spike_threshold) { && element_usec < cw_noise_spike_threshold) {
cw_receive_state = old_cw_receive_state; cw_receive_state = RS_IDLE;
return CW_ERROR; return CW_ERROR;
} }