On Mon, Sep 01, 2014 at 07:55:40PM +0200, Nedeljko Babic wrote:
> +/* Rounding to zero used for simplicity */
> +static av_always_inline aac_float_t float_add(aac_float_t a, aac_float_t b)
> +{
> +    int diff;
> +
> +    if (a.mant == 0)
> +        return b;
> +
> +    if (b.mant == 0)
> +        return a;
> +
> +    diff = a.expo - b.expo;
> +
> +    if (diff < 0)  // a.expo < b.expo
> +    {
> +        diff = -diff;
> +        if (diff >= 31)
> +            a.mant = 0;
> +        else
> +            a.mant >>= diff;
> +        a.expo = b.expo;
> +    }
> +    else  // a.expo >= b.expo
> +    {
> +        if (diff >= 31)
> +            b.mant = 0;
> +        else
> +            b.mant >>= diff;
> +    }

In addition to the comments I had before, if you care only
about (mostly) matching single-precision IEEE you can
save some cycles by changing to diff > 24 instead
of >= 31.
Obviously that means you need to change the
code to directly return e.g. a in the else
path instead of insisting on explicitly
adding 0 to a, otherwise it won't get any faster of course.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to