From: drowe67 Date: Thu, 12 Apr 2018 09:30:35 +0000 (+0000) Subject: refactored C to get consistent variable names X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=ea757051465e48f642dc7492cd8ff30968273dc5;p=freetel-svn-tracking.git refactored C to get consistent variable names git-svn-id: https://svn.code.sf.net/p/freetel/code@3469 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/ofdm.c b/codec2-dev/src/ofdm.c index 17fb7193..baf18430 100644 --- a/codec2-dev/src/ofdm.c +++ b/codec2-dev/src/ofdm.c @@ -894,8 +894,8 @@ void ofdm_demod(struct OFDM *ofdm, int *rx_bits, COMP *rxbuf_in) { } /* - * For testing, we want to save these complex data values - * without the pilots. Thus, the name rx (no pilot) np + * Output complex data symbols after phase correction; + * rx_np means the pilot symbols have been removed */ ofdm->rx_np[(rr * OFDM_NC) + (i - 1)] = rx_corr; @@ -1009,7 +1009,7 @@ 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; - for (i=0; iuw_errors += rx_uw[i]; } if (ofdm->uw_errors > 2) { diff --git a/codec2-dev/src/ofdm_demod.c b/codec2-dev/src/ofdm_demod.c index e604ad1f..6dd1f011 100644 --- a/codec2-dev/src/ofdm_demod.c +++ b/codec2-dev/src/ofdm_demod.c @@ -38,11 +38,22 @@ #include "ofdm_internal.h" #include "octave.h" #include "test_bits_ofdm.h" - -#define ASCALE (2E5*1.1491/2.0) /* scale from shorts back to floats */ -#define NFRAMES 100 /* just log the first 100 frames */ -#define NDISCARD 20 - +#include "mpdecode_core.h" + +#define ASCALE (2E5*1.1491/2.0) /* scale from shorts back to floats */ +#define NFRAMES 100 /* just log the first 100 frames */ +#define NDISCARD 20 /* BER2measure disctrds first 20 frames */ +#define CODED_BITSPERFRAME 224 /* number of LDPC codeword bits/frame */ + +/* QPSK constellation for symbol likelihood calculations */ + +static COMP S_matrix[] = { + { 1.0f, 0.0f}, + { 0.0f, 1.0f}, + { 0.0f, -1.0f}, + {-1.0f, 0.0f} +}; + int opt_exists(char *argv[], int argc, char opt[]) { int i; for (i=0; isync_state,"synced") == 0) || (strcmp(ofdm->sync_state,"trial_sync") == 0) ) { ofdm_demod(ofdm, rx_bits, rxbuf_in); - if (sd == 0) { - /* simple hard decision output for uncoded testing */ + if (llr_en) { + double symbol_likelihood[ (CODED_BITSPERFRAME/OFDM_BPS) * (1<rx_np[j]); + ldpc_codeword_symbols[i].imag = cimagf(ofdm->rx_np[j]); + } + float *ldpc_codeword_symbol_amps = &ofdm->rx_amp[(OFDM_NUWBITS+OFDM_NTXTBITS)/OFDM_BPS]; + + Demod2D(symbol_likelihood, ldpc_codeword_symbols, S_matrix, EsNo, ldpc_codeword_symbol_amps, CODED_BITSPERFRAME/OFDM_BPS); + Somap(bit_likelihood, symbol_likelihood, CODED_BITSPERFRAME/OFDM_BPS); + + fwrite(bit_likelihood, sizeof(double), CODED_BITSPERFRAME, fout); + + } else { + /* simple hard decision output for uncoded testing, all bits in frame dumped inlcuding UW and txt */ for(i=0; i