Hello Richard,

I dug through the svn log of codec2-dev/src/fdmdv.c and grabbed a
version from about a week ago, just before I started messing around.
Have attached what I think is the offending code (diff attached).  

I think we were a bit unlucky, the day codec2 was updated from
codec2-dev was modem open heart surgery day.

The basic test does it's thing now:

~/codec2/build_linux/src$ ./fdmdv_get_test_bits - 14000 | ./fdmdv_mod -
- | ./fdmdv_demod - - | ./fdmdv_put_test_bits -
bits_per_fdmdv_frame: 28 bits_per_codec_frame: 56 bytes_per_codec_frame:
7
bits_per_fdmdv_frame: 28 bits_per_codec_frame: 56 bytes_per_codec_frame:
7
---------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--
bits 13664  errors 0  BER 0.0000

Cheers,

David


On Fri, 2014-06-20 at 12:32 -0500, Richard Shaw wrote:
>  Fri, Jun 20, 2014 at 7:04 AM, David Rowe <[email protected]> wrote:
>         ./fdmdv_get_test_bits - 14000 | ./fdmdv_mod - -
>         | ./fdmdv_demod - -
>         | ./fdmdv_put_test_bits -
>         
>         doesn't work for me in the latest codec-dec & codec2, but does
>         work in
>         an earlier version I have laying around (SVN revision 1342).
>         
>         The correct output is something like:
>         
>         
> "---------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
> 
> 
> I can confirm that it was the commit made to get codec2 building again
> with fdmdv2 that caused the problem. Trying the revision just prior
> (1632) gets good results:
> 
> 
> $ ./fdmdv_get_test_bits - 14000 | ./fdmdv_mod - - | ./fdmdv_demod - -
> | ./fdmdv_put_test_bits -
> bits_per_fdmdv_frame: 28 bits_per_codec_frame: 56
> bytes_per_codec_frame: 7
> bits_per_fdmdv_frame: 28 bits_per_codec_frame: 56
> bytes_per_codec_frame: 7
> ---------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--
> bits 13664  errors 0  BER 0.0000 
> 
> 
> Here's the commit:
> 
> 
> https://dl.dropboxusercontent.com/u/34775202/codec2-svn1656.diff
> 
> 
> 
> Can someone figure out what caused the problem?
> 
> 
> Thanks,
> Richard
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
> _______________________________________________ Freetel-codec2 mailing list 
> [email protected] 
> https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Index: fdmdv.c
===================================================================
--- fdmdv.c	(revision 1695)
+++ fdmdv.c	(working copy)
@@ -106,7 +106,7 @@
 
 static float cabsolute(COMP a)
 {
-    return sqrt(a.real*a.real + a.imag*a.imag);
+    return sqrt(pow(a.real, 2.0) + pow(a.imag, 2.0));
 }
 
 /*---------------------------------------------------------------------------*\
@@ -644,15 +644,13 @@
 
     for(i=0; i<NPILOTLPF-nin; i++)
 	pilot_lpf[i] = pilot_lpf[nin+i];
-    for(i=NPILOTLPF-nin, j=NPILOTCOEFF; i<NPILOTLPF; i++,j++) {
+    for(i=NPILOTLPF-nin, j=0; 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]));
-	    //pilot_lpf[i] = pilot_baseband[j-NPILOTCOEFF+1];
-        }
+	for(k=0; k<NPILOTCOEFF; k++)
+	    pilot_lpf[i] = cadd(pilot_lpf[i], fcmult(pilot_coeff[k], pilot_baseband[j+k]));
     }
 
-   /* 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++) {
@@ -724,9 +722,9 @@
     /*
       Down convert latest M samples of pilot by multiplying by ideal
       BPSK pilot signal we have generated locally.  The peak of the
-      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.
+      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++) {
@@ -735,7 +733,7 @@
     }
 
     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]));
     }
 
@@ -1019,10 +1017,8 @@
        leads to sensible scatter plots */
 
     for(c=0; c<Nc; c++) {
-        norm = 1.0/(1E-6 + cabsolute(prev_rx_symbols[c]));
-	prev_rx_symbols[c] = fcmult(norm, prev_rx_symbols[c]);
-        phase_difference[c] = cmult(prev_rx_symbols[c], cconj(prev_rx_symbols[c]));
-	phase_difference[c] = cmult(phase_difference[c],pi_on_4);        
+        norm = 1.0/(cabsolute(prev_rx_symbols[c])+1E-6);
+	phase_difference[c] = cmult(cmult(rx_symbols[c], fcmult(norm,cconj(prev_rx_symbols[c]))), pi_on_4);
     }
 				    
     /* map (Nc,1) DQPSK symbols back into an (1,Nc*Nb) array of bits */
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to