[xiph-cvs] cvs commit: speex/libspeex filters.c misc.h nb_celp.c sb_celp.c smallft.c

Jean-Marc Valin jm at xiph.org
Tue Oct 7 22:01:19 PDT 2003



jm          03/10/08 01:01:19

  Modified:    libspeex filters.c misc.h nb_celp.c sb_celp.c smallft.c
  Log:
  fixed-point: replace divisions by shifts...

Revision  Changes    Path
1.45      +3 -3      speex/libspeex/filters.c

Index: filters.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- filters.c	8 Oct 2003 04:57:58 -0000	1.44
+++ filters.c	8 Oct 2003 05:01:18 -0000	1.45
@@ -130,7 +130,7 @@
    for (i=0;i<N;i++)
    {
       int xh,xl,yh,yl;
-      xi=floor(.5+x[i]);
+      xi=x[i];
       yi = xi + (mem[0]<<2);
       xh = xi>>15; xl=xi&0x00007fff; yh = yi>>15; yl=yi&0x00007fff; 
       for (j=0;j<ord-1;j++)
@@ -150,7 +150,7 @@
    for (i=0;i<N;i++)
    {
       int yh,yl;
-      xi=floor(.5+x[i]);
+      xi=x[i];
       yi = xi + (mem[0]<<2);
       yh = yi>>15; yl=yi&0x00007fff; 
       for (j=0;j<ord-1;j++)
@@ -171,7 +171,7 @@
    for (i=0;i<N;i++)
    {
       int xh,xl;
-      xi=floor(.5+x[i]);
+      xi=x[i];
       yi = xi + (mem[0]<<2);
       xh = xi>>15; xl=xi&0x00007fff;
       for (j=0;j<ord-1;j++)

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

Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/misc.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- misc.h	8 Oct 2003 04:56:09 -0000	1.32
+++ misc.h	8 Oct 2003 05:01:18 -0000	1.33
@@ -45,10 +45,10 @@
 typedef int          spx_word32_t;
 typedef spx_word32_t spx_mem_t;
 typedef spx_word16_t spx_coef_t;
-typedef long long   spx_sig_t;
+typedef spx_word32_t spx_sig_t;
 
 #define LPC_SCALING  8192.
-#define SIG_SCALING  16384.
+#define SIG_SCALING  16384
 
 #define LPC_SHIFT    13
 #define SIG_SHIFT    14

<p><p>1.134     +3 -3      speex/libspeex/nb_celp.c

Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- nb_celp.c	8 Oct 2003 04:52:27 -0000	1.133
+++ nb_celp.c	8 Oct 2003 05:01:18 -0000	1.134
@@ -217,7 +217,7 @@
    /* Copy new data in input buffer */
    speex_move(st->inBuf, st->inBuf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(spx_sig_t));
    for (i=0;i<st->frameSize;i++)
-      st->inBuf[st->bufSize-st->frameSize+i] = SIG_SCALING*in[i];
+      st->inBuf[st->bufSize-st->frameSize+i] = SHL((int)in[i], SIG_SHIFT);
 
    /* Move signals 1 frame towards the past */
    speex_move(st->exc2Buf, st->exc2Buf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(spx_sig_t));
@@ -904,7 +904,7 @@
 
    /* Replace input by synthesized speech */
    for (i=0;i<st->frameSize;i++)
-     in[i]=st->frame[i]/SIG_SCALING;
+     in[i]=SHR(st->frame[i],SIG_SHIFT);
 
    if (SUBMODE(innovation_quant) == noise_codebook_quant || st->submodeID==0)
       st->bounded_pitch = 1;
@@ -1615,7 +1615,7 @@
    
    /*Copy output signal*/
    for (i=0;i<st->frameSize;i++)
-     out[i]=st->frame[i]/SIG_SCALING;
+     out[i]=SHR(st->frame[i],SIG_SHIFT);
 
    /* Store the LSPs for interpolation in the next frame */
    for (i=0;i<st->lpcSize;i++)

<p><p>1.136     +1 -1      speex/libspeex/sb_celp.c

Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -r1.135 -r1.136
--- sb_celp.c	8 Oct 2003 04:52:27 -0000	1.135
+++ sb_celp.c	8 Oct 2003 05:01:18 -0000	1.136
@@ -1083,7 +1083,7 @@
    fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
 
    for (i=0;i<st->full_frame_size;i++)
-      out[i]=2*(st->y0[i]-st->y1[i]) / SIG_SCALING;
+      out[i]=SHR((st->y0[i]-st->y1[i]), SIG_SHIFT-1);
 
    for (i=0;i<st->lpcSize;i++)
       st->old_qlsp[i] = st->qlsp[i];

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

Index: smallft.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/smallft.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- smallft.c	8 Oct 2003 04:57:58 -0000	1.13
+++ smallft.c	8 Oct 2003 05:01:18 -0000	1.14
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: *unnormalized* fft transform
- last mod: $Id: smallft.c,v 1.13 2003/10/08 04:57:58 jm Exp $
+ last mod: $Id: smallft.c,v 1.14 2003/10/08 05:01:18 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