Bug: 312244899

Clone this repo:
  1. ab28dcb Upgrade libultrahdr to d52a0d13814ca399fc8a07e23de1d2c63f0e8404 by Harish Mahendrakar · 12 days ago main master
  2. d52a0d1 bump version to 1.4.0 by Harish Mahendrakar · 12 days ago upstream-main
  3. dcfadb7 bump to 1.3.1 by Ram Mohan M · 6 weeks ago
  4. 68b866f add gles include dirs to the list of include paths by Ram Mohan M · 4 weeks ago
  5. e30da5b Upgrade libultrahdr to ea518da3a839c59f88ffc6c4020920c944251fd2 by Harish Mahendrakar · 2 weeks ago

Introduction

libultrahdr is an image compression library that uses gain map technology to store and distribute HDR images. Conceptually on the encoding side, the library accepts SDR and HDR rendition of an image and from these a Gain Map (quotient between the two renditions) is computed. The library then uses backward compatible means to store the base image (SDR), gain map image and some associated metadata. Legacy readers that do not support handling the gain map image and/or metadata, will display the base image. Readers that support the format combine the base image with the gain map and render a high dynamic range image on compatible displays.

For additional information, see android hdr-image-format guide.

Build from source using CMake

This software suite has been built and tested on platforms:

  • Android
  • Linux
  • macOS
  • Windows

Refer to building.md for complete instructions.

Using libultrahdr

A detailed description of libultrahdr encode and decode api is included in ultrahdr_api.h and for sample usage refer demo app.

libultrahdr includes two classes of APIs, one to compress and the other to decompress HDR images:

Encoding api outline:

ScenarioHdr intent rawSdr intent rawSdr intent compressedGain map compressedQualityExifUse Case
API - 0P010 or rgba1010102 or rgbaf16NoNoNoOptionalOptionalUsed if, only hdr raw intent is present. [^1]
API - 1P010 or rgba1010102 or rgbaf16YUV420 or rgba8888NoNoOptionalOptionalUsed if, hdr raw and sdr raw intents are present.[^2]
API - 2P010 or rgba1010102 or rgbaf16YUV420 or rgba8888YesNoNoNoUsed if, hdr raw, sdr raw and sdr compressed intents are present.[^3]
API - 3P010 or rgba1010102 or rgbaf16NoYesNoNoNoUsed if, hdr raw and sdr compressed intents are present.[^4]
API - 4NoNoYesYesNoNoUsed if, sdr compressed, gain map compressed and GainMap Metadata are present.[^5]

[^1]: Tonemap hdr to sdr. Compute gain map from hdr and sdr. Compress sdr and gainmap at quality configured. Add exif if provided. Combine sdr compressed, gainmap in multi picture format with gainmap metadata. [^2]: Compute gain map from hdr and sdr. Compress sdr and gainmap at quality configured. Add exif if provided. Combine sdr compressed, gainmap in multi picture format with gainmap metadata. [^3]: Compute gain map from hdr and raw sdr. Compress gainmap. Combine sdr compressed, gainmap in multi picture format with gainmap metadata. [^4]: Decode compressed sdr input. Compute gain map from hdr and decoded sdr. Compress gainmap. Combine sdr compressed, gainmap in multi picture format with gainmap metadata. [^5]: Combine sdr compressed, gainmap in multi picture format with gainmap metadata.

Decoding api outline:

Configure display device characteristics (display transfer characteristics, max display boost) for optimal usage.

InputUsage
max_display_boost(optional, >= 1.0) the maximum available boost supported by a display.
supported color transfer format pairscolor transferColor format SDR32bppRGBA8888HDR_LINEAR64bppRGBAHalfFloatHDR_PQ32bppRGBA1010102 PQHDR_HLG32bppRGBA1010102 HLG