[Speex-dev] Manual scratch allocation : memory usage doubt

Sameer Manchali sameerm at sanyo.co.in
Sat Feb 20 00:31:22 PST 2010


I am currently encoding 32 Khz/Qual-10/UWB encode mode, with  
MANUAL_ALLOC enabled ( similar to the c5x/c6x configuration).

In file sb_celp.c, I noticed the scratch memory grow during 
recursive (UWB -> WB) calls to 'sb_encode'.

1. 'stack' was not tracked (with 'tmp_stack' as done at other palaces) 
   after/before - auto-correlation/Levinson-Durbin scope (~line 597 -

2. Similarly in the sub-frame encode loop (last major loop) after/before
   LSP-interpolation/weighted-signal-frm-synthesized-speech calculations
   (~line 762 - 950).

In <1>, the scope of the variable over after the braces, so I think that
memory allocated on the scratch may not be needed further. Is it right?

In <2>, I think the excitation, and other of one sub-frame will not be 
needed for the others. Is it ok?

So, is it ok to do reuse the above scratch stack?
This saves about 1.2 Kbyte of total scratch space required when running
in UWB/Qual-10 mode.


More information about the Speex-dev mailing list