[Ffmpeg-devel] [PATCH] Fix to bmp decoder

Aurelien Jacobs aurel
Mon Oct 30 15:16:38 CET 2006


On Mon, 30 Oct 2006 14:44:42 +0100
Michel Bardiaux <mbardiaux at mediaxim.be> wrote:

> I couldnt find where that is documented, but I have it in several codes 
> of mine. Without it, after converting a 641x430 bmp (generated 
> indepently of ffmpeg!) to jpg, the image is distorted.
> 
> Index: libavcodec/bmp.c
> ===================================================================
> --- libavcodec/bmp.c	(revision 6838)
> +++ libavcodec/bmp.c	(working copy)
> @@ -178,6 +180,7 @@
>      dsize = buf_size - hsize;
>  
>      n = avctx->width * (depth / 8);
> +    while(n%4) n++;

Hum... A modulo in a loop...
What about this instead ?
  n = avctx->width * (depth / 8) + 3 & ~3;

Aurel




More information about the ffmpeg-devel mailing list