[Speex-dev] Speex echo canceller on TI C55 DSP

Jim Crichton jim.crichton at comcast.net
Wed May 10 07:02:33 PDT 2006

>> When the dust
>> settles, I will send a patch with additions to the TI directory for the 
>> echo
>> canceler example, including instructions on these last changes.  Also, I
>> would like to modify the memory allocation to follow the same structure 
>> as
>> the encoder/decoder, including the ability to override the malloc 
>> function.
>What do you mean here?

misc.c provides the ability to override some functions, including the 
allocation and printing.  fftwrap.c uses speex_alloc, then calls 
kiss_fftr_alloc, which calls kiss_fft_alloc, which calls KISS_FFT_MALLOC, 
which is defined as malloc in kiss_fft.h.  It would make it more consistent 
to define KISS_FFT_MALLOC as speex_alloc.  That is the only change that I 
would suggest here.

I was not able to use the default speex_alloc for this build, because the TI 
calloc routine would not work with a heap larger than 16383 chars, with the 
small memory model that I am using.  I was already using a different alloc 
mechanism in the encoder/decoder build (user_misc.h in the ti directory), 
and I used that method successfully here.  However, since kiss_fft_alloc was 
not using speex_alloc, I ended up with two memory allocation methods.  Then 
I scratched my head for a while because kiss_fft had used up almost all of 
the heap, and fwrite would not work, so my program would not write out the 
canceled samples.  It was all rather silly, really, but a consistent 
allocation mechanism would avoid some of the confusion.

>> Finally, there is a lingering issue.  The C55 and C64 builds cancel the 
>> echo
>> similarly, but they do not produce the same results.  The files match for
>> the first 0x1000 bytes (2048 samples, or 16 frames).  We recently sorted 
>> out
>> something like this in the encoder, but I am not sure if the expected
>> results are the same here.  Do you expect bit-exact results for all
>> fixed-point builds?  I can look into this some more, but first I need to
>> figure out if I can fit the echo canceler into my application at all.

>Assuming the FFT tables are exactly the same (that's the only place
>using float), then I would definitely expect bit-exact results.

My builds for the two platforms used exactly the same source files, though 
there were a few ifdefs in the test_echo routine to deal with file I/O for 
the C55 with its 16-bit char size.  When I get a chance, I will add some 
instrumentation and see if I can find where things diverge.  Just looking at 
the canceled audio files with a waveform editor, they were not obviously 
different, so it is not a burning issue for me.

- Jim

More information about the Speex-dev mailing list