off by one error in lpf_peak_pick() filtering and filter coeffs brought into sync...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 15 Jun 2014 03:56:37 +0000 (03:56 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 15 Jun 2014 03:56:37 +0000 (03:56 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1650 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/fdmdv.c
codec2-dev/src/pilot_coeff.h

index 6c664f79e83c3d552704280c71aa60cd46aee7df..f912c5d3eab3a171f3a3ae6f922410e75b78c1c1 100644 (file)
@@ -644,13 +644,15 @@ void lpf_peak_pick(float *foff, float *max, COMP pilot_baseband[],
 
     for(i=0; i<NPILOTLPF-nin; i++)
        pilot_lpf[i] = pilot_lpf[nin+i];
-    for(i=NPILOTLPF-nin, j=0; i<NPILOTLPF; i++,j++) {
+    for(i=NPILOTLPF-nin, j=NPILOTCOEFF; i<NPILOTLPF; i++,j++) {
        pilot_lpf[i].real = 0.0; pilot_lpf[i].imag = 0.0;
-       for(k=0; k<NPILOTCOEFF; k++)
-           pilot_lpf[i] = cadd(pilot_lpf[i], fcmult(pilot_coeff[k], pilot_baseband[j+k]));
+       for(k=0; k<NPILOTCOEFF; k++) {
+           pilot_lpf[i] = cadd(pilot_lpf[i], fcmult(pilot_coeff[k], pilot_baseband[j-k]));
+           //pilot_lpf[i] = pilot_baseband[j-NPILOTCOEFF+1];
+        }
     }
 
-    /* decimate to improve DFT resolution, window and DFT */
+   /* decimate to improve DFT resolution, window and DFT */
 
     mpilot = FS/(2*200);  /* calc decimation rate given new sample rate is twice LPF freq */
     for(i=0; i<MPILOTFFT; i++) {
@@ -722,9 +724,9 @@ float rx_est_freq_offset(struct FDMDV *f, COMP rx_fdm[], int nin)
     /*
       Down convert latest M samples of pilot by multiplying by ideal
       BPSK pilot signal we have generated locally.  The peak of the
-      resulting signal is sensitive to the time shift between the
-      received and local version of the pilot, so we do it twice at
-      different time shifts and choose the maximum.
+      DFT of the resulting signal is sensitive to the time shift
+      between the received and local version of the pilot, so we do it
+      twice at different time shifts and choose the maximum.
     */
 
     for(i=0; i<NPILOTBASEBAND-nin; i++) {
@@ -733,7 +735,7 @@ float rx_est_freq_offset(struct FDMDV *f, COMP rx_fdm[], int nin)
     }
 
     for(i=0,j=NPILOTBASEBAND-nin; i<nin; i++,j++) {
-               f->pilot_baseband1[j] = cmult(rx_fdm[i], cconj(pilot[i]));
+        f->pilot_baseband1[j] = cmult(rx_fdm[i], cconj(pilot[i]));
        f->pilot_baseband2[j] = cmult(rx_fdm[i], cconj(prev_pilot[i]));
     }
 
index 66e7501d8fae38862796d8825c5ec95086cff433..b284af93bde128ba1073100096e703f2835eab64 100644 (file)
@@ -1,34 +1,34 @@
 /* Generated by pilot_coeff_file() Octave function */
 
 const float pilot_coeff[]={
-  0.00204705,
-  0.00276339,
-  0.00432595,
-  0.00697042,
-  0.0108452,
-  0.0159865,
-  0.0223035,
-  0.029577,
-  0.0374709,
-  0.045557,
-  0.0533491,
-  0.0603458,
-  0.0660751,
-  0.070138,
-  0.0722452,
-  0.0722452,
-  0.070138,
-  0.0660751,
-  0.0603458,
-  0.0533491,
-  0.045557,
-  0.0374709,
-  0.029577,
-  0.0223035,
-  0.0159865,
-  0.0108452,
-  0.00697042,
-  0.00432595,
-  0.00276339,
-  0.00204705
+  0.00223001,
+  0.00301037,
+  0.00471258,
+  0.0075934,
+  0.0118145,
+  0.0174153,
+  0.0242969,
+  0.0322204,
+  0.0408199,
+  0.0496286,
+  0.0581172,
+  0.0657392,
+  0.0719806,
+  0.0764066,
+  0.0787022,
+  0.0787022,
+  0.0764066,
+  0.0719806,
+  0.0657392,
+  0.0581172,
+  0.0496286,
+  0.0408199,
+  0.0322204,
+  0.0242969,
+  0.0174153,
+  0.0118145,
+  0.0075934,
+  0.00471258,
+  0.00301037,
+  0.00223001
 };