Gr_io_signature question


#1

Ok I’ve decided on somewhat of a revisit of my code. Taking Eric’s
advice
I’m going to reimplement the code in a more flowgraph based behavior.
After
a vector is brought into the system by the MPI (my UDP interface system)
some values will be stripped and the pay load will be passed to a first
code
block that converts the values from an array of U8’s to an array of
unsigned
shorts that represent the physical bit value (each U8 will have 8 values
representing their binary equivalents.). This will then be parsed into
2
streams (broken at the midpoint of the array into 2 separate streams)
and
passed out to the encoding block. This Aloumoti encoder will then use a
bit
from row 0 and 1 from row 1 and convert them into a 2X2 matrix and pass
this
out the other end (so I’m assuming a 1:2 or 2:4 interpolation is needed
here). My question is how to utilize ‘gr_io_signature’ in the class
derivation to create the 2 output streams, how to return on these 2
steams
and then access them on the other end.

I know the python should look something like

#get values from UDP here

MPI_SRC=gr.vector_source(src_data) #the stripped vector

BIT_CONVERT=my.Bit_Vector()

ALOUMOTI_ENCODER=my.Aloumoti()

TX0PAYLOAD=gr.vector_sink()

TX1PAYLOAD=gr.vector_sink()

fg.connect(MPI_SRC, BIT_CONVERTER)

fg.connect((BIT_CONVERTER,0), (ALOUMOTI_ENCODER,0))

fg.connect((BIT_CONVERTER,1), (ALOUMOTI_ENCODER,1))

fg.connect((ALOUMOTI_ENCODER,0), TX0PAYLOAD)#these are sink currently so
I
can check the behavior of my flow graph system.

fg.connect((ALOUMOTI_ENCODER,1), TX1PAYLOAD)

at least this is the impression I get from the documentation.

However the aloumoti needs these 2 streams in combination to create the
output streams, how (in c) do I specify that there are 2 inputs and then
proceed to access those inputs in the C system? I’m already aware it
will
in some way involve the min_in, min_out, etc. variables and their use in
generating an IO signature.

Is it involved in the declaration of the in and out variables at the
beginning of the ‘work’ function:

Specifically do I use something akin to:

const float *in0= (const float *) input_items[0];

const float *in1= (const float *) input_items[1];

Any help would be greatly appreciated.

-Garrett McGrath


#2

What size (in Bytes) is a single Item on the input stream? Float == 4
Bytes? So long as the Item size can be expressed in terms of Bytes,
then using the io_signature is pretty straight forward.

You might also need to change the “forecast()” method depending on how
many input Items (per stream) are created for each output Item (or vice
versa). The default is 1:1.

However the aloumoti needs these 2 streams in combination to create
the output streams, how (in c) do I specify that there are 2 inputs
and then proceed to access those inputs in the C system? I?m already
aware it will in some way involve the min_in, min_out, etc. variables
and their use in generating an IO signature.

The number of input streams is set by either (1) the number provided by
the previous connect() block, or (2) the number specified by
“set_input_signature()” if using an exact setting.

Examples

  • To specify exactly 2 input streams, you’d use:

set_input_signature (gr_make_io_signature (2, 2,
<size_of_input_stream_item>));

  • If you know that the number of input streams is either 1, 2, or 3,
    then you could use:

set_input_signature (gr_make_io_signature (1, 3,
<size_of_input_stream_item>));

and then in “work()” you’d have to make sure to process
“input_items.size()” number of input streams.

  • If you don’t know the number of input streams, and there might not be
    any, you can specify an unknown number of streams from (0 to any):

set_input_signature (gr_make_io_signature (0, -1,
<size_of_input_stream_item>));

[but I’ve never tried it].

Specifically do I use something akin to:

const float *in0= (const float *) input_items[0];

const float *in1= (const float *) input_items[1];

Yes, that looks correct; if you use the exact “set_input_signature()”
above, you’re guaranteed to have 2 input streams and then what you
wrote would always work.

And you’d do the same thing for “output_items[]” to access those
streams.

Hope this answers your questions. - MLD


#3

On Wed, May 03, 2006 at 09:09:45AM -0400, Michael D. wrote:

and then proceed to access those inputs in the C system? Iâ??m already
aware it will in some way involve the min_in, min_out, etc. variables
and their use in generating an IO signature.

The number of input streams is set by either (1) the number provided by
the previous connect() block, or (2) the number specified by
“set_input_signature()” if using an exact setting.

Seems basically right, though instead of using
“set_{input,output}_signature”, build the signatures and pass them
as args to the parent’s constructor.

Eric