[Speex-dev] Unifying fixed point and floating point
Jean-Marc Valin
Jean-Marc.Valin at USherbrooke.ca
Sat Sep 17 17:11:03 PDT 2005
Hi Nic,
Things are a bit more complicated than that. I can't change all the
floats to speex_wordxx_t without first finding out what fixed-point
representation I want to use for each value and then choose the MULxx
operator to use (and making sure there's no possible overflow or loss of
precision).
Jean-Marc
Le dimanche 18 septembre 2005 à 00:05 +0200, Nic Roets a écrit :
> I've been browsing around the speex-1.10 source tree.
>
> Firstly I see 'float' is still used in many places. Can't we change
> them all to the appropriate type (spx_wordxx_t or similar) defined in
> arch.h ?
>
> Secondly I see there is a lot of duplication regarding real-valued
> constants. One way would be to say:
> #ifndef FIXED_POINT
> #define CONSTANT(x) (x)
> #else
> #define CONSTANT(x) ((int)((x)*16384.0 + 0.5))
> #endif
> and then use the macro appropriately.
>
> This would assume that all the compilers we intent to support has the
> ability to evaluate constant expressions at compile time. In my
> experience this assumption is reasonable.
>
> Regards
> -n
>
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev
--
Jean-Marc Valin <Jean-Marc.Valin at USherbrooke.ca>
Université de Sherbrooke
More information about the Speex-dev
mailing list