discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Threading in OOT Blocks


From: Ron Economos
Subject: Re: [Discuss-gnuradio] Threading in OOT Blocks
Date: Fri, 21 Dec 2018 12:44:31 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

The output buffer isn't guaranteed to be all zeros. You have to explicitly write the zeros.

Ron

On 12/21/18 11:17, Kevin Lee wrote:
Hello, 

I am learning to create OOT blocks for GNURadio, and have encountered a small roadblock. I am trying to develop an upsampling module from an interpolator block type that simply adds 0s between each sample of the input. The loop I use to add the 0s is given as follows, from my work function:

for (int i = 0; i < arr_len; i++)
{
    out[i*upsample_factor+offset] = in[i];
}

Checking the resulting output, however, shows that after the first few samples, the module fails and what it looks like is that there are two threads writing to the same resource, as there is an overlap between two sets of values separated by "upsample_factor" 0s.

For instance, for an upsampling factor of 5:
(..., 1, 0, 0, 5, 0, 2, 0, 0, 6, 0, 3, 0, 0, 7, 0, 4, 0, ...)

Where it should be:
(..., 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, ...)

The same exact issue occurs in a similar Python implementation. However, it appears to be successful if you first create a new empty array, insert the values, and then copy that array into the out[]. Though for speed, I need this to be written efficiently in C++...

Would someone be able to offer any insight into this issue?

Thank you,

Kevin


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

reply via email to

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