Gr-trellis : problem in using viterbi decoder

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 in_bits;
     Â
       for (int i = 0; i <K ; i++) { // K - no of bits
      in_bits.push_back(inputbits[i]); // input bits
       }
       std::vector 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);
Â

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs