Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/speexdsp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libspeex/filters.c4
-rw-r--r--libspeex/fixed_debug.h20
-rw-r--r--libspeex/nb_celp.c2
-rw-r--r--libspeex/preprocess.c2
4 files changed, 16 insertions, 12 deletions
diff --git a/libspeex/filters.c b/libspeex/filters.c
index a05567b..4fd5180 100644
--- a/libspeex/filters.c
+++ b/libspeex/filters.c
@@ -598,7 +598,7 @@ void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_sig_t *y1, s
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 @@ void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_sig_t *y1, s
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);
}
diff --git a/libspeex/fixed_debug.h b/libspeex/fixed_debug.h
index 459fa89..bfe576b 100644
--- a/libspeex/fixed_debug.h
+++ b/libspeex/fixed_debug.h
@@ -74,12 +74,13 @@ static inline int NEG32(long long x)
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 @@ static inline int _EXTEND32(int x, char *file, int line)
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 @@ static inline short ADD16(int a, int b)
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;
}
diff --git a/libspeex/nb_celp.c b/libspeex/nb_celp.c
index 0702577..8c65add 100644
--- a/libspeex/nb_celp.c
+++ b/libspeex/nb_celp.c
@@ -910,7 +910,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
/* 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);
diff --git a/libspeex/preprocess.c b/libspeex/preprocess.c
index e531746..5731d1c 100644
--- a/libspeex/preprocess.c
+++ b/libspeex/preprocess.c
@@ -570,7 +570,7 @@ static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx
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);