Skip to content

google/libultrahdr

Background

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 parsing 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.

More information about libultrahdr can be found at https://developer.android.com/guide/topics/media/platform/hdr-image-format.

Building libultrahdr

libultrahdr compresses base image and gain map image in to jpeg format. For this libjpeg-turbo is used. This is cloned from https://github.com/libjpeg-turbo/libjpeg-turbo.git and included in the build process.

Requirements

  • CMake v3.13 or later

  • NASM or Yasm (If libjpeg-turbo is building on x86 or x86-64 with SIMD extensions)

    • If using NASM, 2.13 or later is required.
    • If using Yasm, 1.2.0 or later is required.
    • If building on macOS, NASM or Yasm can be obtained from MacPorts or Homebrew.

Should work with GCC v7 (or later) and Clang 5 (or later) on Linux and Mac Platforms.

Building Lib and Samples

To build libultrahdr and sample application:

mkdir {build_directory}
cd {build_directory}
cmake ../ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
make

To build unit tests:

mkdir {build_directory}
cd {build_directory}
cmake ../ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DUHDR_BUILD_TESTS=1
make
ctest

This will generate the following files under {build_directory}:

libultrahdr.a
Static link library for the ultrahdr API

ultrahdr_app
Sample application demonstrating ultrahdr API

ultrahdr_unit_test
Unit tests

Building Fuzzers

Refer to README.md for complete instructions.

Using libultrahdr

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

  • Refer to jpegr.h for detailed description of various encode and decode api.
  • Refer to ultrahdr_app.cpp for examples of its usage.

About

Ultra HDR is a true HDR image format, and is backcompatible. libultrahdr is the reference codec for the Ultra HDR format. The codecs that support the format can render the HDR intent of the image on HDR displays; other codecs can still decode and display the SDR intent of the image.

Topics

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors