On Mon, Aug 28, 2023 at 1:08 PM Jeff Long <willco...@gmail.com> wrote:

> See fir_filter_blok.impl.cc for an example ...
>
> forecast() does not include history. For a sync, interp or decim block,
> forecast is not required at all.
>

Sorry I can't find the code you pointed out.

I saw this:
https://github.com/n-west/gnuradio-volk/blob/master/gnuradio-runtime/python/gnuradio/gr/gateway.py

I don't know what block is but it seems that default forecast
implementation does include history.


> history() should be the number of previous items required, without the
> (-1).
>


If history=1 (default) there are no items prepended. So the number of
prepended items should be history-1

This post

https://lists.gnu.org/archive/html/discuss-gnuradio/2011-02/msg00480.html

seems to state the same thing:

"If you set the history to 'N', this means you always have the last (N-1) input
values kept in your buffer."

Am I wrong?

Thanks,
Marco





>
> On Mon, Aug 28, 2023 at 5:08 AM Marco Menchise <marco.mench...@gmail.com>
> wrote:
>
>> Hi, I'm a gnuradio newbie.
>>
>> I'm trying to write a block that calculates output at time k based on
>> three input samples: one at time k-N-1 (in the past), one at time k (the
>> current sample) and one at k+M (in the future).
>>
>> I spent some hours struggling against "history" and forecast function.
>>
>> Here:
>> https://lists.gnu.org/archive/html/discuss-gnuradio/2016-04/msg00520.html
>> I found a good visualization of  the history concept. As I said, I also
>> need to process "future" samples so I also investigated the "forecast"
>> function.
>>
>> Here is what I understood:
>>
>> 1) history=N tells the scheduler to prepend N-1 "old" samples to the
>> input_items buffer. The oldest prepended sample has relative index = 0, so
>> the "current" buffer starts at index N-1.
>>
>> 2) The forecast function must return N-1 + noutput_items+ M, where M is
>> the number of samples required in the future. Forecast *must* take into
>> account history. Each general_work call is guaranteed to have *at least*
>> N-1 + noutput_items+ M samples in input_items buffer.
>>
>> 3) I did some tests and noticed that the scheduler may pass to
>> general_work *more* than N-1+noutput_items+M samples. Extra samples should
>> be ignored by general_work. They will be passed again in the next call.
>>
>> 4) general_work must "consume" just noutput_items samples
>>
>> I tried to collect all those concepts in the attached figure where I used
>> both absolute and relative indexes to mark samples. I assumed history=4 and
>> M=2. The input_items in the first general_work call has at least 9 samples.
>> I must process input samples from 103 to 106 (included) using samples from
>> 100 to 108 (included) and I must generate 4 output_samples. In the next
>> call I must process samples from 107 to 110 (included) and, again, I must
>> generate 4 output samples. I must ignore "extra" samples in both cases.
>>
>> Is that correct? I'm I missing something?
>>
>> Thanks,
>> Marco
>>
>>
>>
>>
>>
>> [image: gnuradio.drawio (1).png]
>>
>

Reply via email to