Debian Codegraph @

pywt/_extensions/c/wavelets.h

raw symbols SCIP
1 /* Copyright (c) 2006-2012 Filip Wasilewski <http://en.ig.ma/>
2 * Copyright (c) 2012-2016 The PyWavelets Developers
3 * <https://github.com/PyWavelets/pywt>
4 * See COPYING for license details.
5 */
6
7 #pragma once
8
9 #include "common.h"
10
11 /* Wavelet symmetry properties */
12 typedef enum {
13 UNKNOWN = -1,
14 ASYMMETRIC = 0,
15 NEAR_SYMMETRIC = 1,
16 SYMMETRIC = 2,
17 ANTI_SYMMETRIC = 3
18 } SYMMETRY;
19
20 /* Wavelet name */
21 typedef enum {
22 HAAR,
23 RBIO,
24 DB,
25 SYM,
26 COIF,
27 BIOR,
28 DMEY,
29 GAUS,
30 MEXH,
31 MORL,
32 CGAU,
33 SHAN,
34 FBSP,
35 CMOR
36 } WAVELET_NAME;
37
38
39 /* Wavelet structure holding pointers to filter arrays and property attributes */
40 typedef struct {
41 /* Wavelet properties */
42
43 pywt_index_t support_width;
44
45 SYMMETRY symmetry;
46
47 unsigned int orthogonal:1;
48 unsigned int biorthogonal:1;
49 unsigned int compact_support:1;
50
51 int _builtin;
52 char* family_name;
53 char* short_name;
54
55
56 } BaseWavelet;
57
58 typedef struct {
59 BaseWavelet base;
60 double* dec_hi_double; /* highpass decomposition */
61 double* dec_lo_double; /* lowpass decomposition */
62 double* rec_hi_double; /* highpass reconstruction */
63 double* rec_lo_double; /* lowpass reconstruction */
64 float* dec_hi_float;
65 float* dec_lo_float;
66 float* rec_hi_float;
67 float* rec_lo_float;
68 size_t dec_len; /* length of decomposition filter */
69 size_t rec_len; /* length of reconstruction filter */
70
71 int vanishing_moments_psi;
72 int vanishing_moments_phi;
73
74 } DiscreteWavelet;
75
76 typedef struct {
77
78 BaseWavelet base;
79 float lower_bound;
80 float upper_bound;
81 /* Parameters for shan, fbsp, cmor*/
82 int complex_cwt;
83 float center_frequency;
84 float bandwidth_frequency;
85 unsigned int fbsp_order;
86
87 } ContinuousWavelet;
88
89
90 int is_discrete_wavelet(WAVELET_NAME name);
91
92 /*
93 * Allocate Wavelet struct and set its attributes
94 * name - (currently) a character codename of a wavelet family
95 * order - order of the wavelet (ie. coif3 has order 3)
96 */
97 DiscreteWavelet* discrete_wavelet(WAVELET_NAME name, unsigned int order);
98 ContinuousWavelet* continuous_wavelet(WAVELET_NAME name, unsigned int order);
99 /*
100 * Allocate blank Discrete Wavelet with zero-filled filters of given length
101 */
102 DiscreteWavelet* blank_discrete_wavelet(size_t filters_length);
103
104 ContinuousWavelet* blank_continuous_wavelet(void);
105
106 /* Deep copy Discrete Wavelet */
107 DiscreteWavelet* copy_discrete_wavelet(DiscreteWavelet* base);
108
109 /*
110 * Free wavelet struct. Use this to free Wavelet allocated with
111 * wavelet(...) or blank_wavelet(...) functions.
112 */
113 void free_discrete_wavelet(DiscreteWavelet *wavelet);
114
115 void free_continuous_wavelet(ContinuousWavelet *wavelet);