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 <zzw.1...@163.com>

> 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" <k9...@mac.com> 写道:
>
>     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
> *
> *
>
>
>
> ------------------------------
> 网易为中小企业免费提供企业邮箱(自主域名) <http://ym.163.com/?from=od3>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to