From: drowe67 Date: Wed, 21 Nov 2012 22:03:13 +0000 (+0000) Subject: reversed direction of freq shifter for consistency and exposed centre freq in fdmdv... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=e0f9d56ea7a1c7f35039dbb19929de48ac23b296;p=freetel-svn-tracking.git reversed direction of freq shifter for consistency and exposed centre freq in fdmdv modem header file git-svn-id: https://svn.code.sf.net/p/freetel/code@1044 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/fdmdv.c b/codec2-dev/src/fdmdv.c index b16d8018..ca60e5ba 100644 --- a/codec2-dev/src/fdmdv.c +++ b/codec2-dev/src/fdmdv.c @@ -178,19 +178,19 @@ struct FDMDV * CODEC2_WIN32SUPPORT fdmdv_create(void) /* Set up frequency of each carrier */ for(c=0; cfreq[c].real = cos(2.0*PI*carrier_freq/FS); f->freq[c].imag = sin(2.0*PI*carrier_freq/FS); } for(c=NC/2; cfreq[c].real = cos(2.0*PI*carrier_freq/FS); f->freq[c].imag = sin(2.0*PI*carrier_freq/FS); } - f->freq[NC].real = cos(2.0*PI*FCENTRE/FS); - f->freq[NC].imag = sin(2.0*PI*FCENTRE/FS); + f->freq[NC].real = cos(2.0*PI*FDMDV_FCENTRE/FS); + f->freq[NC].imag = sin(2.0*PI*FDMDV_FCENTRE/FS); /* Generate DBPSK pilot Look Up Table (LUT) */ @@ -724,7 +724,7 @@ void CODEC2_WIN32SUPPORT fdmdv_freq_shift(COMP rx_fdm_fcorr[], COMP rx_fdm[], fl foff_rect->real = cos(2.0*PI*foff/FS); foff_rect->imag = sin(2.0*PI*foff/FS); for(i=0; icoarse_fine == COARSE) fdmdv->foff = foff_coarse; - fdmdv_freq_shift(rx_fdm_fcorr, rx_fdm, fdmdv->foff, &fdmdv->foff_rect, &fdmdv->foff_phase_rect, *nin); + fdmdv_freq_shift(rx_fdm_fcorr, rx_fdm, -fdmdv->foff, &fdmdv->foff_rect, &fdmdv->foff_phase_rect, *nin); /* baseband processing */ diff --git a/codec2-dev/src/fdmdv.h b/codec2-dev/src/fdmdv.h index e19fc696..a9c768f8 100644 --- a/codec2-dev/src/fdmdv.h +++ b/codec2-dev/src/fdmdv.h @@ -60,6 +60,7 @@ extern "C" { #define FDMDV_MAX_SAMPLES_PER_FRAME 200 /* max demod samples/frame, use this to allocate storage */ #define FDMDV_SCALE 1000 /* suggested scaling for 16 bit shorts */ #define FDMDV_NSYM 15 +#define FDMDV_FCENTRE 1200 /* Centre frequency, Nc/2 carriers below this, Nc/2 carriers above (Hz) */ /* 8 to 48 kHz sample rate conversion */ diff --git a/codec2-dev/src/fdmdv_internal.h b/codec2-dev/src/fdmdv_internal.h index 34c9ab5b..9d4e0c30 100644 --- a/codec2-dev/src/fdmdv_internal.h +++ b/codec2-dev/src/fdmdv_internal.h @@ -43,7 +43,7 @@ #define FS 8000 /* sample rate in Hz */ #define T (1.0/FS) /* sample period in seconds */ #define RS 50 /* symbol rate in Hz */ -#define NC 14 /* number of carriers */ +#define NC 14 /* number of data carriers (plus one pilot in the centre) */ #define NB 2 /* Bits/symbol for QPSK modulation */ #define RB (NC*RS*NB) /* bit rate */ #define M (FS/RS) /* oversampling factor */ @@ -51,7 +51,6 @@ #define NFILTER (NSYM*M) /* size of tx/rx filters at sample rate M */ #define FSEP 75 /* Separation between carriers (Hz) */ -#define FCENTRE 1200 /* Centre frequency, Nc/2 carriers below this, Nc/2 carriers above (Hz) */ #define NT 5 /* number of symbols we estimate timing over */ #define P 4 /* oversample factor used for initial rx symbol filtering */ @@ -69,8 +68,10 @@ #define COARSE 0 #define FINE 1 -#define TRACK_COEFF 0.5 +/* averaging filter coeffs */ + +#define TRACK_COEFF 0.5 #define SNR_COEFF 0.9 /* SNR est averaging filter coeff */ /*---------------------------------------------------------------------------*\ diff --git a/codec2-dev/src/fifo.c b/codec2-dev/src/fifo.c index 6ac3dbac..4d224da7 100644 --- a/codec2-dev/src/fifo.c +++ b/codec2-dev/src/fifo.c @@ -6,7 +6,7 @@ A FIFO design useful in gluing the FDMDV modem and codec together in integrated applications. The unittest/tfifo indicates these - routines are thread safe without the need for syncronisisation + routines are thread safe without the need for syncronisation object, e.g. a different thread can read and write to a fifo at the same time.