seems to at least be working for single channel
authorval058 <val058@630fbc32-c412-0410-8d9e-966872dfccd7>
Fri, 18 Aug 2006 01:22:15 +0000 (01:22 +0000)
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>
Mon, 19 May 2008 04:30:41 +0000 (14:30 +1000)
git-svn-id: svn://lasagne.centie.net.au/trunk/audio/aec@183 630fbc32-c412-0410-8d9e-966872dfccd7

libspeex/mdf.c

index 9d5b413..cf9354a 100644 (file)
@@ -486,7 +486,7 @@ void mc_echo_cancel(SpeexEchoState *st, const spx_int16_t *ref, const spx_int16_
    M = st->M;
    C = st->C;
    K = st->K;
-   spx_word32_t Syy,See,Sxx;
+   spx_word32_t Syy=0,See=0,Sxx=0;
 
    st->cancel_count++;
 #ifdef FIXED_POINT
@@ -531,7 +531,7 @@ void mc_echo_cancel(SpeexEchoState *st, const spx_int16_t *ref, const spx_int16_
       {
          spx_word16_t tmp;
          spx_word32_t tmp32;
-         st->x[speak+N+i] = st->x[speak+N+i+st->frame_size];
+         st->x[speak*N+i] = st->x[speak*N+i+st->frame_size];
          tmp32 = SUB32(EXTEND32(echo[i]), EXTEND32(MULT16_16_P15(st->preemph, st->memX[speak])));
 #ifdef FIXED_POINT
          /*FIXME: If saturation occurs here, we need to freeze adaptation for M frames (not just one) */
@@ -546,7 +546,7 @@ void mc_echo_cancel(SpeexEchoState *st, const spx_int16_t *ref, const spx_int16_
             st->saturated = 1;
          }      
 #endif
-         st->x[speak+N+i+st->frame_size] = EXTRACT16(tmp32);
+         st->x[speak*N+i+st->frame_size] = EXTRACT16(tmp32);
          st->memX[speak] = echo[i];
       }
    }