Skip to content

Commit

Permalink
Reduced epsilons
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Dec 21, 2024
1 parent 70b4159 commit 4ceff05
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Tests/test_file_avif.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_read(self) -> None:
# generated with:
# avifdec hopper.avif hopper_avif_write.png
assert_image_similar_tofile(
image, "Tests/images/avif/hopper_avif_write.png", 12.0
image, "Tests/images/avif/hopper_avif_write.png", 11.5
)

def _roundtrip(self, tmp_path: Path, mode: str, epsilon: float) -> None:
Expand All @@ -163,7 +163,7 @@ def _roundtrip(self, tmp_path: Path, mode: str, epsilon: float) -> None:
if mode == "RGB":
# avifdec hopper.avif avif/hopper_avif_write.png
assert_image_similar_tofile(
image, "Tests/images/avif/hopper_avif_write.png", 12.0
image, "Tests/images/avif/hopper_avif_write.png", 5.81
)

# This test asserts that the images are similar. If the average pixel
Expand All @@ -181,7 +181,7 @@ def test_write_rgb(self, tmp_path: Path) -> None:
Does it have the bits we expect?
"""

self._roundtrip(tmp_path, "RGB", 12.5)
self._roundtrip(tmp_path, "RGB", 8.41)

def test_AvifEncoder_with_invalid_args(self) -> None:
"""
Expand Down Expand Up @@ -574,7 +574,7 @@ def test_p_mode_transparency(self) -> None:
im_png.save(buf_out, format="AVIF", quality=100)

with Image.open(buf_out) as expected:
assert_image_similar(im_png.convert("RGBA"), expected, 1)
assert_image_similar(im_png.convert("RGBA"), expected, 0.17)

def test_decoder_strict_flags(self) -> None:
# This would fail if full avif strictFlags were enabled
Expand Down Expand Up @@ -633,10 +633,10 @@ def test_write_animation_L(self, tmp_path: Path) -> None:
assert im.n_frames == orig.n_frames

# Compare first and second-to-last frames to the original animated GIF
assert_image_similar(im.convert("RGB"), orig.convert("RGB"), 25.0)
assert_image_similar(im.convert("RGB"), orig.convert("RGB"), 2.25)
orig.seek(orig.n_frames - 2)
im.seek(im.n_frames - 2)
assert_image_similar(im.convert("RGB"), orig.convert("RGB"), 25.0)
assert_image_similar(im.convert("RGB"), orig.convert("RGB"), 2.54)

def test_write_animation_RGB(self, tmp_path: Path) -> None:
"""
Expand All @@ -649,11 +649,11 @@ def check(temp_file: str) -> None:
assert im.n_frames == 4

# Compare first frame to original
assert_image_similar(im, frame1.convert("RGBA"), 25.0)
assert_image_similar(im, frame1.convert("RGBA"), 2.7)

# Compare second frame to original
im.seek(1)
assert_image_similar(im, frame2.convert("RGBA"), 25.0)
assert_image_similar(im, frame2.convert("RGBA"), 4.1)

with self.star_frames() as frames:
frame1 = frames[0]
Expand Down

0 comments on commit 4ceff05

Please sign in to comment.