Tuning for low-energy echo.
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Thu, 31 Aug 2006 14:33:24 +0000 (14:33 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Thu, 31 Aug 2006 14:33:24 +0000 (14:33 +0000)
git-svn-id: http://svn.xiph.org/trunk/speex@11824 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/mdf.c

index 80a8700..de66880 100644 (file)
@@ -635,7 +635,7 @@ void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *ref, const spx_int
    /* Compute a bunch of correlations */
    Sey = mdf_inner_prod(st->e+st->frame_size, st->y+st->frame_size, st->frame_size);
    See = mdf_inner_prod(st->e+st->frame_size, st->e+st->frame_size, st->frame_size);
-   See = ADD32(See, SHR32(EXTEND32(10000),6));
+   See = ADD32(See, SHR32(MULT16_16(N, 100),6));
    Syy = mdf_inner_prod(st->y+st->frame_size, st->y+st->frame_size, st->frame_size);
    Sxx = mdf_inner_prod(st->x+st->frame_size, st->x+st->frame_size, st->frame_size);
 
@@ -764,7 +764,7 @@ void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *ref, const spx_int
          /*st->power_1[i] = adapt_rate*r/(e*(1+st->power[i]));*/
          st->power_1[i] = FLOAT_SHL(FLOAT_DIV32_FLOAT(r,FLOAT_MUL32U(e,st->power[i]+10)),WEIGHT_SHIFT+16);
       }
-   } else {
+   } else if (Sxx > SHR32(MULT16_16(N, 1000),6)) {
       /* Temporary adaption rate if filter is not yet adapted enough */
       spx_word16_t adapt_rate=0;