Skip to content

Enable TIFF write of 'half' pixels, if "tiff:half" attribute is nonzero.#1283

Merged
lgritz merged 2 commits intoAcademySoftwareFoundation:masterfrom
lgritz:lg-tiffhalf
Dec 8, 2015
Merged

Enable TIFF write of 'half' pixels, if "tiff:half" attribute is nonzero.#1283
lgritz merged 2 commits intoAcademySoftwareFoundation:masterfrom
lgritz:lg-tiffhalf

Conversation

@lgritz
Copy link
Collaborator

@lgritz lgritz commented Dec 7, 2015

Enable TIFF write of 'half' pixels, if "tiff:half" attribute is nonzero.

Set up a global OIIO attribute "tiff:half" that sets the default globally, and also have the ImageOutput for TIFF recognize a per-file "tiff:half" override. The default in both cases is 0, meaning that requests for half pixel float files in the absence this attribute nonzero will be automatically be upgraded to float, which is more widely read.

The reason for this is that nearly every non-OIIO-based reader fails to correctly recognize half-valued pixels in TIFF files, including PhotoShop and Nuke 9. So you are urged not to write half tiff, unless you are sure that the only consumer of those files uses OIIO (which can read them properly), or have verified that other consumers in your pipeline get it right.

Here is the Adobe tech report describing this TIFF extension: http://chriscox.org/TIFFTN3d1.pdf

A typical OIIO use of this would be to create a half TIFF texture file:

    maketx in.tif -attrib tiff:half 1 -d half -o half.tx

Why would you do this? Because in my benchmarks, texture access of a half TIFF texture file is nearly twice the raw read performance of the equivalent OpenEXR half texture.

Along the way, I added the missing get_int_attribute, get_float_attribute, and get_string_attribute equivalents to the global OIIO::getattribute, to match how we have done it for the versions that are methods of ImageSpec, TextureSystem, and a number of other classes.

to make it match the way we allow those simple cases for ImageSpec and
other places where we get/set attributes.
Set up a global OIIO attribute "tiff:half" that sets the default globally,
and also have the ImageOutput for TIFF recognize a per-file "tiff:half"
override. The default in both cases is 0, meaning that requests for
half pixel float files in the absence this attribute nonzero will be
automatically be upgraded to float, which is more widely read.

The reason for this is that nearly every non-OIIO-based reader fails to
correctly recognize half-valued pixels in TIFF files, including
PhotoShop and Nuke 9. So you are urged not to write half tiff, unless
you are sure that the only consumer of those files uses OIIO (which can
read them properly), or have verified that other consumers in your
pipeline get it right.

Here is the Adobe tech report describing this TIFF extension:
http://chriscox.org/TIFFTN3d1.pdf

A typical OIIO use of this would be to create a half TIFF texture file:

    maketx in.tif -attrib tiff:half 1 -d half -o half.tx

Why would you do this? Because in my benchmarks, texture access of
a half TIFF texture file is nearly twice the raw read performance of
the equivalent OpenEXR half texture.
@fpsunflower
Copy link
Contributor

LGTM

@lgritz lgritz merged commit e27542d into AcademySoftwareFoundation:master Dec 8, 2015
@lgritz lgritz deleted the lg-tiffhalf branch December 8, 2015 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants