@@ -1417,13 +1417,23 @@ def test_get_frames_at_tensor_indices(self):
14171417
14181418 @needs_cuda
14191419 @pytest .mark .parametrize (
1420- "asset" , (NASA_VIDEO , TEST_SRC_2_720P , BT709_FULL_RANGE , TEST_SRC_2_720P_H265 )
1420+ "asset" ,
1421+ (
1422+ NASA_VIDEO ,
1423+ TEST_SRC_2_720P ,
1424+ BT709_FULL_RANGE ,
1425+ TEST_SRC_2_720P_H265 ,
1426+ AV1_VIDEO ,
1427+ ),
14211428 )
14221429 @pytest .mark .parametrize ("contiguous_indices" , (True , False ))
14231430 @pytest .mark .parametrize ("seek_mode" , ("exact" , "approximate" ))
14241431 def test_beta_cuda_interface_get_frame_at (
14251432 self , asset , contiguous_indices , seek_mode
14261433 ):
1434+ if asset == AV1_VIDEO and seek_mode == "approximate" :
1435+ pytest .skip ("AV1 asset doesn't work with approximate mode" )
1436+
14271437 ref_decoder = VideoDecoder (asset .path , device = "cuda" , seek_mode = seek_mode )
14281438 beta_decoder = VideoDecoder (
14291439 asset .path , device = "cuda:0:beta" , seek_mode = seek_mode
@@ -1449,13 +1459,23 @@ def test_beta_cuda_interface_get_frame_at(
14491459
14501460 @needs_cuda
14511461 @pytest .mark .parametrize (
1452- "asset" , (NASA_VIDEO , TEST_SRC_2_720P , BT709_FULL_RANGE , TEST_SRC_2_720P_H265 )
1462+ "asset" ,
1463+ (
1464+ NASA_VIDEO ,
1465+ TEST_SRC_2_720P ,
1466+ BT709_FULL_RANGE ,
1467+ TEST_SRC_2_720P_H265 ,
1468+ AV1_VIDEO ,
1469+ ),
14531470 )
14541471 @pytest .mark .parametrize ("contiguous_indices" , (True , False ))
14551472 @pytest .mark .parametrize ("seek_mode" , ("exact" , "approximate" ))
14561473 def test_beta_cuda_interface_get_frames_at (
14571474 self , asset , contiguous_indices , seek_mode
14581475 ):
1476+ if asset == AV1_VIDEO and seek_mode == "approximate" :
1477+ pytest .skip ("AV1 asset doesn't work with approximate mode" )
1478+
14591479 ref_decoder = VideoDecoder (asset .path , device = "cuda" , seek_mode = seek_mode )
14601480 beta_decoder = VideoDecoder (
14611481 asset .path , device = "cuda:0:beta" , seek_mode = seek_mode
@@ -1482,10 +1502,20 @@ def test_beta_cuda_interface_get_frames_at(
14821502
14831503 @needs_cuda
14841504 @pytest .mark .parametrize (
1485- "asset" , (NASA_VIDEO , TEST_SRC_2_720P , BT709_FULL_RANGE , TEST_SRC_2_720P_H265 )
1505+ "asset" ,
1506+ (
1507+ NASA_VIDEO ,
1508+ TEST_SRC_2_720P ,
1509+ BT709_FULL_RANGE ,
1510+ TEST_SRC_2_720P_H265 ,
1511+ AV1_VIDEO ,
1512+ ),
14861513 )
14871514 @pytest .mark .parametrize ("seek_mode" , ("exact" , "approximate" ))
14881515 def test_beta_cuda_interface_get_frame_played_at (self , asset , seek_mode ):
1516+ if asset == AV1_VIDEO and seek_mode == "approximate" :
1517+ pytest .skip ("AV1 asset doesn't work with approximate mode" )
1518+
14891519 ref_decoder = VideoDecoder (asset .path , device = "cuda" , seek_mode = seek_mode )
14901520 beta_decoder = VideoDecoder (
14911521 asset .path , device = "cuda:0:beta" , seek_mode = seek_mode
@@ -1506,10 +1536,20 @@ def test_beta_cuda_interface_get_frame_played_at(self, asset, seek_mode):
15061536
15071537 @needs_cuda
15081538 @pytest .mark .parametrize (
1509- "asset" , (NASA_VIDEO , TEST_SRC_2_720P , BT709_FULL_RANGE , TEST_SRC_2_720P_H265 )
1539+ "asset" ,
1540+ (
1541+ NASA_VIDEO ,
1542+ TEST_SRC_2_720P ,
1543+ BT709_FULL_RANGE ,
1544+ TEST_SRC_2_720P_H265 ,
1545+ AV1_VIDEO ,
1546+ ),
15101547 )
15111548 @pytest .mark .parametrize ("seek_mode" , ("exact" , "approximate" ))
15121549 def test_beta_cuda_interface_get_frames_played_at (self , asset , seek_mode ):
1550+ if asset == AV1_VIDEO and seek_mode == "approximate" :
1551+ pytest .skip ("AV1 asset doesn't work with approximate mode" )
1552+
15131553 ref_decoder = VideoDecoder (asset .path , device = "cuda" , seek_mode = seek_mode )
15141554 beta_decoder = VideoDecoder (
15151555 asset .path , device = "cuda:0:beta" , seek_mode = seek_mode
@@ -1531,10 +1571,19 @@ def test_beta_cuda_interface_get_frames_played_at(self, asset, seek_mode):
15311571
15321572 @needs_cuda
15331573 @pytest .mark .parametrize (
1534- "asset" , (NASA_VIDEO , TEST_SRC_2_720P , BT709_FULL_RANGE , TEST_SRC_2_720P_H265 )
1574+ "asset" ,
1575+ (
1576+ NASA_VIDEO ,
1577+ TEST_SRC_2_720P ,
1578+ BT709_FULL_RANGE ,
1579+ TEST_SRC_2_720P_H265 ,
1580+ AV1_VIDEO ,
1581+ ),
15351582 )
15361583 @pytest .mark .parametrize ("seek_mode" , ("exact" , "approximate" ))
15371584 def test_beta_cuda_interface_backwards (self , asset , seek_mode ):
1585+ if asset == AV1_VIDEO and seek_mode == "approximate" :
1586+ pytest .skip ("AV1 asset doesn't work with approximate mode" )
15381587
15391588 ref_decoder = VideoDecoder (asset .path , device = "cuda" , seek_mode = seek_mode )
15401589 beta_decoder = VideoDecoder (
@@ -1543,8 +1592,14 @@ def test_beta_cuda_interface_backwards(self, asset, seek_mode):
15431592
15441593 assert ref_decoder .metadata == beta_decoder .metadata
15451594
1546- for frame_index in [0 , 100 , 10 , 50 , 20 , 200 , 150 , 389 ]:
1595+ for frame_index in [0 , 1 , 2 , 1 , 0 , 100 , 10 , 50 , 20 , 200 , 150 , 150 , 150 , 389 , 2 ]:
1596+ # This is ugly, but OK: the indices values above are relevant for
1597+ # the NASA_VIDEO. We need to avoid going out of bounds for other
1598+ # videos so we cap the frame_index. This test still serves its
1599+ # purpose: no matter what the range of the video, we're still doing
1600+ # backwards seeks.
15471601 frame_index = min (frame_index , len (ref_decoder ) - 1 )
1602+
15481603 ref_frame = ref_decoder .get_frame_at (frame_index )
15491604 beta_frame = beta_decoder .get_frame_at (frame_index )
15501605 torch .testing .assert_close (beta_frame .data , ref_frame .data , rtol = 0 , atol = 0 )
@@ -1568,8 +1623,6 @@ def test_beta_cuda_interface_small_h265(self):
15681623
15691624 @needs_cuda
15701625 def test_beta_cuda_interface_error (self ):
1571- with pytest .raises (RuntimeError , match = "Unsupported codec type: av1" ):
1572- VideoDecoder (AV1_VIDEO .path , device = "cuda:0:beta" )
15731626 with pytest .raises (RuntimeError , match = "Unsupported device" ):
15741627 VideoDecoder (NASA_VIDEO .path , device = "cuda:0:bad_variant" )
15751628
0 commit comments