Kaiyu Jiang
2010-Nov-12 01:55 UTC
[Speex-dev] A Probably Bug of TWO_PATH Implementation in Speex1.2rc1 AEC
I have been working on a project importing Speex to a embedded platform for a while. When I tried to shut down the macro TWO_PATH in Speex AEC to save space, an error occurred. Dbf is undefined. The 1.2rc1 code is like this Dbf = 0; See = 0; #ifdef TWO_PATH /* Difference in response, this is used to estimate the variance of our residual power estimate */ for (chan = 0; chan < C; chan++) { spectral_mul_accum(st->X, st->W+chan*N*K*M, st->Y+chan*N, N, M*K); spx_ifft(st->fft_table, st->Y+chan*N, st->y+chan*N); for (i=0;i<st->frame_size;i++) st->e[chan*N+i] = st->e[chan*N+i+st->frame_size] - st->y[chan*N+i+st->frame_size]; Dbf += 10+mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size); for (i=0;i<st->frame_size;i++) st->e[chan*N+i] = st->input[chan*st->frame_size+i] - st->y[chan*N+i+st->frame_size]; See += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size); } #endif #ifndef TWO_PATH Sff = See; #endif but after examining the code, and comparing it with former version of Speex AEC, I think it should be like this, to enable both with or without TWO_PATH versions to work. Is that so? for (chan = 0; chan < C; chan++) { spectral_mul_accum(st->X, st->W+chan*N*K*M, st->Y+chan*N, N, M*K); spx_ifft(st->fft_table, st->Y+chan*N, st->y+chan*N); } See = 0; #ifdef TWO_PATH Dbf = 0; /* Difference in response, this is used to estimate the variance of our residual power estimate */ for (chan = 0; chan < C; chan++) { for (i=0;i<st->frame_size;i++) st->e[chan*N+i] = SUB16(st->e[chan*N+i+st->frame_size], st->y[chan*N+i+st->frame_size]); Dbf += 10+mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size); } #endif for (chan = 0; chan < C; chan++) { for (i=0;i<st->frame_size;i++) st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]); See += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size); } #ifndef TWO_PATH Sff = See; #endif -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20101112/e6b0601e/attachment.htm
Seemingly Similar Threads
- Patch to get impulse response from echo canceller
- Fixed-point scaling of mdf impulse response
- Patch for Analog Devices compiler & fixed-point AGC
- [PATCH] Pitch now quantised at the band level, got rid of all the VQ code.
- Patch to make analysis data available.