discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] The bug in gr_bytes_to_syms?


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] The bug in gr_bytes_to_syms?
Date: Tue, 10 Nov 2009 13:20:54 -0800
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Nov 11, 2009 at 04:34:16AM +0800, fangming he wrote:
> 
> Hi, All,

> Do you notice that the return of this function is noutput_items
> rather than output_items? In this function , the noutput_items is
> the number of the input_items and output_items.

This is incorrect.  The block is derived from gr_sync_interpolator,
with the final constructor arg to gr_sync_interpolator being
BITS_PER_BYTE (== 8), thus the noutput_items is always 8 * the number
of input items.

> In my opinion, the output of this function should be
> output_items. After all, what we concern is the calculation result
> of the input data rather than the length of the data? Does anyone
> thinks so?

> Please clarify it for me!

You could also look at the corresponding QA code contained in
qa_fsk_stuff.py (found by using grep).

> Thanks!
> Fangming

Eric


> int
> gr_bytes_to_syms::work (int noutput_items,
>                         gr_vector_const_void_star &input_items,
>                         gr_vector_void_star &output_items)
> {
>   const unsigned char *in = (unsigned char *) input_items[0];
>   float *out = (float *) output_items[0];
> 
>   assert (noutput_items % BITS_PER_BYTE == 0);
> 
>   for (int i = 0; i < noutput_items / BITS_PER_BYTE; i++){
>     int x = in[i];
> 
>     *out++ = (((x >> 7) & 0x1) << 1) - 1;
>     *out++ = (((x >> 6) & 0x1) << 1) - 1;
>     *out++ = (((x >> 5) & 0x1) << 1) - 1;
>     *out++ = (((x >> 4) & 0x1) << 1) - 1;
>     *out++ = (((x >> 3) & 0x1) << 1) - 1;
>     *out++ = (((x >> 2) & 0x1) << 1) - 1;
>     *out++ = (((x >> 1) & 0x1) << 1) - 1;
>     *out++ = (((x >> 0) & 0x1) << 1) - 1;
>   }
> 
>   return noutput_items;
> }
> 




reply via email to

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