From e30e4d48eb18b5297a53e727ded94d337f4aa021 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Tue, 12 Oct 2021 08:58:22 -0400 Subject: media-libs/libjxl: fixes --- .../roundtripanimationpatches-ifdef-gif-9999.patch | 81 ++++++++++++++++++++++ media-libs/libjxl/libjxl-0.6.ebuild | 7 +- media-libs/libjxl/libjxl-9999.ebuild | 17 ++--- 3 files changed, 90 insertions(+), 15 deletions(-) create mode 100644 media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif-9999.patch (limited to 'media-libs') diff --git a/media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif-9999.patch b/media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif-9999.patch new file mode 100644 index 0000000..fce63e7 --- /dev/null +++ b/media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif-9999.patch @@ -0,0 +1,81 @@ +From 027c7997af8a3735e4b4706328c19e6805bc62b9 Mon Sep 17 00:00:00 2001 +From: "Alex Xu (Hello71)" +Date: Thu, 7 Oct 2021 14:07:35 -0400 +Subject: [PATCH] Run RoundtripAnimationPatches only if gif enabled + +--- + AUTHORS | 1 + + lib/jxl/jxl_test.cc | 42 +++++++++++++++++++++--------------------- + 2 files changed, 22 insertions(+), 21 deletions(-) + +diff --git a/AUTHORS b/AUTHORS +index 03f8b40..d4aaef7 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -28,3 +28,4 @@ Ziemowit Zabawa + Andrius Lukas Narbutas + Misaki Kasumi + Samuel Leong ++Alex Xu (Hello71) +diff --git a/lib/jxl/jxl_test.cc b/lib/jxl/jxl_test.cc +index d411492..0cb0988 100644 +--- a/lib/jxl/jxl_test.cc ++++ b/lib/jxl/jxl_test.cc +@@ -1337,6 +1337,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(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_THAT(ButteraugliDistance(io, io2, cparams.ba_params, ++ /*distmap=*/nullptr, pool), ++ IsSlightlyBelow(1.5)); ++} ++ + #endif // JPEGXL_ENABLE_GIF + + #if JPEGXL_ENABLE_JPEG +@@ -1630,26 +1651,5 @@ TEST(JxlTest, RoundtripProgressive) { + IsSlightlyBelow(2.5f)); + } + +-TEST(JxlTest, RoundtripAnimationPatches) { +- ThreadPool* pool = nullptr; +- const PaddedBytes orig = ReadTestData("jxl/animation_patches.gif"); +- CodecInOut io; +- ASSERT_TRUE(SetFromBytes(Span(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_THAT(ButteraugliDistance(io, io2, cparams.ba_params, +- /*distmap=*/nullptr, pool), +- IsSlightlyBelow(1.5)); +-} +- + } // 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 2c770ee..be55cc0 100644 --- a/media-libs/libjxl/libjxl-0.6.ebuild +++ b/media-libs/libjxl/libjxl-0.6.ebuild @@ -73,22 +73,23 @@ multilib_src_configure() { -DJPEGXL_ENABLE_COVERAGE=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_ENABLE_FUZZERS=OFF - -DJPEGXL_ENABLE_JNI=$(usex java ON OFF) + -DJPEGXL_ENABLE_JNI=$(multilib_native_usex java ON OFF) -DJPEGXL_ENABLE_MANPAGES=$(multilib_native_usex man ON OFF) -DJPEGXL_ENABLE_OPENEXR=$(usex openexr ON OFF) -DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_ENABLE_SKCMS=OFF + -DJPEGXL_ENABLE_TCMALLOC=OFF -DJPEGXL_ENABLE_VIEWERS=$(multilib_native_usex viewers ON OFF) - -DJPEGXL_FORCE_SYSTEM_GTEST=ON -DJPEGXL_FORCE_SYSTEM_BROTLI=ON + -DJPEGXL_FORCE_SYSTEM_GTEST=ON -DJPEGXL_FORCE_SYSTEM_HWY=ON -DJPEGXL_FORCE_SYSTEM_LCMS=ON -DJPEGXL_WARNINGS_AS_ERRORS=OFF $(cmake_use_find_package apng PNG) $(cmake_use_find_package apng ZLIB) - -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=$(! multilib_is_native_abi || use doc || echo ON) + -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=$(multilib_native_usex doc OFF ON) $(cmake_use_find_package gif GIF) $(cmake_use_find_package jpeg JPEG) ) diff --git a/media-libs/libjxl/libjxl-9999.ebuild b/media-libs/libjxl/libjxl-9999.ebuild index 6a78c3d..df6ab5d 100644 --- a/media-libs/libjxl/libjxl-9999.ebuild +++ b/media-libs/libjxl/libjxl-9999.ebuild @@ -55,7 +55,7 @@ DEPEND="${RDEPEND} PATCHES=( "${FILESDIR}/system-lcms.patch" - "${FILESDIR}/roundtripanimationpatches-ifdef-gif.patch" + "${FILESDIR}/roundtripanimationpatches-ifdef-gif-9999.patch" ) src_prepare() { @@ -73,22 +73,23 @@ multilib_src_configure() { -DJPEGXL_ENABLE_COVERAGE=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_ENABLE_FUZZERS=OFF - -DJPEGXL_ENABLE_JNI=$(usex java ON OFF) + -DJPEGXL_ENABLE_JNI=$(multilib_native_usex java ON OFF) -DJPEGXL_ENABLE_MANPAGES=$(multilib_native_usex man ON OFF) -DJPEGXL_ENABLE_OPENEXR=$(usex openexr ON OFF) -DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_ENABLE_SKCMS=OFF + -DJPEGXL_ENABLE_TCMALLOC=OFF -DJPEGXL_ENABLE_VIEWERS=$(multilib_native_usex viewers ON OFF) - -DJPEGXL_FORCE_SYSTEM_GTEST=ON -DJPEGXL_FORCE_SYSTEM_BROTLI=ON + -DJPEGXL_FORCE_SYSTEM_GTEST=ON -DJPEGXL_FORCE_SYSTEM_HWY=ON -DJPEGXL_FORCE_SYSTEM_LCMS=ON -DJPEGXL_WARNINGS_AS_ERRORS=OFF $(cmake_use_find_package apng PNG) $(cmake_use_find_package apng ZLIB) - -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=$(! multilib_is_native_abi || use doc || echo ON) + -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=$(multilib_native_usex doc OFF ON) $(cmake_use_find_package gif GIF) $(cmake_use_find_package jpeg JPEG) ) @@ -96,14 +97,6 @@ multilib_src_configure() { cmake_src_configure } -multilib_src_test() { - # RobustStatisticsTest: https://github.com/libjxl/libjxl/issues/698 - local myctestargs=( - -E '^RobustStatisticsTest\.' - ) - cmake_src_test -} - multilib_src_install() { cmake_src_install if ! use static-libs; then -- cgit v1.2.3-70-g09d2