@@ -182,7 +182,6 @@ def _decode_frames_by_av_module(
182182        video_start_pts/video_end_pts: the starting/ending Presentation TimeStamp where 
183183            frames are read 
184184    """ 
185-     start_time  =  time .perf_counter ()
186185    container  =  av .open (full_path )
187186
188187    video_frames  =  []
@@ -215,7 +214,6 @@ def _decode_frames_by_av_module(
215214    container .close ()
216215    vframes  =  [frame .to_rgb ().to_ndarray () for  frame  in  video_frames ]
217216    vframes  =  torch .as_tensor (np .stack (vframes ))
218-     elapsed_time  =  time .perf_counter () -  start_time 
219217
220218    vframe_pts  =  torch .tensor ([frame .pts  for  frame  in  video_frames ], dtype = torch .int64 )
221219
@@ -354,7 +352,6 @@ def test_stress_test_read_video_from_file(self):
354352                full_path  =  os .path .join (VIDEO_DIR , test_video )
355353
356354                # pass 1: decode all frames using new decoder 
357-                 start_time  =  time .perf_counter ()
358355                tv_result  =  video_reader .read_video_from_file (
359356                    full_path ,
360357                    seek_frame_margin ,
@@ -392,7 +389,6 @@ def test_read_video_from_file(self):
392389            full_path  =  os .path .join (VIDEO_DIR , test_video )
393390
394391            # pass 1: decode all frames using new decoder 
395-             start_time  =  time .perf_counter ()
396392            tv_result  =  video_reader .read_video_from_file (
397393                full_path ,
398394                seek_frame_margin ,
@@ -411,7 +407,6 @@ def test_read_video_from_file(self):
411407                audio_timebase_num ,
412408                audio_timebase_den ,
413409            )
414-             elapsed_time  =  time .perf_counter () -  start_time 
415410            # pass 2: decode all frames using av 
416411            pyav_result  =  _decode_frames_by_av_module (full_path )
417412            # check results from TorchVision decoder 
@@ -436,7 +431,6 @@ def test_read_video_from_file_rescale_min_dimension(self):
436431        for  test_video , config  in  test_videos .items ():
437432            full_path  =  os .path .join (VIDEO_DIR , test_video )
438433
439-             start_time  =  time .perf_counter ()
440434            tv_result  =  video_reader .read_video_from_file (
441435                full_path ,
442436                seek_frame_margin ,
@@ -455,7 +449,6 @@ def test_read_video_from_file_rescale_min_dimension(self):
455449                audio_timebase_num ,
456450                audio_timebase_den ,
457451            )
458-             elapsed_time  =  time .perf_counter () -  start_time 
459452            self .assertEqual (min_dimension , min (tv_result [0 ].size (1 ), tv_result [0 ].size (2 )))
460453
461454    def  test_read_video_from_file_rescale_width (self ):
@@ -475,7 +468,6 @@ def test_read_video_from_file_rescale_width(self):
475468        for  test_video , config  in  test_videos .items ():
476469            full_path  =  os .path .join (VIDEO_DIR , test_video )
477470
478-             start_time  =  time .perf_counter ()
479471            tv_result  =  video_reader .read_video_from_file (
480472                full_path ,
481473                seek_frame_margin ,
@@ -494,7 +486,6 @@ def test_read_video_from_file_rescale_width(self):
494486                audio_timebase_num ,
495487                audio_timebase_den ,
496488            )
497-             elapsed_time  =  time .perf_counter () -  start_time 
498489            self .assertEqual (tv_result [0 ].size (2 ), width )
499490
500491    def  test_read_video_from_file_rescale_height (self ):
@@ -514,7 +505,6 @@ def test_read_video_from_file_rescale_height(self):
514505        for  test_video , config  in  test_videos .items ():
515506            full_path  =  os .path .join (VIDEO_DIR , test_video )
516507
517-             start_time  =  time .perf_counter ()
518508            tv_result  =  video_reader .read_video_from_file (
519509                full_path ,
520510                seek_frame_margin ,
@@ -533,7 +523,6 @@ def test_read_video_from_file_rescale_height(self):
533523                audio_timebase_num ,
534524                audio_timebase_den ,
535525            )
536-             elapsed_time  =  time .perf_counter () -  start_time 
537526            self .assertEqual (tv_result [0 ].size (1 ), height )
538527
539528    def  test_read_video_from_file_rescale_width_and_height (self ):
@@ -553,7 +542,6 @@ def test_read_video_from_file_rescale_width_and_height(self):
553542        for  test_video , config  in  test_videos .items ():
554543            full_path  =  os .path .join (VIDEO_DIR , test_video )
555544
556-             start_time  =  time .perf_counter ()
557545            tv_result  =  video_reader .read_video_from_file (
558546                full_path ,
559547                seek_frame_margin ,
@@ -572,7 +560,6 @@ def test_read_video_from_file_rescale_width_and_height(self):
572560                audio_timebase_num ,
573561                audio_timebase_den ,
574562            )
575-             elapsed_time  =  time .perf_counter () -  start_time 
576563            self .assertEqual (tv_result [0 ].size (1 ), height )
577564            self .assertEqual (tv_result [0 ].size (2 ), width )
578565
@@ -648,7 +635,6 @@ def test_compare_read_video_from_memory_and_file(self):
648635            full_path , video_tensor  =  _get_video_tensor (VIDEO_DIR , test_video )
649636
650637            # pass 1: decode all frames using cpp decoder 
651-             start_time  =  time .perf_counter ()
652638            tv_result_memory  =  video_reader .read_video_from_memory (
653639                video_tensor ,
654640                seek_frame_margin ,
@@ -667,10 +653,8 @@ def test_compare_read_video_from_memory_and_file(self):
667653                audio_timebase_num ,
668654                audio_timebase_den ,
669655            )
670-             elapsed_time  =  time .perf_counter () -  start_time 
671656            self .check_separate_decoding_result (tv_result_memory , config )
672657            # pass 2: decode all frames from file 
673-             start_time  =  time .perf_counter ()
674658            tv_result_file  =  video_reader .read_video_from_file (
675659                full_path ,
676660                seek_frame_margin ,
@@ -689,7 +673,6 @@ def test_compare_read_video_from_memory_and_file(self):
689673                audio_timebase_num ,
690674                audio_timebase_den ,
691675            )
692-             elapsed_time  =  time .perf_counter () -  start_time 
693676
694677            self .check_separate_decoding_result (tv_result_file , config )
695678            # finally, compare results decoded from memory and file 
@@ -713,7 +696,6 @@ def test_read_video_from_file(self):
713696            full_path  =  os .path .join (VIDEO_DIR , test_video )
714697
715698            # pass 1: decode all frames using new decoder 
716-             start_time  =  time .perf_counter ()
717699            tv_result  =  video_reader .read_video_from_file (
718700                full_path ,
719701                seek_frame_margin ,
@@ -732,7 +714,6 @@ def test_read_video_from_file(self):
732714                audio_timebase_num ,
733715                audio_timebase_den ,
734716            )
735-             elapsed_time  =  time .perf_counter () -  start_time 
736717            # pass 2: decode all frames using av 
737718            pyav_result  =  _decode_frames_by_av_module (full_path )
738719
@@ -757,7 +738,6 @@ def test_read_video_from_memory(self):
757738            full_path , video_tensor  =  _get_video_tensor (VIDEO_DIR , test_video )
758739
759740            # pass 1: decode all frames using cpp decoder 
760-             start_time  =  time .perf_counter ()
761741            tv_result  =  video_reader .read_video_from_memory (
762742                video_tensor ,
763743                seek_frame_margin ,
@@ -776,7 +756,6 @@ def test_read_video_from_memory(self):
776756                audio_timebase_num ,
777757                audio_timebase_den ,
778758            )
779-             elapsed_time  =  time .perf_counter () -  start_time 
780759            # pass 2: decode all frames using av 
781760            pyav_result  =  _decode_frames_by_av_module (full_path )
782761
@@ -802,7 +781,6 @@ def test_read_video_from_memory_get_pts_only(self):
802781            full_path , video_tensor  =  _get_video_tensor (VIDEO_DIR , test_video )
803782
804783            # pass 1: decode all frames using cpp decoder 
805-             start_time  =  time .perf_counter ()
806784            tv_result  =  video_reader .read_video_from_memory (
807785                video_tensor ,
808786                seek_frame_margin ,
@@ -821,11 +799,9 @@ def test_read_video_from_memory_get_pts_only(self):
821799                audio_timebase_num ,
822800                audio_timebase_den ,
823801            )
824-             elapsed_time  =  time .perf_counter () -  start_time 
825802            self .assertAlmostEqual (config .video_fps , tv_result [3 ].item (), delta = 0.01 )
826803
827804            # pass 2: decode all frames to get PTS only using cpp decoder 
828-             start_time  =  time .perf_counter ()
829805            tv_result_pts_only  =  video_reader .read_video_from_memory (
830806                video_tensor ,
831807                seek_frame_margin ,
@@ -844,7 +820,6 @@ def test_read_video_from_memory_get_pts_only(self):
844820                audio_timebase_num ,
845821                audio_timebase_den ,
846822            )
847-             elapsed_time  =  time .perf_counter () -  start_time 
848823
849824            self .assertEqual (tv_result_pts_only [0 ].numel (), 0 )
850825            self .assertEqual (tv_result_pts_only [4 ].numel (), 0 )
@@ -867,7 +842,6 @@ def test_read_video_in_range_from_memory(self):
867842            audio_start_pts , audio_end_pts  =  0 , - 1 
868843            audio_timebase_num , audio_timebase_den  =  0 , 1 
869844            # pass 1: decode all frames using new decoder 
870-             start_time  =  time .perf_counter ()
871845            tv_result  =  video_reader .read_video_from_memory (
872846                video_tensor ,
873847                seek_frame_margin ,
@@ -889,7 +863,6 @@ def test_read_video_in_range_from_memory(self):
889863            vframes , vframe_pts , vtimebase , vfps , aframes , aframe_pts , atimebase , asample_rate  =  (
890864                tv_result 
891865            )
892-             elapsed_time  =  time .perf_counter () -  start_time 
893866            self .assertAlmostEqual (config .video_fps , vfps .item (), delta = 0.01 )
894867
895868            for  num_frames  in  [4 , 8 , 16 , 32 , 64 , 128 ]:
@@ -920,7 +893,6 @@ def test_read_video_in_range_from_memory(self):
920893                    )
921894
922895                # pass 2: decode frames in the randomly generated range 
923-                 start_time  =  time .perf_counter ()
924896                tv_result  =  video_reader .read_video_from_memory (
925897                    video_tensor ,
926898                    seek_frame_margin ,
@@ -939,7 +911,6 @@ def test_read_video_in_range_from_memory(self):
939911                    audio_timebase_num ,
940912                    audio_timebase_den ,
941913                )
942-                 elapsed_time  =  time .perf_counter () -  start_time 
943914
944915                # pass 3: decode frames in range using PyAv 
945916                video_timebase_av , audio_timebase_av  =  _get_timebase_by_av_module (full_path )
0 commit comments