Skip to content

Commit 764888d

Browse files
author
Daniel Flores
committed
reorder test variables
1 parent a887d6f commit 764888d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/test_ops.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,16 +1238,18 @@ def decode(self, file_path) -> torch.Tensor:
12381238
# TODO-VideoEncoder: enable additional formats (mkv, webm)
12391239
def test_video_encoder_test_round_trip(self, tmp_path, format):
12401240
asset = NASA_VIDEO
1241-
encoded_path = str(tmp_path / f"encoder_output.{format}")
12421241

1242+
# Test that decode(encode(decode(asset))) == decode(asset)
12431243
source_frames = self.decode(str(asset.path)).data
1244-
frame_rate = 30 # Frame rate is fixed with num frames decoded
12451244

1245+
encoded_path = str(tmp_path / f"encoder_output.{format}")
1246+
frame_rate = 30 # Frame rate is fixed with num frames decoded
12461247
encode_video_to_file(source_frames, frame_rate, encoded_path)
1248+
round_trip_frames = self.decode(encoded_path).data
12471249

12481250
# Check that PSNR for decode(encode(samples)) is above 30
1249-
for s_frame, d_frame in zip(source_frames, self.decode(encoded_path).data):
1250-
res = psnr(s_frame, d_frame)
1251+
for s_frame, rt_frame in zip(source_frames, round_trip_frames):
1252+
res = psnr(s_frame, rt_frame)
12511253
assert res > 30
12521254

12531255

0 commit comments

Comments
 (0)