1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef ECHO_CANCELLER_H 5 #define ECHO_CANCELLER_H 6 7 #include <stdint.h> 8 #include <stdbool.h> 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 typedef struct 15 { 16 int32_t bypass; 17 int32_t hpf_enabled; 18 int32_t af_enabled; 19 int32_t nlp_enabled; 20 int32_t clip_enabled; 21 int32_t stsupp_enabled; 22 int32_t ns_enabled; 23 int32_t cng_enabled; 24 // af config 25 int32_t blocks; 26 int32_t delay; 27 // nlp config 28 float min_ovrd; 29 float target_supp; 30 // ns config 31 float noise_supp; 32 // cng config 33 int32_t cng_type; // 0 - white noise, 1 - pink noise 34 float cng_level; 35 // clip 36 float clip_threshold; 37 int32_t banks; 38 } Ec2FloatConfig; 39 40 struct Ec2FloatState_; 41 42 typedef struct Ec2FloatState_ Ec2FloatState; 43 44 Ec2FloatState *ec2float_create(int sample_rate, int frame_size, const Ec2FloatConfig *cfg); 45 46 int32_t ec2float_destroy(Ec2FloatState *st); 47 48 int32_t ec2float_set_config(Ec2FloatState *st, const Ec2FloatConfig *cfg); 49 50 int32_t ec2float_process(Ec2FloatState *st, int16_t *pcm_in, int16_t *pcm_ref, int32_t pcm_len, int16_t *pcm_out); 51 52 int32_t ec2float_set_external_vad(Ec2FloatState *st, bool vad); 53 54 float ec2float_get_required_mips(Ec2FloatState *st); 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif