stats->rx_timing = coh->rx_timing;
stats->clock_offset = 0.0; /* TODO - implement clock offset estimation */
- assert(stats->nr <= MODEM_STATS_NR_MAX);
+ assert(NSYMROW <= MODEM_STATS_NR_MAX);
stats->nr = NSYMROW;
for(c=0; c<COHPSK_NC*ND; c++) {
for (r=0; r<NSYMROW; r++) {
f->mode = mode;
f->test_frames = 0;
-
+ f->snr_squelch_thresh = 2.0;
+
if (mode == FREEDV_MODE_1600) {
Nc = 16;
f->tx_sync_bit = 0;
f->fdmdv = fdmdv_create(Nc);
if (f->fdmdv == NULL)
return NULL;
- f->snr_thresh = 2.0;
golay23_init();
f->nin = FDMDV_NOM_SAMPLES_PER_FRAME;
f->n_nom_modem_samples = 2*FDMDV_NOM_SAMPLES_PER_FRAME;
bits_per_codec_frame = codec2_bits_per_frame(f->codec2);
bytes_per_codec_frame = (bits_per_codec_frame + 7) / 8;
+ nout = f->n_speech_samples;
if (f->mode == FREEDV_MODE_1600) {
int reliable_sync_bit;
/* squelch if beneath SNR threshold or test frames enabled */
- if ((f->stats.snr_est < f->snr_thresh) || f->test_frames) {
+ if ((f->stats.snr_est < f->snr_squelch_thresh) || f->test_frames) {
for(i=0; i<f->n_speech_samples; i++)
speech_out[i] = 0;
}
nin_prev = f->nin;
cohpsk_demod(f->cohpsk, rx_bits, &sync, demod_in, &f->nin);
f->sync = sync;
- f->snr_est = 2.0;
+ cohpsk_get_demod_stats(f->cohpsk, &f->stats);
+ f->snr_est = f->stats.snr_est;
if (sync) {
}
codec2_decode(f->codec2, speech_out, f->packed_codec_bits);
+
+ if (f->stats.snr_est < f->snr_squelch_thresh) {
+ for(i=0; i<f->n_speech_samples; i++)
+ speech_out[i] = 0;
+ }
speech_out += codec2_samples_per_frame(f->codec2);
}
nout = f->n_speech_samples;
freedv->callback_state = (void*)&my_cb_state;
freedv->freedv_put_next_rx_char = &my_put_next_rx_char;
- freedv->snr_thresh = -100.0;
+ freedv->snr_squelch_thresh = -100.0;
/* Note we need to work out how many samples demod needs on each
call (nin). This is used to adjust for differences in the tx and rx
nin = freedv_nin(freedv);
while(fread(demod_in, sizeof(short), nin, fin) == nin) {
frame++;
- cohpsk_set_frame(freedv->cohpsk, frame);
+ if (mode == FREEDV_MODE_700)
+ cohpsk_set_frame(freedv->cohpsk, frame);
nout = freedv_rx(freedv, speech_out, demod_in);
nin = freedv_nin(freedv);