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" [email protected] 写é“:
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