1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef IIR_RESAMPLE_H
5 #define IIR_RESAMPLE_H
6 
7 #include <stdint.h>
8 
9 enum IIR_RESAMPLE_MODE
10 {
11     IIR_RESAMPLE_MODE_1TO2 = 0,
12     IIR_RESAMPLE_MODE_1TO3,
13     IIR_RESAMPLE_MODE_1TO6,
14     IIR_RESAMPLE_MODE_2TO1,
15     IIR_RESAMPLE_MODE_3TO1,
16     IIR_RESAMPLE_MODE_6TO1,
17     IIR_RESAMPLE_MODE_NUM,
18 };
19 
20 struct IirResampleState_;
21 
22 typedef struct IirResampleState_ IirResampleState;
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 IirResampleState *iir_resample_init(int frame_size, enum IIR_RESAMPLE_MODE mode);
29 
30 void iir_resample_destroy(IirResampleState *st);
31 
32 int iir_resample_needed_out_count(IirResampleState *st, int in_size);
33 
34 // frame_size is input buffer frame_size
35 void iir_resample_process(IirResampleState *st, int16_t *in, int16_t *out, int in_size);
36 
37 enum IIR_RESAMPLE_MODE iir_resample_choose_mode(int sr_in, int sr_out);
38 
39 #ifdef __cplusplus
40 }
41 #endif
42 
43 #endif