Layer Mapper in GnuRadio

Hello

I’m supposed to create a block in GnuRadio that has 1 input and 2 or 4
outputs , it’s actually a Layer mapper in MIMO processing of LTE.

I have written the constructor :

Layer_Mapper_Transmit_Diversity_cc_impl::Layer_Mapper_Transmit_Diversity_cc_impl(int
numLay,int constNum)
: gr_block(“Layer_Mapper_Transmit_Diversity_cc”,
gr_make_io_signature(1, 1, sizeof
(float)*16/(constNum)),
gr_make_io_signature(2, 4, sizeof
(float)16/(constNumnumLay)))
{
NumLay=numLay; //Number of Layers
M=constNum; //Constellation Cardinality
}

and the Forecast Function:

void
Layer_Mapper_Transmit_Diversity_cc_impl::forecast (int
noutput_items,
gr_vector_int &ninput_items_required)
{
ninput_items_required[0] = NumLay * noutput_items;
}

In The General Work Function I wanted to create 4 outputs this way:

int
Layer_Mapper_Transmit_Diversity_cc_impl::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 **out0 = (float **) output_items[0];
float **out1 = (float **) output_items[1];
float **out2 = (float **) output_items[2];
float **out3 = (float **) output_items[3];

Because the inputs and outputs are arrays so I declared them as matrices
,
does GnuRadio accept this ?

    float **out0 = (float **) output_items[0];
    float **out1 = (float **) output_items[1];
    float **out2 = (float **) output_items[2];
    float **out3 = (float **) output_items[3];

Because the inputs and outputs are arrays so I declared them as matrices ,
does GnuRadio accept this ?

So input_items[0] or output_items[1] for example, is a pointer to a
linear chunk of memory. Casting it to a float ** might imply that its an
array of pointers which each point to a linear row/column of a matrix.
But that isnt the case, so things will likely segfault.

You could cast the pointer to a C matrix with the double brackets and
the fixed widths like a [64][4] for example, I think C will map those
double bracketed access nicely to a linear chunk of memory.

I hope that helps!
-josh