[xiph-commits] r12147 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Sun Nov 26 02:50:16 PST 2006
Author: jm
Date: 2006-11-26 02:50:12 -0800 (Sun, 26 Nov 2006)
New Revision: 12147
Modified:
trunk/speex/libspeex/filters.c
trunk/speex/libspeex/fixed_debug.h
trunk/speex/libspeex/nb_celp.c
trunk/speex/libspeex/preprocess.c
Log:
More debug info and fixed two unlikely overflows on clipped input.
Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c 2006-11-26 10:02:33 UTC (rev 12146)
+++ trunk/speex/libspeex/filters.c 2006-11-26 10:50:12 UTC (rev 12147)
@@ -598,7 +598,7 @@
for (i=0;i<M-1;i++)
x[i]=mem[M-i-2];
for (i=0;i<N;i++)
- x[i+M-1]=SATURATE(PSHR16(xx[i],1),16383);
+ x[i+M-1]=SHR16(xx[i],1);
for (i=0,k=0;i<N;i+=2,k++)
{
y1[k]=0;
@@ -615,7 +615,7 @@
y2[k] = SHR32(y2[k],1);
}
for (i=0;i<M-1;i++)
- mem[i]=SATURATE(PSHR16(xx[N-i-1],1),16383);
+ mem[i]=SHR16(xx[N-i-1],1);
}
Modified: trunk/speex/libspeex/fixed_debug.h
===================================================================
--- trunk/speex/libspeex/fixed_debug.h 2006-11-26 10:02:33 UTC (rev 12146)
+++ trunk/speex/libspeex/fixed_debug.h 2006-11-26 10:50:12 UTC (rev 12147)
@@ -74,12 +74,13 @@
return res;
}
-static inline short EXTRACT16(int x)
+#define EXTRACT16(x) _EXTRACT16(x, __FILE__, __LINE__)
+static inline short _EXTRACT16(int x, char *file, int line)
{
int res;
if (!VERIFY_SHORT(x))
{
- fprintf (stderr, "EXTRACT16: input is not short: %d\n", x);
+ fprintf (stderr, "EXTRACT16: input is not short: %d in %s: line %d\n", x, file, line);
}
res = x;
spx_mips++;
@@ -99,16 +100,17 @@
return res;
}
-static inline short SHR16(int a, int shift)
+#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__)
+static inline short _SHR16(int a, int shift, char *file, int line)
{
int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
{
- fprintf (stderr, "SHR16: inputs are not short: %d %d\n", a, shift);
+ fprintf (stderr, "SHR16: inputs are not short: %d >> %d in %s: line %d\n", a, shift, file, line);
}
res = a>>shift;
if (!VERIFY_SHORT(res))
- fprintf (stderr, "SHR16: output is not short: %d\n", res);
+ fprintf (stderr, "SHR16: output is not short: %d in %s: line %d\n", res, file, line);
spx_mips++;
return res;
}
@@ -182,16 +184,18 @@
spx_mips++;
return res;
}
-static inline short SUB16(int a, int b)
+
+#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__)
+static inline short _SUB16(int a, int b, char *file, int line)
{
int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
{
- fprintf (stderr, "SUB16: inputs are not short: %d %d\n", a, b);
+ fprintf (stderr, "SUB16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
}
res = a-b;
if (!VERIFY_SHORT(res))
- fprintf (stderr, "SUB16: output is not short: %d\n", res);
+ fprintf (stderr, "SUB16: output is not short: %d in %s: line %d\n", res, file, line);
spx_mips++;
return res;
}
Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c 2006-11-26 10:02:33 UTC (rev 12146)
+++ trunk/speex/libspeex/nb_celp.c 2006-11-26 10:50:12 UTC (rev 12147)
@@ -910,7 +910,7 @@
/* FIXME: Make sure this is save from overflows (so far so good) */
for (i=0;i<st->subframeSize;i++)
- real_exc[i] = SUB16(real_exc[i], EXTRACT16(PSHR32(exc32[i],SIG_SHIFT-1)));
+ real_exc[i] = EXTRACT16(SUB32(EXTEND32(real_exc[i]), PSHR32(exc32[i],SIG_SHIFT-1)));
ener = SHL32(EXTEND32(compute_rms16(real_exc, st->subframeSize)),SIG_SHIFT);
Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c 2006-11-26 10:02:33 UTC (rev 12146)
+++ trunk/speex/libspeex/preprocess.c 2006-11-26 10:50:12 UTC (rev 12147)
@@ -570,7 +570,7 @@
st->loudness2 = (1-rate2)*st->loudness2 + rate2*pow(st->loudness, 1.0f/LOUDNESS_EXP);
}
- printf ("%f %f %f %f\n", Pframe, loudness, pow(st->loudness, 1.0f/LOUDNESS_EXP), st->loudness2);
+ /*printf ("%f %f %f %f\n", Pframe, loudness, pow(st->loudness, 1.0f/LOUDNESS_EXP), st->loudness2);*/
loudness = pow(st->loudness, 1.0f/LOUDNESS_EXP);
More information about the commits
mailing list