-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add AVIF to wheels using only aomenc and dav1d AVIF codecs for reduced size #8858
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
Changes from 2 commits
8b4e66e
a2cbce7
84485e1
ab55e54
8a6e5af
deb1c9d
6d7f396
7aca46c
8bc14e2
621bcd5
1c40ea5
331354a
8cac43f
ce01f19
8ab93db
a005e28
6c918a0
5573242
8a174f5
f40eed2
8905480
f20ce67
5a8313c
a3cba6a
01daa3d
3ffce33
7607474
2222237
1cabcba
c993fbc
7f44ca6
124c1a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,18 +133,22 @@ function build_libavif { | |
fi | ||
|
||
local out_dir=$(fetch_unpack https://github.com/AOMediaCodec/libavif/archive/refs/tags/v$LIBAVIF_VERSION.tar.gz libavif-$LIBAVIF_VERSION.tar.gz) | ||
# CONFIG_AV1_DECODER=0 is a flag for libaom (included as a subproject of | ||
# libavif) to disable the compilation and inclusion of aom's AVIF decoder. | ||
(cd $out_dir \ | ||
&& CMAKE_POLICY_VERSION_MINIMUM=3.5 cmake \ | ||
-DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \ | ||
-DCMAKE_INSTALL_LIBDIR=$BUILD_PREFIX/lib \ | ||
-DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib \ | ||
-DCMAKE_MACOSX_RPATH=OFF \ | ||
radarhere marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DBUILD_SHARED_LIBS=OFF \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did. Using the linker to generate the shared library file allows it to remove unused objects. There is a mechanism for including shared library dependencies of a python extension inside a wheel file on macOS and linux (delocate and auditwheel, respectively) but there is no such standard mechanism for doing the same on windows. So the windows library has to be built statically. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The savings are modest, about 0.5 MB, but there isn't any cost to switching to a shared library. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you say 0.5mb, I presume that's per wheel. Which wheel(s) were you using to check that? |
||
-DAVIF_LIBSHARPYUV=LOCAL \ | ||
-DAVIF_LIBYUV=LOCAL \ | ||
-DAVIF_CODEC_AOM=LOCAL \ | ||
-DCONFIG_AV1_DECODER=0 \ | ||
fdintino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-DAVIF_CODEC_AOM_DECODE=OFF \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Frankie: Is it possible to build with the libaom and dav1d packages in Linux distributions (i.e., There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The shared libraries linked from the pillow extension are all included in the distributed binary, so that people installing Pillow don't need to install the libraries themselves. This is why libjpeg-turbo, libpng, libtiff, and other libraries are included in the wheel files on PyPI. Nothing would be gained by using libaom from the linux distribution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If someone were to build Pillow from source, they could use libavif from the distro, or build libavif against system libraries. The binary wheels are tagged for python version, system architecture, and ABI compatibility (musl and two different versions of glibc). They are intended to be installed in any compatible environment without any other dependencies. |
||
-DAVIF_CODEC_DAV1D=LOCAL \ | ||
-DAVIF_CODEC_RAV1E=LOCAL \ | ||
-DAVIF_CODEC_SVT=LOCAL \ | ||
-DENABLE_NASM=ON \ | ||
-DCMAKE_MODULE_PATH=/tmp/cmake/Modules \ | ||
. \ | ||
|
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.