|Subject:||Re: [Discuss-gnuradio] zero ninput_items_required|
|Date:||Fri, 18 Oct 2013 15:19:19 +0200|
On Fri, Oct 18, 2013 at 02:32:48PM +0200, Nemanja Savic wrote:If d_sym_rate and d_sampling_freq are integers, integer division will
> The body of my forecast function is:
> ninput_items_required = noutput_items * d_sym_rate / d_sampling_freq;
> printf("ninput_items_required %d, noutput_items %d\n", ninput_items_required
> , noutput_items);
cause ninput_items_required to be zero for small values of
Depending on the state of the buffers, the scheduler calls forecast()
> when i run execution, the output is following:
> ninput_items_required 8, noutput_items 4096
> ninput_items_required 4, noutput_items 2048
> ninput_items_required 2, noutput_items 1024
> ninput_items_required 1, noutput_items 512
> ninput_items_required 0, noutput_items 256
> ninput: 0, produced: 0
> The last line of the output comes from general_work function and prints number
> of input items and number of produced output samples.
> Can somebody explain me why forecast is called 5 times, till number of input
> items reach 0, and after that nothing is possible in work function, cause it
> won't enter the loop since ninput_items = 0;
until it finds a value of ninput_items_required that works (it tries to
process as much as possible). In your case, there is probably some
situation where the input buffer is not full.
The way you've set up forecast(), the scheduler will eventually find out
that it doesn't need any items to produce at least 256 output items. So
it calls work() with no input data, expecting 256 output items.
But since you can't produce anything without input, nothing happens.
It seems like what you want is a sync_decimator, got a gr::block. This
means you set relative_rate in the ctor and don't need to handle all of this
yourself. Make sure you don't set relative_rate to zero, again!
In a sync_decimator, you won't need forecast() at all and your work
function is much simpler. The scheduler will also never try to call a
sycn_decimator w/o input.
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)
Dipl.-Ing. Martin Braun
Phone: +49 721 608-43790
Fax: +49 721 608-46071
KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
Discuss-gnuradio mailing list
|[Prev in Thread]||Current Thread||[Next in Thread]|