[Speex-dev] fixed-point bug

Tom Newbern tnewbern at comcast.net
Fri Sep 17 14:21:31 PDT 2004


Hello Jean-Marc,

I took a look into the fixed-point version noise problem.  I found the white noise to appear only when using DTX.  I was able to trace the problem down to the included code.

I found that the innov_gain was never scaled causing speex_rand_vec to generate a rather large white noise signal.  I modified the code as follows which seems to fix the problem.

nb_celp.c - line #1269
   /* If null mode (no transmission), just set a couple things to zero*/
   if (st->submodes[st->submodeID] == NULL)
   {
      spx_coef_t *lpc;
      lpc = PUSH(stack,11, spx_coef_t);
      bw_lpc(GAMMA_SCALING*.93, st->interp_qlpc, lpc, 10);
      /*for (i=0;i<st->frameSize;i++)
        st->exc[i]=0;*/
      {
         float innov_gain=0;
         float pgain=GAIN_SCALING_1*st->last_pitch_gain;
         if (pgain>.6)
            pgain=.6;
         for (i=0;i<st->frameSize;i++)
            innov_gain += st->innov[i]*st->innov[i];

         /* original code */
         /*innov_gain=sqrt(innov_gain/st->frameSize);*/

         /* proposed fix */
         innov_gain=sqrt(innov_gain/st->frameSize)/SIG_SCALING;

         for (i=0;i<st->frameSize;i++)
            st->exc[i]=0;
         speex_rand_vec(innov_gain, st->exc, st->frameSize);
      }

Tom



More information about the Speex-dev mailing list