[MPlayer-cvslog] r32310 - trunk/libmpcodecs/vf_ass.c

cigaes subversion at mplayerhq.hu
Sat Sep 18 21:13:04 CEST 2010


Author: cigaes
Date: Sat Sep 18 21:13:03 2010
New Revision: 32310

Log:
vf_ass: skip alpha blending for pixels where alpha is zero.
On a test case, it speeds up the blending of about 9%.

Modified:
   trunk/libmpcodecs/vf_ass.c

Modified: trunk/libmpcodecs/vf_ass.c
==============================================================================
--- trunk/libmpcodecs/vf_ass.c	Sat Sep 18 19:40:14 2010	(r32309)
+++ trunk/libmpcodecs/vf_ass.c	Sat Sep 18 21:13:03 2010	(r32310)
@@ -317,7 +317,10 @@ static void my_draw_bitmap(struct vf_ins
     dstv = vf->priv->planes[2] + dst_x + dst_y * vf->priv->outw;
     for (i = 0; i < bitmap_h; ++i) {
         for (j = 0; j < bitmap_w; ++j) {
-            unsigned k = ((unsigned) src[j]) * opacity / 255;
+            unsigned k = src[j];
+            if (!k)
+                continue;
+            k = k * opacity / 255;
             dsty[j] = (k * y + (255 - k) * dsty[j]) / 255;
             dstu[j] = (k * u + (255 - k) * dstu[j]) / 255;
             dstv[j] = (k * v + (255 - k) * dstv[j]) / 255;


More information about the MPlayer-cvslog mailing list