Jim,
You're right, the memset really is there, how could I miss that? :)
I also spoke too soon, as my change doesn't solve anything. At each run,
something random causes the algorithm to either work or not work at all.
There is a correspondence between whether the echo cancel works and
whether the st->PHI and st->W arrays contain data or zeroes. (the arrays
contain zeroes when alg fails, and data when alg works.)
I have tried running the trivial case where the canceller is given two
identical buffers, and it works every time.
The only thing that I know of that can change slightly between runs is
perhaps a minor change in the delay between the play and record buffers.
I have verified, however, that the play buffer is always ahead of the
rec buffer, so the echo canceller is always trying to cancel a signal
that it has seen before.
Can slight differences in this delay cause this problem? What could
cause the PHI and W arrays (sorry I keep calling them that, I don't know
what their meaning is) to be zeroes only?
Thanks,
-Itay
-----Original Message-----
From: Jim Crichton [mailto:jim.crichton@comcast.net]
Sent: Thursday, August 17, 2006 2:52 PM
To: Itay Chamiel
Cc: speex-dev@xiph.org
Subject: Re: [Speex-dev] AEC on a TI C6x - has no effect
Itay,
>I am trying these things, but the main problem that has been bothering
>me recently is that the fixed-point algorithm works "sometimes".
>Meaning that sometimes it will work well, and other times it will not
>work at all.
>
>I think I've found the source of the problem. The speex_alloc()
>function, called by speex_echo_state_init(), calls calloc() and returns
>a zeroed array. On the other hand, the TI implementation (as it is if
>you don't change the MANUAL_ALLOC define) replaces speex_alloc() with a
>different version that doesn't use the heap but only allocates memory
>from a large application-supplied memory block. Nothing zeroes this
>memory, and there is no hint in the comments (ti\user_misc.h, lines
>36-46) to let me know that the block must be zeroed externally. I
>believe this should be clarified in these comments, or perhaps instead
>add a memset in speex_alloc() in ti\user_misc.h to zero the memory.
>Now that I'm zeroing this block in my initialization, everything seems
>to be working much more consistently.
There IS a memset at the bottom of speex_alloc in ti\user_misc.h, so I
do not understand why your zeroing of this block makes any difference.
There may be some more subtle problem.
- Jim