Developer World
Spresense SDK Library v3.2.0-ebc0364
fir_filter.h
Go to the documentation of this file.
1/****************************************************************************
2 * modules/include/digital_filter/fir_filter.h
3 *
4 * Copyright 2021 Sony Semiconductor Solutions Corporation
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17 * the names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior written
19 * permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 ****************************************************************************/
35
40#ifndef __INCLUDE_FILTERS_FIR_FILTER_H
41#define __INCLUDE_FILTERS_FIR_FILTER_H
42
50#include <nuttx/config.h>
51
52#ifdef CONFIG_EXTERNALS_CMSIS_DSP
53#include <arm_math.h>
54
64typedef arm_fir_instance_f32 fir_instancef_t;
65
68#else
69#error "FIR filter needs CMSIS DSP library"
70#endif
71
72# ifdef __cplusplus
73# define EXTERN extern "C"
74extern "C"
75{
76# else
77# define EXTERN extern
78# endif
79
80/********************************************************************************
81 * Public Function Prototypes
82 ********************************************************************************/
83
97int fir_calc_tapnumber(int fs, int tr_width);
98
112fir_instancef_t * fir_create_lpff(int fs, int cutoff_freq,
113 int tr_width, int blocksz);
114
128fir_instancef_t * fir_create_lpff_tap(int fs, int cutoff_freq,
129 int taps, int blocksz);
130
144fir_instancef_t * fir_create_hpff(int fs, int cutoff_freq,
145 int tr_width, int blocksz);
146
160fir_instancef_t * fir_create_hpff_tap(int fs, int cutoff_freq,
161 int taps, int blocksz);
162
176fir_instancef_t * fir_create_bpff(int fs, int lower_cutfreq, int higher_cutfreq,
177 int tr_width, int blocksz);
178
192fir_instancef_t * fir_create_bpff_tap(int fs, int lower_cutfreq, int higher_cutfreq,
193 int taps, int blocksz);
194
208fir_instancef_t * fir_create_beff(int fs, int lower_cutfreq, int higher_cutfreq,
209 int tr_width, int blocksz);
210
224fir_instancef_t * fir_create_beff_tap(int fs, int lower_cutfreq, int higher_cutfreq,
225 int taps, int blocksz);
226
234int fir_get_tapnumf(fir_instancef_t *fir);
235
245void fir_executef(fir_instancef_t *fir, float *input, float *output, int len);
246
256void firabs_executef(fir_instancef_t *fir, float *input, float *output, int len);
257
263void fir_deletef(fir_instancef_t *fir);
264
267# undef EXTERN
268# ifdef __cplusplus
269}
270# endif
271
274#endif /* __INCLUDE_FILTERS_FIR_FILTER_H */
void fir_executef(fir_instancef_t *fir, float *input, float *output, int len)
fir_instancef_t * fir_create_hpff_tap(int fs, int cutoff_freq, int taps, int blocksz)
void firabs_executef(fir_instancef_t *fir, float *input, float *output, int len)
fir_instancef_t * fir_create_lpff_tap(int fs, int cutoff_freq, int taps, int blocksz)
fir_instancef_t * fir_create_hpff(int fs, int cutoff_freq, int tr_width, int blocksz)
fir_instancef_t * fir_create_bpff_tap(int fs, int lower_cutfreq, int higher_cutfreq, int taps, int blocksz)
fir_instancef_t * fir_create_bpff(int fs, int lower_cutfreq, int higher_cutfreq, int tr_width, int blocksz)
void fir_deletef(fir_instancef_t *fir)
fir_instancef_t * fir_create_lpff(int fs, int cutoff_freq, int tr_width, int blocksz)
fir_instancef_t * fir_create_beff(int fs, int lower_cutfreq, int higher_cutfreq, int tr_width, int blocksz)
int fir_get_tapnumf(fir_instancef_t *fir)
int fir_calc_tapnumber(int fs, int tr_width)
fir_instancef_t * fir_create_beff_tap(int fs, int lower_cutfreq, int higher_cutfreq, int taps, int blocksz)