discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] A question about Set_history()


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] A question about Set_history()
Date: Tue, 22 Dec 2009 03:46:41 -0800
User-agent: Mutt/1.5.20 (2009-08-17)

On Tue, Dec 22, 2009 at 12:22:29PM +0800, zhi yan wrote:
> Hi All,
> 
> I am confused of the Set_history() which is a function of gr_block, what is
> the function of this function? thanks~~
> 

It exists so that you can implement an "inline delay line", or similar
functionality.  The primary user of set_history are the FIR filters,
but there is other code that uses it.  The default value of history is
1, which is admittedly confusing, but is how it was historically
defined.

To give a concrete example, if you subclass gr_sync_block (which is
1:1 from input to output) and don't call set_history in the
constructor,  when your work function is called with a value of
noutput_items = N, there are guarenteed to be N valid samples in the
input vector, indexed from 0 to N-1.

If in the constructor you call set_history(2), when work is called
with a value of noputout_items = N, there are guarenteed to be N + 1
valid samples in the input vector, indexed from 0 to N.

If in the constructor you call set_history(H), when work is called
with a value of noputout_items = N, there are guarenteed to be 
N + H - 1 valid samples in the input vector, indexed from 0 to N + H - 2.

The other subclasses of gr_block work similarly.  Take a look at their
forecast routines for the details.

On the first call to work, the first H - 1 samples will be zero.

Eric




reply via email to

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