Boost logo

Boost :

From: Hailin Jin (hljin_at_[hidden])
Date: 2006-10-17 13:40:24


Hi Ullrich and Jose -- GIL has something similar to promotion traits in
the numeric extension. Moreover, it is designed so that users can easily
override the default behaviors without sacrificing performance.

More specificly, the algorithms in the numeric extension allow users to
specify types for holding intermediate results. The intermediate types
are then passed into a set of pre-defined structs for doing fundamental
numerical operations such as addition, subtraction, etc (see
extension/numeric/pixel_numeric_operations.hpp). All the structs are
templated over input types (one, two or more) and output types, which
are often the intermediate types, and these structs are consistently
used throughout the numeric extension. As a result, the user can specify
either "float" or "double" as the intermediate type for convoluting a
"unsigned char" image with a "float" kernel.

Hailin

Ullrich Koethe wrote:
> Lubomir Bourdev wrote:
>
>>> The fact that GIL doesn't provide campling makes me argue it
>>> is not a mature library. It's such a basic need (I get this
>>>
>> >from reading the book!)
>>
>> To clamp a channel in GIL you can just say:
>>
>> T channel;
>> T clamped = std::min(channel, channel_max_value<T>());
>>
>>
>
> But that's not how things work in practice. When the data are already
> stored as type T, overflow has already occured. Moreover, the possibility
> of overflow typically arises deep inside some algorithm, where you cannot
> simply call std::min(), but need another mechanism (e.g. promotion traits).
>
> Ulli
>
>


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