On 03/08/2013 05:07 AM, Jean-Marc Valin wrote: > On 03/07/2013 11:26 AM, Steve Strobel wrote: >> I am not sure I can completely justify it, but my tendency would be to >> to use C++ classes to represent the numeric values. If the variables >> were declared using typedefs, it would be easy to control whether they >> used native float/double or the C++ classes. Naturally a C++ compiler >> would be needed to use the classes, but I don't think it would be too >> hard to make the source also compile as C when using the native >> floats/doubles. > You're aware that the majority of devices that would benefit from a > fixed-point port don't actually have a C++ compiler? In general, I think > there's one important point being missed here. What's hard isn't the > part about "dumb float->fixed conversion". Regardless of how you write > your fixed-point, you still have to do quality testing to make sure > every change you make preserves quality. On top of that, there's usually > many places where you need to write *different* code for the > fixed-point. For example, in many places, the only way to avoid 64-bit > arithmetic is to add renormalization steps or even use a different > algorithm to compute the same result. Sure it'd be nice to have code > that's more readable than what the Speex macros give you, but without > spending more time on a framework (that may not even work) than on the > port, the only real options are something like these macros or a > separate codebase. BTW, for CELT I once wrote a script that would run > the preprocessor to convert the code back to float. > > Jean-Marc > If you want to see how fixed and floating point works out for some real codecs, try the reference code for things like G.723.1 and G.729, which is publically available. The fixed point code often diverges massively from the floating point, typically in areas of normalisation (pseudo floating point) and saturation. It would take a seriously smart tool to have achieved that automatically.
Steve ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ Freetel-codec2 mailing list Freetel-codec2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freetel-codec2