This is my block's constructor:
my_package::my_package(int num_input_ports, int L_samples)
: gr_sync_decimator(
"package",
gr_make_io_signature(2, 5, sizeof(gr_complex)),
gr_make_io_signature(1, 1 ,
num_input_ports*num_input_ports*sizeof(gr_complexd)),
L_samples) {
// global variables
N=num_input_ports;
vect_lengx=N*N;
L=L_samples;
set_decimation(L);
}
Best regards,
Sam
> Date: Fri, 6 Aug 2010 10:21:38 -0700
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [Discuss-gnuradio] Using gr_sync_decimator [was: How to use
> forecast()?]
>
> On Fri, Aug 06, 2010 at 06:32:32AM -0700, Sammour wrote:
> >
> > Hi Eric,
> > I have a similar issue as the one described above and I have read some of
> > the examples in the directory provided but they seem to be different from
> > what I want to implement. I want to collect L samples from N channels and
> > store them in a buffer, do processing and output a vector of length N. I
> > wrote the following code but it doesn't seem to be working properly. Some of
> > them use loops from i=0 to noutput_items*vlen while others use from 0 to
> > noutput_items. Also some of them don't use the function memcpy.
> >
> > I am using gr_sync_decimator with set_decimation(L) is written in the block
> > constructor.
>
> gr_sync_decimator with decimation == L correct, given what you've described.
>
> Can you please show the beginning of your constructor, where you pass the
> arguments to gr_sync_decimator's constructor?
>
> Eric
>
>
>
>
> > ---------------------------------------------------
> > int my_package::work(.....) {
> >
> > gr_complexd *out =(gr_complexd *) output_items[0];
> > const gr_complex *in[N];
> >
> > for (unsigned int i = 0; i<N; i++)
> > in[i] = (const gr_complex *) input_items[i];
> >
> > for (int i = 0; i <noutput_items; i++){
> > for(unsigned int k=0; k<N; k++)
> >
> > memcpy(&inbuffer[k][0],&in[k][i*L],L*sizeof(gr_complex)); //inbuffer is
> > NxL matrix
> >
> > //Signal processing of inbuffer and storing the result in a
> > vector
> > // out_vector of length vect_lengx;
> >
> > memcpy(out, &out_vector.at(0),
> > vect_lengx*sizeof(gr_complexd));
> > out+=vect_lengx;
> >
> > }//end for
> >
> > return noutput_items;
> > }
> > ------------------------------------------------------
> > Can you help me with this please?
> >
> > Thanks a lot.
> >
> > Sammour
> > --
> > View this message in context:
> > http://old.nabble.com/How-to-use-forecast%28%29--tp28705301p29356450.html
> > Sent from the GnuRadio mailing list archive at Nabble.com.
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio