discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Threading in OOT Blocks


From: Kevin Lee
Subject: [Discuss-gnuradio] Threading in OOT Blocks
Date: Fri, 21 Dec 2018 14:17:30 -0500

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


reply via email to

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