Clipping Complex Samples to +/- 1.0?

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

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

-John

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

{{{
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 < http://libvolk.org/doxygen/volk_32f_x2_max_32f.html > & <
http://libvolk.org/doxygen/volk_32f_x2_min_32f.html >, 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs