Support HEIC image encoding with libkvazaar#906
Draft
cmb69 wants to merge 1 commit into
Draft
Conversation
libheif currently supports x265 and kvazaar for encoding HEIC images; while the former is recommended, the latter has a more liberal license, and as such is an interesting alternative. However, kvazaar apparently does not yet support changing the chroma subsampling, and as such, writing HEIC images fails. We apply basically the same fix as for libheif < 1.9.0, where we just ignore the given chroma subsampling, and use whatever the encoder deems suitable (likely 420). [1] <https://github.com/strukturag/libheif?tab=readme-ov-file#compiling>
Member
Author
|
The Ubuntu and macOS CI failures are unrelated; the Windows CI failure might be related, though. Need to check. |
Member
Author
|
I can reproduce locally with https://github.com/libgd/libgd-windows-vcpkg-prebuild; looks like a bad build (see strukturag/libheif#357 (comment)). No way to work around this. I think we need to update the dependencies for Windows anyway. |
Contributor
|
not sure static check/compile time is still the way. Also plugins are loaded during heiv init now if I am not mistaken. I need to read their APIs again and see if we need to call the init too from GD, introducing a gdInit() per process or thread depending on the needs. |
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.
libheif currently supports x265 and kvazaar for encoding HEIC images; while the former is recommended, the latter has a more liberal license, and as such is an interesting alternative. However, kvazaar apparently does not yet support changing the chroma subsampling, and as such, writing HEIC images fails. We apply basically the same fix as for libheif < 1.9.0, where we just ignore the given chroma subsampling, and use whatever the encoder deems suitable (likely 420).
[1] https://github.com/strukturag/libheif?tab=readme-ov-file#compiling
Note that this fixes tests/heif/bug788 for me, and let's tests/heif/heif_im2im proceed (it now only fails due to pixel differences; likely that would happen with older libheif, too).
Also note that comparing the plugin name might be a bit brittle, but comparing the plugin ID might be too, and seems to require more ado, so maybe we're good comparing the name.
Since we support HEIF encoding not only with HEVC, but also with AV1, it seems to prudent to check whether the AV1 encoders supported by libheif (currently AOM, rav1e, and svt-av1), work as expected, or show similar limitations as kvazaar (chroma subsampling is supported by all three, but there may be other limitations).
cc @YakoYakoYokuYoku