fixed seg fault bug at start up caused from foff_filt not being initialised
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 13 Sep 2015 01:05:40 +0000 (01:05 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 13 Sep 2015 01:05:40 +0000 (01:05 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2319 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/cohpsk.c
codec2-dev/src/fdmdv.c
codec2-dev/src/fdmdv_internal.h

index 2542573444b470723c3dd97d56f3941d3012f92b..bcaacc8b202687d105d102ead6e809d44fda171a 100644 (file)
@@ -881,9 +881,9 @@ void rate_Fs_rx_processing(struct COHPSK *coh, COMP ch_symb[][COHPSK_NC*ND], COM
             /* loop filter made up of 1st order IIR plus integrator.  Integerator
                was found to be reqd  */
         
-            fdmdv->filt = (1.0-beta)*fdmdv->filt + beta*atan2(mod_strip.imag, mod_strip.real);
-            //printf("filt: %f angle: %f\n", fdmdv->filt, atan2(mod_strip.imag, mod_strip.real));
-            *f_est += g*fdmdv->filt;
+            fdmdv->foff_filt = (1.0-beta)*fdmdv->foff_filt + beta*atan2(mod_strip.imag, mod_strip.real);
+            //printf("foff_filt: %f angle: %f\n", fdmdv->foff_filt, atan2(mod_strip.imag, mod_strip.real));
+            *f_est += g*fdmdv->foff_filt;
         }    
 
         /* Optional logging used for testing against Octave version */
index bab288d51c84f73a007f70d1221bce2ee3cbc775..64e2abb1d7ee87ba957d60f34d3188bfdcda6815 100644 (file)
@@ -183,6 +183,7 @@ struct FDMDV * fdmdv_create(int Nc)
     }
 
     f->sig_pwr_av = 0.0;
+    f->foff_filt = 0.0;
 
     return f;
 }
@@ -1168,6 +1169,8 @@ float rx_est_timing(COMP rx_symbols[],
        P/4 part was adjusted by experiment, I know not why.... */
     
     norm_rx_timing = atan2f(x.imag, x.real)/(2*PI);
+    assert(fabsf(norm_rx_timing) < 1.0);
+    //fprintf(stderr,"%f %f norm_rx_timing: %f\n", x.real, x.imag, norm_rx_timing);
     rx_timing      = norm_rx_timing*P + P/4;
     
     if (rx_timing > P)
index 74911774ff270d6be19b8f5701a1b856319fcd2b..3ba4b0d74311f24334eb3e79a551ce24ba51ba3a 100644 (file)
@@ -124,7 +124,7 @@ struct FDMDV {
 
     float foff;
     COMP foff_phase_rect;
-    float filt;
+    float foff_filt;
 
     /* Demodulator */