Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): Raise libheif minimum to 1.11 #4380

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* If you want support for GIF images:
* **giflib >= 5.0** (tested through 5.2)
* If you want support for HEIF/HEIC or AVIF images:
* libheif >= 1.3 (1.7 required for AVIF support, 1.16 required for
correct orientation support, tested through 1.17.6)
* **libheif >= 1.11** (1.16 required for correct orientation support,
tested through 1.18.2)
* libheif must be built with an AV1 encoder/decoder for AVIF support.
* Avoid libheif 1.10 on Mac, it is very broken. Libheif 1.11+ is fine.
* If you want support for DICOM medical image files:
* DCMTK >= 3.6.1 (tested through 3.6.8)
* If you want support for WebP images:
Expand Down
6 changes: 1 addition & 5 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,9 @@ checked_find_package (FFmpeg VERSION_MIN 4.0)
checked_find_package (GIF VERSION_MIN 5.0)

# For HEIF/HEIC/AVIF formats
checked_find_package (Libheif VERSION_MIN 1.3
checked_find_package (Libheif VERSION_MIN 1.11
RECOMMEND_MIN 1.16
RECOMMEND_MIN_REASON "for orientation support")
if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11)
message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support")
set (Libheif_FOUND 0)
endif ()

checked_find_package (LibRaw
VERSION_MIN 0.20.0
Expand Down
12 changes: 2 additions & 10 deletions src/heif.imageio/heifinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class HeifInput final : public ImageInput {
{
return feature == "exif";
}
#if LIBHEIF_HAVE_VERSION(1, 4, 0)
bool valid_file(const std::string& filename) const override;
#endif
bool open(const std::string& name, ImageSpec& newspec) override;
bool open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config) override;
Expand Down Expand Up @@ -98,17 +96,12 @@ heif_input_imageio_create()
return new HeifInput;
}

OIIO_EXPORT const char* heif_input_extensions[] = { "heic", "heif",
"heics", "hif",
#if LIBHEIF_HAVE_VERSION(1, 7, 0)
"avif",
#endif
nullptr };
OIIO_EXPORT const char* heif_input_extensions[] = { "heic", "heif", "heics",
"hif", "avif", nullptr };

OIIO_PLUGIN_EXPORTS_END


#if LIBHEIF_HAVE_VERSION(1, 4, 0)
bool
HeifInput::valid_file(const std::string& filename) const
{
Expand All @@ -120,7 +113,6 @@ HeifInput::valid_file(const std::string& filename) const
return filetype_check != heif_filetype_no
&& filetype_check != heif_filetype_yes_unsupported;
}
#endif



Expand Down
12 changes: 3 additions & 9 deletions src/heif.imageio/heifoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,8 @@ heif_output_imageio_create()
return new HeifOutput;
}

OIIO_EXPORT const char* heif_output_extensions[] = { "heif", "heic",
"heics", "hif",
#if LIBHEIF_HAVE_VERSION(1, 7, 0)
"avif",
#endif
nullptr };
OIIO_EXPORT const char* heif_output_extensions[] = { "heif", "heic", "heics",
"hif", "avif", nullptr };

OIIO_PLUGIN_EXPORTS_END

Expand Down Expand Up @@ -115,15 +111,13 @@ HeifOutput::open(const std::string& name, const ImageSpec& newspec,
m_himage.add_plane(heif_channel_interleaved, newspec.width,
newspec.height, 8 * m_spec.nchannels /*bit depth*/);

m_encoder = heif::Encoder(heif_compression_HEVC);
#if LIBHEIF_HAVE_VERSION(1, 7, 0)
m_encoder = heif::Encoder(heif_compression_HEVC);
auto compqual = m_spec.decode_compression_metadata("", 75);
auto extension = Filesystem::extension(m_filename);
if (compqual.first == "avif"
|| (extension == ".avif" && compqual.first == "")) {
m_encoder = heif::Encoder(heif_compression_AV1);
}
#endif
} catch (const heif::Error& err) {
std::string e = err.get_message();
errorfmt("{}", e.empty() ? "unknown exception" : e.c_str());
Expand Down
Loading