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);
lnew = min(Nsam-prx,states.nin);
rxbuf_in = zeros(1,states.nin);
-
+
if lnew
rxbuf_in(1:lnew) = rx(prx:prx+lnew-1);
end
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
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')
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/');
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
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