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

Måns Rullgård mans
Sat Jul 24 00:45:08 CEST 2010


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.

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



More information about the ffmpeg-devel mailing list