discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Re: one question about gr_chunks_to_symbols_bc


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] Re: one question about gr_chunks_to_symbols_bc
Date: Sat, 20 Sep 2008 21:27:27 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

On Sat, Sep 20, 2008 at 09:13:31PM -0500, jiangfan shi wrote:
> Can anyone offer some explanations? Thanks.
> 
> Jiangfan
> 
> On Thu, Sep 18, 2008 at 12:16 PM, jiangfan shi <address@hidden> wrote:
> > Hi, All,
> >
> > I looked through the gr_chunks_to_symbols_bc code, my understanding is
> > that it handles a two-dimension array. Based on the following work()
> > function, my understanding is that  each input_items[m] is a list of
> > chunk (called stream in this function), and the input_items itself is
> > a list of stream. Then the function maps each chunk to a complex based
> > on the symbol table.  Am I right?

Each entry in the table is d_D complex<float>'s long.
Each input byte is mapped to d_D complex<float>'s.
If d_D is 1 -- the usual case -- then each byte on the input is mapped
to a single complex<float> value.

> > =============================
> > int
> > gr_chunks_to_symbols_bc::work (int noutput_items,
> >                        gr_vector_const_void_star &input_items,
> >                        gr_vector_void_star &output_items)
> > {
> >  assert (noutput_items % d_D == 0);
> >  assert (input_items.size() == output_items.size());
> >  int nstreams = input_items.size();
> >
> >  for (int m=0;m<nstreams;m++) {
> >    const unsigned char *in = (unsigned char *) input_items[m];
> >    gr_complex *out = (gr_complex *) output_items[m];
> >
> >    // per stream processing
> >    for (int i = 0; i < noutput_items / d_D; i++){
> >      assert (((unsigned int)in[i]*d_D+d_D) <= d_symbol_table.size());
> >      memcpy(out, &d_symbol_table[(unsigned int)in[i]*d_D],
> > d_D*sizeof(gr_complex));
> >      out+=d_D;
> >    }
> >    // end of per stream processing
> >
> >  }
> >  return noutput_items;
> > }
> >
> > ==========================
> >
> > Another question is that what the gr_chunks_to_symbols_bc constructor
> > means? Based on the following code, I do not understand d_D(D) and
> > d_symbol_table (symbol_table). I know gr_sync_interpolator() is called
> > explicitly in gr_chunks_to_symbols_bc's constructor. are d_D and
> > d_symbol_table other classes? or something else?

Look in the .h file for the answer to the types of d_D and d_symbol_table.

> > =========================
> > gr_chunks_to_symbols_bc::gr_chunks_to_symbols_bc (const
> > std::vector<gr_complex> &symbol_table, const int D)
> >  : gr_sync_interpolator ("chunks_to_symbols_bc",
> >                          gr_make_io_signature (1, -1, sizeof (unsigned 
> > char)),
> >                          gr_make_io_signature (1, -1, sizeof (gr_complex)),
> >                          D),
> >  d_D (D),
> >  d_symbol_table (symbol_table)
> > {
> > }

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]