forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathigo_lib.h
More file actions
143 lines (129 loc) · 4.06 KB
/
igo_lib.h
File metadata and controls
143 lines (129 loc) · 4.06 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2021 Intelligo Technology Inc. All rights reserved.
*
* Author: Fu-Yun TSUO <fy.tsuo@intelli-go.com>
*/
/*******************************************************************************
* [2017] - [2021] Copyright (c) Intelligo Technology Inc.
*
* This unpublished material is proprietary to Intelligo Technology Inc.
* All rights reserved. The methods and techniques described herein are
* considered trade secrets and/or confidential. Reproduction or
* distribution, in whole or in part, is forbidden except by express written
* permission of Intelligo Technology Inc.
*
*******************************************************************************/
#ifndef _IGO_LIB_H_
#define _IGO_LIB_H_
#include <stdint.h>
enum IgoRet {
IGO_RET_OK = 0,
IGO_RET_ERR,
IGO_RET_NO_SERVICE,
IGO_RET_INVL_ARG,
IGO_RET_NO_MEMORY,
IGO_RET_NOT_SUPPORT,
IGO_RET_ALGO_NAME_NOT_FOUND,
IGO_RET_CH_NUM_ERR,
IGO_RET_SAMPLING_RATE_NOT_SUPPORT,
IGO_RET_IN_DATA_ERR,
IGO_RET_REF_DATA_ERR,
IGO_RET_OUT_DATA_ERR,
IGO_RET_PARAM_NOT_FOUND,
IGO_RET_PARAM_READ_ONLY,
IGO_RET_PARAM_WRITE_ONLY,
IGO_RET_PARAM_INVALID_VAL,
IGO_RET_LAST
};
enum IgoDataWidth {
IGO_DATA_16BIT = 0,
IGO_DATA_24BIT,
IGO_DATA_LAST
};
/**
* @brief IgoLibInfo is used to keep information for iGo library.
*
*/
struct IgoLibInfo {
uint32_t major_version; /* Major version */
uint32_t minor_version; /* Minor version */
uint32_t build_version; /* Build version */
uint32_t ext_version; /* Extension version */
uint32_t handle_size; /* Size of handle structure */
};
/**
* @brief IgoStreamData is used to keep audio data for iGo library.
*
*/
struct IgoStreamData {
void *data; /* Data array */
enum IgoDataWidth data_width; /* Specify audio data bit width */
uint16_t sample_num; /* Sample number in this data bulk */
uint16_t sampling_rate; /* Sampling rate for the data stream */
};
/**
* @brief IgoLibConfig is used to keep lib configuration for lib instance
* initialization.
*
*/
struct IgoLibConfig {
const char *algo_name; /* Algorithm name */
uint8_t in_ch_num; /* Input channel number for the algo instance */
uint8_t ref_ch_num; /* Reference channel number for the algo instance */
uint8_t out_ch_num; /* Output channel number for the algo instance */
};
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief IgoLibGetInfo() - Retrieve the lib information.
* @param[out] info Lib information.
*
* This API is used to get library detail information.
*
* @return iGo defined return value.
*/
enum IgoRet IgoLibGetInfo(struct IgoLibInfo *info);
/**
* @brief IgoLibInit() - Initialize iGo lib instance.
* @param[out] handle iGo lib handle.
* @param[in] config Lib configuration for initialization.
* @param[in] param the point of iGO Parameter for initialization.
*
* This API is used to initialize iGo lib instance and get a handle which is
* for control the iGo lib instance.
*
* P.S. The channel number in the config is algorithm dependent.
*
* @return iGo defined return value.
*/
enum IgoRet IgoLibInit(void *handle,
const struct IgoLibConfig *config,
void *param);
/**
* @brief IgoLibProcess() - Process audio stream.
* @param[in] handle iGo lib handle.
* @param[in] in input audio stream.
* @param[in] ref reference audio stream.
* @param[out] out output audio stream.
*
* This API is used to process audio stream. The default audio sample is 16bit.
* The sampling rate and sample number should be specified in IgoStreamData
* structure. If the channel number > 1 for IgoStreamData, the data should be
* interleaved sample by sample.
*
* Note: IgoLibProcess supports 16k/48k 16bit data only by default.
* If other data format or sampling rate is required, please
* ask intelliGo for support.
*
* @return iGo defined return value.
*/
enum IgoRet IgoLibProcess(void *handle,
const struct IgoStreamData *in,
const struct IgoStreamData *ref,
const struct IgoStreamData *out);
#ifdef __cplusplus
}
#endif
#endif