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

Michel Bardiaux mbardiaux
Mon Oct 30 15:39:00 CET 2006


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:



-- 
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bmpdec.pat
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061030/5e3b7f4c/attachment.txt>



More information about the ffmpeg-devel mailing list