[xiph-commits] r14497 - in trunk/speex: include/speex libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Wed Feb 13 02:12:13 PST 2008
Author: jm
Date: 2008-02-13 02:12:13 -0800 (Wed, 13 Feb 2008)
New Revision: 14497
Modified:
trunk/speex/include/speex/speex_echo.h
trunk/speex/libspeex/mdf.c
Log:
Thorvald Natvig: Patch to query the impulse response from the AEC
Modified: trunk/speex/include/speex/speex_echo.h
===================================================================
--- trunk/speex/include/speex/speex_echo.h 2008-02-13 10:11:57 UTC (rev 14496)
+++ trunk/speex/include/speex/speex_echo.h 2008-02-13 10:12:13 UTC (rev 14497)
@@ -51,6 +51,14 @@
/** Get sampling rate */
#define SPEEX_ECHO_GET_SAMPLING_RATE 25
+/* Can't set window sizes */
+/** Get size of impulse response (int32) */
+#define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27
+
+/* Can't set window content */
+/** Get impulse response (int32[]) */
+#define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29
+
/** Internal echo canceller state. Should never be accessed directly. */
struct SpeexEchoState_;
Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c 2008-02-13 10:11:57 UTC (rev 14496)
+++ trunk/speex/libspeex/mdf.c 2008-02-13 10:12:13 UTC (rev 14497)
@@ -1169,6 +1169,27 @@
case SPEEX_ECHO_GET_SAMPLING_RATE:
(*(int*)ptr) = st->sampling_rate;
break;
+ case SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE:
+ *((spx_int32_t *)ptr) = st->M * st->frame_size;
+ break;
+ case SPEEX_ECHO_GET_IMPULSE_RESPONSE:
+ {
+ int M = st->M, N = st->window_size, n = st->frame_size, i, j;
+ spx_int32_t *filt = (spx_int32_t *) ptr;
+ for(j=0;j<M;j++)
+ {
+#ifdef FIXED_POINT
+ for (i=0;i<N;i++)
+ st->wtmp2[i] = EXTRACT16(PSHR32(st->W[j*N+i],16));
+ spx_ifft(st->fft_table, st->wtmp2, st->wtmp);
+#else
+ spx_ifft(st->fft_table, &st->W[j*N], st->wtmp);
+#endif
+ for(i=0;i<n;i++)
+ filt[j*n+i] = PSHR32(MULT16_16(32767,st->wtmp[i]), WEIGHT_SHIFT);
+ }
+ }
+ break;
default:
speex_warning_int("Unknown speex_echo_ctl request: ", request);
return -1;
More information about the commits
mailing list