Skip to content

victorb64/simple-DWT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

47969b8 · Oct 6, 2021

History

5 Commits
Oct 6, 2021
Oct 6, 2021
Oct 6, 2021
Oct 6, 2021

Repository files navigation

simple-DWT

a simple C library for DWT and IDWT mainly for micros. pretty compatible with pywt

needed work buffer size is determined at compile time based on your decomposition level requirements

use pywt to export your filters

todos

vector multiplication and copy

usage

static float32_t coif4HighFilter[] = { -0.000892313902537003, -0.001629492425226786, 0.007346167936268051, 0.01606894713157503, -0.02668230466960483, -0.08126671024919373, 0.05607731960356926, 0.41530842700068227, -0.7822389344242826, 0.43438603311435653, 0.06662747236681717, -0.09622042453595264, -0.03933442260558915, 0.02508225333794961, 0.015211728187697211, -0.0056582838001308835, -0.0037514346971460866, 0.0012665610789256603, 0.0005890202246332165, -0.0002599743371222568, -6.233885431278719e-05, 3.1229861599195265e-05, 3.259647940030751e-06, -1.7849909144933469e-06 };
static float32_t coif4LowFilter[] = { -1.7849909144933469e-06, -3.259647940030751e-06, 3.1229861599195265e-05, 6.233885431278719e-05, -0.0002599743371222568, -0.0005890202246332165, 0.0012665610789256603, 0.0037514346971460866, -0.0056582838001308835, -0.015211728187697211, 0.02508225333794961, 0.03933442260558915, -0.09622042453595264, -0.06662747236681717, 0.43438603311435653, 0.7822389344242826, 0.41530842700068227, -0.05607731960356926, -0.08126671024919373, 0.02668230466960483, 0.01606894713157503, -0.007346167936268051, -0.001629492425226786, 0.000892313902537003 };

DWT_ctx dwtctx;
DWT_Out dwtOut;
static float indata[128] = { 2603.14,1934.47,1480.34,1738.37,2807.33,4263.94,5402.56,5673.5,5034.78,3951.12,3054.67,2801.37,2333.8,2781.86,2363.62,1562.36,869.446,877.83,1821.63,3358.14,4755.37,5329.68,4886.09,3816.41,3857.36,2568.9,2405.47,2574.94,2355.6,1636.5,809.348,511.893,1157.88,2597.08,4169.32,5085.05,4915.54,4096.61,3310.8,1709.39,1497.56,1615.17,1511.31,881.755,-46.7874,-648.383,-349.094,913.504,2594.49,3859.63,3980.62,4670.51,2089.39,1179.55,974.483,1283.34,1530.69,1242.81,450.049,-298.968,-318.741,693.306,2393.55,1206.89,2899.81,4188.17,2921.03,1626.91,920.753,888.224,1102.16,1006.66,385.256,-437.531,-810.675,-240.609,-956.958,245.228,4001.11,3991.55,2998.86,1681.27,756.961,523.118,703.526,730.304,239.318,-604.869,-1201.88,-1733.77,-1698.86,1901.88,3183.35,3439.12,2621.25,1278.55,166.01,-271.105,-158.344,-24.0203,-328.285,-1065.52,-773.645,-1569.66,-696.557,917.57,2358.86,2893.06,2316.13,1072.63,-67.7551,-543.069,-362.24,-32.3427,-120.572,-773.645,-1569.66,-1810.53,-1041.77,567.938,2300.26,3307.71,3139.2,2026.2,694.501,-137.526,-226.133,0 };
#define SAMPLESIZE 128
#define FILTERSIZE 24
#define DECLEVELS 4
float dwtbuffer[DWTBUFSIZE_4(SAMPLESIZE, FILTERSIZE)] = { 0 };
DWT_Init(&dwtctx,sizeof(coif4HighFilter) / sizeof(float), coif4HighFilter, coif4LowFilter, DWT_PADDING_SYMMETRIC, 4, dwtbuffer, DWTBUFSIZE_4(SAMPLESIZE, FILTERSIZE), SAMPLESIZE);
DWT_Decomposition(&dwtctx, indata, SAMPLESIZE, &dwtOut);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages