Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Problem with 1D wavelet transform PR.

hrvoje_intel
Beginner
685 Views
Hi all,
I have a problem concerning the implementation of 1D wavelet transform in IPP.
I am using orthogonal wavelet transform with 4-tap (db2) filter coefficients.
The problem is that I am not able to get the perfect reconstruction.

For input signal:
1 2 3 4 5 6 7 8
i reconstruct:
6 7 8 1 2 3 4 5
I am using periodization for boundary extension.

I set the delayline in the following way:
for (i=0;i< dlyline_len;i++)
dlyline[dlyline_len-1-i]=in_sig[in_sig_len-1-i];

So dlyline is: 6 7 8.
With this dlyline i only set the starting boundary data, can I set the ending boundary data?
I do similar for the reconstruction phase.

I must say that I am not quite clear whether I am using the delay lines in the right way.
Can someone explain the use of delaylines?
Does somebody have a clue what am I doing wrong?

Thanks in advance,

Hrvoje Bogunovic
0 Kudos
6 Replies
Mikhail_Kulikov__Int
New Contributor I
685 Views
Hi,
Yes, it looks like ending boundary data is not filled.
1-D WT interface is intended to fit continuous signal (as well as FIR, IIR, LMS functions.) For the static data, when wrapped extension is used, it needs to copy "ending+starting" data to delay line, but "starting" after the end of original data (in case if you need non-wrapped output).
From lines of code it seems you need to move some starting data to the delay line also, not just place original vector ending. In the result there will be some place at the vector ending to extend it by wrapped starting data. The reconstructed data listing needs to be wrapped around by 3 elements, so may be you need just place first three samples to delay line and fill the end of vector by 1, 2, 3. But it may be also needed to distribute and align wrapping between both stages forward and inverse, if non-expanding decomposition is used (i.e. wrapping is applied on the inverse stage also).
Thanks and Regards,
Mikhail
0 Kudos
hrvoje_intel
Beginner
685 Views
Yes you were right.

I shifted the signal by one so that the first element is now in the delayline and the missing ending value of the signal is the wrapped element.
So the delayline looks like 781 then signal 23456781.
Now perfect reconstruction is satisfied.
Thank you for the suggestion.

I must say that I think it is a rather cumbersome way to work with 1D Wavelet Transoform.

Maybe a question for the Intel staff. What is wrong with the idea which is used in 2DWT where you just supply the surrounding memory locations of the input signal with extended values and perform the transform?

Regards,

Hrvoje Bogunovic
0 Kudos
Mikhail_Kulikov__Int
New Contributor I
685 Views
Thats right,
2D WT uses another (ROI) interface model and "ROI" also has a sense for 1D. At the same time in many cases the "delay line" model is very good for 1D processing, for example for audio filters and other streaming signal processing. So we need it a lot (as well as for FIR, IIR) and often it's the most common demand.
WT are very suitable for streaming data processing, but may be WT is used for entire data processing more frequently, than FIR or IIR, especially in scientific/educational tools.
There is a way to place ROI-like interface request for 1D WT through http://premier.intel.com/, like feature request. It will be individually tracked and it helps to develop/extend IPP design also.
Thank You and Regards,
Mikhail
0 Kudos
jimmyliu51
Beginner
685 Views
I still coundn't understand how you solve the problem.
Do you use both high and low pass delay lines? I am having a similar
problem.
0 Kudos
hrvoje_intel
Beginner
685 Views
I can not say that I understand the idea completely but I have managed to make perfect reconstruction.

Here is how it goes.

First of all it is the same procedure for both low pass and high pass filtering as well as for the analysis and the reconstruction phase.
One part of wavelet decomposition is FIR filtering of the signal. The problem when performing the FIR filtering is what to do with the boundaries because clasic zero padding will not work (at least not if you want to have exactly tha half the number of coefficients after one decomposition step as implemented in IPP).

The procedure with the delay lines is as follows:
You need to put some bondary extrapolated values and shift some data values into the delay line. Since you shifted some data values into the delay line you need to fill the now missing signal values at the end. You fill it again with the extrapolated boundary values.



Example:

Signal [1 2 3 4 5 6 7 8], you have 4-coeff FIR filter and using periodic boundary extension.

Your delay line is 3 elements long since your FIR filter is positioned on the first element of the signal so you need 3 boundary values. Filtering will be performed in 8 subsequent steps. Now you shift the signal by one position to the left into the delay line. The reason for this is that you want to simetrically spread the boundary influence on both sides of the signal not just the front one. For longer FIR filters larger shift is required.

So the delay line is [6 7 1] and now fill this the missing value of the signal with boundary extension value. Now you have the delay line [6 7 1] then the signal [2 3 4 5 6 7 8 1]. Use these two in your IPP wavelet function.



Regards,
Hrvoje
0 Kudos
Mikhail_Kulikov__Int
New Contributor I
685 Views
Hi,
You also may look example how to use IPP Wavelet Transform functions from signal processing domain in the message #1986
WBR,
Mikhail
0 Kudos
Reply