coding up first few FDDV C functions and test framework for Octave to C port
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 16 Apr 2012 00:02:50 +0000 (00:02 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 16 Apr 2012 00:02:50 +0000 (00:02 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@369 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/fdmdv.m
codec2-dev/octave/fdmdv_ut.m
codec2-dev/src/fdmdv.c [new file with mode: 0644]
codec2-dev/src/fdmdv.h [new file with mode: 0644]
codec2-dev/src/fdmdv_internal.h [new file with mode: 0644]
codec2-dev/src/rn.h [new file with mode: 0644]
codec2-dev/src/test_bits.h [new file with mode: 0644]
codec2-dev/unittest/tfdmdv.c [new file with mode: 0644]

index f892046d2053dcc1b95a9b398a5c8e203566bc22..70aa82481f3d174a1ad87cccf3cae1fabf84860a 100644 (file)
@@ -704,6 +704,24 @@ function [track state] = freq_state(sync_bit, state)
   end
 endfunction
 
+
+% Save test bits to a text file in the form of a C array
+
+function test_bits_file(filename)
+  global test_bits;
+  global Ntest_bits;
+
+  f=fopen(filename,"wt");
+  fprintf(f,"/* Generated by test_bits_file() Octave function */\n\n");
+  fprintf(f,"const int test_bits[]={\n");
+  for m=1:Ntest_bits-1
+    fprintf(f,"  %d,\n",test_bits(m));
+  endfor
+  fprintf(f,"  %d\n};\n",test_bits(Ntest_bits));
+  fclose(f);
+endfunction
+
+
 % Initialise ----------------------------------------------------
 
 global pilot_bit;
index 0a20a42b9033bb8b5d4139acf3b0f97b342bb589..ad1c6b9e4eaad31c928b18cf5b25df9f2fa56ad4 100644 (file)
@@ -11,7 +11,7 @@ fdmdv;               % load modem code
  
 % Simulation Parameters --------------------------------------
 
-frames = 100;
+frames = 25;
 EbNo_dB = 7.3;
 Foff_hz = 0;
 modulation = 'dqpsk';
diff --git a/codec2-dev/src/fdmdv.c b/codec2-dev/src/fdmdv.c
new file mode 100644 (file)
index 0000000..7ece1ff
--- /dev/null
@@ -0,0 +1,213 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv.c
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: April 14 2012
+                                                                             
+  Functions that implement a Frequency Divison Multiplexed Modem for
+  Digital Voice (FDMDV) over HF channels.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2012 David Rowe
+
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License version 2.1, as
+  published by the Free Software Foundation.  This program is
+  distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               DEFINES
+
+\*---------------------------------------------------------------------------*/
+
+#define FS                    8000  /* sample rate in Hz                                                    */
+#define T                   (1/Fs)  /* sample period in seconds                                             */
+#define RS                      50  /* symbol rate in Hz                                                    */
+#define NC                      14  /* number of carriers                                                   */
+#define NB                       2  /* Bits/symbol for QPSK modulation                                      */
+#define RB              (Nc*Rs*Nb)  /* bit rate                                                             */
+#define M                    Fs/Rs  /* oversampling factor                                                  */
+#define NSYM                     4  /* number of symbols to filter over                                     */
+#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 NFILTER            (NSYM*M) /* size of tx/rx filters at sampel rate M                               */
+#define NFILTERTIMING (M+Nfilter+M) /* filter memory used for resampling after timing estimation            */
+
+#define NTEST_BITS        (Nc*Nb*4) /* length of test bit sequence */
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               STRUCT for States
+
+\*---------------------------------------------------------------------------*/
+
+struct FDMDV {
+    int current_test_bit;
+};
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               INCLUDES
+
+\*---------------------------------------------------------------------------*/
+
+#include "fdmdv.h"
+#include "rn.h"
+#include "testbits.h"
+
+/*---------------------------------------------------------------------------*\
+                                                                             
+                               FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+static COMP cneg(COMP a)
+{
+    COMP res;
+
+    res.real = -a.real;
+    res.imag = -a.imag;
+
+    return res;
+}
+
+static COMP cmult(COMP a, COMP b)
+{
+    COMP res;
+
+    res.real = a.real*b.real - a.imag*b.imag;
+    res.imag = a.real*b.imag + a.imag*b.real;
+
+    return res;
+}
+
+static COMP cadd(COMP a, COMP b)
+{
+    COMP res;
+
+    res.real = a.real + b.real;
+    res.imag = a.imag + b.imag;
+
+    return res;
+}
+
+static COMP cdot(COMP a[], COMP b[], int n)
+{
+    COMP res;
+    int  i;
+    
+    for(i=0; i<n; i++) 
+       res = cadd(res, cmult(a,b));
+
+    return res;
+}
+
+static void cbuf_shift_update(COMP buf[], COMP update[], int buflen, int updatelen)
+{
+    int  i,j;
+    
+    for(i=0; i<buflen-updatelen; i++) 
+       buf[i] = buf[updatelen+i];
+    for(j=0; j<updatelen; j++) 
+       buf[i] = update[j];
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_create        
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16/4/2012 
+
+  Create and initialise an instance of the modem.  Returns a pointer
+  to the modem states or NULL on failure.  One set of states is
+  sufficient for a full duuplex modem.
+
+\*---------------------------------------------------------------------------*/
+
+struct FDMDV *fdmdv_create(void)
+{
+    struct FDMDV *fdmdv;
+
+    fdmdv = (struct FDMDV*)malloc(sizeof(struct FDMDV));
+    if (fdmdv == NULL)
+       return NULL;
+    
+    return fdmdv;
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: fdmdv_destroy       
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16/4/2012
+
+  Destroy an instance of the modem.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_destroy(struct FDMDV *fdmdv)
+{
+    assert(fdmdv != NULL);
+    free(fdmdv);
+}
+
+/*---------------------------------------------------------------------------*\
+                                                       
+  FUNCTION....: bits_to_dqpsk_symbols()             
+  AUTHOR......: David Rowe                           
+  DATE CREATED: 16/4/2012
+
+  Generate Nc+1 QPSK symbols from vector of (1,Nc*Nb) input tx_bits.
+  The Nc+1 symbol is the +1 -1 +1 .... BPSK sync carrier.
+
+\*---------------------------------------------------------------------------*/
+
+void bits_to_dqpsk_symbols(COMP tx_symbols[], COMP prev_tx_symbols[], int tx_bits[], int *pilot_bit)
+{
+    int c, msb, lsb;
+    COMP j = {0.0,1.0};
+    COMP minusj = {0.0,-1.0};
+
+    /* map tx_bits to to Nc DQPSK symbols */
+
+    for(c=0; c<NC; c++) {
+       msb = tx_bits[2*c]; 
+       lsb = tx_bits[2*c+1];
+       if ((msb == 0) && (lsb == 0))
+           tx_symbols[c] = prev_tx_symbols[c];
+       if ((msb == 0) && (lsb == 1))
+           tx_symbols[c] = cmult(j, prev_tx_symbols[c]);
+       if ((msb == 1) && (lsb == 0))
+           tx_symbols[c] = cneg(prev_tx_symbols[c]);
+       if ((msb == 1) && (lsb == 1))
+           tx_symbols[c] = cmult(cneg(j),prev_tx_symbols[c]);
+    }
+
+    /* +1 -1 +1 -1 BPSK sync carrier, once filtered becomes (roughly)
+       two spectral lines at +/- Rs/2 */
+    if (*pilot_bit)
+       tx_symbols[Nc] = cneg(prev_tx_symbols[Nc]);
+    else
+       tx_symbols[Nc] = prev_tx_symbols[Nc];
+
+    if (*pilot_bit) 
+       *pilot_bit = 0;
+    else
+       *pilot_bit = 1;
+}
+
diff --git a/codec2-dev/src/fdmdv.h b/codec2-dev/src/fdmdv.h
new file mode 100644 (file)
index 0000000..671636f
--- /dev/null
@@ -0,0 +1,54 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: April 14 2012
+                                                                             
+  Header file for a Frequency Divison Multiplexed Modem for Digital
+  Voice (FDMDV) over HF channels.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2012 David Rowe
+
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License version 2.1, as
+  published by the Free Software Foundation.  This program is
+  distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __FDMDV__
+#define __FDMDV__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct FDMDV;
+    
+struct FDMDV *fdmdv_create(void);
+void          fdmdv_destroy(struct FDMDV *fdmdv_state);
+    
+void          fdmdv_mod(struct FDMDV *fdmdv_state, int tx_bits[], COMP tx_fdm[]);
+void          fdmdv_demod(struct FDMDV *fdmdv_state, int tx_bits[], float rx_fdm[], int *nin);
+    
+void          fdmdv_get_test_bits(struct FDMDV *fdmdv_state, int tx_bits[]);
+void          fdmdv_put_test_bits(struct FDMDV *fdmdv_state, int rx_bits[]);
+    
+float         fdmdv_get_snr(struct FDMDV *fdmdv_state);
+void          fdmdv_get_waterfall_line(struct FDMDV *fdmdv_state, float magnitudes[], int *magnitude_points);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/codec2-dev/src/fdmdv_internal.h b/codec2-dev/src/fdmdv_internal.h
new file mode 100644 (file)
index 0000000..f70d683
--- /dev/null
@@ -0,0 +1,36 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_internal.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: April 16 2012
+                                                                             
+  Header file for FDMDV internal functions, exposed via this header
+  file for testing.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2012 David Rowe
+
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License version 2.1, as
+  published by the Free Software Foundation.  This program is
+  distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __FDMDV_INTERNAL__
+#define __FDMDV_INTERNAL__
+
+#include "comp.h"
+
+void bits_to_dqpsk_symbols(COMP tx_symbols[], COMP prev_tx_symbols[], int tx_bits[], int *pilot_bit);
+
+#endif
diff --git a/codec2-dev/src/rn.h b/codec2-dev/src/rn.h
new file mode 100644 (file)
index 0000000..983c2e5
--- /dev/null
@@ -0,0 +1,674 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: rn.h
+  AUTHOR......: David Rowe                                                          
+  DATE CREATED: April 14 2012
+                                                                             
+  Root raised cosine (Root Nyquist) filter for FDMDV modem.
+                                                                              
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2012 David Rowe
+
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License version 2.1, as
+  published by the Free Software Foundation.  This program is
+  distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __RN__
+#define RN
+float gt_alpha5_root[] = {
+    3.15800872e-04,
+    2.79727588e-04,
+    2.69639516e-04,
+    2.64546231e-04,
+    2.61383099e-04,
+    2.59190148e-04,
+    2.57492732e-04,
+    2.56064964e-04,
+    2.54747225e-04,
+    2.53454837e-04,
+    2.52113149e-04,
+    2.50682027e-04,
+    2.49119413e-04,
+    2.47403391e-04,
+    2.45507283e-04,
+    2.43417952e-04,
+    2.41117044e-04,
+    2.38596156e-04,
+    2.35841900e-04,
+    2.32848649e-04,
+    2.29606198e-04,
+    2.26110660e-04,
+    2.22353999e-04,
+    2.18333484e-04,
+    2.14042642e-04,
+    2.09479573e-04,
+    2.04639000e-04,
+    1.99519666e-04,
+    1.94117271e-04,
+    1.88431116e-04,
+    1.82457746e-04,
+    1.76196986e-04,
+    1.69646155e-04,
+    1.62805599e-04,
+    1.55673382e-04,
+    1.48250378e-04,
+    1.40535377e-04,
+    1.32529803e-04,
+    1.24233156e-04,
+    1.15647422e-04,
+    1.06772798e-04,
+    9.76118372e-05,
+    8.81654134e-05,
+    7.84366425e-05,
+    6.84270511e-05,
+    5.81403041e-05,
+    4.75785517e-05,
+    3.67459901e-05,
+    2.56453615e-05,
+    1.42813733e-05,
+    2.65732925e-06,
+    -9.22157136e-06,
+    -2.13514908e-05,
+    -3.37267535e-05,
+    -4.63430099e-05,
+    -5.91941194e-05,
+    -7.22752369e-05,
+    -8.55797626e-05,
+    -9.91023660e-05,
+    -1.12835989e-04,
+    -1.26774821e-04,
+    -1.40911341e-04,
+    -1.55239261e-04,
+    -1.69750592e-04,
+    -1.84438565e-04,
+    -1.99294715e-04,
+    -2.14311789e-04,
+    -2.29480839e-04,
+    -2.44794128e-04,
+    -2.60242212e-04,
+    -2.75816871e-04,
+    -2.91508163e-04,
+    -3.07307383e-04,
+    -3.23204088e-04,
+    -3.39189096e-04,
+    -3.55251466e-04,
+    -3.71381551e-04,
+    -3.87567920e-04,
+    -4.03800479e-04,
+    -4.20067325e-04,
+    -4.36357946e-04,
+    -4.52659989e-04,
+    -4.68962566e-04,
+    -4.85252904e-04,
+    -5.01519786e-04,
+    -5.17750064e-04,
+    -5.33932244e-04,
+    -5.50052851e-04,
+    -5.66100178e-04,
+    -5.82060470e-04,
+    -5.97921867e-04,
+    -6.13670384e-04,
+    -6.29294070e-04,
+    -6.44778745e-04,
+    -6.60112423e-04,
+    -6.75280754e-04,
+    -6.90271758e-04,
+    -7.05070925e-04,
+    -7.19666310e-04,
+    -7.34043232e-04,
+    -7.48189797e-04,
+    -7.62091120e-04,
+    -7.75735364e-04,
+    -7.89107389e-04,
+    -8.02195418e-04,
+    -8.14983993e-04,
+    -8.27461403e-04,
+    -8.39611795e-04,
+    -8.51423552e-04,
+    -8.62880344e-04,
+    -8.73970705e-04,
+    -8.84677743e-04,
+    -8.94990252e-04,
+    -9.04890675e-04,
+    -9.14368254e-04,
+    -9.23404633e-04,
+    -9.31989791e-04,
+    -9.40104365e-04,
+    -9.47739538e-04,
+    -9.54874543e-04,
+    -9.61502551e-04,
+    -9.67600584e-04,
+    -9.73165279e-04,
+    -9.78169541e-04,
+    -9.82616937e-04,
+    -9.86470692e-04,
+    -9.89753203e-04,
+    -9.92390009e-04,
+    -9.94563745e-04,
+    -9.96356035e-04,
+    -9.97190272e-04,
+    -9.97385906e-04,
+    -9.96890492e-04,
+    -9.95735721e-04,
+    -9.93890788e-04,
+    -9.91364072e-04,
+    -9.88132863e-04,
+    -9.84198040e-04,
+    -9.79540856e-04,
+    -9.74158756e-04,
+    -9.68035333e-04,
+    -9.61166225e-04,
+    -9.53536634e-04,
+    -9.45141227e-04,
+    -9.35966472e-04,
+    -9.26006585e-04,
+    -9.15249147e-04,
+    -9.03688283e-04,
+    -8.91312634e-04,
+    -8.78116505e-04,
+    -8.64089591e-04,
+    -8.49226579e-04,
+    -8.33518227e-04,
+    -8.16959761e-04,
+    -7.99543007e-04,
+    -7.81263837e-04,
+    -7.62115141e-04,
+    -7.42093505e-04,
+    -7.21192864e-04,
+    -6.99410552e-04,
+    -6.76741515e-04,
+    -6.53183844e-04,
+    -6.28733457e-04,
+    -6.03389190e-04,
+    -5.77147887e-04,
+    -5.50009115e-04,
+    -5.21970595e-04,
+    -4.93032610e-04,
+    -4.63193720e-04,
+    -4.32454909e-04,
+    -4.00815549e-04,
+    -3.68277318e-04,
+    -3.34840383e-04,
+    -3.00507122e-04,
+    -2.65278490e-04,
+    -2.29157578e-04,
+    -1.92146130e-04,
+    -1.54247973e-04,
+    -1.15465652e-04,
+    -7.58037481e-05,
+    -3.52656246e-05,
+    6.14335925e-06,
+    4.84190059e-05,
+    9.15551544e-05,
+    1.35546760e-04,
+    1.80386840e-04,
+    2.26069491e-04,
+    2.72586893e-04,
+    3.19932279e-04,
+    3.68096980e-04,
+    4.17073365e-04,
+    4.66851910e-04,
+    5.17424122e-04,
+    5.68779624e-04,
+    6.20909069e-04,
+    6.73801232e-04,
+    7.27445923e-04,
+    7.81831078e-04,
+    8.36945686e-04,
+    8.92776854e-04,
+    9.49312772e-04,
+    1.00653974e-03,
+    1.06444516e-03,
+    1.12301455e-03,
+    1.18223458e-03,
+    1.24208997e-03,
+    1.30256668e-03,
+    1.36364870e-03,
+    1.42532128e-03,
+    1.48756769e-03,
+    1.55037250e-03,
+    1.61371827e-03,
+    1.67758894e-03,
+    1.74196634e-03,
+    1.80683380e-03,
+    1.87217245e-03,
+    1.93796500e-03,
+    2.00419187e-03,
+    2.07083517e-03,
+    2.13787462e-03,
+    2.20529174e-03,
+    2.27306554e-03,
+    2.34117698e-03,
+    2.40960436e-03,
+    2.47832809e-03,
+    2.54732581e-03,
+    2.61657744e-03,
+    2.68605994e-03,
+    2.75575284e-03,
+    2.82563247e-03,
+    2.89567806e-03,
+    2.96586537e-03,
+    3.03617345e-03,
+    3.10657756e-03,
+    3.17705672e-03,
+    3.24758578e-03,
+    3.31814387e-03,
+    3.38870549e-03,
+    3.45925010e-03,
+    3.52975187e-03,
+    3.60019081e-03,
+    3.67054075e-03,
+    3.74078249e-03,
+    3.81088946e-03,
+    3.88084361e-03,
+    3.95061774e-03,
+    4.02019545e-03,
+    4.08954860e-03,
+    4.15866330e-03,
+    4.22750990e-03,
+    4.29607892e-03,
+    4.36433818e-03,
+    4.43228800e-03,
+    4.49989238e-03,
+    4.56718497e-03,
+    4.63414034e-03,
+    4.70132291e-03,
+    4.76692608e-03,
+    4.83218137e-03,
+    4.89703501e-03,
+    4.96136981e-03,
+    5.02518690e-03,
+    5.08843431e-03,
+    5.15110299e-03,
+    5.21315463e-03,
+    5.27457565e-03,
+    5.33533355e-03,
+    5.39541259e-03,
+    5.45478362e-03,
+    5.51342992e-03,
+    5.57132465e-03,
+    5.62845070e-03,
+    5.68478300e-03,
+    5.74030441e-03,
+    5.79499130e-03,
+    5.84882670e-03,
+    5.90178821e-03,
+    5.95385913e-03,
+    6.00501811e-03,
+    6.05524878e-03,
+    6.10453076e-03,
+    6.15284804e-03,
+    6.20018109e-03,
+    6.24651431e-03,
+    6.29182896e-03,
+    6.33610990e-03,
+    6.37933917e-03,
+    6.42150209e-03,
+    6.46258151e-03,
+    6.50256328e-03,
+    6.54143105e-03,
+    6.57917131e-03,
+    6.61576852e-03,
+    6.65120988e-03,
+    6.68548075e-03,
+    6.71856907e-03,
+    6.75046115e-03,
+    6.78114576e-03,
+    6.81061020e-03,
+    6.83884413e-03,
+    6.86583586e-03,
+    6.89157602e-03,
+    6.91605393e-03,
+    6.93926120e-03,
+    6.96118822e-03,
+    6.98182760e-03,
+    7.00117076e-03,
+    7.01921133e-03,
+    7.03594180e-03,
+    7.05135678e-03,
+    7.06544981e-03,
+    7.07821650e-03,
+    7.08965141e-03,
+    7.09975114e-03,
+    7.10851128e-03,
+    7.11592939e-03,
+    7.12200207e-03,
+    7.12672785e-03,
+    7.13010431e-03,
+    7.13213096e-03,
+    7.13280635e-03,
+    7.13213096e-03,
+    7.13010431e-03,
+    7.12672785e-03,
+    7.12200207e-03,
+    7.11592939e-03,
+    7.10851128e-03,
+    7.09975114e-03,
+    7.08965141e-03,
+    7.07821650e-03,
+    7.06544981e-03,
+    7.05135678e-03,
+    7.03594180e-03,
+    7.01921133e-03,
+    7.00117076e-03,
+    6.98182760e-03,
+    6.96118822e-03,
+    6.93926120e-03,
+    6.91605393e-03,
+    6.89157602e-03,
+    6.86583586e-03,
+    6.83884413e-03,
+    6.81061020e-03,
+    6.78114576e-03,
+    6.75046115e-03,
+    6.71856907e-03,
+    6.68548075e-03,
+    6.65120988e-03,
+    6.61576852e-03,
+    6.57917131e-03,
+    6.54143105e-03,
+    6.50256328e-03,
+    6.46258151e-03,
+    6.42150209e-03,
+    6.37933917e-03,
+    6.33610990e-03,
+    6.29182896e-03,
+    6.24651431e-03,
+    6.20018109e-03,
+    6.15284804e-03,
+    6.10453076e-03,
+    6.05524878e-03,
+    6.00501811e-03,
+    5.95385913e-03,
+    5.90178821e-03,
+    5.84882670e-03,
+    5.79499130e-03,
+    5.74030441e-03,
+    5.68478300e-03,
+    5.62845070e-03,
+    5.57132465e-03,
+    5.51342992e-03,
+    5.45478362e-03,
+    5.39541259e-03,
+    5.33533355e-03,
+    5.27457565e-03,
+    5.21315463e-03,
+    5.15110299e-03,
+    5.08843431e-03,
+    5.02518690e-03,
+    4.96136981e-03,
+    4.89703501e-03,
+    4.83218137e-03,
+    4.76692608e-03,
+    4.70132291e-03,
+    4.63414034e-03,
+    4.56718497e-03,
+    4.49989238e-03,
+    4.43228800e-03,
+    4.36433818e-03,
+    4.29607892e-03,
+    4.22750990e-03,
+    4.15866330e-03,
+    4.08954860e-03,
+    4.02019545e-03,
+    3.95061774e-03,
+    3.88084361e-03,
+    3.81088946e-03,
+    3.74078249e-03,
+    3.67054075e-03,
+    3.60019081e-03,
+    3.52975187e-03,
+    3.45925010e-03,
+    3.38870549e-03,
+    3.31814387e-03,
+    3.24758578e-03,
+    3.17705672e-03,
+    3.10657756e-03,
+    3.03617345e-03,
+    2.96586537e-03,
+    2.89567806e-03,
+    2.82563247e-03,
+    2.75575284e-03,
+    2.68605994e-03,
+    2.61657744e-03,
+    2.54732581e-03,
+    2.47832809e-03,
+    2.40960436e-03,
+    2.34117698e-03,
+    2.27306554e-03,
+    2.20529174e-03,
+    2.13787462e-03,
+    2.07083517e-03,
+    2.00419187e-03,
+    1.93796500e-03,
+    1.87217245e-03,
+    1.80683380e-03,
+    1.74196634e-03,
+    1.67758894e-03,
+    1.61371827e-03,
+    1.55037250e-03,
+    1.48756769e-03,
+    1.42532128e-03,
+    1.36364870e-03,
+    1.30256668e-03,
+    1.24208997e-03,
+    1.18223458e-03,
+    1.12301455e-03,
+    1.06444516e-03,
+    1.00653974e-03,
+    9.49312772e-04,
+    8.92776854e-04,
+    8.36945686e-04,
+    7.81831078e-04,
+    7.27445923e-04,
+    6.73801232e-04,
+    6.20909069e-04,
+    5.68779624e-04,
+    5.17424122e-04,
+    4.66851910e-04,
+    4.17073365e-04,
+    3.68096980e-04,
+    3.19932279e-04,
+    2.72586893e-04,
+    2.26069491e-04,
+    1.80386840e-04,
+    1.35546760e-04,
+    9.15551544e-05,
+    4.84190059e-05,
+    6.14335925e-06,
+    -3.52656246e-05,
+    -7.58037481e-05,
+    -1.15465652e-04,
+    -1.54247973e-04,
+    -1.92146130e-04,
+    -2.29157578e-04,
+    -2.65278490e-04,
+    -3.00507122e-04,
+    -3.34840383e-04,
+    -3.68277318e-04,
+    -4.00815549e-04,
+    -4.32454909e-04,
+    -4.63193720e-04,
+    -4.93032610e-04,
+    -5.21970595e-04,
+    -5.50009115e-04,
+    -5.77147887e-04,
+    -6.03389190e-04,
+    -6.28733457e-04,
+    -6.53183844e-04,
+    -6.76741515e-04,
+    -6.99410552e-04,
+    -7.21192864e-04,
+    -7.42093505e-04,
+    -7.62115141e-04,
+    -7.81263837e-04,
+    -7.99543007e-04,
+    -8.16959761e-04,
+    -8.33518227e-04,
+    -8.49226579e-04,
+    -8.64089591e-04,
+    -8.78116505e-04,
+    -8.91312634e-04,
+    -9.03688283e-04,
+    -9.15249147e-04,
+    -9.26006585e-04,
+    -9.35966472e-04,
+    -9.45141227e-04,
+    -9.53536634e-04,
+    -9.61166225e-04,
+    -9.68035333e-04,
+    -9.74158756e-04,
+    -9.79540856e-04,
+    -9.84198040e-04,
+    -9.88132863e-04,
+    -9.91364072e-04,
+    -9.93890788e-04,
+    -9.95735721e-04,
+    -9.96890492e-04,
+    -9.97385906e-04,
+    -9.97190272e-04,
+    -9.96356035e-04,
+    -9.94563745e-04,
+    -9.92390009e-04,
+    -9.89753203e-04,
+    -9.86470692e-04,
+    -9.82616937e-04,
+    -9.78169541e-04,
+    -9.73165279e-04,
+    -9.67600584e-04,
+    -9.61502551e-04,
+    -9.54874543e-04,
+    -9.47739538e-04,
+    -9.40104365e-04,
+    -9.31989791e-04,
+    -9.23404633e-04,
+    -9.14368254e-04,
+    -9.04890675e-04,
+    -8.94990252e-04,
+    -8.84677743e-04,
+    -8.73970705e-04,
+    -8.62880344e-04,
+    -8.51423552e-04,
+    -8.39611795e-04,
+    -8.27461403e-04,
+    -8.14983993e-04,
+    -8.02195418e-04,
+    -7.89107389e-04,
+    -7.75735364e-04,
+    -7.62091120e-04,
+    -7.48189797e-04,
+    -7.34043232e-04,
+    -7.19666310e-04,
+    -7.05070925e-04,
+    -6.90271758e-04,
+    -6.75280754e-04,
+    -6.60112423e-04,
+    -6.44778745e-04,
+    -6.29294070e-04,
+    -6.13670384e-04,
+    -5.97921867e-04,
+    -5.82060470e-04,
+    -5.66100178e-04,
+    -5.50052851e-04,
+    -5.33932244e-04,
+    -5.17750064e-04,
+    -5.01519786e-04,
+    -4.85252904e-04,
+    -4.68962566e-04,
+    -4.52659989e-04,
+    -4.36357946e-04,
+    -4.20067325e-04,
+    -4.03800479e-04,
+    -3.87567920e-04,
+    -3.71381551e-04,
+    -3.55251466e-04,
+    -3.39189096e-04,
+    -3.23204088e-04,
+    -3.07307383e-04,
+    -2.91508163e-04,
+    -2.75816871e-04,
+    -2.60242212e-04,
+    -2.44794128e-04,
+    -2.29480839e-04,
+    -2.14311789e-04,
+    -1.99294715e-04,
+    -1.84438565e-04,
+    -1.69750592e-04,
+    -1.55239261e-04,
+    -1.40911341e-04,
+    -1.26774821e-04,
+    -1.12835989e-04,
+    -9.91023660e-05,
+    -8.55797626e-05,
+    -7.22752369e-05,
+    -5.91941194e-05,
+    -4.63430099e-05,
+    -3.37267535e-05,
+    -2.13514908e-05,
+    -9.22157136e-06,
+    2.65732925e-06,
+    1.42813733e-05,
+    2.56453615e-05,
+    3.67459901e-05,
+    4.75785517e-05,
+    5.81403041e-05,
+    6.84270511e-05,
+    7.84366425e-05,
+    8.81654134e-05,
+    9.76118372e-05,
+    1.06772798e-04,
+    1.15647422e-04,
+    1.24233156e-04,
+    1.32529803e-04,
+    1.40535377e-04,
+    1.48250378e-04,
+    1.55673382e-04,
+    1.62805599e-04,
+    1.69646155e-04,
+    1.76196986e-04,
+    1.82457746e-04,
+    1.88431116e-04,
+    1.94117271e-04,
+    1.99519666e-04,
+    2.04639000e-04,
+    2.09479573e-04,
+    2.14042642e-04,
+    2.18333484e-04,
+    2.22353999e-04,
+    2.26110660e-04,
+    2.29606198e-04,
+    2.32848649e-04,
+    2.35841900e-04,
+    2.38596156e-04,
+    2.41117044e-04,
+    2.43417952e-04,
+    2.45507283e-04,
+    2.47403391e-04,
+    2.49119413e-04,
+    2.50682027e-04,
+    2.52113149e-04,
+    2.53454837e-04,
+    2.54747225e-04,
+    2.56064964e-04,
+    2.57492732e-04,
+    2.59190148e-04,
+    2.61383099e-04,
+    2.64546231e-04,
+    2.69639516e-04,
+    2.79727588e-04
+};
+
+#endif
diff --git a/codec2-dev/src/test_bits.h b/codec2-dev/src/test_bits.h
new file mode 100644 (file)
index 0000000..19d7a92
--- /dev/null
@@ -0,0 +1,116 @@
+/* Generated by test_bits_file() Octave function */
+
+const int test_bits[]={
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0
+};
diff --git a/codec2-dev/unittest/tfdmdv.c b/codec2-dev/unittest/tfdmdv.c
new file mode 100644 (file)
index 0000000..374f5d1
--- /dev/null
@@ -0,0 +1,43 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: tfdmdv.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: April 16 2012
+                                                                             
+  Unit tests for FDMDV modem.  Combination of unit tests perfromed
+  entirely by this program and comparisons with reference Octave
+  version of the modem that require running an Octave script
+  ../octave/tfdmdv.m.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+
+/*
+  Copyright (C) 2009 David Rowe
+
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License version 2, as
+  published by the Free Software Foundation.  This program is
+  distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "fdmdv.h"
+
+int main(int argc, char *argv[])
+{
+    
+    /* save to text file for comparison to Octave version */
+
+    return 0;
+}