tag | ef92d981d8e9c83cc9660cd6a9e7bb10b1f1e3c0 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Tue Apr 23 15:27:19 2024 -0700 |
object | c3fdd919507673d6088f62eb41acec64f27643e6 |
Platform Tools Release 35.0.1 (11580240)
commit | c3fdd919507673d6088f62eb41acec64f27643e6 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Mar 07 02:11:02 2024 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Mar 07 02:11:02 2024 +0000 |
tree | 576b365c6d49a8c1b2813807391e49dcc8f54cb3 | |
parent | 2c930e3f851e1f367ea01d02bb2fc61d3c3a3e13 [diff] | |
parent | cef2e104a50bace03d615e2cf353358212c8e129 [diff] |
Snap for 11541002 from cef2e104a50bace03d615e2cf353358212c8e129 to sdk-release Change-Id: I68c980c1a8b63fa3e0b7fb9bda18151b9114884d
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.
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.
CMake v3.13 or later
NASM or Yasm (If libjpeg-turbo needs to be built with SIMD extensions)
Compilers with support for C++17
Should work with GCC v7 (or later) and Clang 5 (or later) on Linux and Mac Platforms.
Should work with Microsoft Visual C++ 2019 (or later) on Windows Platforms.
To build libultrahdr, examples, unit tests:
mkdir {build_directory} cd {build_directory} cmake -G "Unix Makefiles" -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
mkdir {build_directory} cd {build_directory} cmake -G "Visual Studio 16 2019" -DUHDR_BUILD_TESTS=1 ../ cmake --build ./ --config=Release ctest -C Release
This will generate the following files under {build_directory/Release}:
ultrahdr.lib
Static link library for the ultrahdr API
ultrahdr_app.exe
Sample application demonstrating ultrahdr API
ultrahdr_unit_test.exe
Unit tests
mkdir {build_directory} cd {build_directory} cmake -G "NMake Makefiles" -DUHDR_BUILD_TESTS=1 ../ cmake --build ./ ctest
This will generate the following files under {build_directory}:
ultrahdr.lib
Static link library for the ultrahdr API
ultrahdr_app.exe
Sample application demonstrating ultrahdr API
ultrahdr_unit_test.exe
Unit tests
NOTE: This assumes that you are building on a Windows machine using the MSYS environment.
mkdir {build_directory} cd {build_directory} cmake -G "MSYS Makefiles" -DUHDR_BUILD_TESTS=1 ../ cmake --build ./ ctest mkdir {build_directory} cd {build_directory} cmake -G "MinGW Makefiles" -DUHDR_BUILD_TESTS=1 ../ cmake --build ./ ctest
This will generate the following files under {build_directory}:
libultrahdr.a
Static link library for the ultrahdr API
ultrahdr_app.exe
Sample application demonstrating ultrahdr API
ultrahdr_unit_test.exe
Unit tests
NOTE: To not build unit tests, skip passing -DUHDR_BUILD_TESTS=1
To build benchmarks, pass -DUHDR_BUILD_BENCHMARK=1 to cmake configure command and build.
This will additionally generate,
ultrahdr_bm
Benchmark tests
Refer to README.md for complete instructions.
libultrahdr includes two classes of APIs, one to compress and the other to decompress HDR images:
List of encode APIs: | Input | HDR YUV | SDR YUV | JPEG | Encoded gainmap | Quality (0 ~ 100) | EXIF | Use case | | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | | API-0 | P010 | No | No | No | Required | Optional | Experimental only. | | API-1 | P010 | YUV_420 | No | No | Required | Optional | Raw SDR input. Primary image will be encoded from the raw SDR input in the library. | | API-2 | P010 | YUV_420 | Yes | No | No | No | Both JPEG and raw SDR inputs. Gainmap will be calculated from raw HDR and raw SDR inputs, the JPEG input will be preserved (including metadata) as the primary image. | | API-3 | P010 | No | Yes | No | No | No | SDR JPEG input. Gainmap will be calculated from raw HDR and the decoding result of the JPEG input, the JPEG input will be preserved (including metadata) as the primary image. | | API-4 | No | No | Yes | Yes | No | No | SDR JPEG and gainmap inputs. The library will only generate the Ultra HDR related metadata and write everything into the Ultra HDR format, all other metadata from the JPEG input will be preserved. |
List of decode API: | Input | Usage | | ------------- | ------------- | | compressed_jpegr_image | The input data. Pointer to JPEG/R stream. | | dest | The output data. Destination that decoded data to be written. | | max_display_boost | (optional, >= 1.0) the maximum available boost supported by a display. | | exif | (optional, default to NULL) Destination that exif data to be written. | | recovery_map | (optional, default to NULL) Destination that decoded recovery map data to be written. | | output_format | ValueColor format to be writtenSDRRGBA_8888HDR_LINEAR(default) RGBA_F16 linearHDR_PQRGBA_1010102 PQHDR_HLGRGBA_1010102 HLG | | metadata | (optional, default to NULL) Destination of metadata (recovery map version, min/max content boost). |
For more info: