| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <stdio.h> |
| 7 |
|
| 8 |
#include "wt.h" |
| 9 |
|
| 10 |
int main(){ |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
Wavelet *w = wavelet('d', 2); |
| 17 |
MODE mode = MODE_ZEROPAD; |
| 18 |
|
| 19 |
int i; |
| 20 |
float input[] = {1,2,3,4,5,6,7,8,9}; |
| 21 |
float *cA, *cD; |
| 22 |
pywt_index_t input_len, output_len; |
| 23 |
|
| 24 |
input_len = sizeof input / sizeof input[0]; |
| 25 |
output_len = dwt_buffer_length(input_len, w->dec_len, mode); |
| 26 |
|
| 27 |
cA = wtcalloc(output_len, sizeof(float)); |
| 28 |
cD = wtcalloc(output_len, sizeof(float)); |
| 29 |
|
| 30 |
printf("Wavelet: %s %d\n\n", w->family_name, w->vanishing_moments_psi); |
| 31 |
|
| 32 |
float_dec_a(input, input_len, w, cA, output_len, mode); |
| 33 |
float_dec_d(input, input_len, w, cD, output_len, mode); |
| 34 |
|
| 35 |
for(i=0; i<output_len; i++){ |
| 36 |
printf("%f ", cA[i]); |
| 37 |
} |
| 38 |
printf("\n\n"); |
| 39 |
|
| 40 |
for(i=0; i<output_len; i++){ |
| 41 |
printf("%f ", cD[i]); |
| 42 |
} |
| 43 |
printf("\n"); |
| 44 |
|
| 45 |
free_wavelet(w); |
| 46 |
wtfree(cA); |
| 47 |
wtfree(cD); |
| 48 |
return 0; |
| 49 |
} |