[Speex-dev] A Probably Bug of TWO_PATH Implementation in Speex1.2rc1 AEC

Kaiyu Jiang j.equalizer at gmail.com
Thu Nov 11 17:55:46 PST 2010


I have been working on a project importing Speex to a embedded platform for
a while.
When I tried to shut down the macro TWO_PATH in Speex AEC to save space,
an error occurred. Dbf is undefined.

The 1.2rc1 code is like this

   Dbf = 0;
   See = 0;
#ifdef TWO_PATH
   /* Difference in response, this is used to estimate the variance of our
residual power estimate */
   for (chan = 0; chan < C; chan++)
   {
      spectral_mul_accum(st->X, st->W+chan*N*K*M, st->Y+chan*N, N, M*K);
      spx_ifft(st->fft_table, st->Y+chan*N, st->y+chan*N);
      for (i=0;i<st->frame_size;i++)
         st->e[chan*N+i] = st->e[chan*N+i+st->frame_size] -
st->y[chan*N+i+st->frame_size];
      Dbf += 10+mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
      for (i=0;i<st->frame_size;i++)
         st->e[chan*N+i] = st->input[chan*st->frame_size+i] -
st->y[chan*N+i+st->frame_size];
      See += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
   }
#endif

#ifndef TWO_PATH
   Sff = See;
#endif


but after examining the code, and comparing it with former version of Speex
AEC, I think
it should be like this, to enable both with or without TWO_PATH versions to
work.
Is that so?


   for (chan = 0; chan < C; chan++)
   {
    spectral_mul_accum(st->X, st->W+chan*N*K*M, st->Y+chan*N, N, M*K);
   spx_ifft(st->fft_table, st->Y+chan*N, st->y+chan*N);
   }

   See = 0;
#ifdef TWO_PATH
   Dbf = 0;

   /* Difference in response, this is used to estimate the variance of our
residual power estimate */
   for (chan = 0; chan < C; chan++)
   {
      for (i=0;i<st->frame_size;i++)
         st->e[chan*N+i] = SUB16(st->e[chan*N+i+st->frame_size],
st->y[chan*N+i+st->frame_size]);
      Dbf += 10+mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
   }
#endif

   for (chan = 0; chan < C; chan++)
   {
   for (i=0;i<st->frame_size;i++)
    st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i],
st->y[chan*N+i+st->frame_size]);
   See += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
   }

#ifndef TWO_PATH
   Sff = See;
#endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20101112/e6b0601e/attachment.htm 


More information about the Speex-dev mailing list