[MPlayer-cvslog] r30523 - trunk/spudec.c

reimar subversion at mplayerhq.hu
Sat Feb 6 20:18:09 CET 2010


Author: reimar
Date: Sat Feb  6 20:18:09 2010
New Revision: 30523

Log:
Make mkalpha function simpler, faster and more correct.

Modified:
   trunk/spudec.c

Modified: trunk/spudec.c
==============================================================================
--- trunk/spudec.c	Sat Feb  6 18:43:04 2010	(r30522)
+++ trunk/spudec.c	Sat Feb  6 20:18:09 2010	(r30523)
@@ -175,14 +175,9 @@ static inline int mkalpha(int i)
 {
   /* In mplayer's alpha planes, 0 is transparent, then 1 is nearly
      opaque upto 255 which is transparent */
-  switch (i) {
-  case 0xf:
-    return 1;
-  case 0:
-    return 0;
-  default:
-    return (0xf - i) << 4;
-  }
+  // extend 4 -> 8 bit
+  i |= i << 4;
+  return (uint8_t)(-i);
 }
 
 /* Cut the sub to visible part */


More information about the MPlayer-cvslog mailing list