[xiph-cvs] cvs commit: speex/libspeex cb_search.c smallft.c

Jean-Marc Valin jm at xiph.org
Tue Oct 7 21:49:37 PDT 2003



jm          03/10/08 00:49:37

  Modified:    libspeex cb_search.c smallft.c
  Log:
  fixed-point: some innovation search details

Revision  Changes    Path
1.94      +29 -7     speex/libspeex/cb_search.c

Index: cb_search.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/cb_search.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- cb_search.c	8 Oct 2003 04:47:56 -0000	1.93
+++ cb_search.c	8 Oct 2003 04:49:37 -0000	1.94
@@ -220,7 +220,7 @@
                /* New code: update the rest of the target only if it's worth it */
                for (m=0;m<subvect_size;m++)
                {
-                  float g;
+                  spx_word16_t g;
                   int rind;
                   float sign=1;
                   rind = best_index[k];
@@ -230,10 +230,16 @@
                      rind-=shape_cb_size;
                   }
 
-                  g=sign*0.03125*shape_cb[rind*subvect_size+m];
                   q=subvect_size-m;
+#ifdef FIXED_POINT
+                  g=sign*shape_cb[rind*subvect_size+m];
+                  for (n=subvect_size*(i+1);n<nsf;n++,q++)
+                     t[n] -= SHR(MULT16_16(g,r[q]),11);
+#else
+                  g=sign*0.03125*shape_cb[rind*subvect_size+m];
                   for (n=subvect_size*(i+1);n<nsf;n++,q++)
-                     t[n] -= SHR((long long)(g*r[q]),6);
+                     t[n] -= g*r[q];
+#endif
                }
 
 
@@ -290,16 +296,26 @@
    for (i=0;i<nb_subvect;i++)
    {
       int rind;
-      float sign=1;
+      spx_word16_t sign=1;
       rind = ind[i];
       if (rind>=shape_cb_size)
       {
          sign=-1;
          rind-=shape_cb_size;
       }
-
+#ifdef FIXED_POINT
+      if (sign==1)
+      {
+         for (j=0;j<subvect_size;j++)
+            e[subvect_size*i+j]=SHL((spx_word32_t)shape_cb[rind*subvect_size+j],SIG_SHIFT-5);
+      } else {
+         for (j=0;j<subvect_size;j++)
+            e[subvect_size*i+j]=-SHL((spx_word32_t)shape_cb[rind*subvect_size+j],SIG_SHIFT-5);
+      }
+#else
       for (j=0;j<subvect_size;j++)
          e[subvect_size*i+j]=sign*0.03125*SIG_SCALING*shape_cb[rind*subvect_size+j];
+#endif
    }   
    /* Update excitation */
    for (j=0;j<nsf;j++)
@@ -354,8 +370,14 @@
       if (signs[i])
          s=-1;
 #ifdef FIXED_POINT
-      for (j=0;j<subvect_size;j++)
-         exc[subvect_size*i+j]+=s*0.03125*SIG_SCALING*shape_cb[ind[i]*subvect_size+j];
+      if (s==1)
+      {
+         for (j=0;j<subvect_size;j++)
+            exc[subvect_size*i+j]=SHL((spx_word32_t)shape_cb[ind[i]*subvect_size+j],SIG_SHIFT-5);
+      } else {
+         for (j=0;j<subvect_size;j++)
+            exc[subvect_size*i+j]=-SHL((spx_word32_t)shape_cb[ind[i]*subvect_size+j],SIG_SHIFT-5);
+      }
 #else
       for (j=0;j<subvect_size;j++)
          exc[subvect_size*i+j]+=s*0.03125*shape_cb[ind[i]*subvect_size+j];      

<p><p>1.8       +0 -0      speex/libspeex/smallft.c

Index: smallft.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/smallft.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- smallft.c	8 Oct 2003 04:47:56 -0000	1.7
+++ smallft.c	8 Oct 2003 04:49:37 -0000	1.8
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: *unnormalized* fft transform
- last mod: $Id: smallft.c,v 1.7 2003/10/08 04:47:56 jm Exp $
+ last mod: $Id: smallft.c,v 1.8 2003/10/08 04:49:37 jm Exp $
 
  ********************************************************************/
 

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list