# Processing of large number of samples

**URL:** <https://www.ruby-forum.com/t/processing-of-large-number-of-samples/233904>\
**Category:** GNU Radio\
**Created:** [January 21, 2015, 10:53am UTC](https://www.ruby-forum.com/t/processing-of-large-number-of-samples/233904 "2015-01-21T10:53:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [January 21, 2015, 10:53am UTC](https://www.ruby-forum.com/t/processing-of-large-number-of-samples/233904/1 "2015-01-21T10:53:04Z")

</div>

Goodmorning,  
I have general questions about processing a fixed number of samples.

In front of the necessity to process N samples (N=8192 items) in a  
sinchronous block, I developed a mechanism like this:

* * *

if(noutput\_items\>N)  
{  
processing of N elements  
consume(N); return(N); //in this way I process the required N  
elements  
}  
else  
{consume(0); return(0);} // here I’m waiting until the input buffer  
reach  
the required number of elements

* * *

Probably is not the convenctional way to do this, but for now it works  
well.  
My questions are:

- Is there a convenctional way to do this?
- it seems that N cannot be larger than 8192, how can I enlarge the  
input  
buffer?

---

<div class="post-metadata">

**Author:** ![Simone\_Ciccia\_S2106](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Simone\_Ciccia\_S2106](https://www.ruby-forum.com/u/Simone_Ciccia_S2106)\
**Post date:** [January 21, 2015, 11:11am UTC](https://www.ruby-forum.com/t/processing-of-large-number-of-samples/233904/2 "2015-01-21T11:11:05Z")

</div>

Hello Simone,

> Is there a convenctional way to do this?  
> Yes, there is! Since in a sync block, the numbers of samples you consume  
> on you rinput and you produce on your output are identical,  
> you can use set\_output\_multiple(8192) [1].

If what you’re doing feels more like a operation on vectors of samples  
instead of an operation on a stream of samples, you could also use a  
input signature with an input and output item size of 8192 times the  
original item size, and use stream\_to\_vector[2]before and  
vector\_to\_stream to convert from streams to vectors. A typical example  
(and generally a very nice block) is the fft\_vcc[3] block, which  
encapsulates the FFT, which is a vector operation, mathematically.

Greetings,  
Marcus

[1]

> **[GNU Radio Manual and C++ API Reference: gr::block Class Reference](https://www.gnuradio.org/doc/doxygen/classgr_1_1block.html)**

[2]

> **[GNU Radio Manual and C++ API Reference: gr::blocks::stream\_to\_vector Class...](https://www.gnuradio.org/doc/doxygen/classgr_1_1blocks_1_1stream __to__ vector.html)**

[3] [http://gnuradio.org/doc/doxygen/classgr\_1\_1fft\_1\_1fft\_\_vcc.html](http://gnuradio.org/doc/doxygen/classgr_1_1fft_1_1fft__vcc.html)

---

<div class="post-metadata">

**Author:** ![Simone\_Ciccia\_S2106](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Simone\_Ciccia\_S2106](https://www.ruby-forum.com/u/Simone_Ciccia_S2106)\
**Post date:** [January 21, 2015, 11:21am UTC](https://www.ruby-forum.com/t/processing-of-large-number-of-samples/233904/3 "2015-01-21T11:21:32Z")

</div>

> ```
> - Is there a convenctional way to do this?
> 
> ```

There is a set\_min\_noutput items (and if you’re in a synchronous block  
or if you implement forecast, you can be sure that ninput\_items \>  
noutput\_items)

> ```
> - it seems that N cannot be larger than 8192, how can I enlarge the 
> 
> ```

input

> buffer?

Essentially you can’t … if you need fixed large size at your input,  
your only option is to have your own buffer internally.  
I know this sucks, I had the same issue several time.

Cheers,

Sylvain

---

<div class="post-metadata">

**Author:** ![Simone\_Ciccia\_S2106](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Simone\_Ciccia\_S2106](https://www.ruby-forum.com/u/Simone_Ciccia_S2106)\
**Post date:** [January 21, 2015, 12:20pm UTC](https://www.ruby-forum.com/t/processing-of-large-number-of-samples/233904/4 "2015-01-21T12:20:43Z")

</div>

Note that Sylvain’s answer is appropriate to guarantee input sizes of

> =8192, whilst my will lead to n\*8192, n natural.
