5
|
1 /*
|
|
2 * SpanDSP - a series of DSP components for telephony
|
|
3 *
|
|
4 * complex_filters.h
|
|
5 *
|
|
6 * Written by Steve Underwood <steveu@coppice.org>
|
|
7 *
|
|
8 * Copyright (C) 2003 Steve Underwood
|
|
9 *
|
|
10 * All rights reserved.
|
|
11 *
|
|
12 * This program is free software; you can redistribute it and/or modify
|
|
13 * it under the terms of the GNU General Public License version 2, as
|
|
14 * published by the Free Software Foundation.
|
|
15 *
|
|
16 * This program is distributed in the hope that it will be useful,
|
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 * GNU General Public License for more details.
|
|
20 *
|
|
21 * You should have received a copy of the GNU General Public License
|
|
22 * along with this program; if not, write to the Free Software
|
|
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
24 *
|
|
25 * $Id: complex_filters.h,v 1.6 2006/10/24 13:45:28 steveu Exp $
|
|
26 */
|
|
27
|
|
28 #if !defined(_COMPLEX_FILTERS_H_)
|
|
29 #define _COMPLEX_FILTERS_H_
|
|
30
|
|
31 typedef struct filter_s filter_t;
|
|
32
|
|
33 typedef float (*filter_step_func_t)(filter_t *fi, float x);
|
|
34
|
|
35 typedef struct
|
|
36 {
|
|
37 int nz;
|
|
38 int np;
|
|
39 filter_step_func_t fsf;
|
|
40 } fspec_t;
|
|
41
|
|
42 struct filter_s
|
|
43 {
|
|
44 fspec_t *fs;
|
|
45 float sum;
|
|
46 int ptr; /* for moving average filters only */
|
|
47 float v[];
|
|
48 };
|
|
49
|
|
50 typedef struct
|
|
51 {
|
|
52 filter_t *ref;
|
|
53 filter_t *imf;
|
|
54 } cfilter_t;
|
|
55
|
|
56 #ifdef __cplusplus
|
|
57 extern "C" {
|
|
58 #endif
|
|
59
|
|
60 filter_t *filter_create(fspec_t *fs);
|
|
61 void filter_delete(filter_t *fi);
|
|
62 float filter_step(filter_t *fi, float x);
|
|
63
|
|
64 cfilter_t *cfilter_create(fspec_t *fs);
|
|
65 void cfilter_delete(cfilter_t *cfi);
|
|
66 complexf_t cfilter_step(cfilter_t *cfi, const complexf_t *z);
|
|
67
|
|
68 #ifdef __cplusplus
|
|
69 }
|
|
70 #endif
|
|
71
|
|
72 #endif
|
|
73 /*- End of file ------------------------------------------------------------*/
|