Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

yoavnaveh

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-04-2011
01:33 AM

28 Views

wavelet transform 1D

I have experience with the 2D wavelet transform, and I have a 2D multy level wavelet transform based compression application. Now, I need to extend the transform in the following way - on 1 dimension I want to do a (1D) wavelet transform and on the other dimension I want to do a (1D) discete cosine transform.

When I read the manual of the 1D wavelet transform I couldn't understand it: the interface is totally different from the 2D case; I don't get all those delays (they's probably related to border extensions, but I don't get it).

can you refere me to the underlying implementation of ippiWTFwd & ippiWTInv? that can set the connection between the 2D case and the 1D case. If not, how can I understand all this delays - I'm only working on a predefined data set (no streaming or anything like that).

--------------------------------------------------------------------------------------------------------------------------

I've found the following example in a previous thread (given by you). my questions will be in

#include

#include "ipp.h"

// Filter bank for Db, order 2, filter

static const int fwdFltLenL = 4;

static const int fwdFltLenH = 4;

static const float fwdFltL[4] =

{

-1.294095225509215e-001f,

2.241438680418574e-001f,

8.365163037374690e-001f,

4.829629131446903e-001f

};

static const float fwdFltH[4] =

{

-4.829629131446903e-001f,

8.365163037374690e-001f,

-2.241438680418574e-001f,

-1.294095225509215e-001f

};

static const int invFltLenL = 4;

static const int invFltLenH = 4;

static const float invFltL[4] =

{

4.829629131446903e-001f,

8.365163037374690e-001f,

2.241438680418574e-001f,

-1.294095225509215e-001

};

static const float invFltH[4] =

{

-1.294095225509215e-001,

-2.241438680418574e-001,

8.365163037374690e-001,

-4.829629131446903e-001

};

// minimal values, that corresponds to MATLAB calculations

static const int fwdFltOffsL = -1;

static const int fwdFltOffsH = -1;

// minimal values, that corresponds to MATLAB calculations

static const int invFltOffsL = 0;

static const int invFltOffsH = 0;

void main(void)

{

Ipp32f src[] = {1, -10, 324, 48, -483, 4, 7, -5532, 34, 8889, -57, 54};

Ipp32f low[7];

Ipp32f high[7];

int i;

printf("original:\\n");

for(i = 0; i < 12; i++) printf("%.0f; ", src*);*

printf("\\n");

{

// actually it can be single pointer for this offsets,

// but in general case it need to be different

Ipp32f srcExtBegL[2] = {src[10], src[11]}; // wrap [fwdFltLenL + fwdFltOffsL - 1] elements

Ipp32f srcExtBegH[2] = {src[10], src[11]}; // wrap [fwdFltLenH + fwdFltOffsH - 1] elements

Ipp32f srcExtEnd[] = { src[0], src[1] }; // to emulate MATLAB excessive 7's element, that repeat first

IppsWTFwdState_32f* state;

ippsWTFwdInitAlloc_32f (&state, fwdFltL, fwdFltLenL, fwdFltOffsL, fwdFltH, fwdFltLenH, fwdFltOffsH);

ippsWTFwdSetDlyLine_32f( state, srcExtBegL, srcExtBegH);

ippsWTFwd_32f (src, low, high, 6, state);

ippsWTFwd_32f (srcExtEnd, &low[6], &high[6], 1, state);

ippsWTFwdFree_32f (state);

// *the forward part is relatively clear. still some questions: (1) the delay-lines lengths seems to follow from the fact thata 0 offset in ippsWTFwdInitAlloc_32f() for the low (high) filter means that the last sample of the filter is placed on the first sample of the data for the first convolution. is that right? (2) the ippsWTFwdSetDlyLine_32f() sets the "prehistory" of the data, that is set the extension on the beginning of the data. do I need laso to worry about the extension on the end? if not, why?*

// print decomposition result

printf("approx:\\n");

for(i = 0; i < 7; i++) printf("%.4f; ", low*);*

printf("\\n");

printf("details:\\n");

for(i = 0; i < 7; i++) printf("%.4f; ", high*);*

printf("\\n");

}

// note actually we simply do not need to keep MATLAB excessive low[6] & high[6] elements

// it can be applied as wrapped extension from first element

// let's change it to 'trash' to check it

low[6] = 1e20f;

high[6] = -1e10f;

{

// here is first data itself, that we need to place to delay line

// this is for non-shifted reconstruction for given conditions

// (filt. len. and offs.)

// see ippsWTInv_32f first call with &low[1] and &high[1]

// but in other conditions you may need to place wrapped data here also

Ipp32f extBegL[1] = {low[0]}; // [(invFltLenL + invFltOffsL - 1) / 2] elements

Ipp32f extBegH[1] = {high[0]}; // [(invFltLenH + invFltOffsH - 1) / 2] elements

// *why are the "beginning extensions" (infered by their names and usage) are initialized with the beginning of the data and not the end like in the forward case above?*

// we decide do not use low[6] and high[6], so

// we need to extend borders honestly by wrapping

// and, please, note

// we do not use BIG buffer and copying, just input data itself

// and little extension in other memory place

Ipp32f extEndL[1] = {low[0]};

Ipp32f extEndH[1] = {high[0]};

// *how do I determine the end extension lengths (for the beginning extensions I have the above formula) ?*

Ipp32f dst[12];

IppsWTInvState_32f* state;

ippsWTInvInitAlloc_32f (&state, invFltL, invFltLenL, invFltOffsL, invFltH, invFltLenH, invFltOffsH);

ippsWTInvSetDlyLine_32f( state, extBegL, extBegH);

ippsWTInv_32f (&low[1], &high[1], 5, dst, state);

ippsWTInv_32f (extEndL, extEndH, 1, &dst[10], state);

// *why do we have to call ippsWTInv_32f() twice? is it always with teh end extensions in the second call? how do I determine the data offset (in the above case the offset is 1) in teh first call?*

ippsWTInvFree_32f (state);

// print reconstruction result

int i;

printf("reconstruction:\\n");

for(i = 0; i < 12; i++) printf("%.0f; ", dst*);*

printf("\\n");

}

}

thanks,

Yoav

Link Copied

2 Replies

suyuanhang

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-13-2011
08:30 AM

28 Views

I want to implement Daubechies filter of order 6, but also stucked at the parameter settings, the wraping scheme here in the example seems very ad hoc.

Is there any example for wavelet transform of general case?

Naveen_G_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-23-2011
09:00 PM

28 Views

Hi,

Refre to PP User Manual for wavelet Example,i hope this will help you understand the parameter settings.

Thanks,

Naveen Gv

For more complete information about compiler optimizations, see our Optimization Notice.