From f2468449715868ccb4a650a01d08be93be9889b8632b57cbb2af824f16a9fe06 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Wed, 19 Oct 2022 09:51:29 +0000 Subject: [PATCH 1/2] fixups OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kimageformats?expand=0&rev=263 --- 0001-avif-always-indicate-endless-loop.patch | 32 ++++++++++++ ...e-in-canRead-when-imageIndex-imageCo.patch | 34 +++++++++++++ ...23ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch | 51 +++++++++++++++++++ kimageformats.changes | 8 +++ kimageformats.spec | 5 ++ 5 files changed, 130 insertions(+) create mode 100644 0001-avif-always-indicate-endless-loop.patch create mode 100644 0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch create mode 100644 0001-avif-revert-9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch diff --git a/0001-avif-always-indicate-endless-loop.patch b/0001-avif-always-indicate-endless-loop.patch new file mode 100644 index 0000000..a0bd164 --- /dev/null +++ b/0001-avif-always-indicate-endless-loop.patch @@ -0,0 +1,32 @@ +From 1190e53e9b69da6f9663ceb75c4813c5708b7cbd Mon Sep 17 00:00:00 2001 +From: Fushan Wen +Date: Sat, 15 Oct 2022 14:11:56 +0800 +Subject: [PATCH] avif: always indicate endless loop + +avif does not support loops but endless loop was the behavior before +460085 was fixed, so a workaround is added. + +See also: https://github.com/AOMediaCodec/libavif/issues/347 + +CCBUG: 460085 +--- + src/imageformats/avif.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/imageformats/avif.cpp b/src/imageformats/avif.cpp +index c4f7a0f..24aec84 100644 +--- a/src/imageformats/avif.cpp ++++ b/src/imageformats/avif.cpp +@@ -1024,7 +1024,8 @@ int QAVIFHandler::loopCount() const + return 0; + } + +- return 1; ++ // Endless loop to work around https://github.com/AOMediaCodec/libavif/issues/347 ++ return -1; + } + + QPointF QAVIFHandler::CompatibleChromacity(qreal chrX, qreal chrY) +-- +2.38.0 + diff --git a/0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch b/0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch new file mode 100644 index 0000000..b2ebe05 --- /dev/null +++ b/0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch @@ -0,0 +1,34 @@ +From 350ce1b990460cb2178f369f22fe80803f5645f3 Mon Sep 17 00:00:00 2001 +From: Fushan Wen +Date: Sat, 15 Oct 2022 11:40:41 +0800 +Subject: [PATCH] avif: return `false` in `canRead()` when `imageIndex >= + imageCount` + +Otherwise when `cache: false` is set in AnimatedImage, QMovie will try +to read the image forever. + +BUG: 460085 +FIXED-IN: 5.100 +--- + src/imageformats/avif.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/imageformats/avif.cpp b/src/imageformats/avif.cpp +index 2865a4e..c4f7a0f 100644 +--- a/src/imageformats/avif.cpp ++++ b/src/imageformats/avif.cpp +@@ -42,6 +42,11 @@ bool QAVIFHandler::canRead() const + + if (m_parseState != ParseAvifError) { + setFormat("avif"); ++ ++ if (m_parseState == ParseAvifSuccess && m_decoder->imageIndex >= m_decoder->imageCount - 1) { ++ return false; ++ } ++ + return true; + } + return false; +-- +2.38.0 + diff --git a/0001-avif-revert-9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch b/0001-avif-revert-9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch new file mode 100644 index 0000000..8541379 --- /dev/null +++ b/0001-avif-revert-9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch @@ -0,0 +1,51 @@ +From f475a4b24a166d7582163753bc2f4f254257daed Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= +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; +-- +2.38.0 + diff --git a/kimageformats.changes b/kimageformats.changes index aa83c5b..fc42e18 100644 --- a/kimageformats.changes +++ b/kimageformats.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Oct 19 09:50:52 UTC 2022 - Christophe Giboudeaux + +- Add upstream changes: + * 0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch + * 0001-avif-always-indicate-endless-loop.patch + * 0001-avif-revert-9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch + ------------------------------------------------------------------- Sun Oct 9 07:21:20 UTC 2022 - Enrico Belleri diff --git a/kimageformats.spec b/kimageformats.spec index 90b225e..7bc0a81 100644 --- a/kimageformats.spec +++ b/kimageformats.spec @@ -44,6 +44,11 @@ Source: %{name}-%{version}.tar.xz Source1: %{name}-%{version}.tar.xz.sig Source2: frameworks.keyring %endif +# PATCH-FIX-UPSTREAM -- Recommended patches for kimageformats 5.99 +Patch0: 0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch +Patch1: 0001-avif-always-indicate-endless-loop.patch +# PATCH-FIX-UPSTREAM +Patch2: 0001-avif-revert-9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: fdupes BuildRequires: kf5-filesystem From 28c6eb220159aca557a8d00ba72190f0957ecacadd1d904bdb93d7efb7509cfb Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Wed, 19 Oct 2022 09:53:18 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kimageformats?expand=0&rev=264 --- kimageformats.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kimageformats.changes b/kimageformats.changes index fc42e18..bee83ac 100644 --- a/kimageformats.changes +++ b/kimageformats.changes @@ -2,7 +2,7 @@ Wed Oct 19 09:50:52 UTC 2022 - Christophe Giboudeaux - Add upstream changes: - * 0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch + * 0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch (kde#460085) * 0001-avif-always-indicate-endless-loop.patch * 0001-avif-revert-9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch