Zephyr API Documentation
4.2.0-rc3
A Scalable Open Source RTOS
4.2.0-rc3
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2024 OWL Services LLC. All rights reserved.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
12
13
#ifndef INCLUDE_ZEPHYR_DSP_UTILS_H_
14
#define INCLUDE_ZEPHYR_DSP_UTILS_H_
15
16
#include <
stdint.h
>
17
#include <
zephyr/kernel.h
>
18
#include <
zephyr/dsp/dsp.h
>
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
32
42
50
#define Z_SHIFT_Q7_TO_F32(src, m) ((float32_t)(((src << m)) / (float32_t)(1U << 7)))
51
59
#define Z_SHIFT_Q15_TO_F32(src, m) ((float32_t)((src << m) / (float32_t)(1U << 15)))
60
68
#define Z_SHIFT_Q31_TO_F32(src, m) ((float32_t)(((int64_t)src) << m) / (float32_t)(1U << 31))
69
77
#define Z_SHIFT_Q7_TO_F64(src, m) (((float64_t)(src << m)) / (1U << 7))
78
86
#define Z_SHIFT_Q15_TO_F64(src, m) (((float64_t)(src << m)) / (1UL << 15))
87
95
#define Z_SHIFT_Q31_TO_F64(src, m) ((float64_t)(((int64_t)src) << m) / (1ULL << 31))
96
100
110
118
#define Z_SHIFT_F32_TO_Q7(src, m) \
119
((q7_t)Z_CLAMP((int32_t)(src * (1U << 7)) >> m, INT8_MIN, INT8_MAX))
120
128
#define Z_SHIFT_F32_TO_Q15(src, m) \
129
((q15_t)Z_CLAMP((int32_t)(src * (1U << 15)) >> m, INT16_MIN, INT16_MAX))
130
138
#define Z_SHIFT_F32_TO_Q31(src, m) \
139
((q31_t)Z_CLAMP((int64_t)(src * (1U << 31)) >> m, INT32_MIN, INT32_MAX))
140
148
#define Z_SHIFT_F64_TO_Q7(src, m) \
149
((q7_t)Z_CLAMP((int32_t)(src * (1U << 7)) >> m, INT8_MIN, INT8_MAX))
150
158
#define Z_SHIFT_F64_TO_Q15(src, m) \
159
((q15_t)Z_CLAMP((int32_t)(src * (1U << 15)) >> m, INT16_MIN, INT16_MAX))
160
168
#define Z_SHIFT_F64_TO_Q31(src, m) \
169
((q31_t)Z_CLAMP((int64_t)(src * (1U << 31)) >> m, INT32_MIN, INT32_MAX))
170
174
178
179
#ifdef __cplusplus
180
}
181
#endif
182
183
#endif
/* INCLUDE_ZEPHYR_DSP_UTILS_H_ */
dsp.h
Public APIs for Digital Signal Processing (DSP) math.
kernel.h
Public kernel APIs.
stdint.h
zephyr
dsp
utils.h
Generated on
for Zephyr API Documentation by
1.14.0