[MPlayer-advusers] [patch] slow menus

Adam Sulmicki adam at cfar.umd.edu
Sat Jan 6 23:13:33 CET 2007


hello,
 	Attached is a patch that should fix slow menus.
 	below are benchmarks showing before and after.

before-no menu
BENCHMARKs: VC:   0.835s VO:   0.342s A:   0.000s Sys:   0.016s = 1.193s
BENCHMARK%: VC: 70.0336% VO: 28.6388% A:  0.0000% Sys:  1.3277% = 100.0%
before-menu
BENCHMARKs: VC:   0.847s VO:   5.557s A:   0.000s Sys:   0.017s = 6.420s
BENCHMARK%: VC: 13.1862% VO: 86.5501% A:  0.0000% Sys:  0.2637% = 100.0%
before-menu+startup
BENCHMARKs: VC:   0.857s VO:   1.000s A:   0.000s Sys:   0.017s = 1.874s
BENCHMARK%: VC: 45.7365% VO: 53.3692% A:  0.0000% Sys:  0.8944% = 100.0%

after-no menu
BENCHMARKs: VC:   0.815s VO:   0.347s A:   0.000s Sys:   0.016s = 1.177s
BENCHMARK%: VC: 69.1938% VO: 29.4857% A:  0.0000% Sys:  1.3205% = 100.0%
after-menu
BENCHMARKs: VC:   0.845s VO:   0.320s A:   0.000s Sys:   0.016s = 1.181s
BENCHMARK%: VC: 71.5173% VO: 27.1279% A:  0.0000% Sys:  1.3548% = 100.0%
after-menu+startup
BENCHMARKs: VC:   0.838s VO:   0.999s A:   0.000s Sys:   0.016s = 1.853s
BENCHMARK%: VC: 45.2407% VO: 53.9012% A:  0.0000% Sys:  0.8581% = 100.0%

/usr/local/mp-fb/bin/mplayer.snd3 /tt.avi -dr -vf yuy2 -vo s3fb -fs 
-framedrop -frames 100 -ao none -nosound -benchmark -quiet -menu 
-menu-startup

The bencharmks above show 5.5x times improvement for the case when menus 
are enabled but not displayed.

this patch is largely untested.

can folks review it for correctness?

I would be curious how it works for other people who use -dr and menus.

-- 
Adam Sulmicki
http://www.eax.com 	The Supreme Headquarters of the 32 bit registers
-------------- next part --------------
Index: libmenu/vf_menu.c
===================================================================
--- libmenu/vf_menu.c	(wersja 21839)
+++ libmenu/vf_menu.c	(kopia robocza)
@@ -230,20 +230,26 @@
   }
   menu_draw(vf->priv->current,dmpi);
 
-  } else {
+  } else { // show=0
+
     if(mp_input_key_cb)
       mp_input_key_cb = NULL;
-    dmpi = vf_get_image(vf->next,mpi->imgfmt,
-			MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
-			mpi->w,mpi->h);
 
-    dmpi->stride[0] = mpi->stride[0];
-    dmpi->stride[1] = mpi->stride[1];
-    dmpi->stride[2] = mpi->stride[2];
-    dmpi->planes[0] = mpi->planes[0];
-    dmpi->planes[1] = mpi->planes[1];
-    dmpi->planes[2] = mpi->planes[2];
-    dmpi->priv      = mpi->priv;
+    if(mpi->flags&MP_IMGFLAG_DIRECT)
+      dmpi = mpi->priv;
+    else {
+      dmpi = vf_get_image(vf->next,mpi->imgfmt,
+			  MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
+  			  mpi->w,mpi->h);
+
+      dmpi->stride[0] = mpi->stride[0];
+      dmpi->stride[1] = mpi->stride[1];
+      dmpi->stride[2] = mpi->stride[2];
+      dmpi->planes[0] = mpi->planes[0];
+      dmpi->planes[1] = mpi->planes[1];
+      dmpi->planes[2] = mpi->planes[2];
+      dmpi->priv      = mpi->priv;
+    }
   }
   return vf_next_put_image(vf,dmpi, pts);
 }


More information about the MPlayer-advusers mailing list