Hello ,
I am using conv encoder and viterbi decoder in FHSS-BPSK transceiver.
Below I have pasted encoder-decoder code which is a part of pure C++
application. Problem is encoder input and decoder output do not match.
Can anyone point where i am making mistake ?
Thanks in advance
Ram
int K=100;
short inputbits[100]={ ....contains bits.... };
std::vector<short> in_bits;
for (int i = 0; i <K ; i++) { // K - no of bits
in_bits.push_back(inputbits[i]); // input bits
}
std::vector<float> constellation; // BPSK mapping
constellation.push_back(1);
constellation.push_back(-1);
gr_vector_source_s_sptr bit_src =
gr_make_vector_source_s(in_bits,false,K );
gr_vector_to_stream_sptr vector2stream=
gr_make_vector_to_stream(sizeof(short),K);
// encoder
fsm f=
fsm("../../../gr-trellis/src/examples/fsm_files/awgn1o2_128.fsm");
trellis_encoder_ss_sptr encoder = trellis_make_encoder_ss (f, 0);
// modulate
gr_chunks_to_symbols_sf_sptr mod = gr_make_chunks_to_symbols_sf
(constellation, 1);
// ----------- ideal channel -------------
// decoder
trellis_metric_type_t type= TRELLIS_EUCLIDEAN;
trellis_metrics_f_sptr metrics = trellis_make_metrics_f (f.O(), 1,
constellation, type);
trellis_viterbi_s_sptr viterbi =trellis_make_viterbi_s ( f,K, 0, -1);
gr_stream_to_vector_sptr stream2vector=
gr_make_stream_to_vector(sizeof(short), K);
d_dst = gr_make_vector_sink_s (K);
connect( bit_src , 0, vector2stream, 0);
connect( vector2stream , 0,mod, 0);
connect(mod, 0,metrics, 0);
connect(metrics, 0, viterbi, 0);
connect( viterbi, 0,stream2vector, 0);
connect(stream2vector, 0, d_dst, 0);
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio