[xiph-cvs] cvs commit: speex/libspeex ltp.c speex_stereo.h
Jean-Marc Valin
jm at xiph.org
Wed Jan 21 11:49:04 PST 2004
jm 04/01/21 14:49:02
Modified: libspeex Tag: rel-1-0-branch ltp.c speex_stereo.h
Log:
preventing a rare (potential) segfault caused by float precision
Revision Changes Path
No revision
<p>No revision
<p>1.74.2.2 +3 -0 speex/libspeex/ltp.c
Index: ltp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/ltp.c,v
retrieving revision 1.74.2.1
retrieving revision 1.74.2.2
diff -u -r1.74.2.1 -r1.74.2.2
--- ltp.c 6 May 2003 01:20:38 -0000 1.74.2.1
+++ ltp.c 21 Jan 2004 19:48:31 -0000 1.74.2.2
@@ -84,6 +84,7 @@
{
best_score[i]=-1;
gain[i]=0;
+ pitch[i]=start;
}
energy[0]=inner_prod(sw-start, sw-start, len);
e0=inner_prod(sw, sw, len);
@@ -91,6 +92,8 @@
{
/* Update energy for next pitch*/
energy[i-start+1] = energy[i-start] + sw[-i-1]*sw[-i-1] - sw[-i+len-1]*sw[-i+len-1];
+ if (energy[i-start+1] < 1)
+ energy[i-start+1]=1;
}
for (i=start;i<=end;i++)
{
<p><p>1.6.2.1 +9 -0 speex/libspeex/speex_stereo.h
Index: speex_stereo.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_stereo.h,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- speex_stereo.h 3 Mar 2003 06:52:41 -0000 1.6
+++ speex_stereo.h 21 Jan 2004 19:48:33 -0000 1.6.2.1
@@ -37,6 +37,10 @@
#include "speex_bits.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** State used for decoding (intensity) stereo information */
typedef struct SpeexStereoState {
float balance; /**< Left/right balance info */
@@ -59,4 +63,9 @@
/** Callback handler for intensity stereo info */
int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data);
+#ifdef __cplusplus
+}
+#endif
+
+
#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