[rescue] Re: G5 case

Peter Corlett abuse at cabal.org.uk
Wed Jun 25 11:52:58 CDT 2003

Dave McGuire  <mcguire at neurotica.com> wrote:
> On Wednesday, June 25, 2003, at 12:36 PM, Peter Corlett wrote:
>> Nope. I've written a simple 2.5:1 audio compression algorithm in Java,
>> and for 8kHz streams, it ran faster than real time on a 486/66.
> Kick ass!

It was a pretty simple, but reasonably effective algorithm. It basically
involved calculating the difference between the samples, and then quantising
that difference to one of nine values, them being -27, -9, -3, -1, 0, 1, 3,
9, and 27. These values were determined by experimentation to find what
tracked a typical audio stream best. You can then pack five of these
quantised values into a 16 bit word, giving a 5:2 compression.

Decompression is *fast*, involving just four divides, five table lookups and
five adds for each block of five samples. Even an 8 bit CPU such as a PIC
could do this in real time.

>> What tends to bog Java down is (ab)use of the windowing toolkits, cargo
>> cult programming, and poor understanding of algorithmic complexity.
> ...which boils down to being a "bad programmer". :)

This is unfortunately fairly more common than being a good programmer. The
difference between Java and a "real" language is that the bad programmers
are capable of writing code in it.

PGP key ID E85DC776 - finger abuse at mooli.org.uk for full key

More information about the rescue mailing list