changeset 4844:76acf5bbda78

exclude benchmark stuff execution from normal playback
author nick
date Sun, 24 Feb 2002 17:10:06 +0000
parents 00c875a22d10
children ed5aa118e142
files dec_video.c mencoder.c mplayer.c
diffstat 3 files changed, 31 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dec_video.c	Sun Feb 24 17:00:19 2002 +0000
+++ b/dec_video.c	Sun Feb 24 17:10:06 2002 +0000
@@ -38,6 +38,7 @@
 
 // ===================================================================
 
+extern int benchmark;
 extern double video_time_usage;
 extern double vout_time_usage;
 extern double max_video_time_usage;
@@ -1219,8 +1220,11 @@
 t2=GetTimer();t=t2-t;
 tt = t*0.000001f;
 video_time_usage+=tt;
-if(tt > max_video_time_usage) max_video_time_usage=tt;
-cur_video_time_usage=tt;
+if(benchmark)
+{
+    if(tt > max_video_time_usage) max_video_time_usage=tt;
+    cur_video_time_usage=tt;
+}
 if(painted) return 1;
 switch(blit_frame){
 case 3:
@@ -1280,8 +1284,11 @@
     t2=GetTimer()-t2;
     tt=t2*0.000001f;
     vout_time_usage+=tt;
-    if(tt > max_vout_time_usage) max_vout_time_usage = tt;
-    cur_vout_time_usage=tt;
+    if(benchmark)
+    {
+	if(tt > max_vout_time_usage) max_vout_time_usage = tt;
+	cur_vout_time_usage=tt;
+    }
     blit_frame=1;
     break;
 }
--- a/mencoder.c	Sun Feb 24 17:00:19 2002 +0000
+++ b/mencoder.c	Sun Feb 24 17:10:06 2002 +0000
@@ -147,7 +147,6 @@
 //void resync_audio_stream(sh_audio_t *sh_audio){}
 
 int verbose=0; // must be global!
-
 double video_time_usage=0;
 double vout_time_usage=0;
 double max_video_time_usage=0;
@@ -156,7 +155,7 @@
 double cur_vout_time_usage=0;
 static double audio_time_usage=0;
 static int total_time_usage_start=0;
-static int benchmark=0;
+int benchmark=0;
 
 // A-V sync:
 int delay_corrected=1;
--- a/mplayer.c	Sun Feb 24 17:00:19 2002 +0000
+++ b/mplayer.c	Sun Feb 24 17:10:06 2002 +0000
@@ -184,7 +184,7 @@
 static double max_audio_time_usage=0;
 static double cur_audio_time_usage=0;
 static int total_time_usage_start=0;
-static int benchmark=0;
+int benchmark=0;
 static unsigned bench_dropped_frames=0;
 
 // static int play_in_bg=0;
@@ -1562,7 +1562,10 @@
 
 total_time_usage_start=GetTimer();
 audio_time_usage=0; video_time_usage=0; vout_time_usage=0;
-max_audio_time_usage=0; max_video_time_usage=0; max_vout_time_usage=0;
+if(benchmark) 
+{
+  max_audio_time_usage=0; max_video_time_usage=0; max_vout_time_usage=0;
+}
 while(!eof){
 //    unsigned int aq_total_time=GetTimer();
     float aq_sleep_time=0;
@@ -1608,8 +1611,11 @@
   t=GetTimer()-t;
   tt = t*0.000001f;
   audio_time_usage+=tt;
-  if(tt > max_audio_time_usage) max_audio_time_usage = tt;
-  cur_audio_time_usage=tt;
+  if(benchmark)
+  {
+    if(tt > max_audio_time_usage) max_audio_time_usage = tt;
+    cur_audio_time_usage=tt;
+  }
   if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len;
   
   playsize=audio_out->play(sh_audio->a_buffer,playsize,0);
@@ -1861,17 +1867,23 @@
 	   t2=GetTimer()-t2;
 	   tt = t2*0.000001f;
 	   vout_time_usage+=tt;
-	   if(cur_vout_time_usage + tt > max_vout_time_usage)
+	   if(benchmark)
+	   {
+	    if(cur_vout_time_usage + tt > max_vout_time_usage)
 		    max_vout_time_usage = cur_vout_time_usage + tt;
-	   our_n_frames++;
+	    our_n_frames++;
+	   }
 	}
 #endif
 //        usec_sleep(50000); // test only!
 
     }
 /*  Compute total frame dropping here */
-    if((cur_video_time_usage + cur_vout_time_usage + cur_audio_time_usage)*vo_fps > 1)
+    if(benchmark)
+    {
+	if((cur_video_time_usage + cur_vout_time_usage + cur_audio_time_usage)*vo_fps > 1)
 							bench_dropped_frames ++;
+    }
     current_module=NULL;
     
     if(eof) break;