discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] testing block written in block


From: Activecat
Subject: Re: [Discuss-gnuradio] testing block written in block
Date: Thu, 19 Jun 2014 11:35:44 +0800

On Wed, Jun 18, 2014 at 9:14 PM, Nowlan, Sean <address@hidden> wrote:

If you’d rather use stock GR blocks or you would like a flowgraph with identical functionality, you can hook up a Vector to Stream block (with num_items=vector_length) to an Integrate block (with decimation=vector_length).

 

vector_length = 10

self.vec2stream = blocks.vector_to_stream(gr.sizeof_gr_complex, vector_length)

self.integrate = blocks.integrate_cc(vector_length)

self.connect((self.vec2stream, 0), (self.integrate, 0))

 

Sean



I agree, that the Integrate block is a decimator block that implement this perfectly.
Just that she may want to use integrate_ff rather than integrate_cc, depending on her needs.
Also we are assuming that the intake vectors are fixed in length.

    int
    integrate_ff_impl::work(int noutput_items,
              gr_vector_const_void_star &input_items,
              gr_vector_void_star &output_items)
    {
      const float *in = (const float *)input_items[0];
      float *out = (float *)output_items[0];

      for (int i = 0; i < noutput_items; i++) {
        out[i] = (float)0;
        for (int j = 0; j < d_decim; j++)
          out[i] += in[i*d_decim+j];
      }
     
      return noutput_items;
    }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]