Table of Contents
The advanced interface offers the following features which are not included in the basic interface:
Like the basic interface, the advanced interface consists of two functions. The names of these functions are also identical, but their signatures are different:
namespace wavelet_library { template<rank_t rank, class Filter, class TElem> error_code forward_wavelet_transform(const size_t* size, TElem* in, TElem* out, wt_flags f = WT_DEFAULT, int levels = -1); template<rank_t rank, class Filter, class TElem> error_code inverse_wavelet_transform(const size_t* size, TElem* in, TElem* out, wt_flags f = WT_DEFAULT, int levels = -1); }
The first two template arguments have to be specified explicitly in the function call, and they control respectively the rank of the wavelet transform and the wavelet filter (see below).
The third template arguments corresponds to the numerical type of the data to be treated.
The meaning of the run-time arguments is the same as for the basic interface.
The example presented above can be translated to the advanced interface
simply by including wavelet_library/advanced.hpp
and by replacing the call to forward_wavelet_transform
by:
spectral::wavelet_library::forward_wavelet_transform<1,spectral::filters::coiflet_2>(&N, x, y);
In the advanced interface, the specification of the wavelet filter
does not rely on a string descriptor, but rather on a tag-class mechanism.
The available tag classes are listed in the include file
transform/wavelets/filters/qmf_tags.hpp
.
They are defined in the namespace spectral::filters
.
Note that only the orthogonal filters
may be employed with KIWIWALI.
Let us assume that we want to extend the functionality of KIWIWALI to handle another wavelet filter, whose coefficients we know from a textbook or a paper.
By copy-paste starting from the tag-class filters::haar
,
we first define a new tag-class describing the properties of our filter.
Note that the midpoint
member variable is deprecated and actually not necessary.
struct my_filter { static const size_t static_size = 4; static const unsigned int vanishing_moments = 1; typedef my_filter Dual_t; static const char* name; }; const char* my_filter::name = "my_filter";
The filter coefficients have to be provided
through a specialization of the class template
spectral::qmf_predfined
,
which is defined in transform/wavelets/filters/qmf_predefined_runtime.hpp
.
Examples of this can be found in transform/wavelets/filters/qmf_predefined.hpp
.
For our filter, the specialization goes like this:
#include <boost/array.hpp> template<> struct qmf_predefined<my_filter> { typedef my_filter Tag_t; typedef double value_type; static const boost::array<value_type, Tag_t::static_size> value; };