EXR file formats and compression

Source Source Github CGI

Quick links: DWA · #B44A · #B44 · #PXR24 · #RLE · #ZIPS · #ZIP

Compression methods

ZIP

This compression method is a very good general purpose choice and is especially well suited for texture maps because it allows for fast file reading.

ZIPS

This compression method is similar to ZIP but compresses only one image row at a time.

RLE

A very fast compression format that provides good results for large areas with identical colors. Results are worse for images with a lot of detail.

PXR24

lossy

This format only stores 24 bits of the 32 bit data and has subsequently a significant loss of precision. This method is only applied when saving in FLOAT color depth. HALF and UINT remain unchanged.

B44

lossy

This compression method only applies to images stored in HALF color depth. Blocks of 4×4 pixels are stored with using only 14 byte each (instead of the 32 byte they would normally need). Each block is compressed to the exact same size. Different images with the same dimensions require the same storage space regardless of image content.

B44A

lossy

A modified version of B44. If all pixels in a 4*4 block have the same color it will use only 3 instead of 14 byte.

DWA - DreamWorks Animation

lossy

This is a very efficient compression with an adjustable compression strength (The DWA compression level option). Higher levels reduce file size while introducing increasingly more loss of quality. The default value of 45 creates images that have no visible (but measurable) loss of color accuracy. Values of around 250 introduce slightly visible color distortion. High values over 1000 are not recommended because they introduce clearly visible compression artifacts into the image.

Simply called DWA, it applies techniques common in lossy image compression like the discrete cosine transform and Huffman coding, but it uses them to great effect. If you can accept a little loss in your HDR images, DWA can shrink them to a fraction of their lossless size.

Like other DCT compression formats such as JPEG, DWA lets you set the amount of compression you want, so you can find a balance between loss and file size that best suits your particular task. This is a first for OpenEXR, or any other HDR format to my Knowledge. The DWA Compression Level parameter is a floating point number, with higher values leading to more loss and smaller files.

The default Compression Level setting is 45.0, which creates a visually lossless image that is often less than half the size of its truly lossless Piz counterpart. In my tests, boosting that value to 100.0 still had no visible artifacts, but was further reduced to less than a third of the Piz version. Artifacts do start to appear around 200.0, but only if you zoom in to look and by that time your file is about one eighth the size of Piz. Of course, the artifacts do eventually become noticable. If you'd like to see what they look like, I've made a short video showing them—download MP4 or WebM.

(Of course, viewing DWA's lossy compression artifacts in some other lossy movie format is inherently problematic, but…)

Like other DCT codecs, re-compressing DWA over and over again does not incur much additional generational loss, so long as you use the same settings. Another thing that makes DWA significant is that it is fast, very fast. Most computers will have no problem decoding 2K frames at 24fps. The performance is aided by significant SIMD optimization, but it's very quick even without them. Bravo, Karl!