diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-07-26 17:04:54 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-07-26 17:04:54 +0000 |
commit | 2fa99a7ade8748fae314aeab2fea83e9bc88c36c (patch) | |
tree | 689c1cb15f7e7304b955e296748c800ce430542d /pjmedia/src/pjmedia-codec/speex/quant_lsp.c | |
parent | d80219f36636faa876c84b586e7b4b4815767be3 (diff) |
- Bring speex codec up to date with their SVN trunk
- Speex codec should work in FIXED_POINT mode when PJ_HAS_FLOATING_POINT is set to zero.
- ulaw2linear will return zero if zero is given (this would make the VAD works better, and it also fixed click noise when call is established/hangup).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@628 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src/pjmedia-codec/speex/quant_lsp.c')
-rw-r--r-- | pjmedia/src/pjmedia-codec/speex/quant_lsp.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/pjmedia/src/pjmedia-codec/speex/quant_lsp.c b/pjmedia/src/pjmedia-codec/speex/quant_lsp.c index 7bd0b91f..bfca5870 100644 --- a/pjmedia/src/pjmedia-codec/speex/quant_lsp.c +++ b/pjmedia/src/pjmedia-codec/speex/quant_lsp.c @@ -40,9 +40,12 @@ #define M_PI 3.14159265358979323846 #endif - #include "misc.h" +#ifdef BFIN_ASM +#include "quant_lsp_bfin.h" +#endif + #ifdef FIXED_POINT #define LSP_LINEAR(i) (SHL16(i+1,11)) @@ -90,12 +93,13 @@ static void compute_quant_weights(spx_lsp_t *qlsp, spx_word16_t *quant_weight, i } /* Note: x is modified*/ +#ifndef OVERRIDE_LSP_QUANT static int lsp_quant(spx_word16_t *x, const signed char *cdbk, int nbVec, int nbDim) { int i,j; spx_word32_t dist; spx_word16_t tmp; - spx_word32_t best_dist=0; + spx_word32_t best_dist=VERY_LARGE32; int best_id=0; const signed char *ptr=cdbk; for (i=0;i<nbVec;i++) @@ -105,8 +109,8 @@ static int lsp_quant(spx_word16_t *x, const signed char *cdbk, int nbVec, int nb { tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5)); dist=MAC16_16(dist,tmp,tmp); - } - if (dist<best_dist || i==0) + } + if (dist<best_dist) { best_dist=dist; best_id=i; @@ -118,14 +122,16 @@ static int lsp_quant(spx_word16_t *x, const signed char *cdbk, int nbVec, int nb return best_id; } +#endif /* Note: x is modified*/ +#ifndef OVERRIDE_LSP_WEIGHT_QUANT static int lsp_weight_quant(spx_word16_t *x, spx_word16_t *weight, const signed char *cdbk, int nbVec, int nbDim) { int i,j; spx_word32_t dist; spx_word16_t tmp; - spx_word32_t best_dist=0; + spx_word32_t best_dist=VERY_LARGE32; int best_id=0; const signed char *ptr=cdbk; for (i=0;i<nbVec;i++) @@ -136,7 +142,7 @@ static int lsp_weight_quant(spx_word16_t *x, spx_word16_t *weight, const signed tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5)); dist=MAC16_32_Q15(dist,weight[j],MULT16_16(tmp,tmp)); } - if (dist<best_dist || i==0) + if (dist<best_dist) { best_dist=dist; best_id=i; @@ -147,7 +153,7 @@ static int lsp_weight_quant(spx_word16_t *x, spx_word16_t *weight, const signed x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5)); return best_id; } - +#endif void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits) { |