00001 /* Copyright (C) Jean-Marc Valin 00002 00003 File: speex_echo.h 00004 00005 00006 Redistribution and use in source and binary forms, with or without 00007 modification, are permitted provided that the following conditions are 00008 met: 00009 00010 1. Redistributions of source code must retain the above copyright notice, 00011 this list of conditions and the following disclaimer. 00012 00013 2. Redistributions in binary form must reproduce the above copyright 00014 notice, this list of conditions and the following disclaimer in the 00015 documentation and/or other materials provided with the distribution. 00016 00017 3. The name of the author may not be used to endorse or promote products 00018 derived from this software without specific prior written permission. 00019 00020 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00021 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00022 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 00024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00026 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00027 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00028 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00029 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 00033 struct drft_lookup; 00034 00035 typedef struct SpeexEchoState { 00036 int frame_size; 00037 int window_size; 00038 int M; 00039 int cancel_count; 00040 float adapt_rate; 00041 00042 float *x; 00043 float *X; 00044 float *d; 00045 float *D; 00046 float *y; 00047 float *Y; 00048 float *E; 00049 float *PHI; 00050 float *W; 00051 float *power; 00052 float *power_1; 00053 float *grad; 00054 float *old_grad; 00055 00056 struct drft_lookup *fft_lookup; 00057 00058 00059 } SpeexEchoState; 00060 00061 00063 SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length); 00064 00066 void speex_echo_state_destroy(SpeexEchoState *st); 00067 00069 void speex_echo_cancel(SpeexEchoState *st, float *ref, float *echo, float *out, float *Y); 00070