[xiph-cvs] cvs commit: speex/libspeex ltp.c misc.h

Jean-Marc Valin jm at xiph.org
Fri Oct 24 08:01:09 PDT 2003



jm          03/10/24 11:01:09

  Modified:    libspeex ltp.c misc.h
  Log:
  fixed-point: open-loop score calculation converted

Revision  Changes    Path
1.87      +21 -1     speex/libspeex/ltp.c

Index: ltp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/ltp.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- ltp.c	24 Oct 2003 06:00:19 -0000	1.86
+++ ltp.c	24 Oct 2003 15:01:08 -0000	1.87
@@ -92,7 +92,7 @@
    for (i=start;i<=end;i++)
    {
       /* Update energy for next pitch*/
-      energy[i-start+1] = energy[i-start] + SHR(MULT16_16(swn[-i-1],swn[-i-1]) - MULT16_16(swn[-i+len-1],swn[-i+len-1]),6);
+      energy[i-start+1] = energy[i-start] + SHR(MULT16_16(swn[-i-1],swn[-i-1]),6) - SHR(MULT16_16(swn[-i+len-1],swn[-i+len-1]),6);
    }
    for (i=start;i<=end;i++)
    {
@@ -106,6 +106,26 @@
       corr[i-start]=inner_prod(swn, swn-i, len);
       score[i-start]=1.*corr[i-start]*corr[i-start]/(energy[i-start]+1.);
    }
+
+   {
+      spx_word16_t *corr16;
+      spx_word16_t *ener16;
+#ifdef FIXED_POINT
+      corr16 = PUSH(stack, end-start+1, spx_word16_t);
+      ener16 = PUSH(stack, end-start+1, spx_word16_t);
+      normalize16(corr, corr16, 16384, end-start+1);
+      normalize16(energy, ener16, 16384, end-start+1);
+#else
+      corr16=corr;
+      ener16=energy;
+#endif
+      for (i=start;i<=end;i++)
+      {
+         score[i-start]=DIV32_16(MULT16_16(corr16[i-start],corr16[i-start]),ener16[i-start]+1);
+      }
+   }
+
+
    for (i=start;i<=end;i++)
    {
       if (score[i-start]>best_score[N-1])

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

Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/misc.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- misc.h	9 Oct 2003 03:54:37 -0000	1.35
+++ misc.h	24 Oct 2003 15:01:08 -0000	1.36
@@ -106,6 +106,8 @@
 #define MULT16_16_Q14(a,b)     ((a)*(b))
 #define MULT16_16_Q15(a,b)     ((a)*(b))
 
+#define DIV32_16(a,b)     ((a)/(b))
+
 
 #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