mihooper at bellsouth.net
Mon Jun 7 15:08:09 PDT 2010
Thanks for the feedback. But I'm still a bit confused on a couple of things:
1. The TI compiler does not support alloc(), so I have #undef USE_ALLOCA.
2. The TI compiler does support calloc(), so I am using
celt_alloc_scratch(GLOBAL_STACK_SIZE), where GLOBAL_STACK_SIZE = 10000bytes.
3. What confuses me is the following code in modes.c which seems to dictate
the need for "global_stack" to be non-NULL:
#if !defined(VAR_ARRAYS) && !defined(USE_ALLOCA)
Am I misunderstanding something here?
From: Jean-Marc Valin [mailto:Jean-Marc.Valin at USherbrooke.ca]
Sent: Monday, June 07, 2010 4:53 PM
To: Mike Hooper
Cc: celt-dev at xiph.org
Subject: Re: [CELT-dev] GLOBAL_STACK_SIZE
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.
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,
> 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
> passed to *celt_alloc_scratch, which allocates no stack, causing failure
> 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
> bit large to me.
More information about the celt-dev