From 28ef3dbdf9b0f5fc9d13eb12e3e31f4caf545be5 Mon Sep 17 00:00:00 2001 From: okcsampson Date: Mon, 12 Jun 2017 17:34:41 +0000 Subject: [PATCH] Update ofdm.c tx matches octave now git-svn-id: https://svn.code.sf.net/p/freetel/code@3184 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/ofdm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/codec2-dev/src/ofdm.c b/codec2-dev/src/ofdm.c index 2dc247a1..ed7fdefc 100644 --- a/codec2-dev/src/ofdm.c +++ b/codec2-dev/src/ofdm.c @@ -64,7 +64,7 @@ const char pilotvalues[] = { /* Gray coded QPSK modulation function */ static complex float qpsk_mod(int *bits) { - return constellation[(bits[0] << 1) + bits[1]]; + return constellation[(bits[1] << 1) | bits[0]]; } /* Gray coded QPSK demodulation function */ @@ -332,10 +332,10 @@ void ofdm_mod(struct OFDM *ofdm, COMP result[OFDM_SAMPLESPERFRAME], const int *t } else if (OFDM_BPS == 2) { /* Here we will have Nbitsperframe / 2 */ - for (s = 0; s < length; s += 2) { - dibit[0] = tx_bits[s]; - dibit[1] = tx_bits[s + 1]; - tx_sym_lin[s] = qpsk_mod(dibit); + for (s = 0, i = 0; i < length; s += 2, i++) { + dibit[0] = tx_bits[s + 1] & 0x1; + dibit[1] = tx_bits[s] & 0x1; + tx_sym_lin[i] = qpsk_mod(dibit); } } @@ -343,9 +343,9 @@ void ofdm_mod(struct OFDM *ofdm, COMP result[OFDM_SAMPLESPERFRAME], const int *t /* convert to comp */ - for (s = 0; s < OFDM_SAMPLESPERFRAME; s++) { - result[s].real = crealf(tx[s]); - result[s].imag = cimagf(tx[s]); + for (i = 0; i < OFDM_SAMPLESPERFRAME; i++) { + result[i].real = crealf(tx[i]); + result[i].imag = cimagf(tx[i]); } } -- 2.25.1