[xiph-cvs] cvs commit: speex/libspeex filters.c ltp.c quant_lsp.c
Jean-Marc Valin
jm at xiph.org
Sun Nov 30 08:35:21 PST 2003
jm 03/11/30 11:35:21
Modified: libspeex filters.c ltp.c quant_lsp.c
Log:
...
Revision Changes Path
1.68 +2 -3 speex/libspeex/filters.c
Index: filters.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- filters.c 30 Nov 2003 07:11:36 -0000 1.67
+++ filters.c 30 Nov 2003 16:35:20 -0000 1.68
@@ -66,7 +66,7 @@
#ifdef FIXED_POINT
-/* FIXME: These functions are ugly and probably might too much error */
+/* FIXME: These functions are ugly and probably introduce too much error */
void signal_mul(spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len)
{
int i;
@@ -180,8 +180,7 @@
sum += SHR(sum2,6);
}
- /*FIXME: remove division*/
- return SHR(SHL((spx_word32_t)spx_sqrt(1+sum/len),(sig_shift+3)),SIG_SHIFT);
+ return SHR(SHL((spx_word32_t)spx_sqrt(1+DIV32(sum,len)),(sig_shift+3)),SIG_SHIFT);
}
<p><p>1.105 +10 -14 speex/libspeex/ltp.c
Index: ltp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/ltp.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- ltp.c 30 Nov 2003 05:46:03 -0000 1.104
+++ ltp.c 30 Nov 2003 16:35:21 -0000 1.105
@@ -245,10 +245,7 @@
x[i][0]=0;
for (j=0;j<nsf;j++)
{
- /* FIXME: Check for overflows */
- /*x[i][j]+=e[i][0]*r[j]/SIG_SCALING;*/
- x[i][j]+=SHL(MULT16_32_Q15(r[j], e[i][0]),1);
- /*printf ("%d\n", (int)r[j]);*/
+ x[i][j]=ADD32(x[i][j],SHL(MULT16_32_Q15(r[j], e[i][0]),1));
}
}
}
@@ -351,16 +348,15 @@
g1=ptr[1]+32;
g2=ptr[2]+32;
- /* FIXME: check for possible overflows on sum and MULT16_32 */
- sum += MULT16_32_Q14(MULT16_16_16(g0,64),C[0]);
- sum += MULT16_32_Q14(MULT16_16_16(g1,64),C[1]);
- sum += MULT16_32_Q14(MULT16_16_16(g2,64),C[2]);
- sum -= MULT16_32_Q14(MULT16_16_16(g0,g1),C[3]);
- sum -= MULT16_32_Q14(MULT16_16_16(g2,g1),C[4]);
- sum -= MULT16_32_Q14(MULT16_16_16(g2,g0),C[5]);
- sum -= MULT16_32_Q15(MULT16_16_16(g0,g0),C[6]);
- sum -= MULT16_32_Q15(MULT16_16_16(g1,g1),C[7]);
- sum -= MULT16_32_Q15(MULT16_16_16(g2,g2),C[8]);
+ 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]));
+ sum = ADD32(sum,MULT16_32_Q14(MULT16_16_16(g2,64),C[2]));
+ sum = SUB32(sum,MULT16_32_Q14(MULT16_16_16(g0,g1),C[3]));
+ sum = SUB32(sum,MULT16_32_Q14(MULT16_16_16(g2,g1),C[4]));
+ sum = SUB32(sum,MULT16_32_Q14(MULT16_16_16(g2,g0),C[5]));
+ sum = SUB32(sum,MULT16_32_Q15(MULT16_16_16(g0,g0),C[6]));
+ sum = SUB32(sum,MULT16_32_Q15(MULT16_16_16(g1,g1),C[7]));
+ sum = SUB32(sum,MULT16_32_Q15(MULT16_16_16(g2,g2),C[8]));
/* We could force "safe" pitch values to handle packet loss better */
<p><p>1.33 +2 -5 speex/libspeex/quant_lsp.c
Index: quant_lsp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/quant_lsp.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- quant_lsp.c 21 Nov 2003 06:59:25 -0000 1.32
+++ quant_lsp.c 30 Nov 2003 16:35:21 -0000 1.33
@@ -35,8 +35,6 @@
#include "misc.h"
-/* FIXME: Get rid of this kludge quick before someone gets hurt */
-
#ifdef FIXED_POINT
#define LSP_LINEAR(i) (SHL(i+1,11))
@@ -98,7 +96,7 @@
for (j=0;j<nbDim;j++)
{
tmp=SUB16(x[j],SHL((spx_word16_t)*ptr++,5));
- dist+=MULT16_16(tmp,tmp);
+ dist=MAC16_16(dist,tmp,tmp);
}
if (dist<best_dist || i==0)
{
@@ -128,7 +126,7 @@
for (j=0;j<nbDim;j++)
{
tmp=SUB16(x[j],SHL((spx_word16_t)*ptr++,5));
- dist+=MULT16_32_Q15(weight[j],MULT16_16(tmp,tmp));
+ dist=MAC16_32_Q15(dist,weight[j],MULT16_16(tmp,tmp));
}
if (dist<best_dist || i==0)
{
@@ -147,7 +145,6 @@
{
int i;
int id;
- /* FIXME: get rid of that static allocation */
spx_word16_t quant_weight[10];
for (i=0;i<order;i++)
<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