Clipping Complex Samples to +/- 1.0?

This may be more of a general C++ question than a GNU Radio question…
there any super convenient and fast way to clip a complex signal to +/-
on both I & Q?

Something other than splitting them up into floats and using
branchless_clip or if statements?


Hi John - There aren’t a lot of choices to do clipping; this is

float* in = (float*) INPUT;
float* out = (float*) OUTPUT;
for(int nn=0; nn<NUMBER; ++nn) {
*out++ = std::max(std::min(*in++, 1.0),-1.0);

You could use Volk’s “volk_32f_x2_max_32f” and “volk_32f_x2_min_32f”
kernel < Vector Optimized Library of Kernels: $title > & <
Vector Optimized Library of Kernels: $title >, which would
auto-magically handle the whole loop for you.

Maybe someone else can come up with a good reference for a branchless
version of this? Hope this helps! - MLD