xine-lib 1.2.11
filter.h
Go to the documentation of this file.
1/*=============================================================================
2 *
3 * This software has been released under the terms of the GNU Public
4 * license. See http://www.gnu.org/copyleft/gpl.html for details.
5 *
6 * Copyright 2001 Anders Johansson ajh@atri.curtin.edu.au
7 *
8 *=============================================================================
9 */
10
11#if !defined _DSP_H
12# error "Never use <filter.h> directly; include <dsp.h> instead"
13#endif
14
15#ifndef _FILTER_H
16#define _FILTER_H 1
17
18/* Design and implementation of different types of digital filters */
19
20/* Flags used for filter design */
21
22/* Filter characteristics */
23#define LP 0x00010000 /* Low pass */
24#define HP 0x00020000 /* High pass */
25#define BP 0x00040000 /* Band pass */
26#define BS 0x00080000 /* Band stop */
27#define TYPE_MASK 0x000F0000
28
29/* Window types */
30#define BOXCAR 0x00000001
31#define TRIANG 0x00000002
32#define HAMMING 0x00000004
33#define HANNING 0x00000008
34#define BLACKMAN 0x00000010
35#define FLATTOP 0x00000011
36#define KAISER 0x00000012
37#define WINDOW_MASK 0x0000001F
38
39/* Parallel filter design */
40#define FWD 0x00000001 /* Forward indexing of polyphase filter */
41#define REW 0x00000002 /* Reverse indexing of polyphase filter */
42#define ODD 0x00000010 /* Make filter HP */
43
44/* Exported functions */
45extern _ftype_t fir(unsigned int n, _ftype_t* w, _ftype_t* x);
46
47extern _ftype_t* pfir(unsigned int n, unsigned int k, unsigned int xi, _ftype_t** w, _ftype_t** x, _ftype_t* y, unsigned int s);
48
49extern int updateq(unsigned int n, unsigned int xi, _ftype_t* xq, _ftype_t* in);
50extern int updatepq(unsigned int n, unsigned int k, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s);
51
52extern int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt);
53
54extern int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags);
55extern void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs);
56void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef);
57
58extern int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef);
59
60/* Add new data to circular queue designed to be used with a FIR
61 * filter. xq is the circular queue, in pointing at the new sample, xi
62 * current index for xq and n the length of the filter. xq must be n*2
63 * long.
64 */
65#define updateq(n,xi,xq,in)\
66 xq[xi]=(xq)[(xi)+(n)]=*(in);\
67 xi=(++(xi))&((n)-1);
68
69#endif
#define _ftype_t
Definition: dsp.h:17
int szxform(const _ftype_t *a, const _ftype_t *b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef)
int design_fir(unsigned int n, _ftype_t *w, _ftype_t *fc, unsigned int flags, _ftype_t opt)
void bilinear(_ftype_t *a, _ftype_t *b, _ftype_t *k, _ftype_t fs, _ftype_t *coef)
int updatepq(unsigned int n, unsigned int k, unsigned int xi, _ftype_t **xq, _ftype_t *in, unsigned int s)
int design_pfir(unsigned int n, unsigned int k, _ftype_t *w, _ftype_t **pw, _ftype_t g, unsigned int flags)
_ftype_t fir(unsigned int n, _ftype_t *w, _ftype_t *x)
void prewarp(_ftype_t *a, _ftype_t fc, _ftype_t fs)
_ftype_t * pfir(unsigned int n, unsigned int k, unsigned int xi, _ftype_t **w, _ftype_t **x, _ftype_t *y, unsigned int s)
#define updateq(n, xi, xq, in)
Definition: filter.h:65
#define Q
Definition: upmix.c:45