reversed direction of freq shifter for consistency and exposed centre freq in fdmdv...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 21 Nov 2012 22:03:13 +0000 (22:03 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 21 Nov 2012 22:03:13 +0000 (22:03 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1044 01035d8c-6547-0410-b346-abe4f91aad63

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

index b16d80181f8baac3e5040322692315ab8d2599d0..ca60e5bac4c5900b8a2e031d4bd188a5cc013065 100644 (file)
@@ -178,19 +178,19 @@ struct FDMDV * CODEC2_WIN32SUPPORT fdmdv_create(void)
     /* Set up frequency of each carrier */
 
     for(c=0; c<NC/2; c++) {
-       carrier_freq = (-NC/2 + c)*FSEP + FCENTRE;
+       carrier_freq = (-NC/2 + c)*FSEP + FDMDV_FCENTRE;
        f->freq[c].real = cos(2.0*PI*carrier_freq/FS);
        f->freq[c].imag = sin(2.0*PI*carrier_freq/FS);
     }
 
     for(c=NC/2; c<NC; c++) {
-       carrier_freq = (-NC/2 + c + 1)*FSEP + FCENTRE;
+       carrier_freq = (-NC/2 + c + 1)*FSEP + FDMDV_FCENTRE;
        f->freq[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; i<nin; i++) {
-       *foff_phase_rect = cmult(*foff_phase_rect, cconj(*foff_rect));
+       *foff_phase_rect = cmult(*foff_phase_rect, *foff_rect);
        rx_fdm_fcorr[i] = cmult(rx_fdm[i], *foff_phase_rect);
     }
 
@@ -1226,7 +1226,7 @@ void CODEC2_WIN32SUPPORT fdmdv_demod(struct FDMDV *fdmdv, int rx_bits[],
     
     if (fdmdv->coarse_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 */
 
index e19fc696787dbacb2dc1be7db495a9ab896a6a78..a9c768f890697d989d0aa31a74829163b5a8e43d 100644 (file)
@@ -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 */
 
index 34c9ab5bf73dd7dd4d1cc85559f8c0aa4145f9cd..9d4e0c304504a14d9f05042f921e3141565e7e8d 100644 (file)
@@ -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               */
 
 #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 */
 
 /*---------------------------------------------------------------------------*\
index 6ac3dbac73de6be9d819d1c563645eafd6c94b94..4d224da7e1bc686af08fe5272703880a2e35b972 100644 (file)
@@ -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.