Jean-Marc Valin Jean-Marc.Valin at USherbrooke.ca
Mon Jun 7 13:52:58 PDT 2010

Hi Mike,

I can see how this must fail on the C55. The reason for the 100,000 is to be
absolutely sure to be safe, even when using 1024-sample frames in stereo. It's
highly likely that your application doesn't require this so you could use a
lower value. Ideally, if you platform has a C99 compiler -- or at least
alloca() -- then the global stack wouldn't be needed at all (it's just a



Quoting Mike Hooper <mihooper at bellsouth.net>:

> I am having trouble understanding the stack allocation scheme when using a
> C55xx device. From what I can tell, the GLOBAL_STACK_SIZE is set in arch.h
> to 100,000 bytes (when using FIXED_POINT), which is then used in the
> ALLOC_STACK macro found in stack_alloc.h. This macro seems to say, if
> global_stack==0, then call celt_alloc_scratch, found in os_support.h, which
> in turn attempts to allocate (using calloc) 100,000 bytes for the global
> stack. However, the *celt_alloc_scratch expects an "int", which in C55x
> lingo is 16bits (+/-32768). When debugging this macro, a value of -31072 is
> passed to *celt_alloc_scratch, which allocates no stack, causing failure of
> celt_mode_create(). What am I missing? Can you provide some insight on how
> the stack should be allocated? How large should it be? 100,000 bytes seems a
> bit large to me.
> Thx
> MikeH

More information about the celt-dev mailing list