Re: Advice saught on math functions

From: Sandy Harris (pashley@storm.ca)
Date: Fri Jul 12 2002 - 10:42:19 EST


Kirk Reiser wrote:
>
> ... What I am striving to do is build a software based speech
> synthesizer into a linux driver. ... over 512k. Obviously this is
> to large to want built-in to the kernel.

Can you do it in a module instead?

> The majority of the size is from libm.a.

Does dietlibc help?

> There are five functions I need from the library, log(),
> log10(), exp() cos() and sin().

Can you do something useful with integer versions of those functions?
Forth people have done astronomical calculations with only scaled
16-bit arithmetic. If it's accurate enough to aim telescopes, why
not for your job?

Given that phones work with fine 8-bit samples, I suspect speech can
be done just fine with 16-bit math.

base 2 log is easy; I've seen code for it on the web. Scaling that to
get natural log and log10 is straightforward.

exp() is trivial, provided you have the scaling right so it doesn't
overflow into insanity. How hard the scaling is depends on the
application.

I suspect there's a better way, but a brute force unoptimised shot
at 16-bit sin() and cos() just uses a 128 K table; 16 bits in, 16
out.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 15 2002 - 22:00:23 EST