[Top][All Lists]

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

Re: [Discuss-gnuradio] Simple GR_SYNC_BLOCK

From: Dan Halperin
Subject: Re: [Discuss-gnuradio] Simple GR_SYNC_BLOCK
Date: Wed, 07 Mar 2007 10:07:40 -0800
User-agent: Thunderbird (X11/20070303)

Daniel Garcia wrote:
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 ii = 0; ii < noutput_items; ii++) {
          out[ii] = in[ii + 1] - in[ii];
        for (int ii = 0; ii < noutput_items; ii++) {
          d_cumsum = out[i] + d_cumsum;
          out[ii] = d_cumsum;

        return noutput_items;
I haven't actually tried to figure out the answer to your question, but

1) That out[i] bothers me. Shouldn't it be out[ii]?

2) Is there a good reason for doing this in two passes with two stores to each memory location? You can do this in one pass with another temp variable to hold the first value of out[ii]. The compiler might optimize it for you, and then again it might not...


reply via email to

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