From: drowe67 Date: Wed, 18 Apr 2018 21:09:21 +0000 (+0000) Subject: refactored UW insertion X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=94eeb9761e834b22cd8a343482f58d48d7674f47;p=freetel-svn-tracking.git refactored UW insertion git-svn-id: https://svn.code.sf.net/p/freetel/code@3499 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/octave/ofdm_ldpc_tx.m b/codec2-dev/octave/ofdm_ldpc_tx.m index 4dd5eb61..32b6a8bd 100644 --- a/codec2-dev/octave/ofdm_ldpc_tx.m +++ b/codec2-dev/octave/ofdm_ldpc_tx.m @@ -83,7 +83,7 @@ function ofdm_ldpc_tx(filename, interleave_frames = 1, Nsec, EbNodB=100, channel % generate UW and txt symbols to prepend to every frame after LDPC encoding and interleaving - tx_uw_tx_bits = [1 0 0 1 0 1 0 0 1 0 zeros(1,Ntxtbits)]; + tx_uw_tx_bits = [tx_uw zeros(1,Ntxtbits)]; tx_uw_tx_symbols = []; for b=1:2:length(tx_uw_tx_bits) tx_uw_tx_symbols = [tx_uw_tx_symbols qpsk_mod(tx_uw_tx_bits(b:b+1))]; diff --git a/codec2-dev/octave/ofdm_lib.m b/codec2-dev/octave/ofdm_lib.m index 89587ab3..e7b56f12 100644 --- a/codec2-dev/octave/ofdm_lib.m +++ b/codec2-dev/octave/ofdm_lib.m @@ -138,6 +138,8 @@ function states = ofdm_init(bps, Rs, Tcp, Ns, Nc) states.Nsamperframe = (states.Nrowsperframe+1)*(states.M+states.Ncp); states.Ntxtbits = 4; % reserve 4 bits/frame for auxillary text information states.Nuwbits = (Ns-1)*bps - states.Ntxtbits; + states.tx_uw = [1 0 0 1 0 1 0 0 1 0]; + assert(length(states.tx_uw) == states.Nuwbits); % generate same pilots each time @@ -194,7 +196,7 @@ function states = ofdm_init(bps, Rs, Tcp, Ns, Nc) % printf("timing_norm: %f\n", states.timing_norm) % sync state machine - + states.sync_state = states.last_sync_state = 'search'; states.uw_errors = 0; states.sync_counter = 0; @@ -554,7 +556,7 @@ function [tx_bits payload_data_bits codeword] = create_ldpc_test_frame % insert UW and txt bits - tx_bits = [zeros(1,Nuwbits) zeros(1,Ntxtbits) codeword_raw]; + tx_bits = [tx_uw zeros(1,Ntxtbits) codeword_raw]; assert(Nbitsperframe == length(tx_bits)); endfunction @@ -644,8 +646,6 @@ function states = sync_state_machine(states, rx_uw) % freq offset est may be too far out, and has aliases every 1/Ts, so % we use a Unique Word to get a really solid indication of sync. - tx_uw = [1 0 0 1 0 1 0 0 1 0]; - states.uw_errors = sum(xor(tx_uw,rx_uw)); if (states.uw_errors > uw_thresh) states.sync_counter++; diff --git a/codec2-dev/octave/ofdm_load_const.m b/codec2-dev/octave/ofdm_load_const.m index e4b87746..dd634241 100644 --- a/codec2-dev/octave/ofdm_load_const.m +++ b/codec2-dev/octave/ofdm_load_const.m @@ -15,6 +15,7 @@ Nsamperframe = states.Nsamperframe; timing_mx_thresh = 0.3; Nuwbits = states.Nuwbits; Ntxtbits = states.Ntxtbits; +tx_uw = states.tx_uw; W = states.W; w = states.w;