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

Uoti Urpala uoti.urpala
Thu Dec 4 04:30:17 CET 2008


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).





More information about the ffmpeg-devel mailing list