[FFmpeg-devel] [PATCH] os2 (v1?) support for BMP

Benjamin Larsson banan
Tue Mar 25 16:29:59 CET 2008


Benoit Fouet wrote:
> Hi,
>
> width and height are stored on 16 bits in this case, this patch gets
> them right and allows to decode os2 BMP files with 24 bits per pixel.
>
> BTW, if someone has a reference document for BMP, I'd like to complete
> the decoder so that it supports all other headers.
>
>   
> ------------------------------------------------------------------------
>
> Index: libavcodec/bmp.c
> ===================================================================
> --- libavcodec/bmp.c	(revision 12579)
> +++ libavcodec/bmp.c	(working copy)
> @@ -84,8 +84,16 @@
>          return -1;
>      }
>  
> +    if (ihsize == 40) {
>      width = bytestream_get_le32(&buf);
>      height = bytestream_get_le32(&buf);
> +    } else if (ihsize == 12) {
> +        width  = bytestream_get_le16(&buf);
> +        height = bytestream_get_le16(&buf);
> +    } else {
> +      av_log(avctx, AV_LOG_ERROR, "unsupported BMP file, patch welcome");
> +      return -1;
> +    }
>   

Don't forget the indentation.

>  
>      if(bytestream_get_le16(&buf) != 1){ /* planes */
>          av_log(avctx, AV_LOG_ERROR, "invalid BMP header\n");
> @@ -94,7 +102,7 @@
>  
>      depth = bytestream_get_le16(&buf);
>  
> -    if(ihsize > 16)
> +    if(ihsize == 40)
>          comp = bytestream_get_le32(&buf);
>      else
>          comp = BMP_RGB;
>   


MvH
Benjamin Larsson







More information about the ffmpeg-devel mailing list