Sound Open Firmware
Loading...
Searching...
No Matches
numbers.h File Reference
Include dependency graph for numbers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MIN(a, b)
#define MAX(a, b)
#define ROUND_DOWN(size, alignment)
#define ROUND_UP(size, alignment)
#define ABS(a)
#define SGN(a)
#define USE_SOF_GCD   1
#define merge_16b16b(high, low)
#define merge_4b4b(high, low)
#define INT_MAX_FOR_NUMBER_OF_BITS(N)
#define INT_MIN_FOR_NUMBER_OF_BITS(N)
#define SPEED_OF_SOUND   343
#define RECIPROCAL_SPEED_OF_SOUND_Q31   6260885 /* Q1.31 */

Functions

int gcd (int a, int b)
static int ceil_divide (int a, int b)
static void cross_product_s16 (int32_t *px, int32_t *py, int32_t *pz, int16_t a, int16_t b, int16_t c, int16_t d, int16_t e, int16_t f)
 Cross product function.
int find_equal_int16 (int16_t idx[], int16_t vec[], int n, int vec_length, int max_results)
int16_t find_min_int16 (int16_t vec[], int vec_length)
int32_t find_max_abs_int32 (int32_t vec[], int vec_length)
int norm_int32 (int32_t val)
uint32_t crc32 (uint32_t base, const void *data, uint32_t bytes)

Macro Definition Documentation

◆ ABS

#define ABS ( a)
Value:
({ \
__typeof__(a) __a = (a); \
__a < 0 ? -__a : __a; \
})

◆ INT_MAX_FOR_NUMBER_OF_BITS

#define INT_MAX_FOR_NUMBER_OF_BITS ( N)
Value:
((int64_t)((1ULL << ((N) - 1)) - 1))

◆ INT_MIN_FOR_NUMBER_OF_BITS

#define INT_MIN_FOR_NUMBER_OF_BITS ( N)
Value:
((int64_t)(-((1ULL << ((N) - 1)) - 1) - 1))

◆ MAX

#define MAX ( a,
b )
Value:
((a) < (b) ? (b) : (a))

◆ merge_16b16b

#define merge_16b16b ( high,
low )
Value:
(((uint32_t)(high) << 16) | \
((low) & 0xFFFF))

◆ merge_4b4b

#define merge_4b4b ( high,
low )
Value:
(((uint8_t)(high) << 4) | \
((low) & 0xF))

◆ MIN

#define MIN ( a,
b )
Value:
((a) < (b) ? (a) : (b))

◆ RECIPROCAL_SPEED_OF_SOUND_Q31

#define RECIPROCAL_SPEED_OF_SOUND_Q31   6260885 /* Q1.31 */

◆ ROUND_DOWN

#define ROUND_DOWN ( size,
alignment )
Value:
({ \
__typeof__(size) __size = (size); \
__typeof__(alignment) __alignment = (alignment); \
__size - (__size % __alignment); \
})

◆ ROUND_UP

#define ROUND_UP ( size,
alignment )
Value:
({ \
__typeof__(size) __size = (size); \
__typeof__(alignment) __alignment = (alignment); \
((__size + __alignment - 1) / __alignment) * __alignment; \
})

◆ SGN

#define SGN ( a)
Value:
({ \
__typeof__(a) __a = (a); \
__a < 0 ? -1 : \
__a > 0 ? 1 : 0; \
})

◆ SPEED_OF_SOUND

#define SPEED_OF_SOUND   343

◆ USE_SOF_GCD

#define USE_SOF_GCD   1

Function Documentation

◆ ceil_divide()

int ceil_divide ( int a,
int b )
inlinestatic

◆ crc32()

uint32_t crc32 ( uint32_t base,
const void * data,
uint32_t bytes )

◆ cross_product_s16()

void cross_product_s16 ( int32_t * px,
int32_t * py,
int32_t * pz,
int16_t a,
int16_t b,
int16_t c,
int16_t d,
int16_t e,
int16_t f )
inlinestatic

Cross product function.

Calculate cross product for vectors AB(a, b, c) and AC(d, e, f), where A, B, and C are points of a triangle in 3D space. Cross product is used in computational geometry. Cross product AB x AC is (b * f - c * e, c * d - a * f, a * e - b * d)

Parameters
[out]pxx-axis component of cross product vector
[out]pyy-axis component of cross product vector
[out]pzz-axis component of cross product vector
[in]ax-axis component of vector AB
[in]by-axis component of vector AB
[in]cz-axis component of vector AB
[in]dx-axis component of vector AC
[in]ey-axis component of vector AC
[in]fz-axis component of vector AC

◆ find_equal_int16()

int find_equal_int16 ( int16_t idx[],
int16_t vec[],
int n,
int vec_length,
int max_results )

◆ find_max_abs_int32()

int32_t find_max_abs_int32 ( int32_t vec[],
int vec_length )

◆ find_min_int16()

int16_t find_min_int16 ( int16_t vec[],
int vec_length )

◆ gcd()

int gcd ( int a,
int b )

◆ norm_int32()

int norm_int32 ( int32_t val)