File: filterbank.h

package info (click to toggle)
libepsilon 0.9.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,168 kB
  • ctags: 1,205
  • sloc: ansic: 11,329; sh: 9,321; perl: 936; xml: 86; makefile: 84
file content (125 lines) | stat: -rw-r--r-- 3,377 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 * $Id: filterbank.h,v 1.17 2010/02/05 23:50:22 simakov Exp $
 *
 * EPSILON - wavelet image compression library.
 * Copyright (C) 2006,2007,2010 Alexander Simakov, <xander@entropyware.info>
 *
 * This file is part of EPSILON
 *
 * EPSILON is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * EPSILON is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with EPSILON.  If not, see <http://www.gnu.org/licenses/>.
 *
 * http://epsilon-project.sourceforge.net
 */

/** \file
 *
 *  \brief Filter banks
 *
 *  This file holds defines for filter and filterbank
 *  data structures.
 *
 *  \section References
 *
 *  Gilbert Strang, Truong Nguyen "Wavelets and Filter Banks". */

#ifndef __FILTERBANK_H__
#define __FILTERBANK_H__

#ifdef __cplusplus
extern "C" {
#endif

/** \addtogroup wavelet Wavelet transform */
/*@{*/

#include <common.h>

/** Causal filter: h[i] = 0, i < 0 */
#define CAUSAL                  0
/** Anticausal filter: h[i] = 0, i > 0 */
#define ANTICAUSAL              1
/** Symmetric-whole filter: h[-i] = h[i] */
#define SYMMETRIC_WHOLE         2
/** Symmetric-half filter: h[-i] = h[i - 1] */
#define SYMMETRIC_HALF          3

/** Lowpass analysis filter */
#define LOWPASS_ANALYSIS        0
/** Highpass analysis filter */
#define HIGHPASS_ANALYSIS       1
/** Lowpass synthesis filter */
#define LOWPASS_SYNTHESIS       2
/** Highpass synthesis filter */
#define HIGHPASS_SYNTHESIS      3

/** Orthogonal filterbank */
#define ORTHOGONAL              0
/** Biothogonal filterbank */
#define BIORTHOGONAL            1

/** Even subsampling phase */
#define PHASE_EVEN              0
/** Odd subsampling phase */
#define PHASE_ODD               1

/** Filter structure
 *
 *  This structure represents a standalone filter.
 *
 *  \note There is no need to keep all coefficients for symmetric
 *  filters. Only half (h[i], i >= 0) of them is kept. */
typedef struct filter_t_tag {
    /** Filter length */
    int length;
    /** Filter causality */
    int causality;
    /** Filter type */
    int type;
    /** Filter coefficients */
    coeff_t *coeffs;
} filter_t;

/** Filterbank structure
 *
 *  Filter bank consists of two filter pairs. */
typedef struct filterbank_t_tag {
    /** Short filter name (for a program) */
    char *id;
    /** Long filter name (for a user) */
    char *name;
    /** Filterbank type */
    int type;
    /** Lowpass analysis filter */
    filter_t *lowpass_analysis;
    /** Highpass analysis filter */
    filter_t *highpass_analysis;
    /** Lowpass synthesis filter */
    filter_t *lowpass_synthesis;
    /** Highpass synthesis filter */
    filter_t *highpass_synthesis;
} filterbank_t;

/** External array of all available filter banks
 *
 *  This array hold pointers to all available filter banks.
 *  Last element is always \c NULL. */
extern filterbank_t *filterbanks[];

/*@}*/

#ifdef __cplusplus
}
#endif

#endif /* __FILTERBANK_H__ */