discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] gr_block::set_history()


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] gr_block::set_history()
Date: Fri, 21 Sep 2012 10:22:35 -0400

On Thu, Sep 20, 2012 at 8:15 PM, Kyle Zhou <address@hidden> wrote:
>
>
> I have a general work function for which I will use GNU Radio's history
>
> functionality. In the block's constructor, I call set_history( m ). I cast
> the input buffer in the standard way:
>
>   const float *in = (const float *) input_items[0];
>
> My question is wheere in[0] refers to in the buffer. It would make sense to
> me that noutput_items is the number of new items for the block to consume
> and ninput_items[0] refers to the total number of data in the buffer. So,
> in[noutput_items-1] is the last element of the array, in[0] is the start of
> the new items, and the in[-m] refers to the beginning of the history block.
> Thus, ninput_items[0] is greater than or equal to m + noutput_items.
>
> I don't know if this assumption is true and would be pleased if someone knew
> how this works. The GNU Radio API is somewhat vague in this respect. Thanks
> in advance!
>
>
> *************************************************
>
>
> From you description you should use sync block.
> Anyway, my knowledge on history is: (assuming 1:1 in-out ratio)
> in[0] to in[noutput_items+m-2] are what you can use to produce noutput_items
> outputs.
> in[0] is the oldest and in[noutput_items+m-2] is the newest sample.
> ninput_items[0]==noutput_items+m-1
>
> Any one can correct me?
> KZ

Kyle,

Yes, that's how the set_history works. Basically, when told you have
noutput_items, you know that you have noutput_items+(history()-1). The
default for set_history(m) is m=1, so that's where the -1 comes from.
It allows you to look beyond the number of items you've been given.

Tom



reply via email to

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