[CELT-dev] CELT grabbing 100KB of memory right off the top

Andrew Lentvorski bsder at allcaps.org
Mon Apr 18 15:09:47 PDT 2011


On 4/18/11 12:57 PM, Timothy B. Terriberry wrote:
>> Is there a particular reason why CELT grabs 100KB of stack immediately?
>
> You'd be much better off using C99 vararrays, or alloca, if either of
> those are available, rather than the global stack (which is purely there
> as a fallback).

This is grabbing that 100K using calloc() via celt_alloc_scratch().


As for C99, please, think of those of us stuck with embedded toolchains. :)

I had to go all over the code to remove the "restrict" keyword (I 
understand why you want it, but couldn't it be a macro--please?).  I 
really don't want to think about other issues if this keeps getting 
increasingly C99-ified.


That having been said.  After turning on all the compiler optimizations 
for speed, it seems that 28KHz, stereo, frame size of 120 bytes, bitrate 
of 64kbps, and complexity 5 runs at about 50-60 MIPS on a PIC32 (MIPS 
R4K @ 80MHz).  My wall clock times show that it is encoding a 1 minute 
stream in about 40-45 seconds.  My oscilloscope shows that my main loop 
is encoding a packet once every 3.4-3.5ms.

This is, alas, too tight for my application (unless I can get another 
factor of 2 from somewhere--suggestions welcomed).  However, I may take 
another crack at it if I have time to cost engineer things a bit.

-a



More information about the celt-dev mailing list