summaryrefslogtreecommitdiffstats
path: root/spudec.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-06 19:18:09 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-06 19:18:09 +0000
commite008f62627e01a064db9f73f16fb3c2e9b198f3f (patch)
tree1317fef568ab2ac15efe21c4b06ff000e8e05e23 /spudec.c
parenta5bb20514a6cd85392e789f6e1e75b5abac4d560 (diff)
downloadmpv-e008f62627e01a064db9f73f16fb3c2e9b198f3f.tar.bz2
mpv-e008f62627e01a064db9f73f16fb3c2e9b198f3f.tar.xz
Make mkalpha function simpler, faster and more correct.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30523 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'spudec.c')
-rw-r--r--spudec.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/spudec.c b/spudec.c
index 6241c99e0c..8be30e1e56 100644
--- a/spudec.c
+++ b/spudec.c
@@ -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 */