Gr_sync_decimator(custom block)

Hi,
I wrote a custom block to compute beamforming weights. The block takes 8
inputs and 8 outputs.
It takes 64 samples from each input stream and produces 1 output in each
output stream.I am not getting any output and GRC stops working when I
set
the decimation rate to 64.I tried printing noutput_items and it is like
64,32,16,8,4,2,1 and stops. But when I set the rate to 1 the block works
but rather very slowly and overflows when UHD source is connected.The
noutput_items is always 4096 or 4095 for this case. I am not sure if I
am
setting the correct decimation rate and returning correct number of
samples.Can anyone help?
code snippet:
beamformer_cc_impl::beamformer_cc_impl(int nsamples)
: gr_sync_decimator(“beamformerr_cc”,
gr_make_io_signature(1, -1, sizeof (gr_complex)),
gr_make_io_signature(1, -1, sizeof (gr_complex)),nsamples),
d_samples(nsamples),

{

}

int
beamformer_cc_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
for (int i=0;i<ninputs;i++){
out[i] = (gr_complex ) output_items[i];
}
for (int k=0;k<noutput_items;k++){
for(unsigned int i=0;i<ninputs;i++){
memcpy(&in_buffer[i][0]),&((const gr_complex
)input_items[i])[kd_samples],d_samples
sizeof(gr_complex));
}

//…signal processing on in_buffer to compute covariance matrix and
pseudo
inverse of covariance matrix of size 8x8…

for (int i=0;i<ninputs;i++){
memcpy(&out[i][k],&weights[i],sizeof(complex));
}
}
return noutput_items;
}

Thanks,
Saran

On 02/20/2014 06:58 AM, sarankumar wrote:

Hi,
I wrote a custom block to compute beamforming weights. The block takes 8
inputs and 8 outputs.
It takes 64 samples from each input stream and produces 1 output in each
output stream.I am not getting any output and GRC stops working when I
set the decimation rate to 64.I tried printing noutput_items and it is
like 64,32,16,8,4,2,1 and stops. But when I set the rate to 1 the block

When you say ‘stops’, what happens to the upstream blocks?
(also you’re using GR < 3.7, might want to switch when you’re writing
new stuff… but that seems unrelated).

beamformer_cc_impl::work(int noutput_items,

gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
return noutput_items;
}

This seems correct. I’m more concerned about what’s going in upstream.

M

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs