discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] The bug in gr_bytes_to_syms?


From: fangming he
Subject: [Discuss-gnuradio] The bug in gr_bytes_to_syms?
Date: Wed, 11 Nov 2009 04:34:16 +0800

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. 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!
Thanks!
Fangming

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;
}



Windows Live Hotmail: Your friends can get your Facebook updates, right from HotmailĀ®.

reply via email to

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