discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] output is all 0 in howto_square_ff::general_work()


From: zzw.1012
Subject: [Discuss-gnuradio] output is all 0 in howto_square_ff::general_work()
Date: Sun, 23 May 2010 14:09:27 +0800 (CST)

Hi,
    Thanks to Seeve Bunch especially and sorry for my silly question. It's work well now. but , I still have some perplexity.
    here is the printf information in the file of howto_square_ff :: general_work():
 
noutput_items  = 4
input_items[0] = -3.000000
output_items[0] = 9.000000
input_items[1] = 4.000000
output_items[1] = 16.000000
input_items[2] = -5.500000
output_items[2] = 30.250000
input_items[3] = 2.000000
output_items[3] = 4.000000
=======================
noutput_items  = 1
input_items[0] = 3.000000
output_items[0] = 9.000000
 
while the source code is :
howto_square_ff::general_work (int noutput_items,
                               gr_vector_int &ninput_items,
                               gr_vector_const_void_star &input_items,
                               gr_vector_void_star &output_items)
{
  const float *in = (const float *) input_items[0];
  float *out = (float *) output_items[0];
  //test 
  printf ("noutput_items  = %d\n",noutput_items);
  for (int i = 0; i < noutput_items; i++){
    printf ("input_items[%d] = %f\n", i, in[i]);
    out[i] = in[i] * in[i];
    printf ("output_items[%d] = %f\n", i, out[i]);
  }
I can not understand that the src_data is src_data = (-3, 4, -5.5, 2, 3) which have 5 items in all, but why separate into 2 step ,the one is noutput_items  = 4, the other is noutput_items  = 1 ?

在2010-05-23,"Steve Bunch" <address@hidden> 写道:
    const float *in = (const float *) input_items[0];
    float *out = (float *) output_items[0];
...
        printf ("input_items[%d] = %d\n", i, in[i]);
        out[i] = in[i] * in[i];
        printf ("output_items[%d] = %d\n", i, out[i]);

in and out reference floating point numbers.  You are printing them with %d instead of a floating point format, such as %f.

Steve




网易为中小企业免费提供企业邮箱(自主域名)

reply via email to

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