Skip to content

Commit a1e2c74

Browse files
author
Daniel Flores
committed
adjust test order
1 parent 1a7af82 commit a1e2c74

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/test_ops.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,18 +1342,10 @@ def decode(self, file_path) -> torch.Tensor:
13421342

13431343
@pytest.mark.parametrize("format", ("mov", "mp4", "avi", "mkv", "webm", "flv"))
13441344
def test_video_encoder_test_round_trip(self, tmp_path, format):
1345-
13461345
ffmpeg_version = get_ffmpeg_major_version()
13471346
if ffmpeg_version == 4 and format == "webm":
13481347
pytest.skip("Codec for webm is not available in the FFmpeg4 installation.")
1349-
# The output pixel format depends on the codecs available, and FFmpeg version.
1350-
# In the cases where YUV420P is chosen and chroma subsampling happens, we need higher tolerance.
1351-
if ffmpeg_version == 6 or format in ("avi", "flv"):
1352-
atol = 55
1353-
else:
1354-
atol = 2
13551348
asset = NASA_VIDEO
1356-
13571349
# Test that decode(encode(decode(asset))) == decode(asset)
13581350
source_frames = self.decode(str(asset.path)).data
13591351

@@ -1362,6 +1354,13 @@ def test_video_encoder_test_round_trip(self, tmp_path, format):
13621354
encode_video_to_file(source_frames, frame_rate, encoded_path, crf=0)
13631355
round_trip_frames = self.decode(encoded_path).data
13641356

1357+
# The output pixel format depends on the codecs available, and FFmpeg version.
1358+
# In the cases where YUV420P is chosen and chroma subsampling happens, assert_close needs higher tolerance.
1359+
if ffmpeg_version == 6 or format in ("avi", "flv"):
1360+
atol = 55
1361+
else:
1362+
atol = 2
1363+
# TODO-VideoEncoder: Test with FFmpeg's testsrc2 video
13651364
# Check that PSNR for decode(encode(samples)) is above 30
13661365
for s_frame, rt_frame in zip(source_frames, round_trip_frames):
13671366
res = psnr(s_frame, rt_frame)

0 commit comments

Comments
 (0)