From e3aff8e06999bbd38097d78ef91f33f7dee53836 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Tue, 24 Apr 2018 03:37:09 +0000 Subject: [PATCH] fixed bug in amplitude estimator that improved LDPC dec perf - Octave code git-svn-id: https://svn.code.sf.net/p/freetel/code@3521 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/octave/ldpc.m | 8 ++------ codec2-dev/octave/ofdm_dev.m | 8 ++++---- codec2-dev/octave/ofdm_ldpc_rx.m | 4 ++-- codec2-dev/octave/ofdm_lib.m | 2 +- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/codec2-dev/octave/ldpc.m b/codec2-dev/octave/ldpc.m index d337394e..e05cb084 100644 --- a/codec2-dev/octave/ldpc.m +++ b/codec2-dev/octave/ldpc.m @@ -74,19 +74,15 @@ endfunction function [detected_data paritychecks] = ldpc_dec(code_param, max_iterations, demod_type, decoder_type, r, EsNo, fading) - if nargin == 6 - fading = ones(1, length(r)); - end - symbol_likelihood = Demod2D( r, code_param.S_matrix, EsNo, fading); - + % initialize the extrinsic decoder input input_somap_c = zeros(1, code_param.code_bits_per_frame ); bit_likelihood = Somap( symbol_likelihood, demod_type, input_somap_c ); input_decoder_c = bit_likelihood(1:code_param.code_bits_per_frame); - + [x_hat paritychecks] = MpDecode( -input_decoder_c, code_param.H_rows, code_param.H_cols, ... max_iterations, decoder_type, 1, 1); [mx mx_ind] = max(paritychecks); diff --git a/codec2-dev/octave/ofdm_dev.m b/codec2-dev/octave/ofdm_dev.m index 109b0a7a..15f2f88b 100644 --- a/codec2-dev/octave/ofdm_dev.m +++ b/codec2-dev/octave/ofdm_dev.m @@ -309,7 +309,7 @@ function [sim_out rx states] = run_sim(sim_in) lnew = min(Nsam-prx,states.nin); rxbuf_in = zeros(1,states.nin); - + if lnew rxbuf_in(1:lnew) = rx(prx:prx+lnew-1); end @@ -370,7 +370,7 @@ function [sim_out rx states] = run_sim(sim_in) st = (f-1)*Nbitsperframe/bps + 1; en = st + Nbitsperframe/bps - 1; r = rx_np(st:en); fade = rx_amp(st:en); - + fade % optional LDPC decode if ldpc_en @@ -1084,9 +1084,9 @@ more off; init_cml('~/cml/'); -%run_single +run_single %run_curves %run_curves_estimators %acquisition_histograms(0, 0) -acquisition_test(Ntests=3, EbNodB=100, foff_hz=0) +%acquisition_test(Ntests=3, EbNodB=100, foff_hz=0) %sync_metrics('freq') diff --git a/codec2-dev/octave/ofdm_ldpc_rx.m b/codec2-dev/octave/ofdm_ldpc_rx.m index 19178d63..870c18f2 100644 --- a/codec2-dev/octave/ofdm_ldpc_rx.m +++ b/codec2-dev/octave/ofdm_ldpc_rx.m @@ -29,7 +29,7 @@ function ofdm_ldpc_rx(filename, interleave_frames = 1, error_pattern_filename) mod_order = 4; bps = 2; modulation = 'QPSK'; mapping = 'gray'; demod_type = 0; decoder_type = 0; max_iterations = 100; - EsNo = 10; % TODO: fixme + EsNo = 3; % TODO: fixme printf("EsNo fixed at %f - need to est from channel\n", EsNo); init_cml('~/cml/'); @@ -149,7 +149,7 @@ function ofdm_ldpc_rx(filename, interleave_frames = 1, error_pattern_filename) rx_np_de = gp_deinterleave(rx_np); rx_amp_de = gp_deinterleave(rx_amp); - + % Interleaver Sync: % Needs to work on any data % Use indication of LDPC convergence, may need to patch CML code for that diff --git a/codec2-dev/octave/ofdm_lib.m b/codec2-dev/octave/ofdm_lib.m index e975ef41..6dbbb091 100644 --- a/codec2-dev/octave/ofdm_lib.m +++ b/codec2-dev/octave/ofdm_lib.m @@ -454,7 +454,7 @@ function [rx_bits states aphase_est_pilot_log rx_np rx_amp] = ofdm_demod(states, aphase_est_pilot_rect += sum(rx_sym(2+Ns+1,cr)*pilots(cr)'); aphase_est_pilot(c) = angle(aphase_est_pilot_rect); - aamp_est_pilot(c) = abs(aphase_est_pilot_rect/12); + aamp_est_pilot(c) = abs(aphase_est_pilot_rect/6); % amplitude is estimated over 6 rows of pilots end % correct phase offset using phase estimate, and demodulate -- 2.25.1