[Top][All Lists]

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

Re: [Discuss-gnuradio] Clipping Complex Samples to +/- 1.0?

From: Michael Dickens
Subject: Re: [Discuss-gnuradio] Clipping Complex Samples to +/- 1.0?
Date: Tue, 07 Apr 2015 09:10:27 -0400

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 < 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

On Mon, Apr 6, 2015, at 08:25 PM, John Malsbury wrote:
> 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?

reply via email to

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