discuss-gnuradio
[Top][All Lists]
Advanced

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

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


From: Mir M. Ali
Subject: Re: [Discuss-gnuradio] output is all 0 in howto_square_ff::general_work()
Date: Sun, 23 May 2010 12:47:35 -0500

The scheduler chooses the amount of data to process each time. Here it chose 4 the first time it ran the general_work() function and the next time it chose 1. You can look into the scheduler's implementation to know how it chooses this. If you want to make it choose 5 the first time then you can call gr_block::set_output_multiple() function to set the the output_items to be a multiple of 5. This will make the scheduler choose 5 items on input stream. There are other things involved too and I suggest looking at gr_block.h file to know more.



2010/5/23 zzw.1012 <address@hidden>
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




网易为中小企业免费提供企业邮箱(自主域名)
_______________________________________________
Discuss-gnuradio mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio



reply via email to

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