expand tabs
[platform/upstream/gstreamer.git] / gst / audioresample / functable.h
1 /* Resampling library
2  * Copyright (C) <2001> David Schleef <ds@schleef.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #ifndef __FUNCTABLE_H__
22 #define __FUNCTABLE_H__
23
24 typedef void FunctableFunc (double *fx, double *dfx, double x, void *closure);
25
26 typedef struct _Functable Functable;
27 struct _Functable {
28   int length;
29
30   double offset;
31   double multiplier;
32
33   double inv_multiplier;
34
35   double *fx;
36   double *dfx;
37 };
38
39 Functable *functable_new (void);
40 void functable_setup (Functable *t);
41 void functable_free (Functable *t);
42
43 void functable_set_length (Functable *t, int length);
44 void functable_set_offset (Functable *t, double offset);
45 void functable_set_multiplier (Functable *t, double multiplier);
46 void functable_calculate (Functable *t, FunctableFunc func, void *closure);
47 void functable_calculate_multiply (Functable *t, FunctableFunc func, void *closure);
48
49
50 double functable_evaluate (Functable *t,double x);
51
52 double functable_fir(Functable *t,double x0,int n,double *data,int len);
53 void functable_fir2(Functable *t,double *r0, double *r1, double x0,
54         int n,double *data,int len);
55
56 void functable_func_sinc(double *fx, double *dfx, double x, void *closure);
57 void functable_func_boxcar(double *fx, double *dfx, double x, void *closure);
58 void functable_func_hanning(double *fx, double *dfx, double x, void *closure);
59
60 #endif /* __PRIVATE_H__ */
61