[FFmpeg-devel] [PATCH]Make the 32bit bmp palette opaque

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Dec 29 04:02:17 CET 2011


Hi!

BMP files with a 32bit palette have the high byte in the palette set to 0 and 
both ImageMagick and GIMP interpret that as opaque.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index 419c3fa..9a5c244 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -247,7 +247,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
                 ((uint32_t*)p->data[1])[i] = (0xff<<24) | bytestream_get_le24(&buf);
         }else{
             for(i = 0; i < colors; i++)
-                ((uint32_t*)p->data[1])[i] = bytestream_get_le32(&buf);
+                ((uint32_t*)p->data[1])[i] = 0xFFU << 24 | bytestream_get_le32(&buf);
         }
         buf = buf0 + hsize;
     }


More information about the ffmpeg-devel mailing list