Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-15 13:56:10


From: "Ullrich Koethe" <u.koethe_at_[hidden]>
> Peter Dimov wrote:
> > The interface as presented to the user would be orthogonal:
> >
> > basic_image<bool, linear> // == basic_image<unsigned char, linear>
> > basic_image<bool, packed> // == vector<bool>
> > basic_image<bool, rle>
> > basic_image<unsigned char, linear>
> > basic_image<unsigned char, rle>
>
> So you would specialize algorithms on storage format (linear, packed,
> rle)? Interesting, but a lot of work (some algorithms are needed 3
> times).

Only where it makes sense.

Look at it this way. The choices are:

[1]

basic_image<T> - linear
packed_image // always bool
rle_image // always bool

[2]

basic_image<T>
basic_image<packed_bool>
basic_image<rle_bool>

or [3] - see above.

The difference is that in [3] you may choose what to specialize and what to
leave to the generic version to handle.

> > True, with an accessor layer on top it doesn't matter whether it's
> >
> > image<double, 3>
> >
> > or
> >
> > image<array<double, 3> >
> >
> > (when the number of channels is fixed at compile time, which it might
not be
> > if you want to load PSDs or other multichannel formats.)
> >
>
> No, I also have accessors for variable band formats (SequenceAccessor,
> VectorAccessor and VectorBandAccessor)

True, but having

image<std::vector<unsigned char> >

would be quite inefficient since the vectors won't exploit the fact that
they are the same size. Or am I missing something.

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk