/
aec.h
executable file
·195 lines (172 loc) · 4.33 KB
/
aec.h
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
// Copyright 2020-2021 Beken
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __AEC_H__
#define __AEC_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif//__cplusplus
typedef struct _AECContext AECContext;
/**
* @brief AEC enum defines
* @defgroup AEC enums
* @ingroup AEC
* @{
*/
enum AEC_CTRL_CMD
{
AEC_CTRL_CMD_NULL = 0,
AEC_CTRL_CMD_GET_MIC_DELAY, /**< Get mic delay */
AEC_CTRL_CMD_SET_MIC_DELAY, /**< Set mic delay */
AEC_CTRL_CMD_GET_EC_DEPTH, /**< Get ec depth */
AEC_CTRL_CMD_SET_EC_DEPTH, /**< Set ec depth */
AEC_CTRL_CMD_GET_NS_LEVEL, /**<Get ns level */
AEC_CTRL_CMD_SET_NS_LEVEL, /**<Set ns level */
AEC_CTRL_CMD_GET_DRC, /**<Get drc */
AEC_CTRL_CMD_SET_DRC, /**<Set drc */
AEC_CTRL_CMD_GET_FLAGS, /**<Get flags */
AEC_CTRL_CMD_SET_FLAGS, /**<Set flags */
AEC_CTRL_CMD_SET_VOL, /**<Set volum */
AEC_CTRL_CMD_SET_REF_SCALE, /**<Set reference scale */
AEC_CTRL_CMD_SET_TxRxThr, /**<Set TxRxThr */
AEC_CTRL_CMD_SET_TxRxFlr, /**<Set TxRxFlr */
AEC_CTRL_CMD_SET_ECRSD1, /**<Set ECRSD1 */
AEC_CTRL_CMD_SET_ECRSD2, /**<Set ECRSD2 */
AEC_CTRL_CMD_SET_RSDBAND, /**<Set RSDBAND */
AEC_CTRL_CMD_SET_NS_PARA, /**<Set ns parameter */
AEC_CTRL_CMD_SET_PARAMS, /**<Set parameters */
AEC_CTRL_CMD_SET_EC_COE, /**<Set EC_COE */
AEC_CTRL_CMD_SET_DRC_TAB, /**<Set DRC_TAB */
AEC_CTRL_CMD_GET_RX_BUF, /**<Get rx buffer addr */
AEC_CTRL_CMD_GET_TX_BUF, /**<Get tx buffer addr */
AEC_CTRL_CMD_GET_OUT_BUF, /**<Get output buffer addr */
AEC_CTRL_CMD_GET_FRAME_SAMPLE, /**<Get frame sample */
};
/**
* @}
*/
/**
* @brief AUD struct defines
* @defgroup bk_api_aud_structs structs in AUD
* @ingroup bk_api_aud
* @{
*/
/**
* @}
*/
/**
* @brief AEC API
* @defgroup AEC API group
* @{
*/
/**
* @brief Get AECContext size (byte)
*
* @param delay delay samples
*
* @return
* - uint32_t: size(byte)
*/
uint32_t aec_size (uint32_t delay);
/**
* @brief Init aec
*
* This API init aec function :
* - Set aec parameters
* - Init fft parameters
*
* Usage example:
*
*
* AECContext* aec = NULL;
*
* //malloc aec memory
* aec = (AECContext*)os_malloc(aec_size());
*
* //init aec
* aec_init(aec, 16000);
*
*
* @param aec aec parameters
* @param fs frame sample 8K/16K
*
* @return none
*/
void aec_init (AECContext* aec, int16_t fs);
/**
* @brief Control aec
*
* This API control aec function :
* - Set aec parameters
* - Get data addr
*
* Usage example:
*
*
* AECContext* aec = NULL;
*
* //malloc aec memory
* aec = (AECContext*)os_malloc(aec_size());
*
* //init aec
* aec_init(aec, 16000);
*
* //set mic delay
* aec_ctrl(aec, AEC_CTRL_CMD_SET_MIC_DELAY, 10);
*
*
* @param aec aec parameters
* @param cmd control command in enum AEC_CTRL_CMD
* @param arg value
*
* @return none
*/
void aec_ctrl (AECContext* aec, uint32_t cmd, uint32_t arg);
/**
* @brief Control aec
*
* This API control aec function :
* - Set aec parameters
* - Get data addr
*
* Usage example:
*
*
* AECContext* aec = NULL;
*
* //malloc aec memory
* aec = (AECContext*)os_malloc(aec_size());
*
* //init aec
* aec_init(aec, 16000);
*
* //aec excute work
* aec_proc (aec, rin, sin, out);
*
*
* @param aec aec parameters
* @param rin reference data
* @param sin source data
* @param out output data
*
* @return none
*/
void aec_proc (AECContext* aec, int16_t* rin, int16_t* sin, int16_t* out);
/**
* @}
*/
#ifdef __cplusplus
}
#endif//__cplusplus
#endif//__AEC_H__