Yes you’re right about casting between “in” and “input_items”, however,
I
think this problem is somehow related to the large number input ports! I
don’t why!
Here is the whole block:
#ifdef HAVE_CONFIG_H
#include “config.h”
#endif
#include <gnuradio/io_signature.h>
#include “phich_grouping_impl.h”
int N_FS_phich(bool normal_cp){
if(normal_cp)
return 8;
else
return 4;
}
namespace gr {
namespace my {
phich_grouping::sptr
phich_grouping::make(bool normal_cp, int N_phich_group)
{
return gnuradio::get_initial_sptr
(new phich_grouping_impl(normal_cp, N_phich_group));
}
/*
* The private constructor
*/
phich_grouping_impl::phich_grouping_impl(bool normal_cp, int
N_phich_group)
: gr::block(“phich_grouping”,
gr::io_signature::make(N_phich_group *
N_FS_phich(normal_cp), N_phich_group * N_FS_phich(normal_cp) ,
sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
d_normal_cp(normal_cp),
d_N_phich_group(N_phich_group)
{
set_tag_propagation_policy(TPP_DONT);
}
/*
* Our virtual destructor.
*/
phich_grouping_impl::~phich_grouping_impl()
{
}
void
phich_grouping_impl::forecast (int noutput_items, gr_vector_int
&ninput_items_required)
{
for (int i=0; i<d_N_phich_group * N_FS_phich(d_normal_cp); i++)
{
ninput_items_required[i] = 12;
}
}
int
phich_grouping_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 gr_complex *in[d_N_phich_group * N_FS_phich(d_normal_cp)];
gr_complex *out = (gr_complex *) output_items[0];
// in = (const gr_complex *) input_items;
cout << "n input " << input_items.size() << endl;
int phich_in_len[d_N_phich_group];
int x = 0;
for (int i=0; i<d_N_phich_group * N_FS_phich(d_normal_cp); i++)
{
in[i] = (const gr_complex *) input_items[i];
// reading tags
vector<tag_t> tag_len;
get_tags_in_window(tag_len,
0,
0,
ninput_items[0],
pmt::string_to_symbol("length"));
if(tag_len.size()>0)
{
phich_in_len[i] = pmt::to_long(tag_len[0].value);
x++;
}
}
gr_complex y_p[d_N_phich_group][12];
gr_complex y__p_tilt[d_N_phich_group/2][12];
// cout << "\tin[0][0] "<<in[0][0] << endl;
if (x == d_N_phich_group * N_FS_phich(d_normal_cp)) // x ==
d_N_phich_group) is for checking all the input tags are read
{
// grouping …
for (int i=0; i<d_N_phich_group ;i++)
{
for (int k=0; k<phich_in_len[i]; k++)
{
y_p[i][k] = 0;
for (int j=0; j<N_FS_phich(d_normal_cp); j++)
{
y_p[i][k] = y_p[i][k] + in[i*8+j][k];
}
}
}
........
…
…
// adding tag
add_item_tag(0,
nitems_written(0),
pmt::string_to_symbol("length"),
pmt::from_long(12));
cout << "PHICH grouping" << endl;
consume_each(12);
}
else
{ // if tags didn't read
produce(0, 0);
consume_each(0);
}
return WORK_CALLED_PRODUCE;
}
} /* namespace my /
} / namespace gr */
Input to this block is a random source and its output is a file sink. I
would be glad to see the comments on the code to improve it also finding
the problem.
Best,
Mostafa A.
On Sun, Jul 27, 2014 at 10:10 PM, Marcus M.
[email protected]