|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2006-10-18 10:12:07
"Timothy M. Shead" <tshead_at_[hidden]> wrote in message
news:1161178677.13317.51.camel_at_joe.k-3d.com...
> On Wed, 2006-10-18 at 12:29 +0100, Andy Little wrote:
>> "Timothy M. Shead" <tshead_at_[hidden]> wrote in message
>> news:1161054851.13317.27.camel_at_joe.k-3d.com...
>> >I am trying to use GIL with the OpenEXR library, which uses
>> > half-precision floating-point channels:
>
>> I'm not sure if the following fits the bill , but it might provide some
>> ideas.
>>
>>
>> (quan arithmetic_promote header is :
>>
>> http://quan.cvs.sourceforge.net/quan/quan-trunk/quan/meta/arithmetic_promote.hpp?view=markup
>>
>
> Actually, you may have missed Lubomir's response to my message, which -
> in a nutshell - is to provide a specialization for conversion between
> the new and existing types:
Oh yes I missed it, sorry.
> namespace gil
> {
>
> /// Defines conversion from 16-bit-floats to 8-bit-integers
> template<>
> inline bits8 _channel_convert<bits8>(half Value)
> {
> return bits8(Value * 255);
> }
>
> /// Defines conversion from 8-bit-integers to 16-bit-floats
> template<>
> inline half _channel_convert<half>(bits8 Value)
> {
> return half(Value) / 255.0;
> }
>
> } // namespace gil
That looks like a lot less work, much better.
regards
Andy little
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk