changeset 31639:cf048df35b00

Fix conversion from paletted to MPlayer's OSD format.
author reimar
date Sun, 11 Jul 2010 13:36:02 +0000
parents e4cab1a16c0d
children 0d09c303bfe3
files spudec.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/spudec.c	Sun Jul 11 13:05:45 2010 +0000
+++ b/spudec.c	Sun Jul 11 13:36:02 2010 +0000
@@ -1307,10 +1307,12 @@
   for (y = 0; y < h; y++) {
     for (x = 0; x < w; x++) {
       uint32_t pixel = pal[pal_img[x]];
-      *aimg++ = -(pixel >> 24);
-      *img++  = (((pixel & 0x000000ff) >>  0) +
-                 ((pixel & 0x0000ff00) >>  7) +
-                 ((pixel & 0x00ff0000) >> 16)) >> 2;
+      int alpha = pixel >> 24;
+      int gray = (((pixel & 0x000000ff) >>  0) +
+                  ((pixel & 0x0000ff00) >>  7) +
+                  ((pixel & 0x00ff0000) >> 16)) >> 2;
+      *aimg++ = -alpha;
+      *img++  = FFMIN(gray, alpha);
     }
     for (; x < stride; x++)
       *aimg++ = *img++ = 0;