summaryrefslogtreecommitdiff
path: root/media-libs/libjxl/files/roundtripanimationpatches-ifdef-gif.patch
blob: c8baf7d75d772b5a88550f27d3bdcb650187e5cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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