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

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



jm          03/10/08 00:45:26

  Modified:    libspeex cb_search.c misc.h smallft.c vq.c vq.h
  Log:
  fixed-point: some work on innovation quantization

Revision  Changes    Path
1.92      +13 -6     speex/libspeex/cb_search.c

Index: cb_search.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/cb_search.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- cb_search.c	8 Oct 2003 04:40:41 -0000	1.91
+++ cb_search.c	8 Oct 2003 04:45:26 -0000	1.92
@@ -35,6 +35,7 @@
 #include "stack_alloc.h"
 #include "vq.h"
 #include "misc.h"
+#include <stdio.h>
 
 void split_cb_search_shape_sign(
 spx_sig_t target[],			/* target vector */
@@ -54,7 +55,7 @@
    int i,j,k,m,n,q;
    spx_sig_t *resp;
    spx_sig_t *t, *e, *r2;
-   float *E;
+   spx_word32_t *E;
    spx_sig_t *tmp;
    float *ndist, *odist;
    int *itmp;
@@ -88,7 +89,7 @@
    t = PUSH(stack, nsf, spx_sig_t);
    e = PUSH(stack, nsf, spx_sig_t);
    r2 = PUSH(stack, nsf, spx_sig_t);
-   E = PUSH(stack, shape_cb_size, float);
+   E = PUSH(stack, shape_cb_size, spx_word32_t);
    ind = PUSH(stack, nb_subvect, int);
 
    tmp = PUSH(stack, 2*N*nsf, spx_sig_t);
@@ -116,12 +117,15 @@
          nind[i][j]=oind[i][j]=-1;
    }
 
+   for (i=0;i<nsf;i++)
+      t[i]=SHR(target[i],6);
+
    for (j=0;j<N;j++)
       for (i=0;i<nsf;i++)
-         ot[j][i]=target[i];
+         ot[j][i]=t[i];
 
-   for (i=0;i<nsf;i++)
-      t[i]=target[i];
+   /*for (i=0;i<nsf;i++)
+     printf ("%d\n", (int)t[i]);*/
 
    /* Pre-compute codewords response and energy */
    for (i=0;i<shape_cb_size;i++)
@@ -139,6 +143,9 @@
          for (k=0;k<=j;k++)
             res[j] += shape[k]*r[j-k];
          res[j] *= 0.03125;
+         
+         res[j] = SHR(res[j],6);
+         /*printf ("%d\n", (int)res[j]);*/
       }
       
       /* Compute codeword energy */
@@ -225,7 +232,7 @@
                   g=sign*0.03125*shape_cb[rind*subvect_size+m];
                   q=subvect_size-m;
                   for (n=subvect_size*(i+1);n<nsf;n++,q++)
-                     t[n] -= g*r[q];
+                     t[n] -= SHR((long long)(g*r[q]),6);
                }
 
 

<p><p>1.31      +2 -0      speex/libspeex/misc.h

Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/misc.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- misc.h	8 Oct 2003 04:42:59 -0000	1.30
+++ misc.h	8 Oct 2003 04:45:26 -0000	1.31
@@ -54,6 +54,7 @@
 #define SIG_SHIFT    14
 
 #define SHR(a,shift) ((a) >> (shift))
+#define SHL(a,shift) ((a) << (shift))
 
 #define MULT16_16(a,b)     (((signed int)(a))*(b))
 #define MULT16_32_Q14(a,b) (((a)*((b)>>14)) + ((a)*((signed int)((b)&0x00003fff))>>14))
@@ -83,6 +84,7 @@
 #define SIG_SHIFT    0
 
 #define SHR(a,shift)       (a)
+#define SHL(a,shift)       (a)
 #define MULT16_16(a,b)     ((a)*(b))
 
 

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

Index: smallft.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/smallft.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- smallft.c	8 Oct 2003 04:44:02 -0000	1.5
+++ smallft.c	8 Oct 2003 04:45:26 -0000	1.6
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: *unnormalized* fft transform
- last mod: $Id: smallft.c,v 1.5 2003/10/08 04:44:02 jm Exp $
+ last mod: $Id: smallft.c,v 1.6 2003/10/08 04:45:26 jm Exp $
 
  ********************************************************************/
 

<p><p>1.10      +2 -2      speex/libspeex/vq.c

Index: vq.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/vq.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- vq.c	8 Oct 2003 04:40:41 -0000	1.9
+++ vq.c	8 Oct 2003 04:45:26 -0000	1.10
@@ -57,7 +57,7 @@
 
 
 /*Finds the indices of the n-best entries in a codebook*/
-void vq_nbest(spx_sig_t *in, spx_sig_t *codebook, int len, int entries, float *E, int N, int *nbest, float *best_dist)
+void vq_nbest(spx_sig_t *in, spx_sig_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, float *best_dist)
 {
    int i,j,k,used;
    used = 0;
@@ -81,7 +81,7 @@
 }
 
 /*Finds the indices of the n-best entries in a codebook with sign*/
-void vq_nbest_sign(spx_sig_t *in, spx_sig_t *codebook, int len, int entries, float *E, int N, int *nbest, float *best_dist)
+void vq_nbest_sign(spx_sig_t *in, spx_sig_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, float *best_dist)
 {
    int i,j,k, sign, used;
    used=0;

<p><p>1.9       +2 -2      speex/libspeex/vq.h

Index: vq.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/vq.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- vq.h	8 Oct 2003 04:40:41 -0000	1.8
+++ vq.h	8 Oct 2003 04:45:26 -0000	1.9
@@ -37,8 +37,8 @@
 
 int vq_index(float *in, float *codebook, int len, int entries);
 
-void vq_nbest(spx_sig_t *in, spx_sig_t *codebook, int len, int entries, float *E, int N, int *nbest, float *best_dist);
+void vq_nbest(spx_sig_t *in, spx_sig_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, float *best_dist);
 
-void vq_nbest_sign(spx_sig_t *in, spx_sig_t *codebook, int len, int entries, float *E, int N, int *nbest, float *best_dist);
+void vq_nbest_sign(spx_sig_t *in, spx_sig_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, float *best_dist);
 
 #endif

<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