added option for normalisation of fsk eye diagram samples
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 15 Jan 2017 22:33:20 +0000 (22:33 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 15 Jan 2017 22:33:20 +0000 (22:33 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2977 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/freedv_api.c
codec2-dev/src/fsk.c
codec2-dev/src/fsk.h

index 071e5bc3caf1759de7e49c89ef1c3609f78ac95b..62d92769a29cccc0c4c6f78be1999b8105dd94e3 100644 (file)
@@ -236,6 +236,7 @@ struct freedv *freedv_open(int mode) {
         
         f->n_protocol_bits = 0;
         codec2_mode = CODEC2_MODE_700C;
+        fsk_stats_normalise_eye(f->fsk, 0);
     }
     
 
index 3b510b85416d939c4a72dbc88e017fe110e137fe..0c3a481dd9efe69016a9e32211f1cbdbd255b938 100644 (file)
@@ -246,6 +246,7 @@ struct FSK * fsk_create_hbr(int Fs, int Rs,int P,int M, int tx_f1, int tx_fs)
         free(fsk);
         return NULL;
     }
+    fsk->normalise_eye = 1;
 
     return fsk;
 }
@@ -380,6 +381,7 @@ struct FSK * fsk_create(int Fs, int Rs,int M, int tx_f1, int tx_fs)
         free(fsk);
         return NULL;
     }
+    fsk->normalise_eye = 1;
 
     return fsk;
 }
@@ -956,17 +958,19 @@ void fsk2_demod(struct FSK *fsk, uint8_t rx_bits[], float rx_sd[], COMP fsk_in[]
         }
     }
         
-    eye_max = 0;
-    /* Normalize eye to +/- 1 */
-    for(i=0; i<M*eye_traces; i++)
-        for(j=0; j<neyesamp; j++)
-            if(fabsf(fsk->stats->rx_eye[i][j])>eye_max)
-                eye_max = fabsf(fsk->stats->rx_eye[i][j]);
-        
-    for(i=0; i<M*eye_traces; i++)
-        for(j=0; j<neyesamp; j++)
-            fsk->stats->rx_eye[i][j] = fsk->stats->rx_eye[i][j]/eye_max;
+    if (fsk->normalise_eye) {
+        eye_max = 0;
+        /* Normalize eye to +/- 1 */
+        for(i=0; i<M*eye_traces; i++)
+            for(j=0; j<neyesamp; j++)
+                if(fabsf(fsk->stats->rx_eye[i][j])>eye_max)
+                    eye_max = fabsf(fsk->stats->rx_eye[i][j]);
         
+        for(i=0; i<M*eye_traces; i++)
+            for(j=0; j<neyesamp; j++)
+                fsk->stats->rx_eye[i][j] = fsk->stats->rx_eye[i][j]/eye_max;
+    }
+
     fsk->stats->nr = 0;
     fsk->stats->Nc = 0;
     
@@ -1087,7 +1091,9 @@ void fsk_mod_c(struct FSK *fsk,COMP fsk_out[],uint8_t tx_bits[]){
     
 }
 
-
+void fsk_stats_normalise_eye(struct FSK *fsk, int normalise_enable) {
+    fsk->normalise_eye = normalise_enable;
+}
 
 
 
index 470121b1f1a7b1116130c6fd5204cc566be77dd9..d20b665414a94251f8d644eba0366de99169bac0 100644 (file)
@@ -85,6 +85,7 @@ struct FSK {
     
     /*  modem statistic struct */
     struct MODEM_STATS *stats;
+    int normalise_eye;      /* enables/disables normalisation of eye diagram */
 };
 
 /*
@@ -182,4 +183,8 @@ void fsk_demod(struct FSK *fsk, uint8_t rx_bits[],COMP fsk_in[]);
  */
 void fsk_demod_sd(struct FSK *fsk, float rx_bits[],COMP fsk_in[]);
 
+/* enables/disables normalisation of eye diagram samples */
+  
+void fsk_stats_normalise_eye(struct FSK *fsk, int normalise_enable);
+
 #endif