From: drowe67 Date: Tue, 17 Apr 2018 07:34:22 +0000 (+0000) Subject: uncoded BER being counted OK X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=7abd7052b1b71f6245cec344366ff8e3214c4e38;p=freetel-svn-tracking.git uncoded BER being counted OK git-svn-id: https://svn.code.sf.net/p/freetel/code@3493 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/ofdm.c b/codec2-dev/src/ofdm.c index a66351a1..c92bc7bf 100644 --- a/codec2-dev/src/ofdm.c +++ b/codec2-dev/src/ofdm.c @@ -231,7 +231,7 @@ static int coarse_sync(struct OFDM *ofdm, complex float *rx, int length, float * frequency est. We combine samples from either end of frame to improve estimate. Small real 1E-12 term to prevent instability with 0 inputs. */ - + *foff_est = Fs1 * cargf(conjf(p1)*p2 + conjf(p3)*p4 + 1E-12f) / TAU; return timing_est; @@ -381,7 +381,8 @@ struct OFDM *ofdm_create(const struct OFDM_CONFIG *config) { ofdm->timing_valid = 0; ofdm->timing_mx = 0.0f; ofdm->nin = OFDM_SAMPLESPERFRAME; - + ofdm->foff_running = 0.0 + I*0.0; + /* sync state machine */ strcpy(ofdm->sync_state,"searching"); @@ -1001,8 +1002,9 @@ 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; iuw_errors += rx_uw[i]; + ofdm->uw_errors += tx_uw[i] ^ rx_uw[i]; } /* during trial sync we don't tolerate errors so much, we look @@ -1021,7 +1023,7 @@ void ofdm_sync_state_machine(struct OFDM *ofdm, int *rx_uw) { strcpy(ofdm->sync_state_interleaver, "searching"); } - if (ofdm->frame_count == 3) { + if (ofdm->frame_count == 4) { /* three good frames, sync is OK! */ strcpy(next_state, "synced"); } @@ -1033,9 +1035,7 @@ void ofdm_sync_state_machine(struct OFDM *ofdm, int *rx_uw) { if (ofdm->uw_errors > 2) { ofdm->sync_counter++; } else { - if (ofdm->sync_counter) { - ofdm->sync_counter--; - } + ofdm->sync_counter = 0; } if (ofdm->sync_counter == 6) { diff --git a/codec2-dev/src/ofdm_demod.c b/codec2-dev/src/ofdm_demod.c index 2afda390..bb6d32d5 100644 --- a/codec2-dev/src/ofdm_demod.c +++ b/codec2-dev/src/ofdm_demod.c @@ -276,7 +276,7 @@ int main(int argc, char *argv[]) symbols_to_llrs(llr, codeword_symbols_de, codeword_amps_de, EsNo, CODED_SYMSPERFRAME); iter = run_ldpc_decoder(&ldpc, out_char, llr, &parityCheckCount); Nerrs = DATA_BITSPERFRAME - parityCheckCount; - fprintf(stderr, "iter: %d pcc: %d Nerrs: %d\n", iter, parityCheckCount, Nerrs); + //fprintf(stderr, "iter: %d pcc: %d Nerrs: %d\n", iter, parityCheckCount, Nerrs); if (Nerrs < 10) { /* sucessful decode! */ strcpy(next_sync_state_interleaver, "synced"); @@ -297,20 +297,25 @@ int main(int argc, char *argv[]) int rx_bits_raw[CODED_BITSPERFRAME]; for (j=0; j