ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: Elliott B on November 25, 2019, 01:46:55 PM

Title: Support EXR Chromaticities data type
Post by: Elliott B on November 25, 2019, 01:46:55 PM
OpenEXR can contain a variety of data types including float, int, string, and also "chromaticities" which is an array of 8 floats.  Exiftool 11.75 distorts the values of this type.  I'd like to request displaying these numbers accurately and as some sort of list data type.

exrheader (https://github.com/AcademySoftwareFoundation/openexr) shows it correctly:

CC (type chromaticities):
    red   (0.7347 0.2653)
    green (0 1)
    blue  (0.0001 -0.077)
    white (0.32168 0.33767)

Exiftool shows different values:
<OpenEXR:CC>0.73470002412796 0.265300005674362 0 1 9.99999974737875e-05 -0.0769999995827675 0.321680009365082 0.337669998407364</OpenEXR:CC>

Sample image:
https://mega.nz/#!18QmmaST!sZRFbhcw-5tAI0dhdWVOC9ESjsBwkw57KG11pvT1npY
Title: Re: Support EXR Chromaticities data type
Post by: Phil Harvey on November 25, 2019, 01:57:32 PM
Distorts?

It looks to me as if exrheader is rounding the result to 5 or 6 significant figures.  ExifTool is returning the actual stored value without rounding.

- Phil
Title: Re: Support EXR Chromaticities data type
Post by: Elliott B on November 25, 2019, 02:00:15 PM
I created this file using only 5 decimal places in each value in another application.
Title: Re: Support EXR Chromaticities data type
Post by: Phil Harvey on November 25, 2019, 02:09:27 PM
Yes, but the 32-bit floating-point representation is not exact.

- Phil
Title: Re: Support EXR Chromaticities data type
Post by: StarGeek on November 25, 2019, 02:24:03 PM
Quote from: Phil Harvey on November 25, 2019, 02:09:27 PM
Yes, but the 32-bit floating-point representation is not exact.

This is what I recall from my Comp Science classes many years ago.  While this article (http://effbot.org/pyfaq/why-are-floating-point-calculations-so-inaccurate.htm) is centered on Python, it applies to any floating point numbers.

If you type your original numbers into this floating point converter (https://www.h-schmidt.net/FloatConverter/IEEE754.html), you'll see that it results in the numbers that exiftool reports.

Edit: Additional StackOverflow answer (https://stackoverflow.com/questions/2100490/floating-point-inaccuracy-examples)
Title: Re: Support EXR Chromaticities data type
Post by: Elliott B on November 25, 2019, 02:29:30 PM
Ok thanks, I understand now.  Wow, this is an unfortunate limitation of decimal to binary conversion, making it impossible to get the exact value entered in the first place.  I guess the only way around this would be to use some kind of character encoding instead of treating the numbers as floats?
Title: Re: Support EXR Chromaticities data type
Post by: Phil Harvey on November 25, 2019, 03:56:59 PM
@StarGeek:  Cool floating point converter.  Thanks for the link and the additional info.

- Phil