On Fri, Mar 16, 2012 at 8:41 AM, Zhonghua
<address@hidden>
wrote:
Hi all,
After a period of using gnu radio, I have a problem of how to
understand the stream. I got an information from a literature
says: 'From the high level point-of-view, infinite streams of
data flow through the ports. At the C++ level,streams are
dealt with in convenient sized pieces, represented as
contiguous arrays of the underlying type.' In almost each
signal processing block we can see the definition of
'general_work' has this format:
general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star
&input_items,
gr_vector_void_star &output_items)
Some literatures say the 'noutput_items' variable represents
the items number of one piece of the stream. So the first
question is what on earth the size of this variable? where
dose it be specified? For example if A block connects to B
block, how can ensure the 'noutput_items' of A block equal to
the 'ninput_items' (presume B block only has one input
stream).
In an concrete instance, in gr_squelch_base_cc.cc, we can see
the last program as:
if (d_state != ST_MUTED)
out[j++] = in[i]*gr_complex(d_envelope, 0.0);
else
if (!d_gate)
out[j++] = 0.0;
If we set d_gate as False(Actually in case of high sample rate
it has to be set as False), when the input power is lower than
the threshold(means the d_state should be as ST_MUTED), the
out[j] shall get nothing. That means at this point there is no
output data. So how the sequential block recognise this point?
For instance the sequential block is ieee802_15_4_demod, how
could it know where is this lost point? If only one point lost
from the squelch block, is that means the whole piece of
stream and even the whole package could not be demodulated
correctly?
We can set the instance in more precise condition. If there
are two pieces of stream: stream A and stream B. Assume each
noutput_items is 10, that is to say we have A[0], A[1] ....to
A[9] and B[0] to B[9]. If A[0] has lost, then the stream
entering into the sequential demodulation block is
A[0](lost),A[1]....A[9]? Or is A[1],A[2]....B[0]?
If A[0] is valid, A[1] has lost, dose that mean the first
piece of stream would not be demodulated correctly? If one
package need both these two pieces of stream, dose it mean
this package would not be demodulated correctly?
Any answer is greatly appreciated.
Sincerely,
Zhonghua
Zhonghua,
This is a really complicated question to answer without
giving you a full essay. All of this happens in the scheduler,
so if you want to know more, study the code for the
thread-per-block scheduler in gnuradio-core/src/lib/runtime.
It's the gr_block_executor that looks at the read/write
pointers to each blocks buffer and determines how many samples
are available to be read and how many samples a block can
write.
Tom