Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xiph/speex.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>2008-02-13 13:12:13 +0300
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>2008-02-13 13:12:13 +0300
commit0b34061fc7caa8b4f42c6e35b67e49d47e21e46d (patch)
tree74865bab24cb0f59839a7344f8baf3bc07e9b26a
parent371dfc49e259c067a840522fc0d37bfa8ae79566 (diff)
Thorvald Natvig: Patch to query the impulse response from the AEC
git-svn-id: http://svn.xiph.org/trunk/speex@14497 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r--include/speex/speex_echo.h8
-rw-r--r--libspeex/mdf.c21
2 files changed, 29 insertions, 0 deletions
diff --git a/include/speex/speex_echo.h b/include/speex/speex_echo.h
index 77a7846..9c0294b 100644
--- a/include/speex/speex_echo.h
+++ b/include/speex/speex_echo.h
@@ -51,6 +51,14 @@ extern "C" {
/** 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_;
diff --git a/libspeex/mdf.c b/libspeex/mdf.c
index 1fbb4d6..bc24d36 100644
--- a/libspeex/mdf.c
+++ b/libspeex/mdf.c
@@ -1169,6 +1169,27 @@ int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
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;