Change ofdm_txframe output
authorokcsampson <okcsampson@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 11 Jun 2017 22:48:29 +0000 (22:48 +0000)
committerokcsampson <okcsampson@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 11 Jun 2017 22:48:29 +0000 (22:48 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3173 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/ofdm.c

index 4771c9c1336b772499164eb4eb9c775a2030d500..fa36e4057ff4485a0111e497e414b5446aab92f2 100644 (file)
 static void matrix_vector_multiply(struct OFDM *, complex float *, complex float *);
 static complex float qpsk_mod(int *);
 static void qpsk_demod(complex float, int *);
-static void ofdm_txframe(struct OFDM *, complex float [OFDM_NS][OFDM_M + OFDM_NCP], complex float *);
+static void ofdm_txframe(struct OFDM *, complex float [OFDM_SAMPLESPERFRAME], complex float *);
 static int coarse_sync(struct OFDM *, complex float *, int);
 
+/* Constants */
+
+/*
+ * QPSK Quadrant bit-pair values - Gray Coded
+ *
+ *   0.0 -  89.9 = 00
+ *  90.0 - 179.9 = 01
+ * 180.0 - 269.9 = 11
+ * 270.0 - 359.9 = 10
+ */
+const complex float constellation[] = {
+     1.0f + 0.0f * I,
+     0.0f + 1.0f * I,
+     0.0f - 1.0f * I,
+    -1.0f + 0.0f * I
+};
+
+/*
+ * These pilots are compatible with Octave version
+ */
+const char pilotvalues[] = {
+    -1, -1, 1, 1, -1, -1, -1, 1, -1,
+     1, -1, 1, 1,  1,  1,  1, 1,  1
+};
+
+/* Functions */
+
 /* Gray coded QPSK modulation function */
 
 static complex float qpsk_mod(int *bits) {
@@ -114,7 +141,7 @@ static int coarse_sync(struct OFDM *ofdm, complex float *rx, int length) {
  *
  */
 
-void ofdm_txframe(struct OFDM *ofdm, complex float tx[OFDM_NS][OFDM_M + OFDM_NCP],
+static void ofdm_txframe(struct OFDM *ofdm, complex float tx[OFDM_SAMPLESPERFRAME],
         complex float *tx_sym_lin) {
     complex float aframe[OFDM_NS][OFDM_NC + 2];
     complex float asymbol[OFDM_M];
@@ -149,7 +176,7 @@ void ofdm_txframe(struct OFDM *ofdm, complex float tx[OFDM_NS][OFDM_M + OFDM_NCP
 
     /* OFDM up-convert symbol by symbol so we can add CP */
 
-    for (i = 0; i < OFDM_NS; i++) {
+    for (i = 0, k = 0; i < OFDM_NS; i++, k += (OFDM_M + OFDM_NCP)) {
         matrix_vector_multiply(ofdm, asymbol, aframe[i]);
 
         /* Copy the last Ncp columns to the front */
@@ -167,7 +194,7 @@ void ofdm_txframe(struct OFDM *ofdm, complex float tx[OFDM_NS][OFDM_M + OFDM_NCP
         /* Now move row to the tx reference */
 
         for (j = 0; j < (OFDM_M + OFDM_NCP); j++) {
-            tx[i][j] = asymbol_cp[j];
+            tx[k] = asymbol_cp[j];
         }
     }
 }