diff options
Diffstat (limited to 'media-libs')
-rw-r--r-- | media-libs/libavif/files/libavif-0.9.3-dav1d-1.0.0.patch | 32 | ||||
-rw-r--r-- | media-libs/libavif/libavif-0.9.3-r3.ebuild | 108 |
2 files changed, 140 insertions, 0 deletions
diff --git a/media-libs/libavif/files/libavif-0.9.3-dav1d-1.0.0.patch b/media-libs/libavif/files/libavif-0.9.3-dav1d-1.0.0.patch new file mode 100644 index 000000000000..a4358e7223cd --- /dev/null +++ b/media-libs/libavif/files/libavif-0.9.3-dav1d-1.0.0.patch @@ -0,0 +1,32 @@ +https://github.com/AOMediaCodec/libavif/commit/74a21444397e323a088fa1f274c9fc942ee7a870.patch +https://bugs.gentoo.org/834262 + +From: Jamaika1 <lukaszcz18@wp.pl> +Date: Wed, 26 Jan 2022 18:24:31 +0100 +Subject: [PATCH] Change function in SVT-AV1 0.9.0 (#807) + +--- a/src/codec_svt.c ++++ b/src/codec_svt.c +@@ -92,7 +92,9 @@ static avifResult svtCodecEncodeImage(avifCodec * codec, + } + svt_config->encoder_color_format = color_format; + svt_config->encoder_bit_depth = (uint8_t)image->depth; ++#if !SVT_AV1_CHECK_VERSION(0, 9, 0) + svt_config->is_16bit_pipeline = image->depth > 8; ++#endif + + // Follow comment in svt header: set if input is HDR10 BT2020 using SMPTE ST2084. + svt_config->high_dynamic_range_input = (image->depth == 10 && image->colorPrimaries == AVIF_COLOR_PRIMARIES_BT2020 && +@@ -104,8 +106,12 @@ static avifResult svtCodecEncodeImage(avifCodec * codec, + svt_config->logical_processors = encoder->maxThreads; + svt_config->enable_adaptive_quantization = AVIF_FALSE; + // disable 2-pass ++#if SVT_AV1_CHECK_VERSION(0, 9, 0) ++ svt_config->rc_stats_buffer = (SvtAv1FixedBuf) { NULL, 0 }; ++#else + svt_config->rc_firstpass_stats_out = AVIF_FALSE; + svt_config->rc_twopass_stats_in = (SvtAv1FixedBuf) { NULL, 0 }; ++#endif + + if (alpha) { + svt_config->min_qp_allowed = AVIF_CLAMP(encoder->minQuantizerAlpha, 0, 63); diff --git a/media-libs/libavif/libavif-0.9.3-r3.ebuild b/media-libs/libavif/libavif-0.9.3-r3.ebuild new file mode 100644 index 000000000000..6af014af342c --- /dev/null +++ b/media-libs/libavif/libavif-0.9.3-r3.ebuild @@ -0,0 +1,108 @@ +# Copyright 2020-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake-multilib gnome2-utils + +DESCRIPTION="Library for encoding and decoding .avif files" +HOMEPAGE="https://github.com/AOMediaCodec/libavif" +SRC_URI="https://github.com/AOMediaCodec/libavif/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD-2" +# See bug #822336 re subslot +SLOT="0/${PV}" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="+aom dav1d examples extras gdk-pixbuf rav1e svt-av1" + +REQUIRED_USE="|| ( aom dav1d )" + +DEPEND="media-libs/libpng[${MULTILIB_USEDEP}] + sys-libs/zlib[${MULTILIB_USEDEP}] + virtual/jpeg[${MULTILIB_USEDEP}] + aom? ( >=media-libs/libaom-3.1.2:=[${MULTILIB_USEDEP}] ) + dav1d? ( media-libs/dav1d:=[${MULTILIB_USEDEP}] ) + gdk-pixbuf? ( x11-libs/gdk-pixbuf:2[${MULTILIB_USEDEP}] ) + rav1e? ( media-video/rav1e[capi] ) + svt-av1? ( >=media-libs/svt-av1-0.8.6 )" +RDEPEND="${DEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}"/${P}-dav1d-1.0.0.patch +) + +multilib_src_configure() { + local mycmakeargs=( + -DBUILD_SHARED_LIBS=ON + -DAVIF_CODEC_AOM=$(usex aom ON OFF) + -DAVIF_CODEC_DAV1D=$(usex dav1d ON OFF) + -DAVIF_CODEC_LIBGAV1=OFF + + # Use system libraries. + -DAVIF_LOCAL_ZLIBPNG=OFF + -DAVIF_LOCAL_JPEG=OFF + + -DAVIF_BUILD_GDK_PIXBUF=$(usex gdk-pixbuf ON OFF) + + -DAVIF_ENABLE_WERROR=OFF + ) + + if multilib_is_native_abi; then + mycmakeargs+=( + -DAVIF_CODEC_RAV1E=$(usex rav1e ON OFF) + -DAVIF_CODEC_SVT=$(usex svt-av1 ON OFF) + + -DAVIF_BUILD_EXAMPLES=$(usex examples ON OFF) + -DAVIF_BUILD_APPS=$(usex extras ON OFF) + -DAVIF_BUILD_TESTS=$(usex extras ON OFF) + ) + else + mycmakeargs+=( + -DAVIF_CODEC_RAV1E=OFF + -DAVIF_CODEC_SVT=OFF + + -DAVIF_BUILD_EXAMPLES=OFF + -DAVIF_BUILD_APPS=OFF + -DAVIF_BUILD_TESTS=OFF + ) + + if ! use aom ; then + if use rav1e || use svt-av1 ; then + ewarn "libavif on ${MULTILIB_ABI_FLAG} will work in read-only mode." + ewarn "Support for rav1e and/or svt-av1 is is not available on ${MULTILIB_ABI_FLAG}" + ewarn "Enable aom flag for full support on ${MULTILIB_ABI_FLAG}" + fi + fi + fi + + cmake_src_configure +} + +pkg_preinst() { + if use gdk-pixbuf ; then + gnome2_gdk_pixbuf_savelist + fi +} + +pkg_postinst() { + if ! use aom && ! use rav1e && ! use svt-av1 ; then + ewarn "No AV1 encoder is set," + ewarn "libavif will work in read-only mode." + ewarn "Enable aom, rav1e or svt-av1 flag if you want to save .AVIF files." + fi + + if use gdk-pixbuf ; then + # causes segfault if set, see bug 375615 + unset __GL_NO_DSO_FINALIZER + multilib_foreach_abi gnome2_gdk_pixbuf_update + fi +} + +pkg_postrm() { + if use gdk-pixbuf ; then + # causes segfault if set, see bug 375615 + unset __GL_NO_DSO_FINALIZER + multilib_foreach_abi gnome2_gdk_pixbuf_update + fi +} |