[xiph-cvs] cvs commit: speex/libspeex filters.c sb_celp.c
Jean-Marc Valin
jm at xiph.org
Sat Nov 29 23:11:36 PST 2003
jm 03/11/30 02:11:36
Modified: libspeex filters.c sb_celp.c
Log:
fixed-point: Think I got rid of all overflows I could find
Revision Changes Path
1.67 +6 -6 speex/libspeex/filters.c
Index: filters.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- filters.c 30 Nov 2003 05:46:03 -0000 1.66
+++ filters.c 30 Nov 2003 07:11:36 -0000 1.67
@@ -365,22 +365,22 @@
for (i=0;i<M-1;i++)
x[i]=mem[M-i-2];
for (i=0;i<N;i++)
- x[i+M-1]=PSHR(xx[i],1);
+ x[i+M-1]=SATURATE(PSHR(xx[i],1),16383);
for (i=0,k=0;i<N;i+=2,k++)
{
y1[k]=0;
y2[k]=0;
for (j=0;j<M2;j++)
{
- y1[k]+=SHR(MULT16_16(a[j],(x[i+j]+x2[i-j])),1);
- y2[k]-=SHR(MULT16_16(a[j],(x[i+j]-x2[i-j])),1);
+ y1[k]+=SHR(MULT16_16(a[j],ADD16(x[i+j],x2[i-j])),1);
+ y2[k]-=SHR(MULT16_16(a[j],SUB16(x[i+j],x2[i-j])),1);
j++;
- y1[k]+=SHR(MULT16_16(a[j],(x[i+j]+x2[i-j])),1);
- y2[k]+=SHR(MULT16_16(a[j],(x[i+j]-x2[i-j])),1);
+ y1[k]+=SHR(MULT16_16(a[j],ADD16(x[i+j],x2[i-j])),1);
+ y2[k]+=SHR(MULT16_16(a[j],SUB16(x[i+j],x2[i-j])),1);
}
}
for (i=0;i<M-1;i++)
- mem[i]=PSHR(xx[N-i-1],1);
+ mem[i]=SATURATE(PSHR(xx[N-i-1],1),16383);
}
<p><p>1.160 +2 -2 speex/libspeex/sb_celp.c
Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- sb_celp.c 27 Nov 2003 08:42:07 -0000 1.159
+++ sb_celp.c 30 Nov 2003 07:11:36 -0000 1.160
@@ -307,12 +307,11 @@
for (i=0;i<st->frame_size;i++)
st->x0d[i] = SHL(low[i],SIG_SHIFT);
}
-
/* High-band buffering / sync with low band */
for (i=0;i<st->windowSize-st->frame_size;i++)
st->high[i] = st->high[st->frame_size+i];
for (i=0;i<st->frame_size;i++)
- st->high[st->windowSize-st->frame_size+i]=st->x1d[i];
+ st->high[st->windowSize-st->frame_size+i]=SATURATE(st->x1d[i],536854528);
speex_move(st->excBuf, st->excBuf+st->frame_size, (st->bufSize-st->frame_size)*sizeof(spx_sig_t));
@@ -343,6 +342,7 @@
}
st->autocorr[0] = (spx_word16_t)(st->autocorr[0]*st->lpc_floor); /* Noise floor in auto-correlation domain */
+
/* Lag windowing: equivalent to filtering in the power-spectrum domain */
for (i=0;i<st->lpcSize+1;i++)
st->autocorr[i] = MULT16_16_Q14(st->autocorr[i],st->lagWindow[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