spandsp 0.0.6
|
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 Lesser General Public License version 2.1, 00014 * as 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 Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00025 00026 #if !defined(_SPANDSP_COMPLEX_FILTERS_H_) 00027 #define _SPANDSP_COMPLEX_FILTERS_H_ 00028 00029 typedef struct filter_s filter_t; 00030 00031 typedef float (*filter_step_func_t)(filter_t *fi, float x); 00032 00033 /*! Filter state */ 00034 typedef struct 00035 { 00036 int nz; 00037 int np; 00038 filter_step_func_t fsf; 00039 } fspec_t; 00040 00041 struct filter_s 00042 { 00043 fspec_t *fs; 00044 float sum; 00045 int ptr; /* Only for moving average filters */ 00046 float v[]; 00047 }; 00048 00049 typedef struct 00050 { 00051 filter_t *ref; 00052 filter_t *imf; 00053 } cfilter_t; 00054 00055 #if defined(__cplusplus) 00056 extern "C" 00057 { 00058 #endif 00059 00060 SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs); 00061 SPAN_DECLARE(void) filter_delete(filter_t *fi); 00062 SPAN_DECLARE(float) filter_step(filter_t *fi, float x); 00063 00064 SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs); 00065 SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi); 00066 SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z); 00067 00068 #if defined(__cplusplus) 00069 } 00070 #endif 00071 00072 #endif 00073 /*- End of file ------------------------------------------------------------*/