JuliaDSP / Wavelets.jl

A Julia package for fast discrete wavelet transforms and utilities
Other
185 stars 30 forks source link

NondyadicFilters #20

Closed agbristol closed 9 years ago

agbristol commented 9 years ago

Some utility functions and modifications to transforms_filter.jl to support non-dyadic length signals in 1 and 2 dimensions when using filter-based transforms. For a transform by L levels, the length of the signal must be divisible by 2^L. For 2 dimensions, the requirement that the length of the signal be the same in both dimensions remains unchanged.

This PR changes a fundamental assumption underlying the inner loops. Previously, all input and output signals from filtdown and filtup were defined to be even in length (I think). Now, the output of filtdown and the input of filtup can be odd in length. As far as I can tell, this doesn't break anything. But its possible that some corner cases may cause something odd to happen. The only test I've tried (other than the test suite) is to transform signals whose length is divisible by 2^L, but not by 2^(L+1), thereby ensuring the final filtdown output has odd length, and the first filtup input has even length.

I've only changed transforms_filter because I don't understand lifting yet. I'm going to look at that next. If you want to delay incorporating the PR until non-dyadic lifting is added, that's fine. I thought you might want to see the direction this work is going in. I'd like to know if I've accidentally broken something too :)

gummif commented 9 years ago

All right great. If you could just change those tabs to 4 spaces then I will merge. Also, there is level j and level l, and I think it would maybe be more clear to say "transformed level l", or what do you think?

coveralls commented 9 years ago

Coverage Status

Changes Unknown when pulling b2b50cab7fd7f10c424a4d3fdc6fc3aa05336133 on agbristol:nondyadic3 into \ on JuliaDSP:master**.

agbristol commented 9 years ago

Tabs to spaces done as requested. As for levels j and l, I'd like to see l eventually replace j in this module. j is only useful for dyadic operations. As dyadic-only functions are replaced with sufficient-powers-of-two functions, j will disappear.

In the underlying maths, such as [1] "level" describes the number that is l in my changes, the number of time the filter bank has been applied + 1. This would mean renaming j to be something else. It's a dyadic array size parameter, but that's too long. Or maybe it isn't. A long name would discourage use. :) I don't have a better suggestion for a name right now.

I have some changes to the lifting transforms too, which replace j with l and enable non-dyadic signals to be used as input. I can add these to this PR, or open a new one. Which would you prefer?

Andrew

[1] Ripples in Mathematics, Jensen & la Cour-Harbo

gummif commented 9 years ago

That's true. It does simplify and make the code more general. Just continue to use this PR.

coveralls commented 9 years ago

Coverage Status

Changes Unknown when pulling 4c98362cab4d621ba4e476278ebb8c4d25c613b4 on agbristol:nondyadic3 into \ on JuliaDSP:master**.

agbristol commented 9 years ago

These latest changes allow the lifting functions to support non-dyadic signals.