From: drowe67 Date: Tue, 17 Jul 2012 02:16:38 +0000 (+0000) Subject: only decodes when demod in sync and SNR above a threshold, works OK with no channel... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=b9ba43c2b5fffd4c46e09dbfbfa54b3af751f9f4;p=freetel-svn-tracking.git only decodes when demod in sync and SNR above a threshold, works OK with no channel noise, and 10Hz freq offsets git-svn-id: https://svn.code.sf.net/p/freetel/code@591 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/fltk/fl_fdmdv.cxx b/codec2-dev/fltk/fl_fdmdv.cxx index 9d1353d8..d5894917 100644 --- a/codec2-dev/fltk/fl_fdmdv.cxx +++ b/codec2-dev/fltk/fl_fdmdv.cxx @@ -696,25 +696,53 @@ void per_frame_rx_processing(short output_buf[], /* output buf of decoded speec aSNR->add_new_sample(stats.snr_est); /* - State machine to decode codec bits only if we have a 0,1 sync bit - sequence. Collects two frames of demod bits to decode one frame of - codec bits. + State machine to: + + + Mute decoded audio when out of sync. The demod is synced + when we are using the fine freq estimate. + + + Decode codec bits only if we have a 0,1 sync bit + sequence. Collects two frames of demod bits to decode + one frame of codec bits. */ next_state = *state; switch (*state) { case 0: - if (sync_bit == 0) { + /* mute output audio when out of sync */ + + if (*n_output_buf < 2*codec2_samples_per_frame(c2) - N8) { + for(i=0; i 3.0)) next_state = 1; + break; + case 1: + if (sync_bit == 0) { + next_state = 2; + /* first half of frame of codec bits */ memcpy(codec_bits, rx_bits, FDMDV_BITS_PER_FRAME*sizeof(int)); } else + next_state = 1; + + if (stats.fest_coarse_fine == 0) next_state = 0; + break; - case 1: + case 2: + next_state = 1; + + if (stats.fest_coarse_fine == 0) + next_state = 0; + if (sync_bit == 1) { /* second half of frame of codec bits */ @@ -743,7 +771,6 @@ void per_frame_rx_processing(short output_buf[], /* output buf of decoded speec assert(*n_output_buf <= (2*codec2_samples_per_frame(c2))); } - next_state = 0; break; } *state = next_state; @@ -872,10 +899,18 @@ static int callback( const void *inputBuffer, void *outputBuffer, input_buf, &n_input_buf, &nin, &state, codec2); + /* if demod out of sync copy input audio from A/D to aid in tuning */ + if (n_output_buf >= N8) { - for(i=0; i= 0);