1
0
forked from pool/kimageformats

Accepting request 1029945 from KDE:Frameworks5

Add upstream fixes

OBS-URL: https://build.opensuse.org/request/show/1029945
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kimageformats?expand=0&rev=113
This commit is contained in:
Dominique Leuenberger 2022-10-20 09:09:46 +00:00 committed by Git OBS Bridge
commit 31523015c0
5 changed files with 130 additions and 0 deletions

View File

@ -0,0 +1,32 @@
From 1190e53e9b69da6f9663ceb75c4813c5708b7cbd Mon Sep 17 00:00:00 2001
From: Fushan Wen <qydwhotmail@gmail.com>
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

View File

@ -0,0 +1,34 @@
From 350ce1b990460cb2178f369f22fe80803f5645f3 Mon Sep 17 00:00:00 2001
From: Fushan Wen <qydwhotmail@gmail.com>
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

View File

@ -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;
--
2.38.0

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Oct 19 09:50:52 UTC 2022 - Christophe Giboudeaux <christophe@krop.fr>
- Add upstream changes:
* 0001-avif-return-false-in-canRead-when-imageIndex-imageCo.patch (kde#460085)
* 0001-avif-always-indicate-endless-loop.patch
* 0001-avif-revert-9ac923ad09316dcca0fc11e0be6b3dfc6cce6ca0.patch
-------------------------------------------------------------------
Sun Oct 9 07:21:20 UTC 2022 - Enrico Belleri <idesmi@protonmail.com>

View File

@ -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