Unverified Commit eba853e1 authored by Prabhat Roy's avatar Prabhat Roy Committed by GitHub
Browse files

Updated gpu decoder test to use parametrize (#5328)

* Updated gpu decoder test to use parametrize

* Remove list comprehension
parent 5b825901
......@@ -12,7 +12,13 @@ except ImportError:
VIDEO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "videos")
test_videos = [
@pytest.mark.skipif(_HAS_VIDEO_DECODER is False, reason="Didn't compile with support for gpu decoder")
class TestVideoGPUDecoder:
@pytest.mark.skipif(av is None, reason="PyAV unavailable")
@pytest.mark.parametrize(
"video_file",
[
"RATRACE_wave_f_nm_np1_fr_goo_37.avi",
"TrumanShow_wave_f_nm_np1_fr_med_26.avi",
"v_SoccerJuggling_g23_c01.avi",
......@@ -20,15 +26,10 @@ test_videos = [
"R6llTwEh07w.mp4",
"SOX5yA1l24A.mp4",
"WUzgd7C1pWA.mp4",
]
@pytest.mark.skipif(_HAS_VIDEO_DECODER is False, reason="Didn't compile with support for gpu decoder")
class TestVideoGPUDecoder:
@pytest.mark.skipif(av is None, reason="PyAV unavailable")
def test_frame_reading(self):
for test_video in test_videos:
full_path = os.path.join(VIDEO_DIR, test_video)
],
)
def test_frame_reading(self, video_file):
full_path = os.path.join(VIDEO_DIR, video_file)
decoder = VideoReader(full_path, device="cuda:0")
with av.open(full_path) as container:
for av_frame in container.decode(container.streams.video[0]):
......@@ -65,9 +66,20 @@ class TestVideoGPUDecoder:
assert mean_delta < 0.75
@pytest.mark.skipif(av is None, reason="PyAV unavailable")
def test_metadata(self):
for test_video in test_videos:
full_path = os.path.join(VIDEO_DIR, test_video)
@pytest.mark.parametrize(
"video_file",
[
"RATRACE_wave_f_nm_np1_fr_goo_37.avi",
"TrumanShow_wave_f_nm_np1_fr_med_26.avi",
"v_SoccerJuggling_g23_c01.avi",
"v_SoccerJuggling_g24_c01.avi",
"R6llTwEh07w.mp4",
"SOX5yA1l24A.mp4",
"WUzgd7C1pWA.mp4",
],
)
def test_metadata(self, video_file):
full_path = os.path.join(VIDEO_DIR, video_file)
decoder = VideoReader(full_path, device="cuda:0")
video_metadata = decoder.get_metadata()["video"]
with av.open(full_path) as container:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment