[xiph-commits] r11374 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Mon May 8 04:22:34 PDT 2006


Author: jm
Date: 2006-05-08 04:22:31 -0700 (Mon, 08 May 2006)
New Revision: 11374

Modified:
   trunk/speex/libspeex/nb_celp.c
Log:
computation of gain correction now done with 16-bit precision.


Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2006-05-08 10:24:36 UTC (rev 11373)
+++ trunk/speex/libspeex/nb_celp.c	2006-05-08 11:22:31 UTC (rev 11374)
@@ -283,7 +283,7 @@
    VARDECL(spx_mem_t *mem);
    char *stack;
    VARDECL(spx_word16_t *syn_resp);
-   VARDECL(spx_sig_t *real_exc);
+   VARDECL(spx_word16_t *real_exc);
 #ifdef EPIC_48K
    int pitch_half[2];
    int ol_pitch_id=0;
@@ -703,7 +703,7 @@
    ALLOC(innov, st->subframeSize, spx_sig_t);
    ALLOC(ringing, st->subframeSize, spx_word16_t);
    ALLOC(syn_resp, st->subframeSize, spx_word16_t);
-   ALLOC(real_exc, st->subframeSize, spx_sig_t);
+   ALLOC(real_exc, st->subframeSize, spx_word16_t);
    ALLOC(mem, st->lpcSize, spx_mem_t);
 
    /* Loop on sub-frames */
@@ -788,17 +788,13 @@
          if (sub==0)
          {
             for (i=0;i<st->subframeSize;i++)
-               real_exc[i] = SHL32(EXTEND32(st->winBuf[i]),SIG_SHIFT);
-            for (i=0;i<st->subframeSize;i++)
-               sw[i] = st->winBuf[i];
+               real_exc[i] = sw[i] = st->winBuf[i];
          } else {
             for (i=0;i<st->subframeSize;i++)
-               real_exc[i] = SHL32(EXTEND32(in[i+((sub-1)*st->subframeSize)]),SIG_SHIFT);
-            for (i=0;i<st->subframeSize;i++)
-               sw[i] = in[i+((sub-1)*st->subframeSize)];
+               real_exc[i] = sw[i] = in[i+((sub-1)*st->subframeSize)];
          }
       }
-      fir_mem2(real_exc, st->interp_qlpc, real_exc, st->subframeSize, st->lpcSize, st->mem_exc2);
+      fir_mem16(real_exc, st->interp_qlpc, real_exc, st->subframeSize, st->lpcSize, st->mem_exc2);
       
       if (st->complexity==0)
          response_bound >>= 1;
@@ -905,9 +901,9 @@
             innov[i]=0;
          
          for (i=0;i<st->subframeSize;i++)
-            real_exc[i] = SUB32(real_exc[i], exc[i]);
+            real_exc[i] = SUB16(real_exc[i], EXTRACT16(SHR32(exc[i],SIG_SHIFT)));
 
-         ener = SHL32(EXTEND32(compute_rms(real_exc, st->subframeSize)),SIG_SHIFT);
+         ener = SHL32(EXTEND32(compute_rms16(real_exc, st->subframeSize)),SIG_SHIFT);
          
          /*FIXME: Should use DIV32_16 and make sure result fits in 16 bits */
 #ifdef FIXED_POINT



More information about the commits mailing list