-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy pathformat.h
More file actions
57 lines (51 loc) · 1.23 KB
/
format.h
File metadata and controls
57 lines (51 loc) · 1.23 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2016 - 2023 Intel Corporation. All rights reserved.
*
* Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
* Liam Girdwood <liam.r.girdwood@linux.intel.com>
* Keyon Jie <yang.jie@linux.intel.com>
* Adrian Warecki <adrian.warecki@intel.com>
*/
#ifndef __MODULE_AUDIO_FORMAT_H__
#define __MODULE_AUDIO_FORMAT_H__
#include <stdint.h>
#include "../ipc/stream.h"
static inline uint32_t get_sample_bytes(enum sof_ipc_frame fmt)
{
switch (fmt) {
case SOF_IPC_FRAME_S16_LE:
return 2;
case SOF_IPC_FRAME_S24_3LE:
return 3;
case SOF_IPC_FRAME_U8:
case SOF_IPC_FRAME_S8:
case SOF_IPC_FRAME_A_LAW:
case SOF_IPC_FRAME_MU_LAW:
return 1;
default:
return 4;
}
}
static inline uint32_t get_sample_bitdepth(enum sof_ipc_frame fmt)
{
switch (fmt) {
case SOF_IPC_FRAME_S16_LE:
return 16;
case SOF_IPC_FRAME_S24_4LE:
case SOF_IPC_FRAME_S24_3LE:
return 24;
case SOF_IPC_FRAME_U8:
case SOF_IPC_FRAME_S8:
case SOF_IPC_FRAME_A_LAW:
case SOF_IPC_FRAME_MU_LAW:
return 8;
default:
return 32;
}
}
static inline uint32_t get_frame_bytes(enum sof_ipc_frame fmt, uint32_t channels)
{
return get_sample_bytes(fmt) * channels;
}
#endif /* __MODULE_AUDIO_FORMAT_H__ */