From: drowe67 Date: Sun, 13 Sep 2015 01:05:40 +0000 (+0000) Subject: fixed seg fault bug at start up caused from foff_filt not being initialised X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=840a02fbd8f58ed491855a4b88893024777740f1;p=freetel-svn-tracking.git fixed seg fault bug at start up caused from foff_filt not being initialised git-svn-id: https://svn.code.sf.net/p/freetel/code@2319 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/cohpsk.c b/codec2-dev/src/cohpsk.c index 25425734..bcaacc8b 100644 --- a/codec2-dev/src/cohpsk.c +++ b/codec2-dev/src/cohpsk.c @@ -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 */ diff --git a/codec2-dev/src/fdmdv.c b/codec2-dev/src/fdmdv.c index bab288d5..64e2abb1 100644 --- a/codec2-dev/src/fdmdv.c +++ b/codec2-dev/src/fdmdv.c @@ -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) diff --git a/codec2-dev/src/fdmdv_internal.h b/codec2-dev/src/fdmdv_internal.h index 74911774..3ba4b0d7 100644 --- a/codec2-dev/src/fdmdv_internal.h +++ b/codec2-dev/src/fdmdv_internal.h @@ -124,7 +124,7 @@ struct FDMDV { float foff; COMP foff_phase_rect; - float filt; + float foff_filt; /* Demodulator */