CUGL 2.1
Cornell University Game Library
|
#include <CUDSPMath.h>
Static Public Member Functions | |
static size_t | add (float *input1, float *input2, float *output, size_t size) |
static size_t | multiply (float *input1, float *input2, float *output, size_t size) |
static size_t | scale (float *input, float scalar, float *output, size_t size) |
static size_t | scale_add (float *input1, float *input2, float scalar, float *output, size_t size) |
static size_t | slide (float *input, float start, float end, float *output, size_t size) |
static size_t | slide_add (float *input1, float *input2, float start, float end, float *output, size_t size) |
static size_t | clamp (float *data, float min, float max, size_t size) |
static size_t | ease (float *data, float bound, float knee, size_t size) |
Static Public Attributes | |
static bool | VECTORIZE |
This class is a collection of static methods for basic DSP calculations
As with the DSP filters, this class supports vector optimizations for SSE and Neon 64. Our implementation is limited to 128-bit words. While 256-bit (e.g. AVX) are more performant, they are not better for DSP filters and so we keep the optimizations at the same level.
This class is not thread safe. External locking may be required when the filter is shared between multiple threads (such as between an audio thread and the main thread).
|
static |
Adds two input signals together, storing the result in output
It is safe for output to be the same as one of the two input buffers.
input1 | The first input buffer |
input2 | The second input buffer |
output | The output buffer |
size | The number of elements to add |
|
static |
Hard clamps the data stream to the range [min,max]
data | The stream buffer |
min | The minimum allowed value |
max | The maximum allowed value |
size | The number of elements to clamp |
|
static |
Soft clamps the data stream to the range [-bound,bound]
The clamp is a soft knee. Values in the range [-knee, knee] are not affected. Values outside this range are asymptotically clamped to the range [-bound,bound] with the formula
y = (bound*x - knee+knee*knee)/x
data | The stream buffer |
bound | The asymptotic bound |
knee | The soft knee bound |
size | The number of elements to clamp |
|
static |
Multiplies two input signals together, storing the result in output
It is safe for output to be the same as one of the two input buffers.
input1 | The first input buffer |
input2 | The second input buffer |
output | The output buffer |
size | The number of elements to multiply |
|
static |
Scales an input signal, storing the result in output
It is safe for output to be the same as the input buffer.
input | The input buffer |
scalar | The scalar to mutliply by |
output | The output buffer |
size | The number of elements to multiply |
|
static |
Scales an input signal and adds it to another, storing the result in output
It is safe for output to be the same as one of the two input buffers.
input1 | The first input buffer |
input2 | The second input buffer |
scalar | The scalar to mutliply input1 by |
output | The output buffer |
size | The number of elements to process |
|
static |
Scales an input signal, storing the result in output
The scalar is a sliding factor linearly interpolated between start to end. It will use start for the first element of input and end for the size element.
It is safe for output to be the same as the input buffer.
input | The input buffer |
start | The initial scalar value |
end | The final scalar value |
output | The output buffer |
size | The number of elements to multiply |
|
static |
Scales an input signal and adds it to another, storing the result in output
The scalar is a sliding factor linearly interpolated between start to end. It will use start for the first element of input1 and end for the size element.
It is safe for output to be the same as one of the two input buffers.
input1 | The first input buffer |
input2 | The second input buffer |
start | The initial scalar value |
end | The final scalar value |
output | The output buffer |
size | The number of elements to process |
|
static |
Whether to use a vectorization algorithm (Access not thread safe)