diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2022-10-18 23:34:06 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2022-10-18 23:37:30 +0200 |
commit | 959799bb81f7b422193a758a05a90607cbb0394e (patch) | |
tree | 35b0a29e4d79a502305ef81c1d3986d308556b93 /kde-frameworks | |
parent | dev-python/oauthlib: Remove old (diff) | |
download | gentoo-959799bb81f7b422193a758a05a90607cbb0394e.tar.gz gentoo-959799bb81f7b422193a758a05a90607cbb0394e.tar.bz2 gentoo-959799bb81f7b422193a758a05a90607cbb0394e.zip |
kde-frameworks/kimageformats: More AVIF fixes, support 0.11.0
Backporting upstream commits:
bfb12093ad7a0624aa0b779bacf1377bd86c551d
f475a4b24a166d7582163753bc2f4f254257daed
Bug: https://bugs.gentoo.org/877501
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-frameworks')
3 files changed, 168 insertions, 0 deletions
diff --git a/kde-frameworks/kimageformats/files/kimageformats-5.99.0-avif-0.11.0.patch b/kde-frameworks/kimageformats/files/kimageformats-5.99.0-avif-0.11.0.patch new file mode 100644 index 000000000000..8f605331f365 --- /dev/null +++ b/kde-frameworks/kimageformats/files/kimageformats-5.99.0-avif-0.11.0.patch @@ -0,0 +1,51 @@ +From f475a4b24a166d7582163753bc2f4f254257daed Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= <dnovomesky@gmail.com> +Date: Tue, 11 Oct 2022 14:36:17 +0200 +Subject: [PATCH] avif: revert 9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0 commit + +Changes to libavif's avifImageRGBToYUV() API were reverted too. +--- + src/imageformats/avif.cpp | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/src/imageformats/avif.cpp b/src/imageformats/avif.cpp +index ccb4c56..7721c1b 100644 +--- a/src/imageformats/avif.cpp ++++ b/src/imageformats/avif.cpp +@@ -336,7 +336,7 @@ bool QAVIFHandler::decode_one_frame() + rgb.format = AVIF_RGB_FORMAT_ARGB; + #endif + +-#if (AVIF_VERSION >= 80400) && (AVIF_VERSION <= 100100) ++#if AVIF_VERSION >= 80400 + if (m_decoder->imageCount > 1) { + /* accelerate animated AVIF */ + rgb.chromaUpsampling = AVIF_CHROMA_UPSAMPLING_FASTEST; +@@ -351,12 +351,7 @@ bool QAVIFHandler::decode_one_frame() + rgb.rowBytes = result.bytesPerLine(); + rgb.pixels = result.bits(); + +-#if AVIF_VERSION >= 100101 +- // use faster decoding for animations +- avifResult res = avifImageYUVToRGB(m_decoder->image, &rgb, (m_decoder->imageCount > 1) ? AVIF_CHROMA_UPSAMPLING_NEAREST : AVIF_YUV_TO_RGB_DEFAULT); +-#else + avifResult res = avifImageYUVToRGB(m_decoder->image, &rgb); +-#endif + if (res != AVIF_RESULT_OK) { + qWarning("ERROR in avifImageYUVToRGB: %s", avifResultToString(res)); + return false; +@@ -782,11 +777,7 @@ bool QAVIFHandler::write(const QImage &image) + } + } + +-#if AVIF_VERSION >= 100101 +- res = avifImageRGBToYUV(avif, &rgb, AVIF_RGB_TO_YUV_DEFAULT); +-#else + res = avifImageRGBToYUV(avif, &rgb); +-#endif + if (res != AVIF_RESULT_OK) { + qWarning("ERROR in avifImageRGBToYUV: %s", avifResultToString(res)); + return false; +-- +GitLab + diff --git a/kde-frameworks/kimageformats/files/kimageformats-5.99.0-avif-perf-3.patch b/kde-frameworks/kimageformats/files/kimageformats-5.99.0-avif-perf-3.patch new file mode 100644 index 000000000000..1cc9f2f99895 --- /dev/null +++ b/kde-frameworks/kimageformats/files/kimageformats-5.99.0-avif-perf-3.patch @@ -0,0 +1,70 @@ +From bfb12093ad7a0624aa0b779bacf1377bd86c551d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= <dnovomesky@gmail.com> +Date: Sat, 15 Oct 2022 20:03:56 +0200 +Subject: [PATCH] avif: indicate when all frames have been read + +--- + src/imageformats/avif.cpp | 13 ++++++++++--- + src/imageformats/avif_p.h | 1 + + 2 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/imageformats/avif.cpp b/src/imageformats/avif.cpp +index 24aec84..cd3a08b 100644 +--- a/src/imageformats/avif.cpp ++++ b/src/imageformats/avif.cpp +@@ -43,7 +43,7 @@ bool QAVIFHandler::canRead() const + if (m_parseState != ParseAvifError) { + setFormat("avif"); + +- if (m_parseState == ParseAvifSuccess && m_decoder->imageIndex >= m_decoder->imageCount - 1) { ++ if (m_parseState == ParseAvifFinished) { + return false; + } + +@@ -74,7 +74,7 @@ bool QAVIFHandler::canRead(QIODevice *device) + + bool QAVIFHandler::ensureParsed() const + { +- if (m_parseState == ParseAvifSuccess || m_parseState == ParseAvifMetadata) { ++ if (m_parseState == ParseAvifSuccess || m_parseState == ParseAvifMetadata || m_parseState == ParseAvifFinished) { + return true; + } + if (m_parseState == ParseAvifError) { +@@ -88,7 +88,7 @@ bool QAVIFHandler::ensureParsed() const + + bool QAVIFHandler::ensureOpened() const + { +- if (m_parseState == ParseAvifSuccess) { ++ if (m_parseState == ParseAvifSuccess || m_parseState == ParseAvifFinished) { + return true; + } + if (m_parseState == ParseAvifError) { +@@ -459,6 +459,13 @@ bool QAVIFHandler::read(QImage *image) + *image = m_current_image; + if (imageCount() >= 2) { + m_must_jump_to_next_image = true; ++ if (m_decoder->imageIndex >= m_decoder->imageCount - 1) { ++ // all frames in animation have been read ++ m_parseState = ParseAvifFinished; ++ } ++ } else { ++ // the static image has been read ++ m_parseState = ParseAvifFinished; + } + return true; + } +diff --git a/src/imageformats/avif_p.h b/src/imageformats/avif_p.h +index 83fb547..46156bd 100644 +--- a/src/imageformats/avif_p.h ++++ b/src/imageformats/avif_p.h +@@ -55,6 +55,7 @@ private: + ParseAvifNotParsed = 0, + ParseAvifSuccess = 1, + ParseAvifMetadata = 2, ++ ParseAvifFinished = 3, + }; + + ParseAvifState m_parseState; +-- +GitLab + diff --git a/kde-frameworks/kimageformats/kimageformats-5.99.0-r2.ebuild b/kde-frameworks/kimageformats/kimageformats-5.99.0-r2.ebuild new file mode 100644 index 000000000000..6be9f5b4f8b1 --- /dev/null +++ b/kde-frameworks/kimageformats/kimageformats-5.99.0-r2.ebuild @@ -0,0 +1,47 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ECM_QTHELP="false" +PVCUT=$(ver_cut 1-2) +QTMIN=5.15.5 +VIRTUALX_REQUIRED="test" +inherit ecm frameworks.kde.org + +DESCRIPTION="Framework providing additional format plugins for Qt's image I/O system" + +LICENSE="LGPL-2+" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="avif eps heif jpegxl openexr raw" + +DEPEND=" + >=dev-qt/qtgui-${QTMIN}:5 + =kde-frameworks/karchive-${PVCUT}*:5 + avif? ( >=media-libs/libavif-0.8.2:= ) + eps? ( >=dev-qt/qtprintsupport-${QTMIN}:5 ) + heif? ( >=media-libs/libheif-1.10.0:= ) + jpegxl? ( media-libs/libjxl ) + openexr? ( >=media-libs/openexr-3:= ) + raw? ( media-libs/libraw:= ) +" +RDEPEND="${DEPEND}" + +DOCS=( src/imageformats/AUTHORS ) + +PATCHES=( + "${FILESDIR}"/${P}-avif-perf-{1,2,3}.patch + "${FILESDIR}"/${P}-avif-0.11.0.patch +) + +src_configure() { + local mycmakeargs=( + -DKIMAGEFORMATS_JXL=$(usex jpegxl) + $(cmake_use_find_package avif libavif) + $(cmake_use_find_package eps Qt5PrintSupport) + -DKIMAGEFORMATS_HEIF=$(usex heif) + $(cmake_use_find_package openexr OpenEXR) + $(cmake_use_find_package raw LibRaw) + ) + ecm_src_configure +} |