[FFmpeg-devel] [PATCH] Use more appropriate types when decoding vorbisfloats

Måns Rullgård mans
Sat Jul 24 01:26:48 CEST 2010


Alex Converse <alex.converse at gmail.com> writes:

> 2010/7/23 M?ns Rullg?rd <mans at mansr.com>:
>> Alex Converse <alex.converse at gmail.com> writes:
>>
>>> Reduces object code by 56 bytes on x86_64
>>>
>>> Index: libavcodec/vorbis_dec.c
>>> ===================================================================
>>> --- libavcodec/vorbis_dec.c ? (revision 24471)
>>> +++ libavcodec/vorbis_dec.c ? (working copy)
>>> @@ -178,11 +178,11 @@
>>>
>>> ?static float vorbisfloat2float(uint_fast32_t val)
>>> ?{
>>> - ? ?double mant = val & 0x1fffff;
>>> - ? ?long exp ? ?= (val & 0x7fe00000L) >> 21;
>>> + ? ?float mant = val & 0x1fffff;
>>> + ? ?int exp ? ?= (val & 0x7fe00000L) >> 21;
>>> ? ? ?if (val & 0x80000000)
>>> ? ? ? ? ?mant = -mant;
>>> - ? ?return ldexp(mant, exp - 20 - 768);
>>> + ? ?return ldexpf(mant, exp - 20 - 768);
>>> ?}
>>
>> I bet at least two BSDs are missing the f version of ldexp, but we can
>> deal with that.
>
> I think they are too busy complaining about people not writing
> portable software.
>
> I don't want to add a maintenance burden elsewhere. Maybe we should
> just keep the int part of the patch and drop the rest?

It's one line in configure and another in libm.h.  It takes less than
a minute to add if we need it.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list