[Mplayer-cvslog] CVS: main/libmpcodecs vf_bmovl.c,1.4,1.5
Arpi of Ize
arpi at mplayerhq.hu
Sun Jan 26 18:42:53 CET 2003
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv2844/libmpcodecs
Modified Files:
vf_bmovl.c
Log Message:
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>
Index: vf_bmovl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_bmovl.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- vf_bmovl.c 10 Jan 2003 21:44:28 -0000 1.4
+++ vf_bmovl.c 26 Jan 2003 17:42:24 -0000 1.5
@@ -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
More information about the MPlayer-cvslog
mailing list