another go at squench for 800XA
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 7 Feb 2017 04:05:38 +0000 (04:05 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 7 Feb 2017 04:05:38 +0000 (04:05 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3021 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/freedv_api.c

index ace5958ae8c5844bd17baddb48225ee0304e7802..9026ddcfafa85a1dc3eee9b1efad2dc571c1b65a 100644 (file)
@@ -917,18 +917,21 @@ int freedv_comprx_fsk(struct freedv *f, COMP demod_in[], int *valid) {
             (*f->freedv_put_next_proto)(f->proto_callback_state,(char*)proto_bits);
         }
         *valid = 1;
+
+        /* squelch if if sync but SNR too low */
+        if (f->squelch_en && (f->snr_est < f->snr_squelch_thresh)) {
+            *valid = 0;
+        }
     } else {
-        /* Fill with silence */
-        *valid = 0;
+        /* squelch if out of sync, or echo input of squelch off */
+        if (f->squelch_en) 
+            *valid = 0;
+        else
+            *valid = -1;
     }
     f->sync = f->deframer->state;
     f->stats.sync = f->deframer->state;
 
-    if (f->squelch_en && (f->stats.snr_est < f->snr_squelch_thresh)) {
-        //fprintf(stderr,"squelch %f %f !\n", f->stats.snr_est, f->snr_squelch_thresh);
-        *valid = 0;
-    }
-
     return f->n_speech_samples;
 }