openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] Forgot the questions


From: Drew Hess
Subject: Re: [Openexr-devel] Forgot the questions
Date: Wed, 5 Mar 2003 11:00:22 -0800 (PST)

Hi Klas,

OpenEXR doesn't do any explicit log-encoding of data when it reads and
writes files.  At ILM we use 16-bit FP ("half") and 32-bit FP images and
have been moving away from log-encoded formats.

At any rate, if you really need log-encoded images, you can use the ImfLut 
class to implement a lookup table, and use that to encode/decode the 
values you write to/read from OpenEXR images.  If you're really ambitious, 
you could write a new compressor that does this for you.  See 
ImfCompressor.h for the base compressor class, and 
Imf{Zip,Piz,Rle}Compressor.h for compression schemes that we've 
implemented.

According to this page, ATI's 16-bit FP extension is not quite compatible 
with OpenEXR's 16-bit FP half datatype:

http://oss.sgi.com/projects/ogl-sample/registry/ATI/texture_float.txt

(The OpenEXR half datatype is documented in the source code, see half.h)

Specifically, ATI's format doesn't implement NaN or infinities.  
Therefore, there are (large) numbers in ATI's format that aren't
representable in OpenEXR's format.

The document also says, "It is acceptable for an implementation to treat
denormalized 16-bit FP numbers as zero."  OpenEXR's half format always
supports denormals (so does Nvidia's, as far as I know).

Finally, I can't find anything in that document that specifies the bitwise
layout of ATI's 16-bit FP numbers, though it's reasonable to assume that
it's s.e.m (sign bit, exponent, mantissa), which is the same as OpenEXR's
half format.

Other than that, the formats appear to be compatible.  It wouldn't be too
hard to write a converter.  To go from ATI 16-bit FP to OpenEXR half you
would probably want to round values greater than HALF_MAX to +inf, and
values less than -HALF_MAX to -inf. To go from OpenEXR half to ATI 16-bit
FP, you would need to do something reasonable with +/-inf and NaN values
-- set them to the max/min ATI value or 0.0, I guess.  If the bit layouts
aren't the same, you'd have to swizzle those as well.

But it would be dangerous simply to copy a 16-bit ATI FP framebuffer into
an OpenEXR image, because any over-range values would be silently
converted to infinities and NaNs, and might generate FP exceptions down
the line. 


-dwh-



On Tue, 5 Mar 2002, Klas Skogmar wrote:

> I forgot to submit the relevant questions in my previous email.
> 
> 1. Can EXR be logarithmic in any way, like the DPX format?
> 
> 2. Do you know about the compability with ATI's R300 (half values)?
> 
> /Klas







reply via email to

[Prev in Thread] Current Thread [Next in Thread]