Hi all,
I am trying to make an out-of-tree module using sync block.
In which I want to make a local filter, i.e. output of this
filter is not connected to an output port, but to be stored in
a local variable.
int ShortPNcorr_impl::work(int noutput_items,
gr_vector_const_void_star
&input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *)
input_items[0];
gr_complex *out = (gr_complex *)
output_items[0];
gr_complex *tcorr = (gr_complex *)
output_items[1];
int *flag = (int *) output_items[2]; // this is calculated based on local filter
std::vector<gr_complex>
short_corr(noutput_items+history());
gr_complex *corr = (gr_complex *)
&(short_corr[0]);
......................
d_Shfilter->filter(noutput_items+X,
in, corr);
// Where X>0
// d_Shfilter is fft_filter_ccc filter
of length 40 (number of taps)
// Since I am saving
a history of length 320, I am assuming that input buffer has
atleast noutput_items+319 values available
......................
}
I think that filter requires corr to be a pointer
to the vector (similar to 'in' or 'out'), and that is what I
am trying to do. But this results in an unstable operation
and whenever I choose X>250, I get "double free or
corruption" error. Can someone explain this? Is my
understanding of "history" wrong?
Thanks
ᐧ