LIBML
Version 3.2.4
LIBML DSP Software Library
|
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
#include "cosine_values.h"
#include "tpt_math_f16.h"
#include "tpt_math_fast.h"
#include "tpt_math_vector.h"
#include "tpt_math_support.h"
#include "tpt_math_complex.h"
#include "tpt_math_matrix.h"
#include "tpt_math_transform.h"
#include "tpt_math_filter.h"
#include "tpt_math_controller.h"
#include "tpt_math_statistics.h"
#include "tpt_math_svm.h"
#include "tpt_math_distance.h"
#include "tpt_internals.h"
#include "tpt_math_config.h"
Data Structures | |
struct | tpt_linear_interpolate_f32_s |
Instance structure for the floating-point Linear Interpolate function. More... | |
struct | tpt_bilinear_interpolate_f32_s |
Instance structure for the floating-point bilinear interpolation function. More... | |
struct | tpt_bilinear_interpolate_q7_s |
Instance structure for the Q7 bilinear interpolation function. More... | |
struct | tpt_bilinear_interpolate_q15_s |
Instance structure for the Q15 bilinear interpolation function. More... | |
struct | tpt_bilinear_interpolate_q31_s |
Instance structure for the Q31 bilinear interpolation function. More... | |
Macros | |
#define | __FORCEINLINE __attribute__((always_inline)) inline |
#define | LIKELY(EXPR) (EXPR) |
#define | UNLIKELY(EXPR) (EXPR) |
#define | SWAP(x, y, T) |
#define | SQUARE(val) val * val |
#define | OPT_BRANCH_PREDICTION 1 |
#define | OPT_HIGHLY_ACCURATE 0 |
#define | TPT_MATH_LOOPUNROLL 8 |
#define | Q63_MAX (q63_t)0x7FFFFFFFFFFFFFFFLL |
#define | Q63_MIN (q63_t)0x8000000000000000LL |
#define | Q31_MAX (q31_t)0x7FFFFFFF |
#define | Q31_MIN (q31_t)0x80000000 |
#define | Q15_MAX (q15_t)0x7FFF |
#define | Q15_MIN (q15_t)0x8000 |
#define | Q7_MAX (q7_t)0x7F |
#define | Q7_MIN (q7_t)0x80 |
#define | ABS(val, bit) (val > 0) ? val : ((val == Q##bit##_MIN) ? Q##bit##_MAX : -val) |
#define | CLIP(val, bit) ((val) > UINT##bit##_MAX) ? UINT##bit##_MAX : ((val) < 0 ? 0U : (val)) |
#define | CLIPS(val, bit) |
#define | SCALE_COL_T(T, A, ROW, v, i, aRows, aCols) |
#define | SCALE_COL_F32(A, ROW, v, i, aRows, aCols) SCALE_COL_T(f32_t, A, ROW, v, i, aRows, aCols) |
#define | SCALE_COL_F64(A, ROW, v, i, aRows, aCols) SCALE_COL_T(f64_t, A, ROW, v, i, aRows, aCols) |
#define | F32_TO_Q7(val) (q7_t)((fminf(fmaxf(val, -1.0f), 1.0f)) * (1LL << 7)) |
Convert F32 to Q7 format This will use saturating arithmetic. More... | |
#define | F32_TO_Q15(val) (q15_t)((fminf(fmaxf(val, -1.0f), 1.0f)) * (1LL << 15)) |
Convert F32 to Q15 format This will use saturating arithmetic. More... | |
#define | F32_TO_Q31(val) (q31_t)((fminf(fmaxf(val, -1.0f), 1.0f)) * (1LL << 31)) |
Convert F32 to Q31 format This will use saturating arithmetic. More... | |
#define | Q7_TO_F32(val) ((val) * 7.81250000e-03F) |
Convert Q7 to F32 format. More... | |
#define | Q15_TO_F32(val) ((val) * 3.05175781e-05F) |
Convert Q15 to F32 format. More... | |
#define | Q31_TO_F32(val) ((val) * 4.65661287e-10F) |
Convert Q31 to F32 format. More... | |
#define | F64_TO_Q7(val) (q7_t)((fmin(fmax(val, -1.0f), 1.0)) * (1LL << 7)) |
Convert F64 to Q7 format This will use saturating arithmetic. More... | |
#define | F64_TO_Q15(val) (q15_t)((fmin(fmax(val, -1.0f), 1.0)) * (1LL << 15)) |
Convert F64 to Q15 format This will use saturating arithmetic. More... | |
#define | F64_TO_Q31(val) (q31_t)((fmin(fmax(val, -1.0), 1.0)) * (1LL << 31)) |
Convert F64 to Q31 format This will use saturating arithmetic. More... | |
#define | Q7_TO_F64(val) ((val) * 7.812500000000000000e-03) |
Convert Q7 to F64 format. More... | |
#define | Q15_TO_F64(val) ((val) * 3.051757812500000000e-05) |
Convert Q15 to F64 format. More... | |
#define | Q31_TO_F64(val) ((val) * 4.656612873077392578e-10) |
Convert Q31 to F64 format. More... | |
Typedefs | |
typedef long double | f128_t |
128-bit floating-point type definition. More... | |
typedef double | f64_t |
64-bit floating-point type definition. More... | |
typedef float | f32_t |
32-bit floating-point type definition. More... | |
typedef int64_t | q63_t |
64-bit fractional data type in 1.63 format. More... | |
typedef int32_t | q31_t |
32-bit fractional data type in 1.31 format. More... | |
typedef int16_t | q15_t |
16-bit fractional data type in 1.15 format. More... | |
typedef int8_t | q7_t |
8-bit fractional data type in 1.7 format. More... | |
typedef int16_t | q1_14_t |
16-bit fractional data type in 2.14 format. More... | |
typedef int16_t | q2_13_t |
16-bit fractional data type in 3.13 format. More... | |
typedef int16_t | q3_12_t |
16-bit fractional data type in 4.12 format. More... | |
typedef int16_t | q4_11_t |
16-bit fractional data type in 5.11 format. More... | |
typedef int16_t | q5_10_t |
16-bit fractional data type in 6.10 format. More... | |
typedef int16_t | q6_9_t |
16-bit fractional data type in 7.9 format. More... | |
typedef int32_t | q1_30_t |
32-bit fractional data type in 2.30 format. More... | |
typedef int32_t | q2_29_t |
32-bit fractional data type in 3.29 format. More... | |
typedef int32_t | q3_28_t |
32-bit fractional data type in 4.28 format. More... | |
typedef int32_t | q4_27_t |
32-bit fractional data type in 5.27 format. More... | |
typedef int32_t | q5_26_t |
32-bit fractional data type in 6.26 format. More... | |
typedef int32_t | q6_25_t |
32-bit fractional data type in 7.25 format. More... | |
typedef int32_t | q7_24_t |
32-bit fractional data type in 8.24 format. More... | |
typedef int32_t | q17_14_t |
32-bit fractional data type in 18.14 format. More... | |
typedef int64_t | q1_62_t |
64-bit fractional data type in 2.62 format. More... | |
typedef int64_t | q15_48_t |
64-bit fractional data type in 16.48 format. More... | |
typedef int64_t | q33_30_t |
64-bit fractional data type in 34.30 format. More... | |
typedef enum tpt_status_e | tpt_status |
Error status returned by some functions in the library. More... | |
typedef struct tpt_linear_interpolate_f32_s | tpt_linear_interpolate_f32_t |
Instance structure for the floating-point Linear Interpolate function. More... | |
typedef struct tpt_bilinear_interpolate_f32_s | tpt_bilinear_interpolate_f32_t |
Instance structure for the floating-point bilinear interpolation function. More... | |
typedef struct tpt_bilinear_interpolate_q7_s | tpt_bilinear_interpolate_q7_t |
Instance structure for the Q7 bilinear interpolation function. More... | |
typedef struct tpt_bilinear_interpolate_q15_s | tpt_bilinear_interpolate_q15_t |
Instance structure for the Q15 bilinear interpolation function. More... | |
typedef struct tpt_bilinear_interpolate_q31_s | tpt_bilinear_interpolate_q31_t |
Instance structure for the Q31 bilinear interpolation function. More... | |
Enumerations | |
enum | tpt_status_e { TPT_MATH_SUCCESS = 0 , TPT_MATH_ARGUMENT_ERROR = -1 , TPT_MATH_SINGULAR = -5 , TPT_MATH_DECOMPOSITION_FAILURE = -7 } |
Error status returned by some functions in the library. More... | |
Functions | |
static q7_t | clip_q63_to_q7 (q63_t x) |
Clips Q63 to Q7 values. More... | |
static q15_t | clip_q63_to_q15 (q63_t x) |
Clips Q63 to Q15 values. More... | |
static q31_t | clip_q63_to_q31 (q63_t x) |
Clips Q63 to Q31 values. More... | |
static q7_t | clip_q31_to_q7 (q31_t x) |
Clips Q31 to Q7 values. More... | |
static q15_t | clip_q31_to_q15 (q31_t x) |
Clips Q31 to Q15 values. More... | |
static q7_t | clip_q15_to_q7 (q15_t x) |
Clips Q15 to Q7 values. More... | |
static int32_t | __SSAT (int32_t aValue, uint32_t aBits) |
static uint32_t | __USAT (int32_t aValue, uint32_t aBits) |
static uint8_t | __CLZ (uint32_t aData) |
static uint8_t | __CLZ32 (uint32_t aData) |
static q63_t | mult32x64 (q63_t x, q31_t y) |
Multiplies 32 X 64 and returns 32 bit result in 2.30 format. More... | |
static q31_t | mult32x32_keep32 (q31_t acc, q31_t x, q31_t y) |
Multiplies 32 X 32 and returns 32 bit result in 1.31 format. More... | |
static f32_t | tpt_linear_interpolate_f32 (tpt_linear_interpolate_f32_t *aFunction, f32_t aX) |
Process function for the floating-point Linear Interpolation Function. More... | |
static q31_t | tpt_linear_interpolate_q31 (q31_t *pYData, q31_t aX, uint32_t nValues) |
Process function for the Q31 Linear Interpolation Function. More... | |
static q15_t | tpt_linear_interpolate_q15 (q15_t *pYData, q31_t aX, uint32_t nValues) |
Process function for the Q15 Linear Interpolation Function. More... | |
static q7_t | tpt_linear_interpolate_q7 (q7_t *pYData, q31_t aX, uint32_t nValues) |
Process function for the Q7 Linear Interpolation Function. More... | |
static f32_t | tpt_bilinear_interpolate_f32 (const tpt_bilinear_interpolate_f32_t *aFunction, f32_t aX, f32_t aY) |
Floating-point bilinear interpolation. More... | |
static q31_t | tpt_bilinear_interpolate_q31 (tpt_bilinear_interpolate_q31_t *aFunction, q31_t aX, q31_t aY) |
Q31 bilinear interpolation. More... | |
static q15_t | tpt_bilinear_interpolate_q15 (tpt_bilinear_interpolate_q15_t *aFunction, q31_t aX, q31_t aY) |
Q15 bilinear interpolation. More... | |
static q7_t | tpt_bilinear_interpolate_q7 (tpt_bilinear_interpolate_q7_t *aFunction, q31_t aX, q31_t aY) |
Q7 bilinear interpolation. More... | |
#define __FORCEINLINE __attribute__((always_inline)) inline |
#define ABS | ( | val, | |
bit | |||
) | (val > 0) ? val : ((val == Q##bit##_MIN) ? Q##bit##_MAX : -val) |
#define CLIP | ( | val, | |
bit | |||
) | ((val) > UINT##bit##_MAX) ? UINT##bit##_MAX : ((val) < 0 ? 0U : (val)) |
#define CLIPS | ( | val, | |
bit | |||
) |
#define F32_TO_Q15 | ( | val | ) | (q15_t)((fminf(fmaxf(val, -1.0f), 1.0f)) * (1LL << 15)) |
Convert F32 to Q15 format This will use saturating arithmetic.
#define F32_TO_Q31 | ( | val | ) | (q31_t)((fminf(fmaxf(val, -1.0f), 1.0f)) * (1LL << 31)) |
Convert F32 to Q31 format This will use saturating arithmetic.
#define F32_TO_Q7 | ( | val | ) | (q7_t)((fminf(fmaxf(val, -1.0f), 1.0f)) * (1LL << 7)) |
Convert F32 to Q7 format This will use saturating arithmetic.
#define F64_TO_Q15 | ( | val | ) | (q15_t)((fmin(fmax(val, -1.0f), 1.0)) * (1LL << 15)) |
Convert F64 to Q15 format This will use saturating arithmetic.
#define F64_TO_Q31 | ( | val | ) | (q31_t)((fmin(fmax(val, -1.0), 1.0)) * (1LL << 31)) |
Convert F64 to Q31 format This will use saturating arithmetic.
#define F64_TO_Q7 | ( | val | ) | (q7_t)((fmin(fmax(val, -1.0f), 1.0)) * (1LL << 7)) |
Convert F64 to Q7 format This will use saturating arithmetic.
#define LIKELY | ( | EXPR | ) | (EXPR) |
#define OPT_BRANCH_PREDICTION 1 |
#define OPT_HIGHLY_ACCURATE 0 |
#define Q15_MAX (q15_t)0x7FFF |
#define Q15_MIN (q15_t)0x8000 |
#define Q15_TO_F32 | ( | val | ) | ((val) * 3.05175781e-05F) |
Convert Q15 to F32 format.
#define Q15_TO_F64 | ( | val | ) | ((val) * 3.051757812500000000e-05) |
Convert Q15 to F64 format.
#define Q31_MAX (q31_t)0x7FFFFFFF |
#define Q31_MIN (q31_t)0x80000000 |
#define Q31_TO_F32 | ( | val | ) | ((val) * 4.65661287e-10F) |
Convert Q31 to F32 format.
#define Q31_TO_F64 | ( | val | ) | ((val) * 4.656612873077392578e-10) |
Convert Q31 to F64 format.
#define Q63_MAX (q63_t)0x7FFFFFFFFFFFFFFFLL |
#define Q63_MIN (q63_t)0x8000000000000000LL |
#define Q7_MAX (q7_t)0x7F |
#define Q7_MIN (q7_t)0x80 |
#define Q7_TO_F32 | ( | val | ) | ((val) * 7.81250000e-03F) |
Convert Q7 to F32 format.
#define Q7_TO_F64 | ( | val | ) | ((val) * 7.812500000000000000e-03) |
Convert Q7 to F64 format.
#define SCALE_COL_F32 | ( | A, | |
ROW, | |||
v, | |||
i, | |||
aRows, | |||
aCols | |||
) | SCALE_COL_T(f32_t, A, ROW, v, i, aRows, aCols) |
#define SCALE_COL_F64 | ( | A, | |
ROW, | |||
v, | |||
i, | |||
aRows, | |||
aCols | |||
) | SCALE_COL_T(f64_t, A, ROW, v, i, aRows, aCols) |
#define SQUARE | ( | val | ) | val * val |
#define SWAP | ( | x, | |
y, | |||
T | |||
) |
#define TPT_MATH_LOOPUNROLL 8 |
#define UNLIKELY | ( | EXPR | ) | (EXPR) |
typedef long double f128_t |
128-bit floating-point type definition.
typedef float f32_t |
32-bit floating-point type definition.
typedef double f64_t |
64-bit floating-point type definition.
typedef int64_t q15_48_t |
64-bit fractional data type in 16.48 format.
typedef int16_t q15_t |
16-bit fractional data type in 1.15 format.
typedef int32_t q17_14_t |
32-bit fractional data type in 18.14 format.
typedef int16_t q1_14_t |
16-bit fractional data type in 2.14 format.
typedef int32_t q1_30_t |
32-bit fractional data type in 2.30 format.
typedef int64_t q1_62_t |
64-bit fractional data type in 2.62 format.
typedef int16_t q2_13_t |
16-bit fractional data type in 3.13 format.
typedef int32_t q2_29_t |
32-bit fractional data type in 3.29 format.
typedef int32_t q31_t |
32-bit fractional data type in 1.31 format.
typedef int64_t q33_30_t |
64-bit fractional data type in 34.30 format.
typedef int16_t q3_12_t |
16-bit fractional data type in 4.12 format.
typedef int32_t q3_28_t |
32-bit fractional data type in 4.28 format.
typedef int16_t q4_11_t |
16-bit fractional data type in 5.11 format.
typedef int32_t q4_27_t |
32-bit fractional data type in 5.27 format.
typedef int16_t q5_10_t |
16-bit fractional data type in 6.10 format.
typedef int32_t q5_26_t |
32-bit fractional data type in 6.26 format.
typedef int64_t q63_t |
64-bit fractional data type in 1.63 format.
typedef int32_t q6_25_t |
32-bit fractional data type in 7.25 format.
typedef int16_t q6_9_t |
16-bit fractional data type in 7.9 format.
typedef int32_t q7_24_t |
32-bit fractional data type in 8.24 format.
typedef int8_t q7_t |
8-bit fractional data type in 1.7 format.
typedef struct tpt_bilinear_interpolate_f32_s tpt_bilinear_interpolate_f32_t |
Instance structure for the floating-point bilinear interpolation function.
typedef struct tpt_bilinear_interpolate_q15_s tpt_bilinear_interpolate_q15_t |
Instance structure for the Q15 bilinear interpolation function.
typedef struct tpt_bilinear_interpolate_q31_s tpt_bilinear_interpolate_q31_t |
Instance structure for the Q31 bilinear interpolation function.
typedef struct tpt_bilinear_interpolate_q7_s tpt_bilinear_interpolate_q7_t |
Instance structure for the Q7 bilinear interpolation function.
typedef struct tpt_linear_interpolate_f32_s tpt_linear_interpolate_f32_t |
Instance structure for the floating-point Linear Interpolate function.
typedef enum tpt_status_e tpt_status |
Error status returned by some functions in the library.
enum tpt_status_e |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Multiplies 32 X 32 and returns 32 bit result in 1.31 format.