diff options
Diffstat (limited to 'apps/codecs/libspeex')
-rw-r--r-- | apps/codecs/libspeex/_kiss_fft_guts.h | 42 | ||||
-rw-r--r-- | apps/codecs/libspeex/cb_search.c | 24 | ||||
-rw-r--r-- | apps/codecs/libspeex/kiss_fft.c | 6 | ||||
-rw-r--r-- | apps/codecs/libspeex/kiss_fft.h | 8 | ||||
-rw-r--r-- | apps/codecs/libspeex/lsp.c | 200 | ||||
-rw-r--r-- | apps/codecs/libspeex/lsp.h | 12 | ||||
-rw-r--r-- | apps/codecs/libspeex/ltp_bfin.h | 60 | ||||
-rw-r--r-- | apps/codecs/libspeex/nb_celp.c | 6 | ||||
-rw-r--r-- | apps/codecs/libspeex/oggframing.c | 62 | ||||
-rw-r--r-- | apps/codecs/libspeex/quant_lsp_bfin.h | 66 | ||||
-rw-r--r-- | apps/codecs/libspeex/sb_celp.c | 2 | ||||
-rw-r--r-- | apps/codecs/libspeex/smallft.c | 12 | ||||
-rw-r--r-- | apps/codecs/libspeex/speex/ogg.h | 14 | ||||
-rw-r--r-- | apps/codecs/libspeex/vorbis_psy.c | 16 |
14 files changed, 265 insertions, 265 deletions
diff --git a/apps/codecs/libspeex/_kiss_fft_guts.h b/apps/codecs/libspeex/_kiss_fft_guts.h index e9bb018c4b..12c055040f 100644 --- a/apps/codecs/libspeex/_kiss_fft_guts.h +++ b/apps/codecs/libspeex/_kiss_fft_guts.h | |||
@@ -60,8 +60,8 @@ struct kiss_fft_state{ | |||
60 | 60 | ||
61 | #if defined(CHECK_OVERFLOW) | 61 | #if defined(CHECK_OVERFLOW) |
62 | # define CHECK_OVERFLOW_OP(a,op,b) \ | 62 | # define CHECK_OVERFLOW_OP(a,op,b) \ |
63 | if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ | 63 | if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ |
64 | fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } | 64 | fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | 67 | ||
@@ -79,11 +79,11 @@ struct kiss_fft_state{ | |||
79 | (m).i = PSHR32( smul((a).r,(b).i) + smul((a).i,(b).r),17 ); }while(0) | 79 | (m).i = PSHR32( smul((a).r,(b).i) + smul((a).i,(b).r),17 ); }while(0) |
80 | 80 | ||
81 | # define DIVSCALAR(x,k) \ | 81 | # define DIVSCALAR(x,k) \ |
82 | (x) = sround( smul( x, SAMP_MAX/k ) ) | 82 | (x) = sround( smul( x, SAMP_MAX/k ) ) |
83 | 83 | ||
84 | # define C_FIXDIV(c,div) \ | 84 | # define C_FIXDIV(c,div) \ |
85 | do { DIVSCALAR( (c).r , div); \ | 85 | do { DIVSCALAR( (c).r , div); \ |
86 | DIVSCALAR( (c).i , div); }while (0) | 86 | DIVSCALAR( (c).i , div); }while (0) |
87 | 87 | ||
88 | # define C_MULBYSCALAR( c, s ) \ | 88 | # define C_MULBYSCALAR( c, s ) \ |
89 | do{ (c).r = sround( smul( (c).r , s ) ) ;\ | 89 | do{ (c).r = sround( smul( (c).r , s ) ) ;\ |
@@ -110,28 +110,28 @@ struct kiss_fft_state{ | |||
110 | 110 | ||
111 | #define C_ADD( res, a,b)\ | 111 | #define C_ADD( res, a,b)\ |
112 | do { \ | 112 | do { \ |
113 | CHECK_OVERFLOW_OP((a).r,+,(b).r)\ | 113 | CHECK_OVERFLOW_OP((a).r,+,(b).r)\ |
114 | CHECK_OVERFLOW_OP((a).i,+,(b).i)\ | 114 | CHECK_OVERFLOW_OP((a).i,+,(b).i)\ |
115 | (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ | 115 | (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ |
116 | }while(0) | 116 | }while(0) |
117 | #define C_SUB( res, a,b)\ | 117 | #define C_SUB( res, a,b)\ |
118 | do { \ | 118 | do { \ |
119 | CHECK_OVERFLOW_OP((a).r,-,(b).r)\ | 119 | CHECK_OVERFLOW_OP((a).r,-,(b).r)\ |
120 | CHECK_OVERFLOW_OP((a).i,-,(b).i)\ | 120 | CHECK_OVERFLOW_OP((a).i,-,(b).i)\ |
121 | (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ | 121 | (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ |
122 | }while(0) | 122 | }while(0) |
123 | #define C_ADDTO( res , a)\ | 123 | #define C_ADDTO( res , a)\ |
124 | do { \ | 124 | do { \ |
125 | CHECK_OVERFLOW_OP((res).r,+,(a).r)\ | 125 | CHECK_OVERFLOW_OP((res).r,+,(a).r)\ |
126 | CHECK_OVERFLOW_OP((res).i,+,(a).i)\ | 126 | CHECK_OVERFLOW_OP((res).i,+,(a).i)\ |
127 | (res).r += (a).r; (res).i += (a).i;\ | 127 | (res).r += (a).r; (res).i += (a).i;\ |
128 | }while(0) | 128 | }while(0) |
129 | 129 | ||
130 | #define C_SUBFROM( res , a)\ | 130 | #define C_SUBFROM( res , a)\ |
131 | do {\ | 131 | do {\ |
132 | CHECK_OVERFLOW_OP((res).r,-,(a).r)\ | 132 | CHECK_OVERFLOW_OP((res).r,-,(a).r)\ |
133 | CHECK_OVERFLOW_OP((res).i,-,(a).i)\ | 133 | CHECK_OVERFLOW_OP((res).i,-,(a).i)\ |
134 | (res).r -= (a).r; (res).i -= (a).i; \ | 134 | (res).r -= (a).r; (res).i -= (a).i; \ |
135 | }while(0) | 135 | }while(0) |
136 | 136 | ||
137 | 137 | ||
@@ -150,10 +150,10 @@ struct kiss_fft_state{ | |||
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | #define kf_cexp(x,phase) \ | 152 | #define kf_cexp(x,phase) \ |
153 | do{ \ | 153 | do{ \ |
154 | (x)->r = KISS_FFT_COS(phase);\ | 154 | (x)->r = KISS_FFT_COS(phase);\ |
155 | (x)->i = KISS_FFT_SIN(phase);\ | 155 | (x)->i = KISS_FFT_SIN(phase);\ |
156 | }while(0) | 156 | }while(0) |
157 | #define kf_cexp2(x,phase) \ | 157 | #define kf_cexp2(x,phase) \ |
158 | do{ \ | 158 | do{ \ |
159 | (x)->r = spx_cos_norm((phase));\ | 159 | (x)->r = spx_cos_norm((phase));\ |
diff --git a/apps/codecs/libspeex/cb_search.c b/apps/codecs/libspeex/cb_search.c index 8a190e535d..f9ff0a6784 100644 --- a/apps/codecs/libspeex/cb_search.c +++ b/apps/codecs/libspeex/cb_search.c | |||
@@ -99,10 +99,10 @@ static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t * | |||
99 | 99 | ||
100 | 100 | ||
101 | static void split_cb_search_shape_sign_N1( | 101 | static void split_cb_search_shape_sign_N1( |
102 | spx_word16_t target[], /* target vector */ | 102 | spx_word16_t target[], /* target vector */ |
103 | spx_coef_t ak[], /* LPCs for this subframe */ | 103 | spx_coef_t ak[], /* LPCs for this subframe */ |
104 | spx_coef_t awk1[], /* Weighted LPCs for this subframe */ | 104 | spx_coef_t awk1[], /* Weighted LPCs for this subframe */ |
105 | spx_coef_t awk2[], /* Weighted LPCs for this subframe */ | 105 | spx_coef_t awk2[], /* Weighted LPCs for this subframe */ |
106 | const void *par, /* Codebook/search parameters*/ | 106 | const void *par, /* Codebook/search parameters*/ |
107 | int p, /* number of LPC coeffs */ | 107 | int p, /* number of LPC coeffs */ |
108 | int nsf, /* number of samples in subframe */ | 108 | int nsf, /* number of samples in subframe */ |
@@ -241,10 +241,10 @@ int update_target | |||
241 | 241 | ||
242 | 242 | ||
243 | void split_cb_search_shape_sign( | 243 | void split_cb_search_shape_sign( |
244 | spx_word16_t target[], /* target vector */ | 244 | spx_word16_t target[], /* target vector */ |
245 | spx_coef_t ak[], /* LPCs for this subframe */ | 245 | spx_coef_t ak[], /* LPCs for this subframe */ |
246 | spx_coef_t awk1[], /* Weighted LPCs for this subframe */ | 246 | spx_coef_t awk1[], /* Weighted LPCs for this subframe */ |
247 | spx_coef_t awk2[], /* Weighted LPCs for this subframe */ | 247 | spx_coef_t awk2[], /* Weighted LPCs for this subframe */ |
248 | const void *par, /* Codebook/search parameters*/ | 248 | const void *par, /* Codebook/search parameters*/ |
249 | int p, /* number of LPC coeffs */ | 249 | int p, /* number of LPC coeffs */ |
250 | int nsf, /* number of samples in subframe */ | 250 | int nsf, /* number of samples in subframe */ |
@@ -576,10 +576,10 @@ spx_int32_t *seed | |||
576 | 576 | ||
577 | #ifndef SPEEX_DISABLE_ENCODER | 577 | #ifndef SPEEX_DISABLE_ENCODER |
578 | void noise_codebook_quant( | 578 | void noise_codebook_quant( |
579 | spx_word16_t target[], /* target vector */ | 579 | spx_word16_t target[], /* target vector */ |
580 | spx_coef_t ak[], /* LPCs for this subframe */ | 580 | spx_coef_t ak[], /* LPCs for this subframe */ |
581 | spx_coef_t awk1[], /* Weighted LPCs for this subframe */ | 581 | spx_coef_t awk1[], /* Weighted LPCs for this subframe */ |
582 | spx_coef_t awk2[], /* Weighted LPCs for this subframe */ | 582 | spx_coef_t awk2[], /* Weighted LPCs for this subframe */ |
583 | const void *par, /* Codebook/search parameters*/ | 583 | const void *par, /* Codebook/search parameters*/ |
584 | int p, /* number of LPC coeffs */ | 584 | int p, /* number of LPC coeffs */ |
585 | int nsf, /* number of samples in subframe */ | 585 | int nsf, /* number of samples in subframe */ |
diff --git a/apps/codecs/libspeex/kiss_fft.c b/apps/codecs/libspeex/kiss_fft.c index bff826d754..5b699a362f 100644 --- a/apps/codecs/libspeex/kiss_fft.c +++ b/apps/codecs/libspeex/kiss_fft.c | |||
@@ -184,7 +184,7 @@ static void kf_bfly3( | |||
184 | do{ | 184 | do{ |
185 | if (!st->inverse) { | 185 | if (!st->inverse) { |
186 | C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); | 186 | C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); |
187 | } | 187 | } |
188 | 188 | ||
189 | C_MUL(scratch[1],Fout[m] , *tw1); | 189 | C_MUL(scratch[1],Fout[m] , *tw1); |
190 | C_MUL(scratch[2],Fout[m2] , *tw2); | 190 | C_MUL(scratch[2],Fout[m2] , *tw2); |
@@ -237,7 +237,7 @@ static void kf_bfly5( | |||
237 | for ( u=0; u<m; ++u ) { | 237 | for ( u=0; u<m; ++u ) { |
238 | if (!st->inverse) { | 238 | if (!st->inverse) { |
239 | C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); | 239 | C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); |
240 | } | 240 | } |
241 | scratch[0] = *Fout0; | 241 | scratch[0] = *Fout0; |
242 | 242 | ||
243 | C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); | 243 | C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); |
@@ -299,7 +299,7 @@ static void kf_bfly_generic( | |||
299 | scratchbuf[q1] = Fout[ k ]; | 299 | scratchbuf[q1] = Fout[ k ]; |
300 | if (!st->inverse) { | 300 | if (!st->inverse) { |
301 | C_FIXDIV(scratchbuf[q1],p); | 301 | C_FIXDIV(scratchbuf[q1],p); |
302 | } | 302 | } |
303 | k += m; | 303 | k += m; |
304 | } | 304 | } |
305 | 305 | ||
diff --git a/apps/codecs/libspeex/kiss_fft.h b/apps/codecs/libspeex/kiss_fft.h index fa3f2c6042..43319b1ba8 100644 --- a/apps/codecs/libspeex/kiss_fft.h +++ b/apps/codecs/libspeex/kiss_fft.h | |||
@@ -26,13 +26,13 @@ extern "C" { | |||
26 | # include <xmmintrin.h> | 26 | # include <xmmintrin.h> |
27 | # define kiss_fft_scalar __m128 | 27 | # define kiss_fft_scalar __m128 |
28 | #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes) | 28 | #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes) |
29 | #else | 29 | #else |
30 | #define KISS_FFT_MALLOC speex_alloc | 30 | #define KISS_FFT_MALLOC speex_alloc |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | 33 | ||
34 | #ifdef FIXED_POINT | 34 | #ifdef FIXED_POINT |
35 | #include "arch.h" | 35 | #include "arch.h" |
36 | # define kiss_fft_scalar spx_int16_t | 36 | # define kiss_fft_scalar spx_int16_t |
37 | #else | 37 | #else |
38 | # ifndef kiss_fft_scalar | 38 | # ifndef kiss_fft_scalar |
@@ -99,7 +99,7 @@ void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout | |||
99 | your compiler output to call this before you exit. | 99 | your compiler output to call this before you exit. |
100 | */ | 100 | */ |
101 | void kiss_fft_cleanup(void); | 101 | void kiss_fft_cleanup(void); |
102 | 102 | ||
103 | 103 | ||
104 | #ifdef __cplusplus | 104 | #ifdef __cplusplus |
105 | } | 105 | } |
diff --git a/apps/codecs/libspeex/lsp.c b/apps/codecs/libspeex/lsp.c index edf480e8bc..8408d782aa 100644 --- a/apps/codecs/libspeex/lsp.c +++ b/apps/codecs/libspeex/lsp.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /*---------------------------------------------------------------------------*\ | 1 | /*---------------------------------------------------------------------------*\ |
2 | Original copyright | 2 | Original copyright |
3 | FILE........: lsp.c | 3 | FILE........: lsp.c |
4 | AUTHOR......: David Rowe | 4 | AUTHOR......: David Rowe |
5 | DATE CREATED: 24/2/93 | 5 | DATE CREATED: 24/2/93 |
6 | 6 | ||
7 | Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point, | 7 | Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point, |
8 | optimizations, additional functions, ...) | 8 | optimizations, additional functions, ...) |
@@ -219,31 +219,31 @@ static float cheb_poly_eva(spx_word32_t *coef, spx_word16_t x, int m, char *stac | |||
219 | 219 | ||
220 | 220 | ||
221 | int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t delta, char *stack) | 221 | int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t delta, char *stack) |
222 | /* float *a lpc coefficients */ | 222 | /* float *a lpc coefficients */ |
223 | /* int lpcrdr order of LPC coefficients (10) */ | 223 | /* int lpcrdr order of LPC coefficients (10) */ |
224 | /* float *freq LSP frequencies in the x domain */ | 224 | /* float *freq LSP frequencies in the x domain */ |
225 | /* int nb number of sub-intervals (4) */ | 225 | /* int nb number of sub-intervals (4) */ |
226 | /* float delta grid spacing interval (0.02) */ | 226 | /* float delta grid spacing interval (0.02) */ |
227 | 227 | ||
228 | 228 | ||
229 | { | 229 | { |
230 | spx_word16_t temp_xr,xl,xr,xm=0; | 230 | spx_word16_t temp_xr,xl,xr,xm=0; |
231 | spx_word32_t psuml,psumr,psumm,temp_psumr/*,temp_qsumr*/; | 231 | spx_word32_t psuml,psumr,psumm,temp_psumr/*,temp_qsumr*/; |
232 | int i,j,m,flag,k; | 232 | int i,j,m,flag,k; |
233 | VARDECL(spx_word32_t *Q); /* ptrs for memory allocation */ | 233 | VARDECL(spx_word32_t *Q); /* ptrs for memory allocation */ |
234 | VARDECL(spx_word32_t *P); | 234 | VARDECL(spx_word32_t *P); |
235 | VARDECL(spx_word16_t *Q16); /* ptrs for memory allocation */ | 235 | VARDECL(spx_word16_t *Q16); /* ptrs for memory allocation */ |
236 | VARDECL(spx_word16_t *P16); | 236 | VARDECL(spx_word16_t *P16); |
237 | spx_word32_t *px; /* ptrs of respective P'(z) & Q'(z) */ | 237 | spx_word32_t *px; /* ptrs of respective P'(z) & Q'(z) */ |
238 | spx_word32_t *qx; | 238 | spx_word32_t *qx; |
239 | spx_word32_t *p; | 239 | spx_word32_t *p; |
240 | spx_word32_t *q; | 240 | spx_word32_t *q; |
241 | spx_word16_t *pt; /* ptr used for cheb_poly_eval() | 241 | spx_word16_t *pt; /* ptr used for cheb_poly_eval() |
242 | whether P' or Q' */ | 242 | whether P' or Q' */ |
243 | int roots=0; /* DR 8/2/94: number of roots found */ | 243 | int roots=0; /* DR 8/2/94: number of roots found */ |
244 | flag = 1; /* program is searching for a root when, | 244 | flag = 1; /* program is searching for a root when, |
245 | 1 else has found one */ | 245 | 1 else has found one */ |
246 | m = lpcrdr/2; /* order of P'(z) & Q'(z) polynomials */ | 246 | m = lpcrdr/2; /* order of P'(z) & Q'(z) polynomials */ |
247 | 247 | ||
248 | /* Allocate memory space for polynomials */ | 248 | /* Allocate memory space for polynomials */ |
249 | ALLOC(Q, (m+1), spx_word32_t); | 249 | ALLOC(Q, (m+1), spx_word32_t); |
@@ -252,7 +252,7 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del | |||
252 | /* determine P'(z)'s and Q'(z)'s coefficients where | 252 | /* determine P'(z)'s and Q'(z)'s coefficients where |
253 | P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ | 253 | P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ |
254 | 254 | ||
255 | px = P; /* initialise ptrs */ | 255 | px = P; /* initialise ptrs */ |
256 | qx = Q; | 256 | qx = Q; |
257 | p = px; | 257 | p = px; |
258 | q = qx; | 258 | q = qx; |
@@ -297,7 +297,7 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del | |||
297 | } | 297 | } |
298 | #endif | 298 | #endif |
299 | 299 | ||
300 | px = P; /* re-initialise ptrs */ | 300 | px = P; /* re-initialise ptrs */ |
301 | qx = Q; | 301 | qx = Q; |
302 | 302 | ||
303 | /* now that we have computed P and Q convert to 16 bits to | 303 | /* now that we have computed P and Q convert to 16 bits to |
@@ -313,20 +313,20 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del | |||
313 | } | 313 | } |
314 | 314 | ||
315 | /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z). | 315 | /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z). |
316 | Keep alternating between the two polynomials as each zero is found */ | 316 | Keep alternating between the two polynomials as each zero is found */ |
317 | 317 | ||
318 | xr = 0; /* initialise xr to zero */ | 318 | xr = 0; /* initialise xr to zero */ |
319 | xl = FREQ_SCALE; /* start at point xl = 1 */ | 319 | xl = FREQ_SCALE; /* start at point xl = 1 */ |
320 | 320 | ||
321 | for(j=0;j<lpcrdr;j++){ | 321 | for(j=0;j<lpcrdr;j++){ |
322 | if(j&1) /* determines whether P' or Q' is eval. */ | 322 | if(j&1) /* determines whether P' or Q' is eval. */ |
323 | pt = Q16; | 323 | pt = Q16; |
324 | else | 324 | else |
325 | pt = P16; | 325 | pt = P16; |
326 | 326 | ||
327 | psuml = cheb_poly_eva(pt,xl,m,stack); /* evals poly. at xl */ | 327 | psuml = cheb_poly_eva(pt,xl,m,stack); /* evals poly. at xl */ |
328 | flag = 1; | 328 | flag = 1; |
329 | while(flag && (xr >= -FREQ_SCALE)){ | 329 | while(flag && (xr >= -FREQ_SCALE)){ |
330 | spx_word16_t dd; | 330 | spx_word16_t dd; |
331 | /* Modified by JMV to provide smaller steps around x=+-1 */ | 331 | /* Modified by JMV to provide smaller steps around x=+-1 */ |
332 | #ifdef FIXED_POINT | 332 | #ifdef FIXED_POINT |
@@ -338,10 +338,10 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del | |||
338 | if (fabs(psuml)<.2) | 338 | if (fabs(psuml)<.2) |
339 | dd *= .5; | 339 | dd *= .5; |
340 | #endif | 340 | #endif |
341 | xr = SUB16(xl, dd); /* interval spacing */ | 341 | xr = SUB16(xl, dd); /* interval spacing */ |
342 | psumr = cheb_poly_eva(pt,xr,m,stack);/* poly(xl-delta_x) */ | 342 | psumr = cheb_poly_eva(pt,xr,m,stack);/* poly(xl-delta_x) */ |
343 | temp_psumr = psumr; | 343 | temp_psumr = psumr; |
344 | temp_xr = xr; | 344 | temp_xr = xr; |
345 | 345 | ||
346 | /* if no sign change increment xr and re-evaluate poly(xr). Repeat til | 346 | /* if no sign change increment xr and re-evaluate poly(xr). Repeat til |
347 | sign change. | 347 | sign change. |
@@ -350,41 +350,41 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del | |||
350 | interval the zero lies in. | 350 | interval the zero lies in. |
351 | If there is no sign change between poly(xm) and poly(xl) set interval | 351 | If there is no sign change between poly(xm) and poly(xl) set interval |
352 | between xm and xr else set interval between xl and xr and repeat till | 352 | between xm and xr else set interval between xl and xr and repeat till |
353 | root is located within the specified limits */ | 353 | root is located within the specified limits */ |
354 | 354 | ||
355 | if(SIGN_CHANGE(psumr,psuml)) | 355 | if(SIGN_CHANGE(psumr,psuml)) |
356 | { | 356 | { |
357 | roots++; | 357 | roots++; |
358 | 358 | ||
359 | psumm=psuml; | 359 | psumm=psuml; |
360 | for(k=0;k<=nb;k++){ | 360 | for(k=0;k<=nb;k++){ |
361 | #ifdef FIXED_POINT | 361 | #ifdef FIXED_POINT |
362 | xm = ADD16(PSHR16(xl,1),PSHR16(xr,1)); /* bisect the interval */ | 362 | xm = ADD16(PSHR16(xl,1),PSHR16(xr,1)); /* bisect the interval */ |
363 | #else | 363 | #else |
364 | xm = .5*(xl+xr); /* bisect the interval */ | 364 | xm = .5*(xl+xr); /* bisect the interval */ |
365 | #endif | 365 | #endif |
366 | psumm=cheb_poly_eva(pt,xm,m,stack); | 366 | psumm=cheb_poly_eva(pt,xm,m,stack); |
367 | /*if(psumm*psuml>0.)*/ | 367 | /*if(psumm*psuml>0.)*/ |
368 | if(!SIGN_CHANGE(psumm,psuml)) | 368 | if(!SIGN_CHANGE(psumm,psuml)) |
369 | { | 369 | { |
370 | psuml=psumm; | 370 | psuml=psumm; |
371 | xl=xm; | 371 | xl=xm; |
372 | } else { | 372 | } else { |
373 | psumr=psumm; | 373 | psumr=psumm; |
374 | xr=xm; | 374 | xr=xm; |
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | /* once zero is found, reset initial interval to xr */ | 378 | /* once zero is found, reset initial interval to xr */ |
379 | freq[j] = X2ANGLE(xm); | 379 | freq[j] = X2ANGLE(xm); |
380 | xl = xm; | 380 | xl = xm; |
381 | flag = 0; /* reset flag for next search */ | 381 | flag = 0; /* reset flag for next search */ |
382 | } | 382 | } |
383 | else{ | 383 | else{ |
384 | psuml=temp_psumr; | 384 | psuml=temp_psumr; |
385 | xl=temp_xr; | 385 | xl=temp_xr; |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
389 | return(roots); | 389 | return(roots); |
390 | } | 390 | } |
@@ -393,10 +393,10 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del | |||
393 | 393 | ||
394 | /*---------------------------------------------------------------------------*\ | 394 | /*---------------------------------------------------------------------------*\ |
395 | 395 | ||
396 | FUNCTION....: lsp_to_lpc() | 396 | FUNCTION....: lsp_to_lpc() |
397 | 397 | ||
398 | AUTHOR......: David Rowe | 398 | AUTHOR......: David Rowe |
399 | DATE CREATED: 24/2/93 | 399 | DATE CREATED: 24/2/93 |
400 | 400 | ||
401 | Converts LSP coefficients to LPC coefficients. | 401 | Converts LSP coefficients to LPC coefficients. |
402 | 402 | ||
@@ -405,9 +405,9 @@ int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t del | |||
405 | #ifdef FIXED_POINT | 405 | #ifdef FIXED_POINT |
406 | 406 | ||
407 | void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) | 407 | void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) |
408 | /* float *freq array of LSP frequencies in the x domain */ | 408 | /* float *freq array of LSP frequencies in the x domain */ |
409 | /* float *ak array of LPC coefficients */ | 409 | /* float *ak array of LPC coefficients */ |
410 | /* int lpcrdr order of LPC coefficients */ | 410 | /* int lpcrdr order of LPC coefficients */ |
411 | { | 411 | { |
412 | (void)stack; | 412 | (void)stack; |
413 | int i,j; | 413 | int i,j; |
@@ -488,10 +488,10 @@ void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) | |||
488 | for(i=1;i<m;i++) { | 488 | for(i=1;i<m;i++) { |
489 | 489 | ||
490 | for(j=1;j<2*(i+1)-1;j++) { | 490 | for(j=1;j<2*(i+1)-1;j++) { |
491 | mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]); | 491 | mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]); |
492 | xp[i+1][j+2] = ADD32(SUB32(xp[i][j+2], mult), xp[i][j]); | 492 | xp[i+1][j+2] = ADD32(SUB32(xp[i][j+2], mult), xp[i][j]); |
493 | mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]); | 493 | mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]); |
494 | xq[i+1][j+2] = ADD32(SUB32(xq[i][j+2], mult), xq[i][j]); | 494 | xq[i+1][j+2] = ADD32(SUB32(xq[i][j+2], mult), xq[i][j]); |
495 | } | 495 | } |
496 | 496 | ||
497 | /* for last col xp[i][j+2] = xq[i][j+2] = 0 */ | 497 | /* for last col xp[i][j+2] = xq[i][j+2] = 0 */ |
@@ -525,9 +525,9 @@ void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) | |||
525 | #else | 525 | #else |
526 | 526 | ||
527 | void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) | 527 | void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) |
528 | /* float *freq array of LSP frequencies in the x domain */ | 528 | /* float *freq array of LSP frequencies in the x domain */ |
529 | /* float *ak array of LPC coefficients */ | 529 | /* float *ak array of LPC coefficients */ |
530 | /* int lpcrdr order of LPC coefficients */ | 530 | /* int lpcrdr order of LPC coefficients */ |
531 | 531 | ||
532 | 532 | ||
533 | { | 533 | { |
@@ -543,8 +543,8 @@ void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) | |||
543 | 543 | ||
544 | /* initialise contents of array */ | 544 | /* initialise contents of array */ |
545 | 545 | ||
546 | for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */ | 546 | for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */ |
547 | *pw++ = 0.0; | 547 | *pw++ = 0.0; |
548 | } | 548 | } |
549 | 549 | ||
550 | /* Set pointers up */ | 550 | /* Set pointers up */ |
@@ -563,29 +563,29 @@ void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) | |||
563 | 563 | ||
564 | for(j=0;j<=lpcrdr;j++){ | 564 | for(j=0;j<=lpcrdr;j++){ |
565 | int i2=0; | 565 | int i2=0; |
566 | for(i=0;i<m;i++,i2+=2){ | 566 | for(i=0;i<m;i++,i2+=2){ |
567 | n1 = pw+(i*4); | 567 | n1 = pw+(i*4); |
568 | n2 = n1 + 1; | 568 | n2 = n1 + 1; |
569 | n3 = n2 + 1; | 569 | n3 = n2 + 1; |
570 | n4 = n3 + 1; | 570 | n4 = n3 + 1; |
571 | xout1 = xin1 - 2.f*x_freq[i2] * *n1 + *n2; | 571 | xout1 = xin1 - 2.f*x_freq[i2] * *n1 + *n2; |
572 | xout2 = xin2 - 2.f*x_freq[i2+1] * *n3 + *n4; | 572 | xout2 = xin2 - 2.f*x_freq[i2+1] * *n3 + *n4; |
573 | *n2 = *n1; | 573 | *n2 = *n1; |
574 | *n4 = *n3; | 574 | *n4 = *n3; |
575 | *n1 = xin1; | 575 | *n1 = xin1; |
576 | *n3 = xin2; | 576 | *n3 = xin2; |
577 | xin1 = xout1; | 577 | xin1 = xout1; |
578 | xin2 = xout2; | 578 | xin2 = xout2; |
579 | } | 579 | } |
580 | xout1 = xin1 + *(n4+1); | 580 | xout1 = xin1 + *(n4+1); |
581 | xout2 = xin2 - *(n4+2); | 581 | xout2 = xin2 - *(n4+2); |
582 | if (j>0) | 582 | if (j>0) |
583 | ak[j-1] = (xout1 + xout2)*0.5f; | 583 | ak[j-1] = (xout1 + xout2)*0.5f; |
584 | *(n4+1) = xin1; | 584 | *(n4+1) = xin1; |
585 | *(n4+2) = xin2; | 585 | *(n4+2) = xin2; |
586 | 586 | ||
587 | xin1 = 0.0; | 587 | xin1 = 0.0; |
588 | xin2 = 0.0; | 588 | xin2 = 0.0; |
589 | } | 589 | } |
590 | 590 | ||
591 | } | 591 | } |
diff --git a/apps/codecs/libspeex/lsp.h b/apps/codecs/libspeex/lsp.h index 648652fb9e..2841e4b747 100644 --- a/apps/codecs/libspeex/lsp.h +++ b/apps/codecs/libspeex/lsp.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /*---------------------------------------------------------------------------*\ | 1 | /*---------------------------------------------------------------------------*\ |
2 | Original Copyright | 2 | Original Copyright |
3 | FILE........: AK2LSPD.H | 3 | FILE........: AK2LSPD.H |
4 | TYPE........: Turbo C header file | 4 | TYPE........: Turbo C header file |
5 | COMPANY.....: Voicetronix | 5 | COMPANY.....: Voicetronix |
6 | AUTHOR......: James Whitehall | 6 | AUTHOR......: James Whitehall |
7 | DATE CREATED: 21/11/95 | 7 | DATE CREATED: 21/11/95 |
8 | 8 | ||
9 | Modified by Jean-Marc Valin | 9 | Modified by Jean-Marc Valin |
10 | 10 | ||
@@ -61,4 +61,4 @@ void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin); | |||
61 | 61 | ||
62 | void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes); | 62 | void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes); |
63 | 63 | ||
64 | #endif /* __AK2LSPD__ */ | 64 | #endif /* __AK2LSPD__ */ |
diff --git a/apps/codecs/libspeex/ltp_bfin.h b/apps/codecs/libspeex/ltp_bfin.h index b530f85986..8d7225b017 100644 --- a/apps/codecs/libspeex/ltp_bfin.h +++ b/apps/codecs/libspeex/ltp_bfin.h | |||
@@ -220,7 +220,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p | |||
220 | normalize16(energy, ener16, 180, end-start+1); | 220 | normalize16(energy, ener16, 180, end-start+1); |
221 | 221 | ||
222 | if (N == 1) { | 222 | if (N == 1) { |
223 | /* optimised asm to handle N==1 case */ | 223 | /* optimised asm to handle N==1 case */ |
224 | __asm__ __volatile__ | 224 | __asm__ __volatile__ |
225 | ( | 225 | ( |
226 | " I0 = %1;\n\t" /* I0: corr16[] */ | 226 | " I0 = %1;\n\t" /* I0: corr16[] */ |
@@ -253,35 +253,35 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p | |||
253 | 253 | ||
254 | } | 254 | } |
255 | else { | 255 | else { |
256 | for (i=start;i<=end;i++) | 256 | for (i=start;i<=end;i++) |
257 | { | 257 | { |
258 | spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]); | 258 | spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]); |
259 | /* Instead of dividing the tmp by the energy, we multiply on the other side */ | 259 | /* Instead of dividing the tmp by the energy, we multiply on the other side */ |
260 | if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start]))) | 260 | if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start]))) |
261 | { | 261 | { |
262 | /* We can safely put it last and then check */ | 262 | /* We can safely put it last and then check */ |
263 | best_score[N-1]=tmp; | 263 | best_score[N-1]=tmp; |
264 | best_ener[N-1]=ener16[i-start]+1; | 264 | best_ener[N-1]=ener16[i-start]+1; |
265 | pitch[N-1]=i; | 265 | pitch[N-1]=i; |
266 | /* Check if it comes in front of others */ | 266 | /* Check if it comes in front of others */ |
267 | for (j=0;j<N-1;j++) | 267 | for (j=0;j<N-1;j++) |
268 | { | 268 | { |
269 | if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start]))) | 269 | if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start]))) |
270 | { | 270 | { |
271 | for (k=N-1;k>j;k--) | 271 | for (k=N-1;k>j;k--) |
272 | { | 272 | { |
273 | best_score[k]=best_score[k-1]; | 273 | best_score[k]=best_score[k-1]; |
274 | best_ener[k]=best_ener[k-1]; | 274 | best_ener[k]=best_ener[k-1]; |
275 | pitch[k]=pitch[k-1]; | 275 | pitch[k]=pitch[k-1]; |
276 | } | 276 | } |
277 | best_score[j]=tmp; | 277 | best_score[j]=tmp; |
278 | best_ener[j]=ener16[i-start]+1; | 278 | best_ener[j]=ener16[i-start]+1; |
279 | pitch[j]=i; | 279 | pitch[j]=i; |
280 | break; | 280 | break; |
281 | } | 281 | } |
282 | } | 282 | } |
283 | } | 283 | } |
284 | } | 284 | } |
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c index 31eaa06b6b..90a5d1e991 100644 --- a/apps/codecs/libspeex/nb_celp.c +++ b/apps/codecs/libspeex/nb_celp.c | |||
@@ -1019,7 +1019,7 @@ void nb_decoder_destroy(void *state) | |||
1019 | */ | 1019 | */ |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | #define median3(a, b, c) ((a) < (b) ? ((b) < (c) ? (b) : ((a) < (c) ? (c) : (a))) : ((c) < (b) ? (b) : ((c) < (a) ? (c) : (a)))) | 1022 | #define median3(a, b, c) ((a) < (b) ? ((b) < (c) ? (b) : ((a) < (c) ? (c) : (a))) : ((c) < (b) ? (b) : ((c) < (a) ? (c) : (a)))) |
1023 | 1023 | ||
1024 | #ifdef FIXED_POINT | 1024 | #ifdef FIXED_POINT |
1025 | const spx_word16_t attenuation[10] = {32767, 31483, 27923, 22861, 17278, 12055, 7764, 4616, 2533, 1283}; | 1025 | const spx_word16_t attenuation[10] = {32767, 31483, 27923, 22861, 17278, 12055, 7764, 4616, 2533, 1283}; |
@@ -1353,10 +1353,10 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) | |||
1353 | */ | 1353 | */ |
1354 | pit_min = ol_pitch-margin+1; | 1354 | pit_min = ol_pitch-margin+1; |
1355 | if (pit_min < st->min_pitch) | 1355 | if (pit_min < st->min_pitch) |
1356 | pit_min = st->min_pitch; | 1356 | pit_min = st->min_pitch; |
1357 | pit_max = ol_pitch+margin; | 1357 | pit_max = ol_pitch+margin; |
1358 | if (pit_max > st->max_pitch) | 1358 | if (pit_max > st->max_pitch) |
1359 | pit_max = st->max_pitch; | 1359 | pit_max = st->max_pitch; |
1360 | } else { | 1360 | } else { |
1361 | pit_min = pit_max = ol_pitch; | 1361 | pit_min = pit_max = ol_pitch; |
1362 | } | 1362 | } |
diff --git a/apps/codecs/libspeex/oggframing.c b/apps/codecs/libspeex/oggframing.c index 6a0ee21412..42d29502a8 100644 --- a/apps/codecs/libspeex/oggframing.c +++ b/apps/codecs/libspeex/oggframing.c | |||
@@ -58,16 +58,16 @@ spx_ogg_int64_t spx_ogg_page_granulepos(spx_ogg_page *og){ | |||
58 | 58 | ||
59 | int spx_ogg_page_serialno(spx_ogg_page *og){ | 59 | int spx_ogg_page_serialno(spx_ogg_page *og){ |
60 | return(og->header[14] | | 60 | return(og->header[14] | |
61 | (og->header[15]<<8) | | 61 | (og->header[15]<<8) | |
62 | (og->header[16]<<16) | | 62 | (og->header[16]<<16) | |
63 | (og->header[17]<<24)); | 63 | (og->header[17]<<24)); |
64 | } | 64 | } |
65 | 65 | ||
66 | long spx_ogg_page_pageno(spx_ogg_page *og){ | 66 | long spx_ogg_page_pageno(spx_ogg_page *og){ |
67 | return(og->header[18] | | 67 | return(og->header[18] | |
68 | (og->header[19]<<8) | | 68 | (og->header[19]<<8) | |
69 | (og->header[20]<<16) | | 69 | (og->header[20]<<16) | |
70 | (og->header[21]<<24)); | 70 | (og->header[21]<<24)); |
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
@@ -109,9 +109,9 @@ static spx_ogg_uint32_t _spx_ogg_crc_entry(unsigned long index){ | |||
109 | for (i=0; i<8; i++) | 109 | for (i=0; i<8; i++) |
110 | if (r & 0x80000000UL) | 110 | if (r & 0x80000000UL) |
111 | r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator | 111 | r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator |
112 | polynomial, although we use an | 112 | polynomial, although we use an |
113 | unreflected alg and an init/final | 113 | unreflected alg and an init/final |
114 | of 0, not 0xffffffff */ | 114 | of 0, not 0xffffffff */ |
115 | else | 115 | else |
116 | r<<=1; | 116 | r<<=1; |
117 | return (r & 0xffffffffUL); | 117 | return (r & 0xffffffffUL); |
@@ -280,7 +280,7 @@ int spx_ogg_stream_packetin(spx_ogg_stream_state *os,spx_ogg_packet *op){ | |||
280 | os->body_fill-=os->body_returned; | 280 | os->body_fill-=os->body_returned; |
281 | if(os->body_fill) | 281 | if(os->body_fill) |
282 | memmove(os->body_data,os->body_data+os->body_returned, | 282 | memmove(os->body_data,os->body_data+os->body_returned, |
283 | os->body_fill); | 283 | os->body_fill); |
284 | os->body_returned=0; | 284 | os->body_returned=0; |
285 | } | 285 | } |
286 | 286 | ||
@@ -350,8 +350,8 @@ int spx_ogg_stream_flush(spx_ogg_stream_state *os,spx_ogg_page *og){ | |||
350 | granule_pos=0; | 350 | granule_pos=0; |
351 | for(vals=0;vals<maxvals;vals++){ | 351 | for(vals=0;vals<maxvals;vals++){ |
352 | if((os->lacing_vals[vals]&0x0ff)<255){ | 352 | if((os->lacing_vals[vals]&0x0ff)<255){ |
353 | vals++; | 353 | vals++; |
354 | break; | 354 | break; |
355 | } | 355 | } |
356 | } | 356 | } |
357 | }else{ | 357 | }else{ |
@@ -396,10 +396,10 @@ int spx_ogg_stream_flush(spx_ogg_stream_state *os,spx_ogg_page *og){ | |||
396 | /* 32 bits of page counter (we have both counter and page header | 396 | /* 32 bits of page counter (we have both counter and page header |
397 | because this val can roll over) */ | 397 | because this val can roll over) */ |
398 | if(os->pageno==-1)os->pageno=0; /* because someone called | 398 | if(os->pageno==-1)os->pageno=0; /* because someone called |
399 | stream_reset; this would be a | 399 | stream_reset; this would be a |
400 | strange thing to do in an | 400 | strange thing to do in an |
401 | encode stream, but it has | 401 | encode stream, but it has |
402 | plausible uses */ | 402 | plausible uses */ |
403 | { | 403 | { |
404 | long pageno=os->pageno++; | 404 | long pageno=os->pageno++; |
405 | for(i=18;i<22;i++){ | 405 | for(i=18;i<22;i++){ |
@@ -595,7 +595,7 @@ long spx_ogg_sync_pageseek(spx_ogg_sync_state *oy,spx_ogg_page *og){ | |||
595 | /* Compare */ | 595 | /* Compare */ |
596 | if(memcmp(chksum,page+22,4)){ | 596 | if(memcmp(chksum,page+22,4)){ |
597 | /* D'oh. Mismatch! Corrupt page (or miscapture and not a page | 597 | /* D'oh. Mismatch! Corrupt page (or miscapture and not a page |
598 | at all) */ | 598 | at all) */ |
599 | /* replace the computed checksum with the one actually read in */ | 599 | /* replace the computed checksum with the one actually read in */ |
600 | memcpy(page+22,chksum,4); | 600 | memcpy(page+22,chksum,4); |
601 | 601 | ||
@@ -703,17 +703,17 @@ int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og){ | |||
703 | if(br){ | 703 | if(br){ |
704 | os->body_fill-=br; | 704 | os->body_fill-=br; |
705 | if(os->body_fill) | 705 | if(os->body_fill) |
706 | memmove(os->body_data,os->body_data+br,os->body_fill); | 706 | memmove(os->body_data,os->body_data+br,os->body_fill); |
707 | os->body_returned=0; | 707 | os->body_returned=0; |
708 | } | 708 | } |
709 | 709 | ||
710 | if(lr){ | 710 | if(lr){ |
711 | /* segment table */ | 711 | /* segment table */ |
712 | if(os->lacing_fill-lr){ | 712 | if(os->lacing_fill-lr){ |
713 | memmove(os->lacing_vals,os->lacing_vals+lr, | 713 | memmove(os->lacing_vals,os->lacing_vals+lr, |
714 | (os->lacing_fill-lr)*sizeof(*os->lacing_vals)); | 714 | (os->lacing_fill-lr)*sizeof(*os->lacing_vals)); |
715 | memmove(os->granule_vals,os->granule_vals+lr, | 715 | memmove(os->granule_vals,os->granule_vals+lr, |
716 | (os->lacing_fill-lr)*sizeof(*os->granule_vals)); | 716 | (os->lacing_fill-lr)*sizeof(*os->granule_vals)); |
717 | } | 717 | } |
718 | os->lacing_fill-=lr; | 718 | os->lacing_fill-=lr; |
719 | os->lacing_packet-=lr; | 719 | os->lacing_packet-=lr; |
@@ -750,13 +750,13 @@ int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og){ | |||
750 | os->lacing_vals[os->lacing_fill-1]==0x400){ | 750 | os->lacing_vals[os->lacing_fill-1]==0x400){ |
751 | bos=0; | 751 | bos=0; |
752 | for(;segptr<segments;segptr++){ | 752 | for(;segptr<segments;segptr++){ |
753 | int val=header[27+segptr]; | 753 | int val=header[27+segptr]; |
754 | body+=val; | 754 | body+=val; |
755 | bodysize-=val; | 755 | bodysize-=val; |
756 | if(val<255){ | 756 | if(val<255){ |
757 | segptr++; | 757 | segptr++; |
758 | break; | 758 | break; |
759 | } | 759 | } |
760 | } | 760 | } |
761 | } | 761 | } |
762 | } | 762 | } |
@@ -775,8 +775,8 @@ int spx_ogg_stream_pagein(spx_ogg_stream_state *os, spx_ogg_page *og){ | |||
775 | os->granule_vals[os->lacing_fill]=-1; | 775 | os->granule_vals[os->lacing_fill]=-1; |
776 | 776 | ||
777 | if(bos){ | 777 | if(bos){ |
778 | os->lacing_vals[os->lacing_fill]|=0x100; | 778 | os->lacing_vals[os->lacing_fill]|=0x100; |
779 | bos=0; | 779 | bos=0; |
780 | } | 780 | } |
781 | 781 | ||
782 | if(val<255)saved=os->lacing_fill; | 782 | if(val<255)saved=os->lacing_fill; |
diff --git a/apps/codecs/libspeex/quant_lsp_bfin.h b/apps/codecs/libspeex/quant_lsp_bfin.h index c884078e6b..917047bb56 100644 --- a/apps/codecs/libspeex/quant_lsp_bfin.h +++ b/apps/codecs/libspeex/quant_lsp_bfin.h | |||
@@ -55,9 +55,9 @@ static int lsp_quant( | |||
55 | 55 | ||
56 | __asm__ __volatile__ | 56 | __asm__ __volatile__ |
57 | ( | 57 | ( |
58 | " %0 = 1 (X);\n\t" /* %0: best_dist */ | 58 | " %0 = 1 (X);\n\t" /* %0: best_dist */ |
59 | " %0 <<= 30;\n\t" | 59 | " %0 <<= 30;\n\t" |
60 | " %1 = 0 (X);\n\t" /* %1: best_i */ | 60 | " %1 = 0 (X);\n\t" /* %1: best_i */ |
61 | " P2 = %3\n\t" /* P2: ptr to cdbk */ | 61 | " P2 = %3\n\t" /* P2: ptr to cdbk */ |
62 | " R5 = 0;\n\t" /* R5: best cb entry */ | 62 | " R5 = 0;\n\t" /* R5: best cb entry */ |
63 | 63 | ||
@@ -68,18 +68,18 @@ static int lsp_quant( | |||
68 | " B0 = %2;\n\t" | 68 | " B0 = %2;\n\t" |
69 | 69 | ||
70 | " R2.L = W [I0++];\n\t" | 70 | " R2.L = W [I0++];\n\t" |
71 | " LSETUP (lq1, lq2) LC0 = %4;\n\t" | 71 | " LSETUP (lq1, lq2) LC0 = %4;\n\t" |
72 | "lq1: R3 = 0;\n\t" /* R3: dist */ | 72 | "lq1: R3 = 0;\n\t" /* R3: dist */ |
73 | " LSETUP (lq3, lq4) LC1 = %5;\n\t" | 73 | " LSETUP (lq3, lq4) LC1 = %5;\n\t" |
74 | "lq3: R1 = B [P2++] (X);\n\t" | 74 | "lq3: R1 = B [P2++] (X);\n\t" |
75 | " R1 <<= 5;\n\t" | 75 | " R1 <<= 5;\n\t" |
76 | " R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t" | 76 | " R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t" |
77 | " R0 = R0.L*R0.L;\n\t" | 77 | " R0 = R0.L*R0.L;\n\t" |
78 | "lq4: R3 = R3 + R0;\n\t" | 78 | "lq4: R3 = R3 + R0;\n\t" |
79 | 79 | ||
80 | " cc =R3<%0;\n\t" | 80 | " cc =R3<%0;\n\t" |
81 | " if cc %0=R3;\n\t" | 81 | " if cc %0=R3;\n\t" |
82 | " if cc %1=R5;\n\t" | 82 | " if cc %1=R5;\n\t" |
83 | "lq2: R5 += 1;\n\t" | 83 | "lq2: R5 += 1;\n\t" |
84 | " L0 = 0;\n\t" | 84 | " L0 = 0;\n\t" |
85 | : "=&d" (best_dist), "=&d" (best_id) | 85 | : "=&d" (best_dist), "=&d" (best_id) |
@@ -117,9 +117,9 @@ static int lsp_weight_quant( | |||
117 | 117 | ||
118 | __asm__ __volatile__ | 118 | __asm__ __volatile__ |
119 | ( | 119 | ( |
120 | " %0 = 1 (X);\n\t" /* %0: best_dist */ | 120 | " %0 = 1 (X);\n\t" /* %0: best_dist */ |
121 | " %0 <<= 30;\n\t" | 121 | " %0 <<= 30;\n\t" |
122 | " %1 = 0 (X);\n\t" /* %1: best_i */ | 122 | " %1 = 0 (X);\n\t" /* %1: best_i */ |
123 | " P2 = %4\n\t" /* P2: ptr to cdbk */ | 123 | " P2 = %4\n\t" /* P2: ptr to cdbk */ |
124 | " R5 = 0;\n\t" /* R5: best cb entry */ | 124 | " R5 = 0;\n\t" /* R5: best cb entry */ |
125 | 125 | ||
@@ -128,26 +128,26 @@ static int lsp_weight_quant( | |||
128 | " L0 = R0;\n\t" | 128 | " L0 = R0;\n\t" |
129 | " L1 = R0;\n\t" | 129 | " L1 = R0;\n\t" |
130 | " I0 = %2;\n\t" /* %2: &x[0] */ | 130 | " I0 = %2;\n\t" /* %2: &x[0] */ |
131 | " I1 = %3;\n\t" /* %3: &weight[0] */ | 131 | " I1 = %3;\n\t" /* %3: &weight[0] */ |
132 | " B0 = %2;\n\t" | 132 | " B0 = %2;\n\t" |
133 | " B1 = %3;\n\t" | 133 | " B1 = %3;\n\t" |
134 | 134 | ||
135 | " LSETUP (lwq1, lwq2) LC0 = %5;\n\t" | 135 | " LSETUP (lwq1, lwq2) LC0 = %5;\n\t" |
136 | "lwq1: R3 = 0 (X);\n\t" /* R3: dist */ | 136 | "lwq1: R3 = 0 (X);\n\t" /* R3: dist */ |
137 | " LSETUP (lwq3, lwq4) LC1 = %6;\n\t" | 137 | " LSETUP (lwq3, lwq4) LC1 = %6;\n\t" |
138 | "lwq3: R0.L = W [I0++] || R2.L = W [I1++];\n\t" | 138 | "lwq3: R0.L = W [I0++] || R2.L = W [I1++];\n\t" |
139 | " R1 = B [P2++] (X);\n\t" | 139 | " R1 = B [P2++] (X);\n\t" |
140 | " R1 <<= 5;\n\t" | 140 | " R1 <<= 5;\n\t" |
141 | " R0.L = R0.L - R1.L;\n\t" | 141 | " R0.L = R0.L - R1.L;\n\t" |
142 | " R0 = R0.L*R0.L;\n\t" | 142 | " R0 = R0.L*R0.L;\n\t" |
143 | " A1 = R2.L*R0.L (M,IS);\n\t" | 143 | " A1 = R2.L*R0.L (M,IS);\n\t" |
144 | " A1 = A1 >>> 16;\n\t" | 144 | " A1 = A1 >>> 16;\n\t" |
145 | " R1 = (A1 += R2.L*R0.H) (IS);\n\t" | 145 | " R1 = (A1 += R2.L*R0.H) (IS);\n\t" |
146 | "lwq4: R3 = R3 + R1;\n\t" | 146 | "lwq4: R3 = R3 + R1;\n\t" |
147 | 147 | ||
148 | " cc =R3<%0;\n\t" | 148 | " cc =R3<%0;\n\t" |
149 | " if cc %0=R3;\n\t" | 149 | " if cc %0=R3;\n\t" |
150 | " if cc %1=R5;\n\t" | 150 | " if cc %1=R5;\n\t" |
151 | "lwq2: R5 += 1;\n\t" | 151 | "lwq2: R5 += 1;\n\t" |
152 | " L0 = 0;\n\t" | 152 | " L0 = 0;\n\t" |
153 | " L1 = 0;\n\t" | 153 | " L1 = 0;\n\t" |
diff --git a/apps/codecs/libspeex/sb_celp.c b/apps/codecs/libspeex/sb_celp.c index 51f255661f..b28744812f 100644 --- a/apps/codecs/libspeex/sb_celp.c +++ b/apps/codecs/libspeex/sb_celp.c | |||
@@ -459,7 +459,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits) | |||
459 | spx_int32_t modeid; | 459 | spx_int32_t modeid; |
460 | modeid = mode->nb_modes-1; | 460 | modeid = mode->nb_modes-1; |
461 | st->relative_quality+=1.0*(ratio+2); | 461 | st->relative_quality+=1.0*(ratio+2); |
462 | if (st->relative_quality<-1) | 462 | if (st->relative_quality<-1) |
463 | st->relative_quality=-1; | 463 | st->relative_quality=-1; |
464 | while (modeid) | 464 | while (modeid) |
465 | { | 465 | { |
diff --git a/apps/codecs/libspeex/smallft.c b/apps/codecs/libspeex/smallft.c index 6ff46a8445..6e3a927b5f 100644 --- a/apps/codecs/libspeex/smallft.c +++ b/apps/codecs/libspeex/smallft.c | |||
@@ -96,10 +96,10 @@ static void drfti1(int n, float *wa, int *ifac){ | |||
96 | argld=(float)ld*argh; | 96 | argld=(float)ld*argh; |
97 | fi=0.f; | 97 | fi=0.f; |
98 | for (ii=2;ii<ido;ii+=2){ | 98 | for (ii=2;ii<ido;ii+=2){ |
99 | fi+=1.f; | 99 | fi+=1.f; |
100 | arg=fi*argld; | 100 | arg=fi*argld; |
101 | wa[i++]=cos(arg); | 101 | wa[i++]=cos(arg); |
102 | wa[i++]=sin(arg); | 102 | wa[i++]=sin(arg); |
103 | } | 103 | } |
104 | is+=ido; | 104 | is+=ido; |
105 | } | 105 | } |
@@ -169,7 +169,7 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){ | |||
169 | } | 169 | } |
170 | 170 | ||
171 | static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1, | 171 | static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1, |
172 | float *wa2,float *wa3){ | 172 | float *wa2,float *wa3){ |
173 | static float hsqt2 = .70710678118654752f; | 173 | static float hsqt2 = .70710678118654752f; |
174 | int i,k,t0,t1,t2,t3,t4,t5,t6; | 174 | int i,k,t0,t1,t2,t3,t4,t5,t6; |
175 | float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; | 175 | float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; |
@@ -749,7 +749,7 @@ static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1, | |||
749 | } | 749 | } |
750 | 750 | ||
751 | static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1, | 751 | static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1, |
752 | float *wa2,float *wa3){ | 752 | float *wa2,float *wa3){ |
753 | static float sqrt2=1.414213562373095f; | 753 | static float sqrt2=1.414213562373095f; |
754 | int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8; | 754 | int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8; |
755 | float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; | 755 | float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; |
diff --git a/apps/codecs/libspeex/speex/ogg.h b/apps/codecs/libspeex/speex/ogg.h index d42851f10c..8898b99582 100644 --- a/apps/codecs/libspeex/speex/ogg.h +++ b/apps/codecs/libspeex/speex/ogg.h | |||
@@ -66,8 +66,8 @@ typedef struct { | |||
66 | 66 | ||
67 | int *lacing_vals; /* The values that will go to the segment table */ | 67 | int *lacing_vals; /* The values that will go to the segment table */ |
68 | spx_ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact | 68 | spx_ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact |
69 | this way, but it is simple coupled to the | 69 | this way, but it is simple coupled to the |
70 | lacing fifo */ | 70 | lacing fifo */ |
71 | long lacing_storage; | 71 | long lacing_storage; |
72 | long lacing_fill; | 72 | long lacing_fill; |
73 | long lacing_packet; | 73 | long lacing_packet; |
@@ -103,10 +103,10 @@ typedef struct { | |||
103 | spx_ogg_int64_t granulepos; | 103 | spx_ogg_int64_t granulepos; |
104 | 104 | ||
105 | spx_ogg_int64_t packetno; /* sequence number for decode; the framing | 105 | spx_ogg_int64_t packetno; /* sequence number for decode; the framing |
106 | knows where there's a hole in the data, | 106 | knows where there's a hole in the data, |
107 | but we need coupling so that the codec | 107 | but we need coupling so that the codec |
108 | (which is in a seperate abstraction | 108 | (which is in a seperate abstraction |
109 | layer) also knows about the gap */ | 109 | layer) also knows about the gap */ |
110 | } spx_ogg_packet; | 110 | } spx_ogg_packet; |
111 | 111 | ||
112 | typedef struct { | 112 | typedef struct { |
@@ -169,7 +169,7 @@ extern int spx_ogg_stream_flush(spx_ogg_stream_state *os, spx_ogg_page *og) | |||
169 | extern int spx_ogg_sync_init(spx_ogg_sync_state *oy); | 169 | extern int spx_ogg_sync_init(spx_ogg_sync_state *oy); |
170 | extern int spx_ogg_sync_clear(spx_ogg_sync_state *oy); | 170 | extern int spx_ogg_sync_clear(spx_ogg_sync_state *oy); |
171 | extern int spx_ogg_sync_reset(spx_ogg_sync_state *oy); | 171 | extern int spx_ogg_sync_reset(spx_ogg_sync_state *oy); |
172 | extern int spx_ogg_sync_destroy(spx_ogg_sync_state *oy); | 172 | extern int spx_ogg_sync_destroy(spx_ogg_sync_state *oy); |
173 | 173 | ||
174 | extern void spx_ogg_alloc_buffer(spx_ogg_sync_state *oy, long size); | 174 | extern void spx_ogg_alloc_buffer(spx_ogg_sync_state *oy, long size); |
175 | extern char *spx_ogg_sync_buffer(spx_ogg_sync_state *oy, long size); | 175 | extern char *spx_ogg_sync_buffer(spx_ogg_sync_state *oy, long size); |
diff --git a/apps/codecs/libspeex/vorbis_psy.c b/apps/codecs/libspeex/vorbis_psy.c index 91cf49c69c..2032bf63e2 100644 --- a/apps/codecs/libspeex/vorbis_psy.c +++ b/apps/codecs/libspeex/vorbis_psy.c | |||
@@ -90,9 +90,9 @@ static void _analysis_output(char *base,int i,float *v,int n,int bark,int dB){ | |||
90 | if(dB){ | 90 | if(dB){ |
91 | float val; | 91 | float val; |
92 | if(v[j]==0.) | 92 | if(v[j]==0.) |
93 | val=-140.; | 93 | val=-140.; |
94 | else | 94 | else |
95 | val=todB(v[j]); | 95 | val=todB(v[j]); |
96 | fprintf(of,"%f\n",val); | 96 | fprintf(of,"%f\n",val); |
97 | }else{ | 97 | }else{ |
98 | fprintf(of,"%f\n",v[j]); | 98 | fprintf(of,"%f\n",v[j]); |
@@ -254,19 +254,19 @@ static void bark_noise_hybridmp(int n,const long *b, | |||
254 | } | 254 | } |
255 | 255 | ||
256 | static void _vp_noisemask(VorbisPsy *p, | 256 | static void _vp_noisemask(VorbisPsy *p, |
257 | float *logfreq, | 257 | float *logfreq, |
258 | float *logmask){ | 258 | float *logmask){ |
259 | 259 | ||
260 | int i,n=p->n/2; | 260 | int i,n=p->n/2; |
261 | float *work=alloca(n*sizeof(*work)); | 261 | float *work=alloca(n*sizeof(*work)); |
262 | 262 | ||
263 | bark_noise_hybridmp(n,p->bark,logfreq,logmask, | 263 | bark_noise_hybridmp(n,p->bark,logfreq,logmask, |
264 | 140.,-1); | 264 | 140.,-1); |
265 | 265 | ||
266 | for(i=0;i<n;i++)work[i]=logfreq[i]-logmask[i]; | 266 | for(i=0;i<n;i++)work[i]=logfreq[i]-logmask[i]; |
267 | 267 | ||
268 | bark_noise_hybridmp(n,p->bark,work,logmask,0., | 268 | bark_noise_hybridmp(n,p->bark,work,logmask,0., |
269 | p->vi->noisewindowfixed); | 269 | p->vi->noisewindowfixed); |
270 | 270 | ||
271 | for(i=0;i<n;i++)work[i]=logfreq[i]-work[i]; | 271 | for(i=0;i<n;i++)work[i]=logfreq[i]-work[i]; |
272 | 272 | ||
@@ -319,10 +319,10 @@ VorbisPsy *vorbis_psy_init(int rate, int n) | |||
319 | float bark=toBARK(rate/(2*n)*i); | 319 | float bark=toBARK(rate/(2*n)*i); |
320 | 320 | ||
321 | for(;lo+p->vi->noisewindowlomin<i && | 321 | for(;lo+p->vi->noisewindowlomin<i && |
322 | toBARK(rate/(2*n)*lo)<(bark-p->vi->noisewindowlo);lo++); | 322 | toBARK(rate/(2*n)*lo)<(bark-p->vi->noisewindowlo);lo++); |
323 | 323 | ||
324 | for(;hi<=n && (hi<i+p->vi->noisewindowhimin || | 324 | for(;hi<=n && (hi<i+p->vi->noisewindowhimin || |
325 | toBARK(rate/(2*n)*hi)<(bark+p->vi->noisewindowhi));hi++); | 325 | toBARK(rate/(2*n)*hi)<(bark+p->vi->noisewindowhi));hi++); |
326 | 326 | ||
327 | p->bark[i]=((lo-1)<<16)+(hi-1); | 327 | p->bark[i]=((lo-1)<<16)+(hi-1); |
328 | 328 | ||