JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::FloatVectorOperations Class Reference

A collection of simple vector operations on arrays of floats, accelerated with SIMD instructions where possible. More...

#include <juce_FloatVectorOperations.h>

Collaboration diagram for juce::FloatVectorOperations:

Static Public Member Functions

static void abs (float *dest, const float *src, int numValues) noexcept
 Copies a source vector to a destination, taking the absolute of each value. More...
 
static void abs (double *dest, const double *src, int numValues) noexcept
 Copies a source vector to a destination, taking the absolute of each value. More...
 
static void add (float *dest, float amountToAdd, int numValues) noexcept
 Adds a fixed value to the destination values. More...
 
static void add (double *dest, double amountToAdd, int numValues) noexcept
 Adds a fixed value to the destination values. More...
 
static void add (float *dest, const float *src, float amount, int numValues) noexcept
 Adds a fixed value to each source value and stores it in the destination array. More...
 
static void add (double *dest, const double *src, double amount, int numValues) noexcept
 Adds a fixed value to each source value and stores it in the destination array. More...
 
static void add (float *dest, const float *src, int numValues) noexcept
 Adds the source values to the destination values. More...
 
static void add (double *dest, const double *src, int numValues) noexcept
 Adds the source values to the destination values. More...
 
static void add (float *dest, const float *src1, const float *src2, int num) noexcept
 Adds each source1 value to the corresponding source2 value and stores the result in the destination array. More...
 
static void add (double *dest, const double *src1, const double *src2, int num) noexcept
 Adds each source1 value to the corresponding source2 value and stores the result in the destination array. More...
 
static void addWithMultiply (float *dest, const float *src, float multiplier, int numValues) noexcept
 Multiplies each source value by the given multiplier, then adds it to the destination value. More...
 
static void addWithMultiply (double *dest, const double *src, double multiplier, int numValues) noexcept
 Multiplies each source value by the given multiplier, then adds it to the destination value. More...
 
static void addWithMultiply (float *dest, const float *src1, const float *src2, int num) noexcept
 Multiplies each source1 value by the corresponding source2 value, then adds it to the destination value. More...
 
static void addWithMultiply (double *dest, const double *src1, const double *src2, int num) noexcept
 Multiplies each source1 value by the corresponding source2 value, then adds it to the destination value. More...
 
static bool areDenormalsDisabled () noexcept
 This method returns true if denormals are currently disabled. More...
 
static void clear (float *dest, int numValues) noexcept
 Clears a vector of floats. More...
 
static void clear (double *dest, int numValues) noexcept
 Clears a vector of doubles. More...
 
static void clip (float *dest, const float *src, float low, float high, int num) noexcept
 Each element of dest is calculated by hard clipping the corresponding src element so that it is in the range specified by the arguments low and high. More...
 
static void clip (double *dest, const double *src, double low, double high, int num) noexcept
 Each element of dest is calculated by hard clipping the corresponding src element so that it is in the range specified by the arguments low and high. More...
 
static void convertFixedToFloat (float *dest, const int *src, float multiplier, int numValues) noexcept
 Converts a stream of integers to floats, multiplying each one by the given multiplier. More...
 
static void copy (float *dest, const float *src, int numValues) noexcept
 Copies a vector of floats. More...
 
static void copy (double *dest, const double *src, int numValues) noexcept
 Copies a vector of doubles. More...
 
static void copyWithMultiply (float *dest, const float *src, float multiplier, int numValues) noexcept
 Copies a vector of floats, multiplying each value by a given multiplier. More...
 
static void copyWithMultiply (double *dest, const double *src, double multiplier, int numValues) noexcept
 Copies a vector of doubles, multiplying each value by a given multiplier. More...
 
static void disableDenormalisedNumberSupport (bool shouldDisable=true) noexcept
 On Intel CPUs, this method enables the SSE flush-to-zero and denormalised-are-zero modes. More...
 
static void enableFlushToZeroMode (bool shouldEnable) noexcept
 This method enables or disables the SSE/NEON flush-to-zero mode. More...
 
static void fill (float *dest, float valueToFill, int numValues) noexcept
 Copies a repeated value into a vector of floats. More...
 
static void fill (double *dest, double valueToFill, int numValues) noexcept
 Copies a repeated value into a vector of doubles. More...
 
static float findMaximum (const float *src, int numValues) noexcept
 Finds the maximum value in the given array. More...
 
static double findMaximum (const double *src, int numValues) noexcept
 Finds the maximum value in the given array. More...
 
static Range< floatfindMinAndMax (const float *src, int numValues) noexcept
 Finds the minimum and maximum values in the given array. More...
 
static Range< double > findMinAndMax (const double *src, int numValues) noexcept
 Finds the minimum and maximum values in the given array. More...
 
static float findMinimum (const float *src, int numValues) noexcept
 Finds the minimum value in the given array. More...
 
static double findMinimum (const double *src, int numValues) noexcept
 Finds the minimum value in the given array. More...
 
static void max (float *dest, const float *src, float comp, int num) noexcept
 Each element of dest will be the maximum of the corresponding element of the source array and the given comp value. More...
 
static void max (double *dest, const double *src, double comp, int num) noexcept
 Each element of dest will be the maximum of the corresponding element of the source array and the given comp value. More...
 
static void max (float *dest, const float *src1, const float *src2, int num) noexcept
 Each element of dest will be the maximum of the corresponding source1 and source2 values. More...
 
static void max (double *dest, const double *src1, const double *src2, int num) noexcept
 Each element of dest will be the maximum of the corresponding source1 and source2 values. More...
 
static void min (float *dest, const float *src, float comp, int num) noexcept
 Each element of dest will be the minimum of the corresponding element of the source array and the given comp value. More...
 
static void min (double *dest, const double *src, double comp, int num) noexcept
 Each element of dest will be the minimum of the corresponding element of the source array and the given comp value. More...
 
static void min (float *dest, const float *src1, const float *src2, int num) noexcept
 Each element of dest will be the minimum of the corresponding source1 and source2 values. More...
 
static void min (double *dest, const double *src1, const double *src2, int num) noexcept
 Each element of dest will be the minimum of the corresponding source1 and source2 values. More...
 
static void multiply (float *dest, const float *src, int numValues) noexcept
 Multiplies the destination values by the source values. More...
 
static void multiply (double *dest, const double *src, int numValues) noexcept
 Multiplies the destination values by the source values. More...
 
static void multiply (float *dest, const float *src1, const float *src2, int numValues) noexcept
 Multiplies each source1 value by the correspinding source2 value, then stores it in the destination array. More...
 
static void multiply (double *dest, const double *src1, const double *src2, int numValues) noexcept
 Multiplies each source1 value by the correspinding source2 value, then stores it in the destination array. More...
 
static void multiply (float *dest, float multiplier, int numValues) noexcept
 Multiplies each of the destination values by a fixed multiplier. More...
 
static void multiply (double *dest, double multiplier, int numValues) noexcept
 Multiplies each of the destination values by a fixed multiplier. More...
 
static void multiply (float *dest, const float *src, float multiplier, int num) noexcept
 Multiplies each of the source values by a fixed multiplier and stores the result in the destination array. More...
 
static void multiply (double *dest, const double *src, double multiplier, int num) noexcept
 Multiplies each of the source values by a fixed multiplier and stores the result in the destination array. More...
 
static void negate (float *dest, const float *src, int numValues) noexcept
 Copies a source vector to a destination, negating each value. More...
 
static void negate (double *dest, const double *src, int numValues) noexcept
 Copies a source vector to a destination, negating each value. More...
 
static void subtract (float *dest, const float *src, int numValues) noexcept
 Subtracts the source values from the destination values. More...
 
static void subtract (double *dest, const double *src, int numValues) noexcept
 Subtracts the source values from the destination values. More...
 
static void subtract (float *dest, const float *src1, const float *src2, int num) noexcept
 Subtracts each source2 value from the corresponding source1 value and stores the result in the destination array. More...
 
static void subtract (double *dest, const double *src1, const double *src2, int num) noexcept
 Subtracts each source2 value from the corresponding source1 value and stores the result in the destination array. More...
 
static void subtractWithMultiply (float *dest, const float *src, float multiplier, int numValues) noexcept
 Multiplies each source value by the given multiplier, then subtracts it to the destination value. More...
 
static void subtractWithMultiply (double *dest, const double *src, double multiplier, int numValues) noexcept
 Multiplies each source value by the given multiplier, then subtracts it to the destination value. More...
 
static void subtractWithMultiply (float *dest, const float *src1, const float *src2, int num) noexcept
 Multiplies each source1 value by the corresponding source2 value, then subtracts it to the destination value. More...
 
static void subtractWithMultiply (double *dest, const double *src1, const double *src2, int num) noexcept
 Multiplies each source1 value by the corresponding source2 value, then subtracts it to the destination value. More...
 

Static Private Member Functions

static intptr_t getFpStatusRegister () noexcept
 
static void setFpStatusRegister (intptr_t) noexcept
 

Private Attributes

friend ScopedNoDenormals
 

Detailed Description

A collection of simple vector operations on arrays of floats, accelerated with SIMD instructions where possible.

{Audio}

Member Function Documentation

◆ abs() [1/2]

static void juce::FloatVectorOperations::abs ( float dest,
const float src,
int  numValues 
)
staticnoexcept

Copies a source vector to a destination, taking the absolute of each value.

Referenced by juce::dsp::AudioBlock< float >::replaceWithAbsoluteValueOf().

◆ abs() [2/2]

static void juce::FloatVectorOperations::abs ( double *  dest,
const double *  src,
int  numValues 
)
staticnoexcept

Copies a source vector to a destination, taking the absolute of each value.

◆ add() [1/8]

static void juce::FloatVectorOperations::add ( float dest,
float  amountToAdd,
int  numValues 
)
staticnoexcept

◆ add() [2/8]

static void juce::FloatVectorOperations::add ( double *  dest,
double  amountToAdd,
int  numValues 
)
staticnoexcept

Adds a fixed value to the destination values.

◆ add() [3/8]

static void juce::FloatVectorOperations::add ( float dest,
const float src,
float  amount,
int  numValues 
)
staticnoexcept

Adds a fixed value to each source value and stores it in the destination array.

◆ add() [4/8]

static void juce::FloatVectorOperations::add ( double *  dest,
const double *  src,
double  amount,
int  numValues 
)
staticnoexcept

Adds a fixed value to each source value and stores it in the destination array.

◆ add() [5/8]

static void juce::FloatVectorOperations::add ( float dest,
const float src,
int  numValues 
)
staticnoexcept

Adds the source values to the destination values.

◆ add() [6/8]

static void juce::FloatVectorOperations::add ( double *  dest,
const double *  src,
int  numValues 
)
staticnoexcept

Adds the source values to the destination values.

◆ add() [7/8]

static void juce::FloatVectorOperations::add ( float dest,
const float src1,
const float src2,
int  num 
)
staticnoexcept

Adds each source1 value to the corresponding source2 value and stores the result in the destination array.

◆ add() [8/8]

static void juce::FloatVectorOperations::add ( double *  dest,
const double *  src1,
const double *  src2,
int  num 
)
staticnoexcept

Adds each source1 value to the corresponding source2 value and stores the result in the destination array.

◆ addWithMultiply() [1/4]

static void juce::FloatVectorOperations::addWithMultiply ( float dest,
const float src,
float  multiplier,
int  numValues 
)
staticnoexcept

Multiplies each source value by the given multiplier, then adds it to the destination value.

Referenced by juce::AudioBuffer< float >::addFrom(), and juce::dsp::AudioBlock< float >::addWithMultiply().

◆ addWithMultiply() [2/4]

static void juce::FloatVectorOperations::addWithMultiply ( double *  dest,
const double *  src,
double  multiplier,
int  numValues 
)
staticnoexcept

Multiplies each source value by the given multiplier, then adds it to the destination value.

◆ addWithMultiply() [3/4]

static void juce::FloatVectorOperations::addWithMultiply ( float dest,
const float src1,
const float src2,
int  num 
)
staticnoexcept

Multiplies each source1 value by the corresponding source2 value, then adds it to the destination value.

◆ addWithMultiply() [4/4]

static void juce::FloatVectorOperations::addWithMultiply ( double *  dest,
const double *  src1,
const double *  src2,
int  num 
)
staticnoexcept

Multiplies each source1 value by the corresponding source2 value, then adds it to the destination value.

◆ areDenormalsDisabled()

static bool juce::FloatVectorOperations::areDenormalsDisabled ( )
staticnoexcept

This method returns true if denormals are currently disabled.

◆ clear() [1/2]

static void juce::FloatVectorOperations::clear ( float dest,
int  numValues 
)
staticnoexcept

◆ clear() [2/2]

static void juce::FloatVectorOperations::clear ( double *  dest,
int  numValues 
)
staticnoexcept

Clears a vector of doubles.

◆ clip() [1/2]

static void juce::FloatVectorOperations::clip ( float dest,
const float src,
float  low,
float  high,
int  num 
)
staticnoexcept

Each element of dest is calculated by hard clipping the corresponding src element so that it is in the range specified by the arguments low and high.

◆ clip() [2/2]

static void juce::FloatVectorOperations::clip ( double *  dest,
const double *  src,
double  low,
double  high,
int  num 
)
staticnoexcept

Each element of dest is calculated by hard clipping the corresponding src element so that it is in the range specified by the arguments low and high.

◆ convertFixedToFloat()

static void juce::FloatVectorOperations::convertFixedToFloat ( float dest,
const int src,
float  multiplier,
int  numValues 
)
staticnoexcept

Converts a stream of integers to floats, multiplying each one by the given multiplier.

◆ copy() [1/2]

◆ copy() [2/2]

static void juce::FloatVectorOperations::copy ( double *  dest,
const double *  src,
int  numValues 
)
staticnoexcept

Copies a vector of doubles.

◆ copyWithMultiply() [1/2]

static void juce::FloatVectorOperations::copyWithMultiply ( float dest,
const float src,
float  multiplier,
int  numValues 
)
staticnoexcept

Copies a vector of floats, multiplying each value by a given multiplier.

Referenced by juce::AudioBuffer< float >::addFrom(), and juce::AudioBuffer< float >::copyFrom().

◆ copyWithMultiply() [2/2]

static void juce::FloatVectorOperations::copyWithMultiply ( double *  dest,
const double *  src,
double  multiplier,
int  numValues 
)
staticnoexcept

Copies a vector of doubles, multiplying each value by a given multiplier.

◆ disableDenormalisedNumberSupport()

static void juce::FloatVectorOperations::disableDenormalisedNumberSupport ( bool  shouldDisable = true)
staticnoexcept

On Intel CPUs, this method enables the SSE flush-to-zero and denormalised-are-zero modes.

This effectively sets the DAZ and FZ bits of the MXCSR register. On arm CPUs this will enable flush to zero mode. It's a convenient thing to call before audio processing code where you really want to avoid denormalisation performance hits.

◆ enableFlushToZeroMode()

static void juce::FloatVectorOperations::enableFlushToZeroMode ( bool  shouldEnable)
staticnoexcept

This method enables or disables the SSE/NEON flush-to-zero mode.

◆ fill() [1/2]

static void juce::FloatVectorOperations::fill ( float dest,
float  valueToFill,
int  numValues 
)
staticnoexcept

Copies a repeated value into a vector of floats.

Referenced by juce::dsp::AudioBlock< float >::fill().

◆ fill() [2/2]

static void juce::FloatVectorOperations::fill ( double *  dest,
double  valueToFill,
int  numValues 
)
staticnoexcept

Copies a repeated value into a vector of doubles.

◆ findMaximum() [1/2]

static float juce::FloatVectorOperations::findMaximum ( const float src,
int  numValues 
)
staticnoexcept

Finds the maximum value in the given array.

◆ findMaximum() [2/2]

static double juce::FloatVectorOperations::findMaximum ( const double *  src,
int  numValues 
)
staticnoexcept

Finds the maximum value in the given array.

◆ findMinAndMax() [1/2]

static Range<float> juce::FloatVectorOperations::findMinAndMax ( const float src,
int  numValues 
)
staticnoexcept

Finds the minimum and maximum values in the given array.

Referenced by juce::dsp::AudioBlock< float >::findMinAndMax(), and juce::AudioBuffer< float >::findMinMax().

◆ findMinAndMax() [2/2]

static Range<double> juce::FloatVectorOperations::findMinAndMax ( const double *  src,
int  numValues 
)
staticnoexcept

Finds the minimum and maximum values in the given array.

◆ findMinimum() [1/2]

static float juce::FloatVectorOperations::findMinimum ( const float src,
int  numValues 
)
staticnoexcept

Finds the minimum value in the given array.

◆ findMinimum() [2/2]

static double juce::FloatVectorOperations::findMinimum ( const double *  src,
int  numValues 
)
staticnoexcept

Finds the minimum value in the given array.

◆ getFpStatusRegister()

static intptr_t juce::FloatVectorOperations::getFpStatusRegister ( )
staticprivatenoexcept

◆ max() [1/4]

static void juce::FloatVectorOperations::max ( float dest,
const float src,
float  comp,
int  num 
)
staticnoexcept

Each element of dest will be the maximum of the corresponding element of the source array and the given comp value.

Referenced by juce::dsp::AudioBlock< float >::max().

◆ max() [2/4]

static void juce::FloatVectorOperations::max ( double *  dest,
const double *  src,
double  comp,
int  num 
)
staticnoexcept

Each element of dest will be the maximum of the corresponding element of the source array and the given comp value.

◆ max() [3/4]

static void juce::FloatVectorOperations::max ( float dest,
const float src1,
const float src2,
int  num 
)
staticnoexcept

Each element of dest will be the maximum of the corresponding source1 and source2 values.

◆ max() [4/4]

static void juce::FloatVectorOperations::max ( double *  dest,
const double *  src1,
const double *  src2,
int  num 
)
staticnoexcept

Each element of dest will be the maximum of the corresponding source1 and source2 values.

◆ min() [1/4]

static void juce::FloatVectorOperations::min ( float dest,
const float src,
float  comp,
int  num 
)
staticnoexcept

Each element of dest will be the minimum of the corresponding element of the source array and the given comp value.

Referenced by juce::dsp::AudioBlock< float >::min().

◆ min() [2/4]

static void juce::FloatVectorOperations::min ( double *  dest,
const double *  src,
double  comp,
int  num 
)
staticnoexcept

Each element of dest will be the minimum of the corresponding element of the source array and the given comp value.

◆ min() [3/4]

static void juce::FloatVectorOperations::min ( float dest,
const float src1,
const float src2,
int  num 
)
staticnoexcept

Each element of dest will be the minimum of the corresponding source1 and source2 values.

◆ min() [4/4]

static void juce::FloatVectorOperations::min ( double *  dest,
const double *  src1,
const double *  src2,
int  num 
)
staticnoexcept

Each element of dest will be the minimum of the corresponding source1 and source2 values.

◆ multiply() [1/8]

static void juce::FloatVectorOperations::multiply ( float dest,
const float src,
int  numValues 
)
staticnoexcept

◆ multiply() [2/8]

static void juce::FloatVectorOperations::multiply ( double *  dest,
const double *  src,
int  numValues 
)
staticnoexcept

Multiplies the destination values by the source values.

◆ multiply() [3/8]

static void juce::FloatVectorOperations::multiply ( float dest,
const float src1,
const float src2,
int  numValues 
)
staticnoexcept

Multiplies each source1 value by the correspinding source2 value, then stores it in the destination array.

◆ multiply() [4/8]

static void juce::FloatVectorOperations::multiply ( double *  dest,
const double *  src1,
const double *  src2,
int  numValues 
)
staticnoexcept

Multiplies each source1 value by the correspinding source2 value, then stores it in the destination array.

◆ multiply() [5/8]

static void juce::FloatVectorOperations::multiply ( float dest,
float  multiplier,
int  numValues 
)
staticnoexcept

Multiplies each of the destination values by a fixed multiplier.

◆ multiply() [6/8]

static void juce::FloatVectorOperations::multiply ( double *  dest,
double  multiplier,
int  numValues 
)
staticnoexcept

Multiplies each of the destination values by a fixed multiplier.

◆ multiply() [7/8]

static void juce::FloatVectorOperations::multiply ( float dest,
const float src,
float  multiplier,
int  num 
)
staticnoexcept

Multiplies each of the source values by a fixed multiplier and stores the result in the destination array.

◆ multiply() [8/8]

static void juce::FloatVectorOperations::multiply ( double *  dest,
const double *  src,
double  multiplier,
int  num 
)
staticnoexcept

Multiplies each of the source values by a fixed multiplier and stores the result in the destination array.

◆ negate() [1/2]

static void juce::FloatVectorOperations::negate ( float dest,
const float src,
int  numValues 
)
staticnoexcept

Copies a source vector to a destination, negating each value.

Referenced by juce::dsp::AudioBlock< float >::replaceWithNegativeOf().

◆ negate() [2/2]

static void juce::FloatVectorOperations::negate ( double *  dest,
const double *  src,
int  numValues 
)
staticnoexcept

Copies a source vector to a destination, negating each value.

◆ setFpStatusRegister()

static void juce::FloatVectorOperations::setFpStatusRegister ( intptr_t  )
staticprivatenoexcept

◆ subtract() [1/4]

static void juce::FloatVectorOperations::subtract ( float dest,
const float src,
int  numValues 
)
staticnoexcept

Subtracts the source values from the destination values.

Referenced by juce::dsp::AudioBlock< float >::subtract().

◆ subtract() [2/4]

static void juce::FloatVectorOperations::subtract ( double *  dest,
const double *  src,
int  numValues 
)
staticnoexcept

Subtracts the source values from the destination values.

◆ subtract() [3/4]

static void juce::FloatVectorOperations::subtract ( float dest,
const float src1,
const float src2,
int  num 
)
staticnoexcept

Subtracts each source2 value from the corresponding source1 value and stores the result in the destination array.

◆ subtract() [4/4]

static void juce::FloatVectorOperations::subtract ( double *  dest,
const double *  src1,
const double *  src2,
int  num 
)
staticnoexcept

Subtracts each source2 value from the corresponding source1 value and stores the result in the destination array.

◆ subtractWithMultiply() [1/4]

static void juce::FloatVectorOperations::subtractWithMultiply ( float dest,
const float src,
float  multiplier,
int  numValues 
)
staticnoexcept

Multiplies each source value by the given multiplier, then subtracts it to the destination value.

◆ subtractWithMultiply() [2/4]

static void juce::FloatVectorOperations::subtractWithMultiply ( double *  dest,
const double *  src,
double  multiplier,
int  numValues 
)
staticnoexcept

Multiplies each source value by the given multiplier, then subtracts it to the destination value.

◆ subtractWithMultiply() [3/4]

static void juce::FloatVectorOperations::subtractWithMultiply ( float dest,
const float src1,
const float src2,
int  num 
)
staticnoexcept

Multiplies each source1 value by the corresponding source2 value, then subtracts it to the destination value.

◆ subtractWithMultiply() [4/4]

static void juce::FloatVectorOperations::subtractWithMultiply ( double *  dest,
const double *  src1,
const double *  src2,
int  num 
)
staticnoexcept

Multiplies each source1 value by the corresponding source2 value, then subtracts it to the destination value.

Member Data Documentation

◆ ScopedNoDenormals

friend juce::FloatVectorOperations::ScopedNoDenormals
private

The documentation for this class was generated from the following file: