build: Add automated libheif dependency build with ISO 21496-1 gain map patch - #431
Merged
Conversation
- Enables UHDR_ENABLE_HEIF by default to build libheif with ISO 21496-1 gain map support - Applies PR 1503 patch from upstream libheif with cross-platform C++17 compatibility - Configures ExternalProject_Add for libheif with direct static target builds, disabling unused auxiliary decoders (heifio, doxygen, gdk-pixbuf) - Supports cross-platform builds across Linux, macOS (native ARM64 & cross x86_64), Windows (MSVC), and Android NDK
…/AVIF - Fix -Wshadow and -Wunused-function compiler warnings in heif/avif codecs - Fix argument count in convert_raw_input_to_ycbcr_neon calls - Prevent heap-use-after-free and ensure graceful fallthrough to JPEG probe in uhdr_dec_probe
…r tests - Skip HEIC and AVIF encode tests gracefully with GTEST_SKIP when encoder plugins are absent - Ensure encoder instances are released before GTEST_SKIP to prevent LeakSanitizer warnings
DichenZhang1
force-pushed
the
build/libheif-iso21496-patch
branch
from
August 9, 2026 05:11
a9e46a3 to
04b76e5
Compare
|
The side effects of this PR and the subsequent version re-tagging are causing quite a bit of backscatter in downstream consumers, which reflects quite badly on Google. It would be most considerate of the maintainers to offer a bit more delay and/or greater human review of dependency-related changes before the merge and release process. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enables automated fetching, patching, and building of
libheifwith ISO 21496-1 tone map (tmap) item support whenUHDR_ENABLE_HEIF=ONandUHDR_BUILD_DEPS=ON.Gain map encapsulation in HEIF (
.heic) and AVIF (.avif) containers inlibultrahdrv2.0.0 relies on the ISO 21496-1tmapAPIs introduced in strukturag/libheif#1503. Because this PR is not yet merged upstream into release tags oflibheif, this change adds a patch file and integrates it into CMake's dependency management flow solibultrahdrcan build standalone with full HEIF and AVIF support out-of-the-box.Key Changes
cmake/patches/libheif_pr1503.patchcontaining the ISO 21496-1tmapitem patch fromstrukturag/libheifPR #1503.ExternalProject_Add(libheif)inCMakeLists.txtto fetchlibheif, apply the patch idempotently, and build with-DWITH_EXPERIMENTAL_GAIN_MAP=ONand-DWITH_LIBSHARPYUV=OFF.-DWITH_EXPERIMENTAL_GAIN_MAP=1to compiler flags whenLIBHEIF_FOUNDis true.add_dependencies(core libheif)andadd_dependencies(ultrahdr_unit_test libheif).Verification
cmake -B build -DUHDR_BUILD_DEPS=ON -DUHDR_ENABLE_HEIF=ON -DUHDR_BUILD_TESTS=ON.blaze test //third_party/libultrahdr:ultrahdr_api_test).