diff options
author | jm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2005-05-02 09:16:51 +0400 |
---|---|---|
committer | jm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2005-05-02 09:16:51 +0400 |
commit | 80b322205ca01973e16f8027a0e8348c4dd21144 (patch) | |
tree | 3a2b2d7d4fcfe987c9eefe4e01853b6bca1a316b | |
parent | 926a0ad0e91c789f482f1d880d4ac36da078d6ed (diff) |
fix (untested) for PLC slowdown due to denorm/underflowSpeex-1.0.5
git-svn-id: http://svn.xiph.org/branches/rel-1-0-branch/speex@9201 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r-- | libspeex/ltp.c | 3 | ||||
-rw-r--r-- | libspeex/misc.h | 2 | ||||
-rw-r--r-- | libspeex/nb_celp.c | 12 |
3 files changed, 9 insertions, 8 deletions
diff --git a/libspeex/ltp.c b/libspeex/ltp.c index 8daa82d..a07e7a1 100644 --- a/libspeex/ltp.c +++ b/libspeex/ltp.c @@ -31,6 +31,7 @@ */ #include <math.h> +#include "misc.h" #include "ltp.h" #include "stack_alloc.h" #include "filters.h" @@ -485,7 +486,7 @@ float last_pitch_gain) #endif } for (i=0;i<nsf;i++) - exc[i]=gain[0]*e[2][i]+gain[1]*e[1][i]+gain[2]*e[0][i]; + exc[i]=VERY_SMALL+gain[0]*e[2][i]+gain[1]*e[1][i]+gain[2]*e[0][i]; } } diff --git a/libspeex/misc.h b/libspeex/misc.h index ee8d6fb..1da72a9 100644 --- a/libspeex/misc.h +++ b/libspeex/misc.h @@ -49,7 +49,7 @@ #pragma warning(disable : 4305) #endif -#define VERY_SMALL 1e-30 +#define VERY_SMALL 1e-15 #ifndef RELEASE void print_vec(float *vec, int len, char *name); diff --git a/libspeex/nb_celp.c b/libspeex/nb_celp.c index cca941e..d194991 100644 --- a/libspeex/nb_celp.c +++ b/libspeex/nb_celp.c @@ -584,15 +584,15 @@ int nb_encode(void *state, float *in, SpeexBits *bits) /* Compute impulse response of A(z/g1) / ( A(z)*A(z/g2) )*/ for (i=0;i<st->subframeSize;i++) - exc[i]=0; + exc[i]=VERY_SMALL; exc[0]=1; syn_percep_zero(exc, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack); /* Reset excitation */ for (i=0;i<st->subframeSize;i++) - exc[i]=0; + exc[i]=VERY_SMALL; for (i=0;i<st->subframeSize;i++) - exc2[i]=0; + exc2[i]=VERY_SMALL; /* Compute zero response of A(z/g1) / ( A(z/g2) * A(z) ) */ for (i=0;i<st->lpcSize;i++) @@ -905,7 +905,7 @@ static void nb_decode_lost(DecState *st, float *out, char *stack) if (pitch_gain>.95) pitch_gain=.95; - pitch_gain *= fact; + pitch_gain = pitch_gain*fact + VERY_SMALL; /* Shift all buffers by one frame */ speex_move(st->inBuf, st->inBuf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(float)); @@ -968,13 +968,13 @@ static void nb_decode_lost(DecState *st, float *out, char *stack) /*rand();*/ #else /*exc[i]=pitch_gain*exc[i-st->last_pitch] + fact*st->innov[i+offset];*/ - exc[i]=pitch_gain*exc[i-st->last_pitch] + + exc[i]=pitch_gain*(exc[i-st->last_pitch]+VERY_SMALL) + fact*sqrt(1-pitch_gain)*speex_rand(innov_gain); #endif } } for (i=0;i<st->subframeSize;i++) - sp[i]=exc[i]; + sp[i]=exc[i]+VERY_SMALL; /* Signal synthesis */ if (st->lpc_enh_enabled) |