Skip to content

Commit 3314678

Browse files
author
Daniel Flores
committed
adjust test order
1 parent 9d3a940 commit 3314678

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

test/test_ops.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,19 +1310,10 @@ def decode(self, file_path) -> torch.Tensor:
13101310

13111311
@pytest.mark.parametrize("format", ("mov", "mp4", "avi", "mkv", "webm", "flv"))
13121312
def test_video_encoder_test_round_trip(self, tmp_path, format):
1313-
13141313
ffmpeg_version = get_ffmpeg_major_version()
13151314
if ffmpeg_version == 4 and format == "webm":
13161315
pytest.skip("Codec for webm is not available in the FFmpeg4 installation.")
1317-
# The output pixel format depends on the codecs available, and FFmpeg version.
1318-
# In the cases where YUV420P is chosen and chroma subsampling happens, we need higher tolerance.
1319-
if ffmpeg_version == 6 or format in ("avi", "flv"):
1320-
atol = 55
1321-
else:
1322-
atol = 2
1323-
# TODO-VideoEncoder: Test with FFmpeg's testsrc2 video
13241316
asset = NASA_VIDEO
1325-
13261317
# Test that decode(encode(decode(asset))) == decode(asset)
13271318
source_frames = self.decode(str(asset.path)).data
13281319

@@ -1331,6 +1322,13 @@ def test_video_encoder_test_round_trip(self, tmp_path, format):
13311322
encode_video_to_file(source_frames, frame_rate, encoded_path, crf=0)
13321323
round_trip_frames = self.decode(encoded_path).data
13331324

1325+
# The output pixel format depends on the codecs available, and FFmpeg version.
1326+
# In the cases where YUV420P is chosen and chroma subsampling happens, assert_close needs higher tolerance.
1327+
if ffmpeg_version == 6 or format in ("avi", "flv"):
1328+
atol = 55
1329+
else:
1330+
atol = 2
1331+
# TODO-VideoEncoder: Test with FFmpeg's testsrc2 video
13341332
# Check that PSNR for decode(encode(samples)) is above 30
13351333
for s_frame, rt_frame in zip(source_frames, round_trip_frames):
13361334
res = psnr(s_frame, rt_frame)

0 commit comments

Comments
 (0)