diff options
author | jm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2006-11-19 05:33:03 +0300 |
---|---|---|
committer | jm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2006-11-19 05:33:03 +0300 |
commit | 95861b731098397088377a124da477b721d8875c (patch) | |
tree | 6e94e61576a0ac3db977933dae05ce2dde51b7e8 | |
parent | d4695483ae0908ac2dffb9e2de773b6416db37ea (diff) |
Fixed an overflow in the excitation decoding (again on heavily-clipped signal)
and made operators mode explicit.
git-svn-id: http://svn.xiph.org/trunk/speex@12131 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r-- | libspeex/filters.c | 16 | ||||
-rw-r--r-- | libspeex/nb_celp.c | 2 | ||||
-rw-r--r-- | libspeex/sb_celp.c | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/libspeex/filters.c b/libspeex/filters.c index de9db52..00d9bf0 100644 --- a/libspeex/filters.c +++ b/libspeex/filters.c @@ -650,19 +650,19 @@ void fir_mem_up(const spx_sig_t *x, const spx_word16_t *a, spx_sig_t *y, int N, a1 = a[j+1]; x1 = xx[N-2+j-i]; - y0 = ADD32(y0,SHR(MULT16_16(a0, x1),2)); - y1 = ADD32(y1,SHR(MULT16_16(a1, x1),2)); - y2 = ADD32(y2,SHR(MULT16_16(a0, x0),2)); - y3 = ADD32(y3,SHR(MULT16_16(a1, x0),2)); + y0 = ADD32(y0,SHR32(MULT16_16(a0, x1),2)); + y1 = ADD32(y1,SHR32(MULT16_16(a1, x1),2)); + y2 = ADD32(y2,SHR32(MULT16_16(a0, x0),2)); + y3 = ADD32(y3,SHR32(MULT16_16(a1, x0),2)); a0 = a[j+2]; a1 = a[j+3]; x0 = xx[N+j-i]; - y0 = ADD32(y0,SHR(MULT16_16(a0, x0),2)); - y1 = ADD32(y1,SHR(MULT16_16(a1, x0),2)); - y2 = ADD32(y2,SHR(MULT16_16(a0, x1),2)); - y3 = ADD32(y3,SHR(MULT16_16(a1, x1),2)); + y0 = ADD32(y0,SHR32(MULT16_16(a0, x0),2)); + y1 = ADD32(y1,SHR32(MULT16_16(a1, x0),2)); + y2 = ADD32(y2,SHR32(MULT16_16(a0, x1),2)); + y3 = ADD32(y3,SHR32(MULT16_16(a1, x1),2)); } y[i] = y0; y[i+1] = y1; diff --git a/libspeex/nb_celp.c b/libspeex/nb_celp.c index be56770..24b6866 100644 --- a/libspeex/nb_celp.c +++ b/libspeex/nb_celp.c @@ -1621,7 +1621,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) } } else { for (i=0;i<st->subframeSize;i++) - exc[i]=PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT); + exc[i]=EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767)); /*print_vec(exc, 40, "innov");*/ } if (innov_save) diff --git a/libspeex/sb_celp.c b/libspeex/sb_celp.c index 9284458..87d8148 100644 --- a/libspeex/sb_celp.c +++ b/libspeex/sb_celp.c @@ -210,7 +210,7 @@ static void mix_and_saturate(spx_word32_t *x0, spx_word32_t *x1, spx_word16_t *o { spx_word32_t tmp; #ifdef FIXED_POINT - tmp=PSHR(x0[i]-x1[i],SIG_SHIFT-1); + tmp=PSHR32(SUB32(x0[i],x1[i]),SIG_SHIFT-1); #else tmp=2*(x0[i]-x1[i]); #endif @@ -219,7 +219,7 @@ static void mix_and_saturate(spx_word32_t *x0, spx_word32_t *x1, spx_word16_t *o else if (tmp<-32767) out[i] = -32767; else - out[i] = tmp; + out[i] = EXTRACT16(tmp); } } |