Skip to content

Commit

Permalink
Updating libheif from 1.13.0 to 1.14.0 #50
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Nov 20, 2022
1 parent 667f638 commit 4ef7515
Show file tree
Hide file tree
Showing 14 changed files with 121 additions and 85 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/analysis-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ jobs:
- uses: msys2/setup-msys2@v2
with:
location: C:/temp
update: true
install: >-
mingw-w64-x86_64-libheif
# In release or building from source we do not build `dav1d` or `rav1e` libraries.
# In release or building from source we do not build `dav1d`,`rav1e` and `libSvtAv1Enc` libraries.
# Here we just test working with original package from MSYS.
- name: Copy DLLs from MSYS2
run: |
Expand All @@ -165,6 +166,7 @@ jobs:
cp ${{ env.MSYS2_PREFIX }}/bin/libstdc++-6.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/libdav1d.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/rav1e.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/libSvtAv1Enc.dll $site_packages/
- name: Install from source
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi-pi_heif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: |
cd libheif/windows/mingw-w64-libheif
makepkg-mingw --syncdeps --noconfirm -f
pacman -U mingw-w64-x86_64-libheif-1.13.0-2-any.pkg.tar.zst --noconfirm
pacman -U mingw-w64-x86_64-libheif-1.14.0-1-any.pkg.tar.zst --noconfirm
- name: Remove DLL trailing data
run: ${{ env.MSYS2_PREFIX }}/bin/strip -s ${{ env.MSYS2_PREFIX }}/bin/*.dll
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
run: |
cd libheif/windows/mingw-w64-libheif
makepkg-mingw --syncdeps --noconfirm -f
pacman -U mingw-w64-x86_64-libheif-1.13.0-2-any.pkg.tar.zst --noconfirm
pacman -U mingw-w64-x86_64-libheif-1.14.0-1-any.pkg.tar.zst --noconfirm
- name: Remove DLL trailing data
run: ${{ env.MSYS2_PREFIX }}/bin/strip -s ${{ env.MSYS2_PREFIX }}/bin/*.dll
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-src-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: |
cd libheif/windows/mingw-w64-libheif
makepkg-mingw --syncdeps --noconfirm -f
pacman -U mingw-w64-x86_64-libheif-1.13.0-2-any.pkg.tar.zst --noconfirm
pacman -U mingw-w64-x86_64-libheif-1.14.0-1-any.pkg.tar.zst --noconfirm
- name: Installing Pillow-Heif
run: python -m pip -v install ".[dev]"
Expand Down
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ _# Changelog

All notable changes to this project will be documented in this file.

## [0.8.0 - 2022-xx-xx]
## [0.8.0 - 2022-11-20]

### Added

- Armv7: wheels for Alpine 3.14+ with `musllinux_1_2_armv7l` tag.

### Changed

- `libheif` updated to `1.14.0` version
- Ability to pass `enc_params` for save as `List[Tuple[str, str]]` was removed, now it accepts only `Dict`.
- Deprecated `options().ctx_in_memory` was removed(default behaviour do not change).
- Deprecated `options().strict` was removed(default behaviour do not change).
- Deprecated `check`, `open`, `read`, `check_heif` functions was removed.
- Ability to pass `enc_params` for save as `List[Tuple[str, str]]` was removed, now it accepts only `Dict`.
- `scale` method marked as deprecated.

### Fixed

- Values in `enc_params` for `save` can now have `int` or `float` type and will be automatically converted to `str`.
- Values in `enc_params` for `save` can now be of type `int` or `float` and will be automatically converted to `str`.
- Armv7: wheels supports Debian 10(was only Debian 11+\Ubuntu 20.04+ previously) with `manylinux_2_28_armv7l` tag.
- Armv7: wheels sizes decreased significantly(almost in `3x`).

Expand Down
40 changes: 0 additions & 40 deletions libheif/linux/libheif/001-aom-remove-extend_padding_to_size.patch

This file was deleted.

12 changes: 12 additions & 0 deletions libheif/linux/libheif/001-void-unused-variable.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/libheif/plugins/heif_encoder_svt.cc b/libheif/plugins/heif_encoder_svt.cc
index 586c8b0b3..6d0c8ae15 100644
--- a/libheif/plugins/heif_encoder_svt.cc
+++ b/libheif/plugins/heif_encoder_svt.cc
@@ -97,6 +97,7 @@ static const char* svt_plugin_name()
int int_log2(int pow2_value)
{
int input_value = pow2_value;
+ (void)input_value;

int v = 0;
while (pow2_value > 1) {
55 changes: 55 additions & 0 deletions libheif/linux/libheif/002-fix-dynamic-plugins.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/libheif/CMakeLists.txt b/libheif/CMakeLists.txt
index db9eac7fe..5330b4fe1 100644
--- a/libheif/CMakeLists.txt
+++ b/libheif/CMakeLists.txt
@@ -62,13 +62,17 @@ target_compile_definitions(heif
LIBHEIF_EXPORTS
HAVE_VISIBILITY)

-add_subdirectory(plugins)
-
if (ENABLE_PLUGIN_LOADING AND UNIX)
+ set(PLUGIN_LOADING_SUPPORTED_AND_ENABLED TRUE)
+endif()
+
+if (PLUGIN_LOADING_SUPPORTED_AND_ENABLED)
target_compile_definitions(heif PRIVATE ENABLE_PLUGIN_LOADING=1)
target_link_libraries(heif PRIVATE dl)
endif()

+add_subdirectory(plugins)
+
if (WITH_DEFLATE_HEADER_COMPRESSION)
find_package(ZLIB REQUIRED)
if (ZLIB_FOUND)
diff --git a/libheif/plugins/CMakeLists.txt b/libheif/plugins/CMakeLists.txt
index f25effc76..941a4889c 100644
--- a/libheif/plugins/CMakeLists.txt
+++ b/libheif/plugins/CMakeLists.txt
@@ -5,7 +5,8 @@ macro(plugin_compilation name varName optionName defineName)
set(${varName}_LINKDIR "-L${${varName}_LIBRARY_DIRS}")
endif ()

- if (WITH_${optionName}_PLUGIN)
+ if (PLUGIN_LOADING_SUPPORTED_AND_ENABLED AND WITH_${optionName}_PLUGIN)
+ message("Compiling '" ${name} "' as dynamic plugin")
add_library(heif-${name}
MODULE ${${optionName}_sources} ${${optionName}_extra_plugin_sources}
../heif_plugin.cc
@@ -26,6 +27,7 @@ macro(plugin_compilation name varName optionName defineName)
LIBRARY DESTINATION ${PLUGIN_DIRECTORY}
)
else ()
+ message("Compiling '" ${name} "' as built-in backend")
target_sources(heif PRIVATE ${${optionName}_sources})
target_compile_definitions(heif PRIVATE HAVE_${defineName}=1)
target_include_directories(heif PRIVATE ${${varName}_INCLUDE_DIR})
@@ -34,6 +36,8 @@ macro(plugin_compilation name varName optionName defineName)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${varName}_CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${varName}_CFLAGS}")
+ else()
+ message("Not compiling '" ${name} "' backend")
endif ()
endmacro()

12 changes: 9 additions & 3 deletions libheif/linux_build_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def build_lib_linux(url: str, name: str, musl: bool = False):
# run(f"patch -p 1 -i {patch_path}".split(), check=True)
elif name == "libheif":
chdir(_lib_path)
for patch in ("libheif/001-aom-remove-extend_padding_to_size.patch",):
for patch in (
"libheif/001-void-unused-variable.patch",
"libheif/002-fix-dynamic-plugins.patch",
):
patch_path = path.join(_linux_dir, patch)
run(f"patch -p 1 -i {patch_path}".split(), check=True)
chdir(_build_path)
Expand Down Expand Up @@ -101,7 +104,10 @@ def build_lib_linux(url: str, name: str, musl: bool = False):
cmake_args = f"-DCMAKE_INSTALL_PREFIX={INSTALL_DIR_LIBS} ..".split()
cmake_args += ["-DCMAKE_BUILD_TYPE=Release"]
if name == "libheif":
cmake_args += "-DWITH_EXAMPLES=OFF -DWITH_RAV1E=OFF -DWITH_DAV1D=OFF".split()
cmake_args += (
"-DWITH_EXAMPLES=OFF -DWITH_RAV1E=OFF -DWITH_DAV1D=OFF -DWITH_SvtEnc=OFF"
" -DENABLE_PLUGIN_LOADING=OFF".split()
)
_hide_build_process = False
if musl:
cmake_args += [f"-DCMAKE_INSTALL_LIBDIR={INSTALL_DIR_LIBS}/lib"]
Expand Down Expand Up @@ -150,7 +156,7 @@ def build_libs() -> str:
else:
print("libde265 already installed.")
build_lib_linux(
"https://github.com/strukturag/libheif/releases/download/v1.13.0/libheif-1.13.0.tar.gz",
"https://github.com/strukturag/libheif/releases/download/v1.14.0/libheif-1.14.0.tar.gz",
"libheif",
_is_musllinux,
)
Expand Down
9 changes: 2 additions & 7 deletions libheif/macos/libheif.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
class Libheif < Formula
desc "ISO/IEC 23008-12:2017 HEIF file format decoder and encoder"
homepage "https://www.libde265.org/"
url "https://github.com/strukturag/libheif/releases/download/v1.13.0/libheif-1.13.0.tar.gz"
sha256 "c20ae01bace39e89298f6352f1ff4a54b415b33b9743902da798e8a1e51d7ca1"
url "https://github.com/strukturag/libheif/releases/download/v1.14.0/libheif-1.14.0.tar.gz"
sha256 "9a2b969d827e162fa9eba582ebd0c9f6891f16e426ef608d089b1f24962295b5"
license "LGPL-3.0-only"
# Set current revision from what it was taken plus 10
revision 10
Expand All @@ -17,11 +17,6 @@ class Libheif < Formula
depends_on "shared-mime-info"
depends_on "x265"

patch do
url "https://github.com/strukturag/libheif/commit/a01baccaf40bafcabddba47846f5e914ca0724f6.diff"
sha256 "900c2f1323002af1c6969ae1f9b4a50fe685374e203d034842ee53cb428179ea"
end

def install
system "./configure", *std_configure_args, "--disable-silent-rules"
system "make", "install"
Expand Down
21 changes: 13 additions & 8 deletions libheif/windows/mingw-w64-libheif/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
_realname=libheif
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.13.0
pkgrel=2
pkgver=1.14.0
pkgrel=1
pkgdesc="HEIF image decoder/encoder library and tools (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
Expand All @@ -21,22 +21,24 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-libde265"
"${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
"${MINGW_PACKAGE_PREFIX}-libpng"
"${MINGW_PACKAGE_PREFIX}-libwinpthread-git"
"${MINGW_PACKAGE_PREFIX}-x265")
source=("https://github.com/strukturag/libheif/releases/download/v${pkgver}/${_realname}-${pkgver}.tar.gz"
"001-pkgconfig-match-autotools.patch"::"https://patch-diff.githubusercontent.com/raw/strukturag/libheif/pull/529.diff"
"002-cmake-enable-gdk-pixbuf.patch"::"https://patch-diff.githubusercontent.com/raw/strukturag/libheif/pull/647.diff"
"003-aom-remove-extend_padding_to_size.patch"::"https://github.com/strukturag/libheif/commit/a01baccaf40bafcabddba47846f5e914ca0724f6.diff")
sha256sums=('c20ae01bace39e89298f6352f1ff4a54b415b33b9743902da798e8a1e51d7ca1'
"003-void-unused-variable.patch"::"https://github.com/strukturag/libheif/commit/2ba4e5045c8c7e8ba3ced925a4e1095f6d6f5a02.diff"
"004-fix-dynamic-plugins.patch"::"https://github.com/strukturag/libheif/commit/f1f7edad9a7e6e9c00f7439d4ac2b64478474bff.diff")
sha256sums=('9a2b969d827e162fa9eba582ebd0c9f6891f16e426ef608d089b1f24962295b5'
'80d6acd6b2035572c1547673cf73a2c6a83cd42c0a475a1258551a2983b06d9f'
'649e6d2635ee1c86a064ee35e9dc81713883ef7275aec439c3200488075260b9'
'900c2f1323002af1c6969ae1f9b4a50fe685374e203d034842ee53cb428179ea')
'29ce702764de316c9c42584fc76f12a207d14a9bfef5f054b7a3736b53f358ae'
'2a1252f5b6322c0a10150f4ef15db02d75c9970ba881ab454fba98812279da37')

prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
patch -Np1 -i "${srcdir}/001-pkgconfig-match-autotools.patch"
patch -Np1 -i "${srcdir}/002-cmake-enable-gdk-pixbuf.patch"
patch -Np1 -i "${srcdir}/003-aom-remove-extend_padding_to_size.patch"
patch -Np1 -i "${srcdir}/003-void-unused-variable.patch"
patch -Np1 -i "${srcdir}/004-fix-dynamic-plugins.patch"
}

build() {
Expand All @@ -59,6 +61,8 @@ build() {
-DBUILD_SHARED_LIBS=ON \
-DWITH_RAV1E=OFF \
-DWITH_DAV1D=OFF \
-DWITH_SvtEnc=OFF \
-DENABLE_PLUGIN_LOADING=OFF \
-DX265_CFLAGS="-DX265_API_IMPORTS" \
../${_realname}-${pkgver}

Expand All @@ -73,7 +77,8 @@ build() {
../${_realname}-${pkgver}/configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST}
--host=${MINGW_CHOST} \
--enable-svt=no
}

package() {
Expand Down
10 changes: 2 additions & 8 deletions pi-heif/libheif/macos/libheif.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
class Libheif < Formula
desc "ISO/IEC 23008-12:2017 HEIF file format decoder and encoder"
homepage "https://www.libde265.org/"
url "https://github.com/strukturag/libheif/releases/download/v1.13.0/libheif-1.13.0.tar.gz"
sha256 "c20ae01bace39e89298f6352f1ff4a54b415b33b9743902da798e8a1e51d7ca1"
url "https://github.com/strukturag/libheif/releases/download/v1.14.0/libheif-1.14.0.tar.gz"
sha256 "9a2b969d827e162fa9eba582ebd0c9f6891f16e426ef608d089b1f24962295b5"
license "LGPL-3.0-only"
# Set current revision from what it was taken plus 10
revision 10
Expand All @@ -15,12 +15,6 @@ class Libheif < Formula
depends_on "libpng"
depends_on "shared-mime-info"

# (001) AOM: remove extend_padding_to_size
patch do
url "https://github.com/strukturag/libheif/commit/a01baccaf40bafcabddba47846f5e914ca0724f6.diff"
sha256 "900c2f1323002af1c6969ae1f9b4a50fe685374e203d034842ee53cb428179ea"
end

def install
system "./configure", *std_configure_args, "--disable-silent-rules"
system "make", "install"
Expand Down
24 changes: 15 additions & 9 deletions pi-heif/libheif/windows/mingw-w64-libheif/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
_realname=libheif
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.13.0
pkgrel=2
pkgver=1.14.0
pkgrel=1
pkgdesc="HEIF image decoder/encoder library and tools (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
Expand All @@ -19,22 +19,24 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-libde265"
"${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
"${MINGW_PACKAGE_PREFIX}-libpng"
"${MINGW_PACKAGE_PREFIX}-libwinpthread-git")
"${MINGW_PACKAGE_PREFIX}-libpng")
source=("https://github.com/strukturag/libheif/releases/download/v${pkgver}/${_realname}-${pkgver}.tar.gz"
"001-pkgconfig-match-autotools.patch"::"https://patch-diff.githubusercontent.com/raw/strukturag/libheif/pull/529.diff"
"002-cmake-enable-gdk-pixbuf.patch"::"https://patch-diff.githubusercontent.com/raw/strukturag/libheif/pull/647.diff"
"003-aom-remove-extend_padding_to_size.patch"::"https://github.com/strukturag/libheif/commit/a01baccaf40bafcabddba47846f5e914ca0724f6.diff")
sha256sums=('c20ae01bace39e89298f6352f1ff4a54b415b33b9743902da798e8a1e51d7ca1'
"003-void-unused-variable.patch"::"https://github.com/strukturag/libheif/commit/2ba4e5045c8c7e8ba3ced925a4e1095f6d6f5a02.diff"
"004-fix-dynamic-plugins.patch"::"https://github.com/strukturag/libheif/commit/f1f7edad9a7e6e9c00f7439d4ac2b64478474bff.diff")
sha256sums=('9a2b969d827e162fa9eba582ebd0c9f6891f16e426ef608d089b1f24962295b5'
'80d6acd6b2035572c1547673cf73a2c6a83cd42c0a475a1258551a2983b06d9f'
'649e6d2635ee1c86a064ee35e9dc81713883ef7275aec439c3200488075260b9'
'900c2f1323002af1c6969ae1f9b4a50fe685374e203d034842ee53cb428179ea')
'29ce702764de316c9c42584fc76f12a207d14a9bfef5f054b7a3736b53f358ae'
'2a1252f5b6322c0a10150f4ef15db02d75c9970ba881ab454fba98812279da37')

prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
patch -Np1 -i "${srcdir}/001-pkgconfig-match-autotools.patch"
patch -Np1 -i "${srcdir}/002-cmake-enable-gdk-pixbuf.patch"
patch -Np1 -i "${srcdir}/003-aom-remove-extend_padding_to_size.patch"
patch -Np1 -i "${srcdir}/003-void-unused-variable.patch"
patch -Np1 -i "${srcdir}/004-fix-dynamic-plugins.patch"
}

build() {
Expand All @@ -57,7 +59,10 @@ build() {
-DBUILD_SHARED_LIBS=ON \
-DWITH_RAV1E=OFF \
-DWITH_DAV1D=OFF \
-DWITH_AOM=OFF \
-DWITH_X265=OFF \
-DWITH_SvtEnc=OFF \
-DENABLE_PLUGIN_LOADING=OFF \
../${_realname}-${pkgver}

${MINGW_PREFIX}/bin/cmake --build .
Expand All @@ -71,7 +76,8 @@ build() {
../${_realname}-${pkgver}/configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST}
--host=${MINGW_CHOST} \
--enable-svt=no
}

package() {
Expand Down
Loading

0 comments on commit 4ef7515

Please sign in to comment.