Repository navigation
Allow HEIF/AVIF saving to be compiled out - #246
Merged
Merged
Conversation
Add FREEIMAGE_HEIF_EXPORT, on by default. When it is off, PluginHEIF.cpp does not compile Save, WriteEncoded or the export-support callbacks, so both plugins register as read-only. Bundled builds also skip Kvazaar, which is only an HEVC encoder, and build libaom with CONFIG_AV1_ENCODER=0. With a system libheif only the plugin changes. HeifEncodingTest checks that a read-only build reports no writer and rejects saving. CI adds read-only bundled jobs on Linux and Windows.
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.
Adds
FREEIMAGE_HEIF_EXPORT(defaultON). Configure with-DFREEIMAGE_HEIF_EXPORT=OFFto build HEIF/AVIF as read-only.What OFF changes
PluginHEIF.cppdoes not compileSave,WriteEncoded,SupportsDepthorSupportsType, andInitleavessave_procand the export callbacks unset.FreeImage_FIFSupportsWriting(FIF_HEIF/FIF_AVIF)returns FALSE and saving fails. Reading, header-only loading, ICC and Exif are unchanged.WITH_KVAZAAR=OFF, and libaom is built withCONFIG_AV1_ENCODER=0/WITH_AOM_ENCODER=OFF. The installedfreeimage-codecsarchive list follows, so the exported CMake package does not reference Kvazaar.-DFREEIMAGE_HEIF_EXPORT=0to opt out.Tests
HeifEncodingTest(HeifCodecTest --encode) now checks that both formats report no writer and no export depth, and thatFreeImage_SaveToMemoryfails. Before this change it skipped encoding silently whenever no writer was available.bundled-codecs.ymladds read-only jobs forubuntu-24.04static andwindows-latestshared.heif_exportis a matrix key, so these entries add new jobs instead of changing existing ones.Verified locally (macOS arm64, bundled libheif)
libaom.aaom_codec_av1_cxpresentPluginHEIF.oI also installed the read-only build and built the codec consumer against it. The package resolved and linked without Kvazaar. The consumer still returned 1, but only because it also requires JPEG XL and my local build left JXL out. The CI jobs build with JXL.
JPEG XL saving is not covered here. The plugin side would be the same change, but libjxl doesn't offer a decoder-only build as simply, so it should be a separate PR.