[MPlayer-dev-eng] [PATCH] bmovl speedup

Arpi arpi at thot.banki.hu
Sat Jan 25 12:46:12 CET 2003


Hi,

seems ok, apply it!

> This is a simple patch to change the alpha blending code in bmovl to use
> integers instead of floating point. It speeds it up by about 400%
> meaning that it's now possible to apply alpha blending to a whole
> 1024x768 image on my 1266MHz PIII.
> 
> -- 
> Jonas Jensen <jbj at knef.dk>
> 
> 
> --- MPlayer-20030125/libmpcodecs/vf_bmovl.c	2003-01-10 22:44:28.000000000 +0100
> +++ MPlayer-bmovl-speedup/libmpcodecs/vf_bmovl.c	2003-01-25 1
> 2:25:18.000000000 +0100
> @@ -395,11 +395,20 @@
>  						dmpi->planes[2][pos] = vf->priv->bitmap.v[pos];
>  					}
>  				} else { // Alphablended pixel
> -					dmpi->planes[0][pos] = (dmpi->planes[0][pos]*(1.0-(alpha/255.0))) +
> (vf->priv->bitmap.y[pos]*(alpha/255.0));
> +					dmpi->planes[0][pos] = 
> +						((255 - alpha) * (int)dmpi->planes[0][pos] + 
> +						alpha * (int)vf->priv->bitmap.y[pos]) >> 8;
> +					
>  					if ((ypos%2) && (xpos%2)) {
>  						pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2);
> -						dmpi->planes[1][pos] = (dmpi->planes[1][pos]*(1.0-(alpha/255.0))) +
> (vf->priv->bitmap.u[pos]*(alpha/255.0));
> -						dmpi->planes[2][pos] = (dmpi->planes[2][pos]*(1.0-(alpha/255.0))) +
> (vf->priv->bitmap.v[pos]*(alpha/255.0));
> +
> +						dmpi->planes[1][pos] = 
> +							((255 - alpha) * (int)dmpi->planes[1][pos] + 
> +							alpha * (int)vf->priv->bitmap.u[pos]) >> 8;
> +						
> +						dmpi->planes[2][pos] = 
> +							((255 - alpha) * (int)dmpi->planes[2][pos] + 
> +							alpha * (int)vf->priv->bitmap.v[pos]) >> 8;
>  					}
>  			    }
>  			} // for xpos
> 
> 
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
> 
> 


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu


More information about the MPlayer-dev-eng mailing list