refactored UW insertion
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 18 Apr 2018 21:10:34 +0000 (21:10 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 18 Apr 2018 21:10:34 +0000 (21:10 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3500 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/README_ofdm.txt
codec2-dev/src/ofdm.c
codec2-dev/src/ofdm_demod.c
codec2-dev/src/ofdm_get_test_bits.c
codec2-dev/src/ofdm_internal.h
codec2-dev/src/test_bits_ofdm.h

index 3f90b6d5d69e06903d5aa79e4d0ace63922aed8f..da02ee4473fdcd7d1508dd5b091e6a3a0f8c8711 100644 (file)
@@ -37,9 +37,9 @@ Built as part of codec2-dev, see README for build instructions.
 
     build_linux/src$ ./ofdm_get_test_bits - 10 | ./ofdm_mod - - | play -t raw -r 8000 -s -2 -
 
-2. Generate 10 seconds of test frame bits, modulate, demodulate, count errors:
+2. Generate 10 seconds of uncoded test frame bits, modulate, demodulate, count errors:
 
-    build_linux/src$ ./ofdm_get_test_bits - 10 | ./ofdm_mod - - | ./ofdm_demod -t - /dev/null
+    build_linux/src$ ./ofdm_get_test_bits - 10 | ./ofdm_mod - - | ./ofdm_demod - /dev/null -t
 
     (TODO write ofdm_demod_c.m)
     Use Octave to look at plots of C modem operation:
@@ -74,14 +74,14 @@ Built as part of codec2-dev, see README for build instructions.
      octave:6> ofdm_ldpc_tx('ofdm_test.raw',4,60,3)
      octave:7> ofdm_ldpc_rx('ofdm_test.raw',4)
 
-   C demodulator/LDCP decoder:
+   C demodulator/LDPC decoder:
    
      build_linux/src$ ./ofdm_demod ../../octave/ofdm_test.raw /dev/null -v -t --ldpc --interleave 4
      
 Acceptance Tests
 ----------------
 
-The rate 1/2 LPDC code can correct up to about 10% raw BER, so a good
+The rate 1/2 LDPC code can correct up to about 10% raw BER, so a good
 test is to run the modem at Eb/No operating points that produce just
 less that BER=0.1
 
index 12f13dc3c2e064cd2e427ba75ac0af9d6c5525d0..6ee6037a2ff03bae5da70e3e63fc84152f4ca28d 100644 (file)
@@ -82,6 +82,8 @@ static const char pilotvalues[] = {
      1
 };
 
+static const int tx_uw[] = {1,0,0,1,0,1,0,0,1,0};
+
 /* Functions */
 
 /* Gray coded QPSK modulation function */
@@ -384,7 +386,10 @@ struct OFDM *ofdm_create(const struct OFDM_CONFIG *config) {
     ofdm->foff_running = 0.0 + I*0.0;
     
     /* sync state machine */
-    
+
+    for(i=0; i<OFDM_NUWBITS; i++) {
+        ofdm->tx_uw[i] = tx_uw[i];
+    }
     strcpy(ofdm->sync_state,"search");
     strcpy(ofdm->last_sync_state,"search");
     ofdm->uw_errors = 0;
@@ -1002,9 +1007,8 @@ void ofdm_sync_state_machine(struct OFDM *ofdm, int *rx_uw) {
            we use a Unique Word to get a really solid indication of sync. */
 
         ofdm->uw_errors = 0;
-        int tx_uw[] = {1,0,0,1,0,1,0,0,1,0};
         for (i=0; i<OFDM_NUWBITS; i++) {
-            ofdm->uw_errors += tx_uw[i] ^ rx_uw[i]; 
+            ofdm->uw_errors += ofdm->tx_uw[i] ^ rx_uw[i]; 
         }
 
         /* during trial sync we don't tolerate errors so much, we look
index ad651c4a329ef266255cda73e86db5e924d64f58..66aac11abfc21ecccaf981bfdc316210e3f61f22 100644 (file)
@@ -121,15 +121,16 @@ int main(int argc, char *argv[])
 
     if (argc < 3) {
         fprintf(stderr, "\n");
-       printf("usage: %s InputModemRawFile OutputFile [-o OctaveLogFile] [--llr] [-v VerboseLevel]\n", argv[0]);
+       printf("usage: %s InputModemRawFile OutputFile [-o OctaveLogFile] [--llr] [--ldpc] [--interleave depth] [-v]\n", argv[0]);
         fprintf(stderr, "\n");
-        fprintf(stderr, "              Default output file format is one byte per bit hard decision\n");
-        fprintf(stderr, "  --llr       LLR output, one double per bit, %d doubles/frame\n", CODED_BITSPERFRAME);
-        fprintf(stderr, "  -t          Receive test frames and count errors\n");
-        fprintf(stderr, "  --ldpc      Run (224,112) LDPC decoder.  This forces 112, one char/bit output values\n"
-                        "              per frame.  In testframe mode (-t) raw and coded errors will be counted\n");
-        fprintf(stderr, "  -v          Verbose info the stderr\n");
-        fprintf(stderr, "  -o          Octave log file for testing\n");
+        fprintf(stderr, "                Default output file format is one byte per bit hard decision\n");
+        fprintf(stderr, "  --llr         LLR output, one double per bit, %d doubles/frame\n", CODED_BITSPERFRAME);
+        fprintf(stderr, "  -t            Receive test frames and count errors\n");
+        fprintf(stderr, "  --ldpc        Run (224,112) LDPC decoder.  This forces 112, one char/bit output values\n"
+                        "                per frame.  In testframe mode (-t) raw and coded errors will be counted\n");
+        fprintf(stderr, "  --interleave  Interleaver for LDPC frames, e.g. 1,2,4,8,16, default is 1\n");
+        fprintf(stderr, "  -v            Verbose info the stderr\n");
+        fprintf(stderr, "  -o            Octave log file for testing\n");
         fprintf(stderr, "\n");
        exit(1);
     }
index 2ee037d10df5ae81552784c85f8f89a912ba0daa..89780b911dc1d7c2f0e1aa5757cd0e4e64474788 100644 (file)
@@ -8,7 +8,6 @@
 
 \*---------------------------------------------------------------------------*/
 
-
 /*
   Copyright (C) 2018 David Rowe
 
index 1958b4e14752d67da5b0a39594573372760745e9..1586e63f4695973c351231402c1c8c6826e5b7fe 100644 (file)
@@ -127,6 +127,7 @@ struct OFDM {
 
     /* modem sync state machine */
 
+    int  tx_uw[OFDM_NUWBITS];
     char sync_state[OFDM_STATE_STR];
     char last_sync_state[OFDM_STATE_STR];
     int uw_errors;
index 17b55b3891ff20954757f2a23087255d0eadb8ce..423626e51461eb4a236705fd1b7bbe51647201bd 100644 (file)
@@ -1,15 +1,15 @@
 /* Generated by test_bits_ofdm_file() Octave function */
 
 const int test_bits_ofdm[]={
+  1,
   0,
   0,
+  1,
   0,
+  1,
   0,
   0,
-  0,
-  0,
-  0,
-  0,
+  1,
   0,
   0,
   0,