File: wavelets.h

package info (click to toggle)
pywavelets 1.4.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,680 kB
  • sloc: python: 8,849; ansic: 5,134; makefile: 93
file content (115 lines) | stat: -rw-r--r-- 2,712 bytes parent folder | download | duplicates (3)
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
/* Copyright (c) 2006-2012 Filip Wasilewski <http://en.ig.ma/>
 * Copyright (c) 2012-2016 The PyWavelets Developers
 *                         <https://github.com/PyWavelets/pywt>
 * See COPYING for license details.
 */

#pragma once

#include "common.h"

/* Wavelet symmetry properties */
typedef enum {
    UNKNOWN = -1,
    ASYMMETRIC = 0,
    NEAR_SYMMETRIC = 1,
    SYMMETRIC = 2,
    ANTI_SYMMETRIC = 3
} SYMMETRY;

/* Wavelet name */
typedef enum {
    HAAR,
    RBIO,
    DB,
    SYM,
    COIF,
    BIOR,
    DMEY,
    GAUS,
    MEXH,
    MORL,
    CGAU,
    SHAN,
    FBSP,
    CMOR
} WAVELET_NAME;


/* Wavelet structure holding pointers to filter arrays and property attributes */
typedef struct  {
    /* Wavelet properties */

    pywt_index_t support_width;

    SYMMETRY symmetry;

    unsigned int orthogonal:1;
    unsigned int biorthogonal:1;
    unsigned int compact_support:1;

    int _builtin;
    char* family_name;
    char* short_name;


} BaseWavelet;

typedef struct {
    BaseWavelet base;
    double* dec_hi_double;  /* highpass decomposition */
    double* dec_lo_double;  /* lowpass decomposition */
    double* rec_hi_double;  /* highpass reconstruction */
    double* rec_lo_double;  /* lowpass reconstruction */
    float* dec_hi_float;
    float* dec_lo_float;
    float* rec_hi_float;
    float* rec_lo_float;
    size_t dec_len;   /* length of decomposition filter */
    size_t rec_len;   /* length of reconstruction filter */

    int vanishing_moments_psi;
    int vanishing_moments_phi;

} DiscreteWavelet;

typedef struct {

    BaseWavelet base;
    float lower_bound;
    float upper_bound;
    /* Parameters for shan, fbsp, cmor*/
    int complex_cwt;
    float center_frequency;
    float bandwidth_frequency;
    unsigned int fbsp_order;

} ContinuousWavelet;


int is_discrete_wavelet(WAVELET_NAME name);

/*
 * Allocate Wavelet struct and set its attributes
 * name - (currently) a character codename of a wavelet family
 * order - order of the wavelet (ie. coif3 has order 3)
 */
DiscreteWavelet* discrete_wavelet(WAVELET_NAME name, unsigned int order);
ContinuousWavelet* continuous_wavelet(WAVELET_NAME name, unsigned int order);
/*
 * Allocate blank Discrete Wavelet with zero-filled filters of given length
 */
DiscreteWavelet* blank_discrete_wavelet(size_t filters_length);

ContinuousWavelet* blank_continuous_wavelet(void);

/* Deep copy Discrete Wavelet */
DiscreteWavelet* copy_discrete_wavelet(DiscreteWavelet* base);

/*
 * Free wavelet struct. Use this to free Wavelet allocated with
 * wavelet(...) or blank_wavelet(...) functions.
 */
void free_discrete_wavelet(DiscreteWavelet *wavelet);

void free_continuous_wavelet(ContinuousWavelet *wavelet);