[Speex-dev] How to create a compact Speex library

Jim Crichton jim.crichton at comcast.net
Fri Apr 14 14:39:13 PDT 2006


>> > Sorry if this a repost but I want to create the
>> > smallest Speex library possible to be put in TI's
>> > TMS320 DSP.  I'm only interested in one
>> configuration:
>> > 5.97 Kbps narrowband.  What part of source code
>> can I
>> > remove?  Currently, when I compiled the version
>> 1.1.12
>> > libspeex.a library with the TI TMS320 and
>> > Fixed-Integer options, I get around 522Kb.
>>
>> You mean kilo-bit or kilo-byte? The former is what
>> I'd expect, so if
>> you're getting the latter, something's already
>> wrong.
>>
>> >  I would
>> > like to reduce it to as small as possible given my
>> > above 5.97 Kbps operating constraints (I don't
>> need
>> > all the other extra features from Speex: jitter
>> > buffer, echo cancellation, etc).
>>
>> First, try --disable-wideband (or define
>> DISABLE_WIDEBAND). Then you can
>> start removing other stuff you don't need. To get
>> rid of the echo
>> canceller, simply remove mdf.c. Then you can get rid
>> of jitter.c,
>> preprocess.c, pcm_wrapper.c, smallft.c, ...
>> Basically, if you remove the
>> file and it still works, then it wasn't needed. In
>> addition to all the
>> files you can remove without the need to touch
>> anything else, the
>> following can be disabled as long as you disable a
>> bit of code:
>> - VBR (vbr.c and references to VBR in nb_celp.c)
>> - codebooks for other bit-rates:
>>    * all exc_*.c files except exc_10_16_table.c
>>    * gain_table.c
>>
>> There might be a few bits more that can be removed,
>> but I think this
>> summarizes it well.
>>
>> Jean-Marc
>>
>
>
> Thanks, that help a lot.  I was able to reduced the
> library from 522Kb to 296Kb per your suggestions.  I
> want to reduce it more but don't know what other files
> to remove; you wrote "..., smallft.c, etc.", would you
> mind specifying the "etc" files; I know I'm too lazy
> to figure it out myself and since you are the expert,
> I will trush you more.  Thanks.
>

Take a look at the TI subdirectory in the Speex tree, which has builds for 
some TI DSPs.  Those builds are 8kbps narrowband, with no extra features. 
Change a couple of lines and you have 5.97 narrowband builds.  There is also 
some instrumentation for measuring data memory usage.  Clearly, though, if 
you are worried about data space then you should take a look at Jean-Marc's 
new code (I have not had a chance yet, myself).

What families of TI DSPs are you looking at?  Most everything TI makes 
starts with TMS320, but that is over 100 different parts in several 
different familys.  If you say a little more about what you are trying to 
do, you may find that others here have already tried it.  But you are not 
going to get much help saying "I know I'm too lazy to figure it out myself". 
Having said that, here is the contents of my speex library for TI C55x DSP 
(from the .pjt file):

Source="libspeex\bits.c"
Source="libspeex\cb_search.c"
Source="libspeex\exc_10_16_table.c"
Source="libspeex\exc_10_32_table.c"
Source="libspeex\exc_20_32_table.c"
Source="libspeex\exc_5_256_table.c"
Source="libspeex\exc_5_64_table.c"
Source="libspeex\exc_8_128_table.c"
Source="libspeex\filters.c"
Source="libspeex\gain_table.c"
Source="libspeex\gain_table_lbr.c"
Source="libspeex\lpc.c"
Source="libspeex\lsp.c"
Source="libspeex\lsp_tables_nb.c"
Source="libspeex\ltp.c"
Source="libspeex\math_approx.c"
Source="libspeex\misc.c"
Source="libspeex\modes.c"
Source="libspeex\nb_celp.c"
Source="libspeex\quant_lsp.c"
Source="libspeex\sb_celp.c"
Source="libspeex\speex.c"
Source="libspeex\speex_callbacks.c"
Source="libspeex\vbr.c"
Source="libspeex\vq.c"
Source="your-main-routine-here.c"

I have not removed any files which require code changes, but I will have to 
look at Jean-Marc's tips about vbr.c, exc_*.c, and gain_table.c (thanks for 
those).

By the way, do you really care about the size of the .a file?  My library is 
467kbytes, but that is meaningless, because the library was built with 
symbol information.  Looking at the map file, Speex (including my interface 
routines) takes about 41kbytes in .text and 16kbytes in .const.  That does 
not include data memory, which is what Jean-Marc is working on now.

Regards,

Jim Crichton 




More information about the Speex-dev mailing list