[FFmpeg-devel] [PATCH] AAC: type puns for 16 bit floating point rounding

Måns Rullgård mans
Thu Dec 4 10:35:17 CET 2008


Uoti Urpala <uoti.urpala at pp1.inet.fi> writes:

> On Thu, 2008-12-04 at 03:13 +0000, M?ns Rullg?rd wrote:
>> > @@ -838,24 +842,45 @@ static int decode_spectrum_and_dequant(AACContext * ac, float coef[1024], GetBit
>> >  }
>> >  
>> >  static av_always_inline float flt16_round(float pf) {
>> > +#ifdef ENABLE_IEEE754_PUN
>> > +    union float754 tmp;
>> > +    tmp.f = pf;
>> > +    tmp.i = (tmp.i + 0x00008000U) & 0xFFFF0000U;
>> > +    return tmp.f;
>> > +#else
>> 
>> Are this things safe under strict aliasing rules?
>
> Yes GCC does guarantee that it will work (all the accesses use
> unionvalue.field syntax with the same union).

What gcc does is irrelevant.  Is it guaranteed by the C standard?

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




More information about the ffmpeg-devel mailing list