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

Måns Rullgård mru
Mon Oct 30 21:46:17 CET 2006


Michel Bardiaux <mbardiaux at mediaxim.be> writes:

> Aurelien Jacobs wrote:
>> 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
>
> Right. But more readable like this:

Applied.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list