[FFmpeg-devel] [PATCH]Assume that old bmps do not contain transparency information

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Jul 4 09:17:35 CEST 2014


Attached patch fixes the colourspace for image-samples/MK50TEMP.BMP which has 
its three valid channel bit masks on the actual image (as opposed to the 
image header), the fourth "mask" for alpha is random image data.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index 47ff978..9dd91cf 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -128,6 +128,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
         rgb[0] = bytestream_get_le32(&buf);
         rgb[1] = bytestream_get_le32(&buf);
         rgb[2] = bytestream_get_le32(&buf);
+        if (ihsize > 40)
         alpha = bytestream_get_le32(&buf);

More information about the ffmpeg-devel mailing list