Question

I'm writing a wavelet representation of images in C++ for fast access. What would be the suitable data structure for wavelet?

Here is a typical wavelet, consisting of images at different sizes. It depends on the height and the number of orientations.

1) Highpass: 512x512

2) Subbands with orientations: 256x256 256x256 256x256 256x256

3) Other subbands: 128x128 128x128 128x128 128x128

...

4) Lowpass: 8x8

Should I use recursive data structure? Or simply convert everything to 1-D array?

Was it helpful?

Solution

The answer is: it depends. From a programming abstraction point of view, it's probably simplest to create separate arrays for each sub-image. I would make them one-d arrays that you access as 2-d in an abstraction. The countervailing impulse is to allocate one big array and portion off pieces of it, essentially doing your own memory management. A lot of C++ programs spend most of their time in malloc()/free(), so this might seem appealing, but I don't think it's worth it. Spend your time working on the algorithm, not the tools. Later if you need to tweak it for the last iota of performance, you can do that.

OTHER TIPS

Hoping that talk about the same topic I think that The wavelet matrix article will clarify.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top