Sound Open Firmware
Loading...
Searching...
No Matches
format_generic.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause
2
*
3
* Copyright(c) 2021 Intel Corporation. All rights reserved.
4
*/
5
6
#ifndef __SOF_AUDIO_FORMAT_GENERIC_H__
7
#define __SOF_AUDIO_FORMAT_GENERIC_H__
8
9
#include <stdint.h>
10
11
/* Saturation inline functions */
12
13
static
inline
int32_t
sat_int32
(int64_t x)
14
{
15
if
(x > INT32_MAX)
16
return
INT32_MAX;
17
else
if
(x < INT32_MIN)
18
return
INT32_MIN;
19
else
20
return
(int32_t)x;
21
}
22
23
static
inline
int32_t
sat_int24
(int32_t x)
24
{
25
if
(x >
INT24_MAXVALUE
)
26
return
INT24_MAXVALUE
;
27
else
if
(x <
INT24_MINVALUE
)
28
return
INT24_MINVALUE
;
29
else
30
return
x;
31
}
32
33
static
inline
int16_t
sat_int16
(int32_t x)
34
{
35
if
(x > INT16_MAX)
36
return
INT16_MAX;
37
else
if
(x < INT16_MIN)
38
return
INT16_MIN;
39
else
40
return
(int16_t)x;
41
}
42
43
static
inline
int8_t
sat_int8
(int32_t x)
44
{
45
if
(x > INT8_MAX)
46
return
INT8_MAX;
47
else
if
(x < INT8_MIN)
48
return
INT8_MIN;
49
else
50
return
(int8_t)x;
51
}
52
53
#endif
/* __SOF_AUDIO_FORMAT_GENERIC_H__ */
INT24_MINVALUE
#define INT24_MINVALUE
Definition
format.h:34
INT24_MAXVALUE
#define INT24_MAXVALUE
Definition
format.h:33
sat_int8
static int8_t sat_int8(int32_t x)
Definition
format_generic.h:43
sat_int16
static int16_t sat_int16(int32_t x)
Definition
format_generic.h:33
sat_int24
static int32_t sat_int24(int32_t x)
Definition
format_generic.h:23
sat_int32
static int32_t sat_int32(int64_t x)
Definition
format_generic.h:13
src
include
sof
audio
format_generic.h
Generated by
1.15.0