summaryrefslogtreecommitdiff
path: root/media-libs/libjxl
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2021-10-07 15:13:25 -0400
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2021-10-07 15:13:25 -0400
commit5492c5717ab68e83ca0bba34b14f8a617efc1a23 (patch)
treefc7b4322e482cf56c2e5c61683fc97c232acafef /media-libs/libjxl
parent30feedf6dd65cf689c97a11f4f9720e8b572b523 (diff)
downloadgentoo-overlay-5492c5717ab68e83ca0bba34b14f8a617efc1a23.tar.xz
gentoo-overlay-5492c5717ab68e83ca0bba34b14f8a617efc1a23.zip
media-libs/libjxl: add roundtripanimationpatches-ifdef-gif.patch
Diffstat (limited to 'media-libs/libjxl')
-rw-r--r--media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif.patch71
-rw-r--r--media-libs/libjxl/libjxl-0.6.ebuild5
-rw-r--r--media-libs/libjxl/libjxl-9999.ebuild5
3 files changed, 79 insertions, 2 deletions
diff --git a/media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif.patch b/media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif.patch
new file mode 100644
index 0000000..c8baf7d
--- /dev/null
+++ b/media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif.patch
@@ -0,0 +1,71 @@
+From 134f1876473d9463332711a834e2ddc70fa7e38c Mon Sep 17 00:00:00 2001
+From: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
+Date: Thu, 7 Oct 2021 14:07:35 -0400
+Subject: [PATCH] Run RoundtripAnimationPatches only if gif enabled
+
+---
+ lib/jxl/jxl_test.cc | 42 +++++++++++++++++++++---------------------
+ 1 file changed, 21 insertions(+), 21 deletions(-)
+
+diff --git a/lib/jxl/jxl_test.cc b/lib/jxl/jxl_test.cc
+index aaf1f4e..815ec7c 100644
+--- a/lib/jxl/jxl_test.cc
++++ b/lib/jxl/jxl_test.cc
+@@ -1336,6 +1336,27 @@ TEST(JxlTest, RoundtripLosslessAnimation) {
+ 5e-4);
+ }
+
++TEST(JxlTest, RoundtripAnimationPatches) {
++ ThreadPool* pool = nullptr;
++ const PaddedBytes orig = ReadTestData("jxl/animation_patches.gif");
++ CodecInOut io;
++ ASSERT_TRUE(SetFromBytes(Span<const uint8_t>(orig), &io, pool));
++ ASSERT_EQ(2u, io.frames.size());
++
++ CompressParams cparams;
++ cparams.patches = Override::kOn;
++ DecompressParams dparams;
++ CodecInOut io2;
++ // 40k with no patches, 27k with patch frames encoded multiple times.
++ EXPECT_LE(Roundtrip(&io, cparams, dparams, pool, &io2), 24000u);
++
++ EXPECT_EQ(io2.frames.size(), io.frames.size());
++ // >10 with broken patches
++ EXPECT_LE(ButteraugliDistance(io, io2, cparams.ba_params,
++ /*distmap=*/nullptr, pool),
++ 2.0);
++}
++
+ #endif // JPEGXL_ENABLE_GIF
+
+ #if JPEGXL_ENABLE_JPEG
+@@ -1629,26 +1650,5 @@ TEST(JxlTest, RoundtripProgressive) {
+ 4.0f);
+ }
+
+-TEST(JxlTest, RoundtripAnimationPatches) {
+- ThreadPool* pool = nullptr;
+- const PaddedBytes orig = ReadTestData("jxl/animation_patches.gif");
+- CodecInOut io;
+- ASSERT_TRUE(SetFromBytes(Span<const uint8_t>(orig), &io, pool));
+- ASSERT_EQ(2u, io.frames.size());
+-
+- CompressParams cparams;
+- cparams.patches = Override::kOn;
+- DecompressParams dparams;
+- CodecInOut io2;
+- // 40k with no patches, 27k with patch frames encoded multiple times.
+- EXPECT_LE(Roundtrip(&io, cparams, dparams, pool, &io2), 24000u);
+-
+- EXPECT_EQ(io2.frames.size(), io.frames.size());
+- // >10 with broken patches
+- EXPECT_LE(ButteraugliDistance(io, io2, cparams.ba_params,
+- /*distmap=*/nullptr, pool),
+- 2.0);
+-}
+-
+ } // namespace
+ } // namespace jxl
+--
+2.33.0
+
diff --git a/media-libs/libjxl/libjxl-0.6.ebuild b/media-libs/libjxl/libjxl-0.6.ebuild
index 5513b91..024ae51 100644
--- a/media-libs/libjxl/libjxl-0.6.ebuild
+++ b/media-libs/libjxl/libjxl-0.6.ebuild
@@ -53,7 +53,10 @@ DEPEND="${RDEPEND}
java? ( virtual/jdk:* )
"
-PATCHES=("${FILESDIR}/system-lcms.patch")
+PATCHES=(
+ "${FILESDIR}/system-lcms.patch"
+ "${FILESDIR}/roundtripanimationpatches-ifdef-gif.patch"
+)
src_prepare() {
if [[ ${PV} != 9999 ]]; then
diff --git a/media-libs/libjxl/libjxl-9999.ebuild b/media-libs/libjxl/libjxl-9999.ebuild
index 5513b91..024ae51 100644
--- a/media-libs/libjxl/libjxl-9999.ebuild
+++ b/media-libs/libjxl/libjxl-9999.ebuild
@@ -53,7 +53,10 @@ DEPEND="${RDEPEND}
java? ( virtual/jdk:* )
"
-PATCHES=("${FILESDIR}/system-lcms.patch")
+PATCHES=(
+ "${FILESDIR}/system-lcms.patch"
+ "${FILESDIR}/roundtripanimationpatches-ifdef-gif.patch"
+)
src_prepare() {
if [[ ${PV} != 9999 ]]; then