[Top][All Lists]

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

Re: [Discuss-gnuradio] Try to understand the stream in Gnu Radio

From: Zhonghua
Subject: Re: [Discuss-gnuradio] Try to understand the stream in Gnu Radio
Date: Fri, 16 Mar 2012 20:28:54 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20120216 Thunderbird/3.1.19

On 03/16/2012 06:37 PM, Tom Rondeau wrote:
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);
      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.




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.


Hi Tom,

Thank you for your information. I think you have answered the first question that where and how dose the size be determined. To the detailed question, do you think if one item lost, all this package will lose? And in my last instance, do you think which assemblage will be sent to the sequential block? Thank you again!


reply via email to

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