blob: d8c6e912f72f56cbb77828604341384f1c065ddf [file] [log] [blame]
Amit Pundire6732bb2020-09-28 12:43:59 +05301/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef FIR_FILTER_H
18#define FIR_FILTER_H
19
20#include <stdint.h>
21
22typedef enum fir_filter_mode { FIR_SINGLE_FILTER = 0, FIR_PER_CHANNEL_FILTER } fir_filter_mode_t;
23
24typedef struct fir_filter {
25 fir_filter_mode_t mode;
26 uint32_t channels;
27 uint32_t filter_length;
28 uint32_t buffer_size;
29 int16_t* coeffs;
30 int16_t* state;
31} fir_filter_t;
32
33fir_filter_t* fir_init(uint32_t channels, fir_filter_mode_t mode, uint32_t filter_length,
34 uint32_t input_length, int16_t* coeffs);
35void fir_release(fir_filter_t* fir);
36void fir_reset(fir_filter_t* fir);
37void fir_process_interleaved(fir_filter_t* fir, int16_t* input, int16_t* output, uint32_t samples);
38
39#endif /* #ifndef FIR_FILTER_H */