Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
4.1.99
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
q
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
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
46
#define Z_SHIFT_Q7_TO_F32(src, m) ((float32_t)(((src << m)) / (float32_t)(1U << 7)))
47
55
#define Z_SHIFT_Q15_TO_F32(src, m) ((float32_t)((src << m) / (float32_t)(1U << 15)))
56
64
#define Z_SHIFT_Q31_TO_F32(src, m) ((float32_t)(((int64_t)src) << m) / (float32_t)(1U << 31))
65
73
#define Z_SHIFT_Q7_TO_F64(src, m) (((float64_t)(src << m)) / (1U << 7))
74
82
#define Z_SHIFT_Q15_TO_F64(src, m) (((float64_t)(src << m)) / (1UL << 15))
83
91
#define Z_SHIFT_Q31_TO_F64(src, m) ((float64_t)(((int64_t)src) << m) / (1ULL << 31))
92
114
#define Z_SHIFT_F32_TO_Q7(src, m) \
115
((q7_t)Z_CLAMP((int32_t)(src * (1U << 7)) >> m, INT8_MIN, INT8_MAX))
116
124
#define Z_SHIFT_F32_TO_Q15(src, m) \
125
((q15_t)Z_CLAMP((int32_t)(src * (1U << 15)) >> m, INT16_MIN, INT16_MAX))
126
134
#define Z_SHIFT_F32_TO_Q31(src, m) \
135
((q31_t)Z_CLAMP((int64_t)(src * (1U << 31)) >> m, INT32_MIN, INT32_MAX))
136
144
#define Z_SHIFT_F64_TO_Q7(src, m) \
145
((q7_t)Z_CLAMP((int32_t)(src * (1U << 7)) >> m, INT8_MIN, INT8_MAX))
146
154
#define Z_SHIFT_F64_TO_Q15(src, m) \
155
((q15_t)Z_CLAMP((int32_t)(src * (1U << 15)) >> m, INT16_MIN, INT16_MAX))
156
164
#define Z_SHIFT_F64_TO_Q31(src, m) \
165
((q31_t)Z_CLAMP((int64_t)(src * (1U << 31)) >> m, INT32_MIN, INT32_MAX))
166
171
#ifdef __cplusplus
172
}
173
#endif
174
175
#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 Fri Mar 14 2025 00:06:42 for Zephyr API Documentation by
1.12.0