forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat_hifi3.h
More file actions
40 lines (32 loc) · 766 Bytes
/
format_hifi3.h
File metadata and controls
40 lines (32 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2021 Intel Corporation. All rights reserved.
*/
#ifndef __SOF_AUDIO_FORMAT_HIFI3_H__
#define __SOF_AUDIO_FORMAT_HIFI3_H__
#include <xtensa/config/defs.h>
#include <xtensa/tie/xt_hifi3.h>
#include <stdint.h>
/* Saturation inline functions */
static inline int32_t sat_int32(int64_t x)
{
return (ae_int32)AE_ROUND32F48SSYM(AE_SLAI64(x, 16));
}
static inline int32_t sat_int24(int32_t x)
{
return AE_SRAI32(AE_SLAI32S(x, 8), 8);
}
static inline int16_t sat_int16(int32_t x)
{
return AE_SAT16X4(x, x);
}
static inline int8_t sat_int8(int32_t x)
{
if (x > INT8_MAX)
return INT8_MAX;
else if (x < INT8_MIN)
return INT8_MIN;
else
return (int8_t)x;
}
#endif /* __SOF_AUDIO_FORMAT_HIFI3_H__ */