complex_filters.h

00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * complex_filters.h
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2003 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025  *
00026  * $Id: complex_filters.h,v 1.2 2004/03/30 14:29:40 steveu Exp $
00027  */
00028 
00029 #if !defined(_COMPLEX_FILTERS_H_)
00030 #define _COMPLEX_FILTERS_H_
00031 
00032 typedef struct filter_s filter_t;
00033 
00034 typedef float (*filter_step_func_t)(filter_t *fi, float x);
00035 
00036 typedef struct
00037 {
00038     int                 nz;
00039     int                 np;
00040     filter_step_func_t  fsf;
00041 } fspec_t;
00042 
00043 struct filter_s
00044 {
00045     fspec_t             *fs;
00046     float               sum;
00047     int                 ptr;            /* for moving average filters only */
00048     float               v[0];
00049 };
00050 
00051 typedef struct
00052 {
00053     filter_t            *ref;
00054     filter_t            *imf;
00055 } cfilter_t;
00056 
00057 #ifdef __cplusplus
00058 extern "C" {
00059 #endif
00060 
00061 filter_t *filter_create(fspec_t *fs);
00062 void filter_delete(filter_t *fi);
00063 float filter_step(filter_t *fi, float x);
00064 
00065 cfilter_t *cfilter_create(fspec_t *fs);
00066 void cfilter_delete(cfilter_t *cfi);
00067 complex_t cfilter_step(cfilter_t *cfi, const complex_t *z);
00068 
00069 #ifdef __cplusplus
00070 }
00071 #endif
00072 
00073 #endif
00074 /*- End of file ------------------------------------------------------------*/

Generated on Fri Nov 10 09:40:23 2006 for libspandsp by  doxygen 1.5.1