1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __DUAL_MIC_DENOISE_H__ 5 #define __DUAL_MIC_DENOISE_H__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 #define DUAL_MIC_DENOISE_GET_CALIBRATION_COEF_LEN (0) 12 #define DUAL_MIC_DENOISE_GET_CALIBRATION_COEF (1) 13 #define DUAL_MIC_DENOISE_SET_CALIBRATION_COEF (2) 14 15 typedef struct { 16 int bypass; 17 float alpha_h; 18 float alpha_slow; 19 float alpha_fast; 20 float thegma; 21 float thre_corr; 22 float thre_filter_diff; 23 float cal_left_gain; 24 float cal_right_gain; 25 int delay_mono_sample; 26 int wnr_enable; 27 } DUAL_MIC_DENOISE_CFG_T; 28 29 /** 30 * @brief Initialization 31 * 32 * @param alloc_ext The allocate extent RAM 33 * @param cfg The configuration set parameter 34 */ 35 void dual_mic_denoise_init(int32_t sample_rate, int32_t frame_size, const DUAL_MIC_DENOISE_CFG_T *cfg, void* (* alloc_ext)(int)); 36 37 /** 38 * @brief Run 39 * 40 * @param in input sample buffer 41 * sample rate: 16k; 42 * sample bit: 16; 43 * channel num: 2; 44 * LRLRLR......: Left: main mic, Right: assist mic 45 * @param out output sample buffer 46 * sample rate: 16k; 47 * sample bit: 16; 48 * channel num: 1; 49 * @param[in] len The length is sample number 50 */ 51 void dual_mic_denoise_run(short *in, short len, short *out); 52 53 /** 54 * @brief Calibrate left and right gain 55 * 56 * @param in Same as dual_mic_denoise_run definition 57 * @param[in] len Same as dual_mic_denoise_run definition 58 * @param[out] cfg Return calibrate configure parameter 59 */ 60 void dual_mic_denoise_Cal_Gain(short *in, short len, DUAL_MIC_DENOISE_CFG_T *cfg); 61 62 /** 63 * @brief Oppose initialization 64 */ 65 void dual_mic_denoise_deinit(void); 66 67 int dual_mic_denoise_ctl(int ctl, void *ptr); 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif