[cairo] [Pixman] Floating point API in Pixman

James Cloos cloos at jhcloos.com
Tue Aug 17 08:42:08 PDT 2010


>>>>> "KK" == Krzysztof Kosiński <tweenk.pl at gmail.com> writes:

KK> So what is the bottom line? Should we have two versions of all code,
KK> one using float and one using pixman_fixed_t, or is replacing
KK> pixman_fixed_t with float sufficient?

The typical thing done in the audio world is to have both float and
fixed versions of the algorithms and to choose one at compile time,
often by way of a configure option and/or a #define.

There are alternate approaches, though.  Xiph provides a completely
separate library for non-float decoding of vorbis.

I would expect video codecs to follow that pattern, too.

Pixman seems to be at a similar level.

I'd suggest a look at the speex code and build for well designed example
of the typical style.

KK> How much slower is softfloat - a factor of 5, 15 or 500?

If it is kernel-emulated floats then the factor is large enough that you
want to avoid it at almost all costs for anything which occurs w/in loops.

If everything which might use floats is compiled against a soft float
library then things are better.  But it is still worth avoiding floats
in important loops.

I suspect using floats would be *much* better than the existing fixeds
on modern x86_64 systems.  But fixed will remain important on smaller,
lighter systems for some time to come.

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the cairo mailing list