[MPlayer-dev-eng] [PATCH] for mencoder, 7% speed increase
wander
wander at f1racing.net
Tue Jul 23 02:51:47 CEST 2002
Sorry again, didn't read the rules about sending patches
(changed subject line, removed tabs out of patch)
---------- Forwarded message ----------
Hello,
First of all I'd like to apoligise for the last posts I made here, the
anwser was in the manual, I should have looked better.
I made a patch for mencoder so that it prints info like this:
Pos: 37.1s 1113f ( 2%) 178fps Trem: 4min 170mb A-V:0.031 [655:224]
only once every second, because printing this info 178 times a second
takes up quite a bit of processing power and our pathetic human eyes can't
handle that anyway.
This lead to a 7% increase in speed on my system.
I thought about using GetTimer(), but I think the method I use now is more
efficient, and the time between every update is allowed to fluctuate a
bit.
This patch doesn't touch the code for verbose printing btw, so if you want
the old behaviour, you could turn on verbose mode.
I hope you guys find this patch usefull,
Wander
-------------- next part --------------
--- ./mencoder.c Mon Jul 22 00:20:05 2002
+++ /download/MPlayer-20020722/mencoder.c Mon Jul 22 23:30:41 2002
@@ -345,6 +345,10 @@
unsigned int timer_start;
+//These two for printing info only once every second:
+int fps = 0;
+int frames_since_print = 0;
+
mp_msg_init();
mp_msg_set_level(MSGL_STATUS);
mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s",banner_text);
@@ -1131,15 +1135,22 @@
duplicatedframes, skippedframes
);
} else
- mp_msg(MSGT_AVSYNC,MSGL_STATUS,"Pos:%6.1fs %6df (%2d%%) %3dfps Trem:%4dmin %3dmb A-V:%5.3f [%d:%d]\r",
- mux_v->timer, decoded_frameno, (int)(p*100),
- (t>1) ? (int)(decoded_frameno/t) : 0,
- (p>0.001) ? (int)((t/p-t)/60) : 0,
- (p>0.001) ? (int)(ftell(muxer_f)/p/1024/1024) : 0,
- v_pts_corr,
- (mux_v->timer>1) ? (int)(mux_v->size/mux_v->timer/125) : 0,
- (mux_a && mux_a->timer>1) ? (int)(mux_a->size/mux_a->timer/125) : 0
- );
+ fps = (p>0.001) ? (int)(ftell(muxer_f)/p/1024/1024) : 0;
+ frames_since_print++;
+ if (frames_since_print > fps) {
+
+ mp_msg(MSGT_AVSYNC,MSGL_STATUS,"Pos:%6.1fs %6df (%2d%%) %3dfps Trem:%4dmin %3dmb A-V:%5.3f [%d:%d]\r",
+ mux_v->timer, decoded_frameno, (int)(p*100),
+ (t>1) ? (int)(decoded_frameno/t) : 0,
+ (p>0.001) ? (int)((t/p-t)/60) : 0,
+ fps,
+ v_pts_corr,
+ (mux_v->timer>1) ? (int)(mux_v->size/mux_v->timer/125) : 0,
+ (mux_a && mux_a->timer>1) ? (int)(mux_a->size/mux_a->timer/125) : 0
+ );
+ frames_since_print = 0;
+ }
+
#endif
}
fflush(stdout);
More information about the MPlayer-dev-eng
mailing list