How to define a minimum number of input samples for a block

Hi,

I’m developing a block that need a minimum number of input samples to
process, for example, the block must have at least 1000 samples.

In the work() function may I compare if the ninput_items[] is greater
than
1000 and if not I return zero?
Should I need to create an internal buffer (history) to cumulate samples
if
the number of samples provided was less that 1000, and the work() will
return 0?
There is any other way to configure the block to work with a minimum
number
of samples?

Thank you.

Daniel

Hi Martin,

Thank you, I will try.
My block is asymmetric, for n input samples it will have always 4 output
samples.
So I thinking that if I configure the previous block as you suggested,
it
will work, right?

Regards,
Daniel

http://gnuradio.org/doc/doxygen/classgr_1_1block.html#a65cfc579150dc4d10c6180d3365aa9a8

M

On 01.04.2015 11:19, Daniel Mazzer wrote:

Hi Martin,

Thank you, I will try.
My block is asymmetric, for n input samples it will have always 4 output
samples.
So I thinking that if I configure the previous block as you suggested,
it will work, right?

In that case, you want something else:

Make your block an ‘sync_interpolator’ with an interpolation rate of 4.
Then, in your work() function, you only get noutput_items, and the
number of input items is implicitly noutput_items/4.

M

Hi Martin,

Ok, it really makes sense.
I will modify my block and try that way.

Thank you.

Regards,
Daniel.