[opus] Memory Size?

Mike Hooper mihooper at bellsouth.net
Fri Aug 31 11:25:19 PDT 2012


Thanks for the quick reply.

Let me make sure I understand what you are saying.

I have compiled with NONTHREADSAFE_PSEUDOSTACK since the TI compiler does
not support alloca. As I understand it, ALLOC_STACK, using
opus_alloc_scratch(), creates a heap of size= GLOBAL_STACK_SIZE, which is
100k bytes as defined in arch.h by 
"#define GLOBAL_STACK_SIZE 100000" for FIXED_POINT systems. 

After the heap is created, both the encoder and decoder are created in this
heap by:
	enc = malloc(size);
	dec = malloc(size);

Therefore, if I have determined (by using get_size) that both the encoder
and decoder require no more 50kbytes, I can safely reduce the
GLOBAL_STACK_SIZE to 50kbytes?

-----Original Message-----
From: Gregory Maxwell [mailto:gmaxwell at gmail.com] 
Sent: Friday, August 31, 2012 1:40 PM
To: Mike Hooper
Cc: opus at xiph.org
Subject: Re: [opus] Memory Size?

On Fri, Aug 31, 2012 at 1:10 PM, Mike Hooper <mihooper at bellsouth.net> wrote:
> In order to determine the optimum heap size requirements for my embedded
> C55xx design, I have used the following to get the encoder and decoder
> memory requirements:
> Both the encode decoder init function return no error. However,
> crashes somewhere deep in the bowels of the function (I cannot determine
> where since I have compiler optimizations enabled). Do I need more heap
> what is returned by the above get_size functions?

In a normal compile there are _no_ heap allocations done except in the
_create calls, which you can avoid using as you've described.

If you have compiled with NONTHREADSAFE_PSEUDOSTACK in order to reduce
the stack usage then there are heap allocations via
opus_alloc_scratch() to allocate stack for the pesudostack.

More information about the opus mailing list