[FFmpeg-devel] [PATCH] Remove MULL macro from lsp.c

Loren Merritt lorenm
Tue Aug 26 21:01:15 CEST 2008


On Tue, 26 Aug 2008, M?ns Rullg?rd wrote:

> "Vladimir Voroshilov" <voroshil at gmail.com> writes:
>
>> Please look into attached patch and tell what chunks are ok.
>> I used (and tested) only MULL macro but others (due to used "l"
>> suffix) can have the same bug.
>> Unfortunately, i'm not know asm enough good to be sure.
>>
>> Index: libavcodec/i386/mathops.h
>> ===================================================================
>> --- libavcodec/i386/mathops.h	(revision 14975)
>> +++ libavcodec/i386/mathops.h	(working copy)
>> @@ -28,18 +28,18 @@
>>              "imull %3               \n\t"\
>>              "shrdl %4, %%edx, %%eax \n\t"\
>>              : "=a"(rt), "=d"(dummy)\
>> -            : "a" (ra), "rm" (rb), "i"(FRAC_BITS));\
>> +            : "a" ((int)ra), "rm" ((int)rb), "i"(FRAC_BITS));\
>>           rt; })
>
> I think only the potential memory operands need the cast.  Here it
> would be the "rb" parameter.

ra needs to be sign-extended too.
gcc defaults to zero-extend when loading 16bit values from memory. Or if 
it's computed, then the msbs will be junk.

--Loren Merritt



More information about the ffmpeg-devel mailing list