Skip to content

Commit 222e74d

Browse files
committed
add webm tolerance to the round trip test
1 parent d1e5bdf commit 222e74d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/test_encoders.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,9 +743,10 @@ def test_round_trip(self, tmp_path, format, method):
743743
assert source_frames.shape == round_trip_frames.shape
744744
assert source_frames.dtype == round_trip_frames.dtype
745745

746+
atol = 3 if format == "webm" else 2
746747
for s_frame, rt_frame in zip(source_frames, round_trip_frames):
747748
assert psnr(s_frame, rt_frame) > 30
748-
torch.testing.assert_close(s_frame, rt_frame, atol=2, rtol=0)
749+
torch.testing.assert_close(s_frame, rt_frame, atol=atol, rtol=0)
749750

750751
@pytest.mark.parametrize(
751752
"format",
@@ -858,13 +859,12 @@ def test_video_encoder_against_ffmpeg_cli(self, tmp_path, format, pixel_format):
858859
# There may be additional subtle differences in the encoder.
859860
percentage = 94 if ffmpeg_version == 6 or format == "avi" else 99
860861

861-
atol = 3 if format == "webm" else 2
862862
# Check that PSNR between both encoded versions is high
863863
for ff_frame, enc_frame in zip(ffmpeg_frames, encoder_frames):
864864
res = psnr(ff_frame, enc_frame)
865865
assert res > 30
866866
assert_tensor_close_on_at_least(
867-
ff_frame, enc_frame, percentage=percentage, atol=atol
867+
ff_frame, enc_frame, percentage=percentage, atol=2
868868
)
869869

870870
def test_to_file_like_custom_file_object(self):

0 commit comments

Comments
 (0)