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

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Mon Apr 25 00:16:24 PDT 2005


Author: jm
Date: 2005-04-25 00:16:23 -0700 (Mon, 25 Apr 2005)
New Revision: 9180

Modified:
   trunk/speex/libspeex/cb_search.c
   trunk/speex/libspeex/ltp.c
Log:
convert codebook data (signed char) to spx_word16_t in a cleaner manner


Modified: trunk/speex/libspeex/cb_search.c
===================================================================
--- trunk/speex/libspeex/cb_search.c	2005-04-25 06:19:35 UTC (rev 9179)
+++ trunk/speex/libspeex/cb_search.c	2005-04-25 07:16:23 UTC (rev 9180)
@@ -48,13 +48,15 @@
 static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
 {
    int i, j, k;
+   VARDECL(spx_word16_t *shape);
+   ALLOC(shape, subvect_size, spx_word16_t);
    for (i=0;i<shape_cb_size;i++)
    {
       spx_word16_t *res;
-      const signed char *shape;
-
+      
       res = resp+i*subvect_size;
-      shape = shape_cb+i*subvect_size;
+      for (k=0;k<subvect_size;k++)
+         shape[k] = (spx_word16_t)shape_cb[i*subvect_size+k];
       E[i]=0;
 
       /* Compute codeword response using convolution with impulse response */

Modified: trunk/speex/libspeex/ltp.c
===================================================================
--- trunk/speex/libspeex/ltp.c	2005-04-25 06:19:35 UTC (rev 9179)
+++ trunk/speex/libspeex/ltp.c	2005-04-25 07:16:23 UTC (rev 9180)
@@ -445,9 +445,9 @@
          spx_word32_t sum=0;
          spx_word16_t g0,g1,g2;
          ptr = gain_cdbk+3*i;
-         g0=ptr[0]+32;
-         g1=ptr[1]+32;
-         g2=ptr[2]+32;
+         g0=ADD16((spx_word16_t)ptr[0],32);
+         g1=ADD16((spx_word16_t)ptr[1],32);
+         g2=ADD16((spx_word16_t)ptr[2],32);
 
          sum = ADD32(sum,MULT16_32_Q14(MULT16_16_16(g0,64),C[0]));
          sum = ADD32(sum,MULT16_32_Q14(MULT16_16_16(g1,64),C[1]));



More information about the commits mailing list