[CELT-dev] Optimisation Help

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Fri Feb 12 03:53:50 PST 2010


On 2010-02-12 02:03, Chen-Po Sun wrote:
> I have been looking into optimising the CELT decoder for speed to make
> it acceptable for use in games, we would need it to be at least twice as
> fast as it currently is for this. I was hoping to be able to crunch some
> things down with some SIMD but there doesn't seem to be any good
> candidates for that.

First, if your chip has a fast FPU, make sure the code is compiled as 
float (default). Also, note that if you encode without the pitch 
predictor (e.g. using complexity 1), the decoding operation is faster too.

> Some profiling has shown the ec_ilog and decode_pulses would be good
> functions to optimise, though they seem quite minimal already.

On most CPUs, there's actually an instruction that computes ec_ilog(). 
For example, on x86 that would be the CLZ (count leading zeros) 
instructions, where ilog2(x)=31-clz(x) or something like that. Most 
chips of that instruction in one form or another.

As for decode pulses, there are many tradeoffs that can be used for that 
function. For example, you can make it faster by using more memory -- or 
in some cases just by tuning the current tradeoffs. The first thing to 
do would be to check what's the actual bottleneck on that function. Is 
it the number of arithmetic operations or just the fact that it branches 
a lot?

> I am currently on 0.6.1, do the newer versions have any significant
> performance updates to the decoder? (I'd prefer not to update until 1.0
> if I don't have to as we have made some changes to get things working on
> the ps3).

I think the main change in 0.7.x would be the stereo quality. If you're 
using stereo, it's probably a good idea to upgrade. You may see a bit of 
change in complexity, but I would expect it to be small (can't tell in 
which direction).

Cheers,

	Jean-Marc



More information about the celt-dev mailing list