Zephyr API Documentation 4.2.0-rc3
A Scalable Open Source RTOS
 4.2.0-rc3
basicmath.h
Go to the documentation of this file.
1/* Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
2 * SPDX-License-Identifier: Apache-2.0
3 */
4
10
11#ifndef ZEPHYR_INCLUDE_DSP_BASICMATH_H_
12#define ZEPHYR_INCLUDE_DSP_BASICMATH_H_
13
14#include <zephyr/dsp/dsp.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
26
38
51DSP_FUNC_SCOPE void zdsp_mult_q7(const DSP_DATA q7_t *src_a, const DSP_DATA q7_t *src_b,
52 DSP_DATA q7_t *dst, uint32_t block_size);
53
66DSP_FUNC_SCOPE void zdsp_mult_q15(const DSP_DATA q15_t *src_a, const DSP_DATA q15_t *src_b,
67 DSP_DATA q15_t *dst, uint32_t block_size);
68
81DSP_FUNC_SCOPE void zdsp_mult_q31(const DSP_DATA q31_t *src_a, const DSP_DATA q31_t *src_b,
82 DSP_DATA q31_t *dst, uint32_t block_size);
83
92 DSP_DATA float32_t *dst, uint32_t block_size);
93
97
109
118 DSP_DATA float32_t *dst, uint32_t block_size);
119
132DSP_FUNC_SCOPE void zdsp_add_q7(const DSP_DATA q7_t *src_a, const DSP_DATA q7_t *src_b,
133 DSP_DATA q7_t *dst, uint32_t block_size);
134
147DSP_FUNC_SCOPE void zdsp_add_q15(const DSP_DATA q15_t *src_a, const DSP_DATA q15_t *src_b,
148 DSP_DATA q15_t *dst, uint32_t block_size);
149
162DSP_FUNC_SCOPE void zdsp_add_q31(const DSP_DATA q31_t *src_a, const DSP_DATA q31_t *src_b,
163 DSP_DATA q31_t *dst, uint32_t block_size);
164
168
180
189 DSP_DATA float32_t *dst, uint32_t block_size);
190
203DSP_FUNC_SCOPE void zdsp_sub_q7(const DSP_DATA q7_t *src_a, const DSP_DATA q7_t *src_b,
204 DSP_DATA q7_t *dst, uint32_t block_size);
205
218DSP_FUNC_SCOPE void zdsp_sub_q15(const DSP_DATA q15_t *src_a, const DSP_DATA q15_t *src_b,
219 DSP_DATA q15_t *dst, uint32_t block_size);
220
233DSP_FUNC_SCOPE void zdsp_sub_q31(const DSP_DATA q31_t *src_a, const DSP_DATA q31_t *src_b,
234 DSP_DATA q31_t *dst, uint32_t block_size);
235
239
265
274 DSP_DATA float32_t *dst, uint32_t block_size);
275
290DSP_FUNC_SCOPE void zdsp_scale_q7(const DSP_DATA q7_t *src, q7_t scale_fract, int8_t shift,
291 DSP_DATA q7_t *dst, uint32_t block_size);
292
307DSP_FUNC_SCOPE void zdsp_scale_q15(const DSP_DATA q15_t *src, q15_t scale_fract, int8_t shift,
308 DSP_DATA q15_t *dst, uint32_t block_size);
309
324DSP_FUNC_SCOPE void zdsp_scale_q31(const DSP_DATA q31_t *src, q31_t scale_fract, int8_t shift,
325 DSP_DATA q31_t *dst, uint32_t block_size);
326
330
344
352 uint32_t block_size);
353
365DSP_FUNC_SCOPE void zdsp_abs_q7(const DSP_DATA q7_t *src, DSP_DATA q7_t *dst, uint32_t block_size);
366
379 uint32_t block_size);
380
394 uint32_t block_size);
395
399
412
421 const DSP_DATA float32_t *src_b, uint32_t block_size,
422 DSP_DATA float32_t *result);
423
439 uint32_t block_size, DSP_DATA q31_t *result);
440
456 uint32_t block_size, DSP_DATA q63_t *result);
457
474 uint32_t block_size, DSP_DATA q63_t *result);
475
479
496
510DSP_FUNC_SCOPE void zdsp_shift_q7(const DSP_DATA q7_t *src, int8_t shift_bits, DSP_DATA q7_t *dst,
511 uint32_t block_size);
512
527 DSP_DATA q15_t *dst, uint32_t block_size);
528
543 DSP_DATA q31_t *dst, uint32_t block_size);
544
548
563
572 DSP_DATA float32_t *dst, uint32_t block_size);
573
587 uint32_t block_size);
588
602 uint32_t block_size);
603
617 uint32_t block_size);
618
622
637
645 uint32_t block_size);
646
659 uint32_t block_size);
660
673 uint32_t block_size);
674
687 uint32_t block_size);
688
692
702
711 DSP_DATA uint8_t *dst, uint32_t block_size);
712
721 DSP_DATA uint16_t *dst, uint32_t block_size);
722
731 DSP_DATA uint32_t *dst, uint32_t block_size);
732
736
746
755 DSP_DATA uint8_t *dst, uint32_t block_size);
756
765 DSP_DATA uint16_t *dst, uint32_t block_size);
766
775 DSP_DATA uint32_t *dst, uint32_t block_size);
776
780
790
798 uint32_t block_size);
799
807 uint32_t block_size);
808
816 uint32_t block_size);
817
821
831
840 DSP_DATA uint8_t *dst, uint32_t block_size);
841
850 DSP_DATA uint16_t *dst, uint32_t block_size);
851
860 DSP_DATA uint32_t *dst, uint32_t block_size);
861
865
877
887 float32_t low, float32_t high, uint32_t num_samples);
888
898 q31_t high, uint32_t num_samples);
899
909 q15_t high, uint32_t num_samples);
910
920 uint32_t num_samples);
921
925
929
930#ifdef __cplusplus
931}
932#endif
933
934#ifdef CONFIG_FP16
936#endif /* CONFIG_FP16 */
937
938#endif /* ZEPHYR_INCLUDE_DSP_BASICMATH_H_ */
Public APIs for DSP basicmath for 16 bit floating point.
Public APIs for Digital Signal Processing (DSP) math.
#define DSP_DATA
Definition dsp.h:23
#define DSP_FUNC_SCOPE
Definition dsp.h:17
void zdsp_abs_q15(const q15_t *src, q15_t *dst, uint32_t block_size)
Q15 vector absolute value.
void zdsp_abs_f32(const float32_t *src, float32_t *dst, uint32_t block_size)
Floating-point vector absolute value.
void zdsp_abs_q7(const q7_t *src, q7_t *dst, uint32_t block_size)
Q7 vector absolute value.
void zdsp_abs_q31(const q31_t *src, q31_t *dst, uint32_t block_size)
Q31 vector absolute value.
void zdsp_add_q15(const q15_t *src_a, const q15_t *src_b, q15_t *dst, uint32_t block_size)
Q15 vector addition.
void zdsp_add_q31(const q31_t *src_a, const q31_t *src_b, q31_t *dst, uint32_t block_size)
Q31 vector addition.
void zdsp_add_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst, uint32_t block_size)
Q7 vector addition.
void zdsp_add_f32(const float32_t *src_a, const float32_t *src_b, float32_t *dst, uint32_t block_size)
Floating-point vector addition.
void zdsp_and_u8(const uint8_t *src_a, const uint8_t *src_b, uint8_t *dst, uint32_t block_size)
Compute the logical bitwise AND of two fixed-point vectors.
void zdsp_and_u16(const uint16_t *src_a, const uint16_t *src_b, uint16_t *dst, uint32_t block_size)
Compute the logical bitwise AND of two fixed-point vectors.
void zdsp_and_u32(const uint32_t *src_a, const uint32_t *src_b, uint32_t *dst, uint32_t block_size)
Compute the logical bitwise AND of two fixed-point vectors.
void zdsp_clip_q31(const q31_t *src, q31_t *dst, q31_t low, q31_t high, uint32_t num_samples)
Elementwise fixed-point clipping.
void zdsp_clip_q7(const q7_t *src, q7_t *dst, q7_t low, q7_t high, uint32_t num_samples)
Elementwise fixed-point clipping.
void zdsp_clip_q15(const q15_t *src, q15_t *dst, q15_t low, q15_t high, uint32_t num_samples)
Elementwise fixed-point clipping.
void zdsp_clip_f32(const float32_t *src, float32_t *dst, float32_t low, float32_t high, uint32_t num_samples)
Elementwise floating-point clipping.
void zdsp_dot_prod_q15(const q15_t *src_a, const q15_t *src_b, uint32_t block_size, q63_t *result)
Dot product of Q15 vectors.
void zdsp_dot_prod_f32(const float32_t *src_a, const float32_t *src_b, uint32_t block_size, float32_t *result)
Dot product of floating-point vectors.
void zdsp_dot_prod_q7(const q7_t *src_a, const q7_t *src_b, uint32_t block_size, q31_t *result)
Dot product of Q7 vectors.
void zdsp_dot_prod_q31(const q31_t *src_a, const q31_t *src_b, uint32_t block_size, q63_t *result)
Dot product of Q31 vectors.
void zdsp_mult_q31(const q31_t *src_a, const q31_t *src_b, q31_t *dst, uint32_t block_size)
Q31 vector multiplication.
void zdsp_mult_f32(const float32_t *src_a, const float32_t *src_b, float32_t *dst, uint32_t block_size)
Floating-point vector multiplication.
void zdsp_mult_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst, uint32_t block_size)
Q7 vector multiplication.
void zdsp_mult_q15(const q15_t *src_a, const q15_t *src_b, q15_t *dst, uint32_t block_size)
Q15 vector multiplication.
void zdsp_negate_q31(const q31_t *src, q31_t *dst, uint32_t block_size)
Negates the elements of a Q31 vector.
void zdsp_negate_q15(const q15_t *src, q15_t *dst, uint32_t block_size)
Negates the elements of a Q15 vector.
void zdsp_negate_q7(const q7_t *src, q7_t *dst, uint32_t block_size)
Negates the elements of a Q7 vector.
void zdsp_negate_f32(const float32_t *src, float32_t *dst, uint32_t block_size)
Negates the elements of a floating-point vector.
void zdsp_not_u16(const uint16_t *src, uint16_t *dst, uint32_t block_size)
Compute the logical bitwise NOT of a fixed-point vector.
void zdsp_not_u8(const uint8_t *src, uint8_t *dst, uint32_t block_size)
Compute the logical bitwise NOT of a fixed-point vector.
void zdsp_not_u32(const uint32_t *src, uint32_t *dst, uint32_t block_size)
Compute the logical bitwise NOT of a fixed-point vector.
void zdsp_offset_q15(const q15_t *src, q15_t offset, q15_t *dst, uint32_t block_size)
Adds a constant offset to a Q15 vector.
void zdsp_offset_f32(const float32_t *src, float32_t offset, float32_t *dst, uint32_t block_size)
Adds a constant offset to a floating-point vector.
void zdsp_offset_q31(const q31_t *src, q31_t offset, q31_t *dst, uint32_t block_size)
Adds a constant offset to a Q31 vector.
void zdsp_offset_q7(const q7_t *src, q7_t offset, q7_t *dst, uint32_t block_size)
Adds a constant offset to a Q7 vector.
void zdsp_or_u16(const uint16_t *src_a, const uint16_t *src_b, uint16_t *dst, uint32_t block_size)
Compute the logical bitwise OR of two fixed-point vectors.
void zdsp_or_u32(const uint32_t *src_a, const uint32_t *src_b, uint32_t *dst, uint32_t block_size)
Compute the logical bitwise OR of two fixed-point vectors.
void zdsp_or_u8(const uint8_t *src_a, const uint8_t *src_b, uint8_t *dst, uint32_t block_size)
Compute the logical bitwise OR of two fixed-point vectors.
void zdsp_scale_q7(const q7_t *src, q7_t scale_fract, int8_t shift, q7_t *dst, uint32_t block_size)
Multiplies a Q7 vector by a scalar.
void zdsp_scale_f32(const float32_t *src, float32_t scale, float32_t *dst, uint32_t block_size)
Multiplies a floating-point vector by a scalar.
void zdsp_scale_q31(const q31_t *src, q31_t scale_fract, int8_t shift, q31_t *dst, uint32_t block_size)
Multiplies a Q31 vector by a scalar.
void zdsp_scale_q15(const q15_t *src, q15_t scale_fract, int8_t shift, q15_t *dst, uint32_t block_size)
Multiplies a Q15 vector by a scalar.
void zdsp_shift_q15(const q15_t *src, int8_t shift_bits, q15_t *dst, uint32_t block_size)
Shifts the elements of a Q15 vector a specified number of bits.
void zdsp_shift_q7(const q7_t *src, int8_t shift_bits, q7_t *dst, uint32_t block_size)
Shifts the elements of a Q7 vector a specified number of bits.
void zdsp_shift_q31(const q31_t *src, int8_t shift_bits, q31_t *dst, uint32_t block_size)
Shifts the elements of a Q31 vector a specified number of bits.
void zdsp_sub_q7(const q7_t *src_a, const q7_t *src_b, q7_t *dst, uint32_t block_size)
Q7 vector subtraction.
void zdsp_sub_q31(const q31_t *src_a, const q31_t *src_b, q31_t *dst, uint32_t block_size)
Q31 vector subtraction.
void zdsp_sub_q15(const q15_t *src_a, const q15_t *src_b, q15_t *dst, uint32_t block_size)
Q15 vector subtraction.
void zdsp_sub_f32(const float32_t *src_a, const float32_t *src_b, float32_t *dst, uint32_t block_size)
Floating-point vector subtraction.
void zdsp_xor_u8(const uint8_t *src_a, const uint8_t *src_b, uint8_t *dst, uint32_t block_size)
Compute the logical bitwise XOR of two fixed-point vectors.
void zdsp_xor_u16(const uint16_t *src_a, const uint16_t *src_b, uint16_t *dst, uint32_t block_size)
Compute the logical bitwise XOR of two fixed-point vectors.
void zdsp_xor_u32(const uint32_t *src_a, const uint32_t *src_b, uint32_t *dst, uint32_t block_size)
Compute the logical bitwise XOR of two fixed-point vectors.
float float32_t
32-bit floating-point type definition.
Definition types.h:55
int64_t q63_t
64-bit fractional data type in 1.63 format.
Definition types.h:41
int16_t q15_t
16-bit fractional data type in 1.15 format.
Definition types.h:29
int32_t q31_t
32-bit fractional data type in 1.31 format.
Definition types.h:35
int8_t q7_t
8-bit fractional data type in 1.7 format.
Definition types.h:23
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT8_TYPE__ int8_t
Definition stdint.h:72