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 version 2, as
00014  * published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  *
00025  * $Id: complex_filters.h,v 1.9 2007/04/08 08:16:17 steveu Exp $
00026  */
00027 
00028 #if !defined(_SPANDSP_COMPLEX_FILTERS_H_)
00029 #define _SPANDSP_COMPLEX_FILTERS_H_
00030 
00031 typedef struct filter_s filter_t;
00032 
00033 typedef float (*filter_step_func_t)(filter_t *fi, float x);
00034 
00035 typedef struct
00036 {
00037     int                 nz;
00038     int                 np;
00039     filter_step_func_t  fsf;
00040 } fspec_t;
00041 
00042 struct filter_s
00043 {
00044     fspec_t             *fs;
00045     float               sum;
00046     int                 ptr;            /* for moving average filters only */
00047     float               v[];
00048 };
00049 
00050 typedef struct
00051 {
00052     filter_t            *ref;
00053     filter_t            *imf;
00054 } cfilter_t;
00055 
00056 #if defined(__cplusplus)
00057 extern "C"
00058 {
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 complexf_t cfilter_step(cfilter_t *cfi, const complexf_t *z);
00068 
00069 #if defined(__cplusplus)
00070 }
00071 #endif
00072 
00073 #endif
00074 /*- End of file ------------------------------------------------------------*/

Generated on Tue Jul 24 11:29:28 2007 for libspandsp by  doxygen 1.5.2