#include <os/OsStatus.h>
#include <os/OsIntTypes.h>
#include <math.h>
#include <mp/MpDspUtilsConvertVect.h>
#include <mp/MpDspUtilsIntSqrt.h>
#include <mp/MpDspUtilsSum.h>
#include <mp/MpDspUtilsSumVect.h>
#include <mp/MpDspUtilsShift.h>
#include <mp/MpDspUtilsSerials.h>
Go to the source code of this file.
|
#define | MP_FIXED_POINT |
| Switch between fixed and floating point math. More...
|
|
#define | MP_DSP_INLINE_VECTOR_FUNCTIONS |
| Switch between inlining and non-inlining of vector operations. More...
|
|
#define | MP_DSP_VECTOR_API inline |
|
#define | MPF_SIGN_BIT16 (1<<15) |
|
#define | MPF_SIGN_BIT32 (1<<31) |
|
#define | MPF_FLOAT(num, intLength, fracLength) (floor((num)*(float)(1<<(fracLength)))) |
|
#define | MPF_STEP(intLength, fracLength) MPF_FLOAT(1.0/(1<<(fracLength)), (intLength), (fracLength)) |
|
#define | MPF_MAX(intLength, fracLength) MPF_FLOAT((1<<(intLength))-1.0/(1<<(fracLength)), (intLength), (fracLength)) |
|
#define | MPF_SATURATE(val, maxval) ((val)>=(maxval) ? (maxval) : (val)<-(maxval) ? -(maxval) : (val)) |
| Saturate val to [-maxval;maxval] range. More...
|
|
#define | MPF_SATURATE16(val) MPF_SATURATE(val, INT16_MAX) |
| Saturate val to fit 16-bit signed integer. More...
|
|
#define | MPF_SATURATE32(val) MPF_SATURATE(val, INT32_MAX) |
| Saturate val to fit 32-bit signed integer. This does not touch type of the data. More...
|
|
#define | MPF_EXTRACRT16(val) ((int16_t)(val)) |
| Return 16 bit integer. More...
|
|
Switch between fixed and floating point math.
#define MP_DSP_INLINE_VECTOR_FUNCTIONS |
Switch between inlining and non-inlining of vector operations.
#define MP_DSP_VECTOR_API inline |
#define MPF_SIGN_BIT16 (1<<15) |
#define MPF_SIGN_BIT32 (1<<31) |
#define MPF_FLOAT |
( |
|
num, |
|
|
|
intLength, |
|
|
|
fracLength |
|
) |
| (floor((num)*(float)(1<<(fracLength)))) |
#define MPF_STEP |
( |
|
intLength, |
|
|
|
fracLength |
|
) |
| MPF_FLOAT(1.0/(1<<(fracLength)), (intLength), (fracLength)) |
#define MPF_MAX |
( |
|
intLength, |
|
|
|
fracLength |
|
) |
| MPF_FLOAT((1<<(intLength))-1.0/(1<<(fracLength)), (intLength), (fracLength)) |
#define MPF_SATURATE |
( |
|
val, |
|
|
|
maxval |
|
) |
| ((val)>=(maxval) ? (maxval) : (val)<-(maxval) ? -(maxval) : (val)) |
Saturate val
to [-maxval;maxval] range.
- Note
- This does not touch type of the data.
-
DSPs are usually saturate to [-maxval-1;maxval] range, but this will lead to problems when negating negative saturated value. That is -(-maxval-1) may wrap to 0. So, we saturate to [-maxval;maxval] range.
Saturate val
to fit 32-bit signed integer. This does not touch type of the data.
- See also
- MPF_SATURATE()
#define MPF_EXTRACRT16 |
( |
|
val | ) |
((int16_t)(val)) |
Return 16 bit integer.
In debug mode this will be used to check values. So, use it when appropriate.