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
12
#ifndef __SOF_AUDIO_FORMAT_GENERIC_H__
13
#define __SOF_AUDIO_FORMAT_GENERIC_H__
14
15
#include <stdint.h>
16
26
static
inline
int32_t
sat_int32
(int64_t x)
27
{
28
if
(x > INT32_MAX)
29
return
INT32_MAX;
30
else
if
(x < INT32_MIN)
31
return
INT32_MIN;
32
else
33
return
(int32_t)x;
34
}
35
41
static
inline
int32_t
sat_int24
(int32_t x)
42
{
43
if
(x >
INT24_MAXVALUE
)
44
return
INT24_MAXVALUE
;
45
else
if
(x <
INT24_MINVALUE
)
46
return
INT24_MINVALUE
;
47
else
48
return
x;
49
}
50
56
static
inline
int16_t
sat_int16
(int32_t x)
57
{
58
if
(x > INT16_MAX)
59
return
INT16_MAX;
60
else
if
(x < INT16_MIN)
61
return
INT16_MIN;
62
else
63
return
(int16_t)x;
64
}
65
71
static
inline
int8_t
sat_int8
(int32_t x)
72
{
73
if
(x > INT8_MAX)
74
return
INT8_MAX;
75
else
if
(x < INT8_MIN)
76
return
INT8_MIN;
77
else
78
return
(int8_t)x;
79
}
80
83
#endif
/* __SOF_AUDIO_FORMAT_GENERIC_H__ */
sat_int8
static int8_t sat_int8(int32_t x)
Saturate a 32-bit integer to signed 8-bit integer range.
Definition
format_generic.h:71
sat_int16
static int16_t sat_int16(int32_t x)
Saturate a 32-bit integer to signed 16-bit integer range.
Definition
format_generic.h:56
sat_int24
static int32_t sat_int24(int32_t x)
Saturate a 32-bit integer to signed 24-bit integer range.
Definition
format_generic.h:41
sat_int32
static int32_t sat_int32(int64_t x)
Saturate a 64-bit integer to signed 32-bit integer range.
Definition
format_generic.h:26
INT24_MINVALUE
#define INT24_MINVALUE
Definition
format.h:34
INT24_MAXVALUE
#define INT24_MAXVALUE
Definition
format.h:33
src
include
sof
audio
format_generic.h
Generated by
1.9.8