summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libspeex/Makefile2
-rw-r--r--apps/codecs/libspeex/SOURCES3
-rw-r--r--apps/codecs/libspeex/cb_search.c4
-rw-r--r--apps/codecs/libspeex/filters.c6
-rw-r--r--apps/codecs/libspeex/ltp.c4
-rw-r--r--apps/codecs/libspeex/modes.c147
-rw-r--r--apps/codecs/libspeex/modes_wb.c74
-rw-r--r--apps/codecs/libspeex/nb_celp.c23
-rw-r--r--apps/codecs/libspeex/quant_lsp.c8
-rw-r--r--apps/codecs/libspeex/sb_celp.c21
-rw-r--r--apps/codecs/libspeex/speex_header.c2
-rw-r--r--apps/codecs/libspeex/stereo.c2
12 files changed, 253 insertions, 43 deletions
diff --git a/apps/codecs/libspeex/Makefile b/apps/codecs/libspeex/Makefile
index 651d589e65..7c73f02d67 100644
--- a/apps/codecs/libspeex/Makefile
+++ b/apps/codecs/libspeex/Makefile
@@ -14,7 +14,7 @@ ifdef APPEXTRA
14 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) 14 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
15endif 15endif
16 16
17SPEEXOPTS = -DHAVE_CONFIG_H 17SPEEXOPTS = -DHAVE_CONFIG_H -DSPEEX_DISABLE_ENCODER
18 18
19# We're faster on ARM-targets with -O1 instead of -O2 19# We're faster on ARM-targets with -O1 instead of -O2
20ifeq ($(CPU),arm) 20ifeq ($(CPU),arm)
diff --git a/apps/codecs/libspeex/SOURCES b/apps/codecs/libspeex/SOURCES
index e1f038160b..89e3f1db03 100644
--- a/apps/codecs/libspeex/SOURCES
+++ b/apps/codecs/libspeex/SOURCES
@@ -28,9 +28,6 @@ speex.c
28speex_callbacks.c 28speex_callbacks.c
29speex_header.c 29speex_header.c
30stereo.c 30stereo.c
31vbr.c
32vq.c
33window.c
34#ifdef CPU_COLDFIRE 31#ifdef CPU_COLDFIRE
35filters_cf.S 32filters_cf.S
36ltp_cf.S 33ltp_cf.S
diff --git a/apps/codecs/libspeex/cb_search.c b/apps/codecs/libspeex/cb_search.c
index f7ecca4a62..8afb8ab5f3 100644
--- a/apps/codecs/libspeex/cb_search.c
+++ b/apps/codecs/libspeex/cb_search.c
@@ -49,6 +49,7 @@
49#include "cb_search_bfin.h" 49#include "cb_search_bfin.h"
50#endif 50#endif
51 51
52#ifndef SPEEX_DISABLE_ENCODER
52#ifndef OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK 53#ifndef OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
53static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack) 54static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
54{ 55{
@@ -511,6 +512,7 @@ int update_target
511 target[j]=SUB16(target[j],PSHR16(r2[j],2)); 512 target[j]=SUB16(target[j],PSHR16(r2[j],2));
512 } 513 }
513} 514}
515#endif
514 516
515 517
516void split_cb_shape_sign_unquant( 518void split_cb_shape_sign_unquant(
@@ -571,6 +573,7 @@ spx_int32_t *seed
571 } 573 }
572} 574}
573 575
576#ifndef SPEEX_DISABLE_ENCODER
574void noise_codebook_quant( 577void noise_codebook_quant(
575spx_word16_t target[], /* target vector */ 578spx_word16_t target[], /* target vector */
576spx_coef_t ak[], /* LPCs for this subframe */ 579spx_coef_t ak[], /* LPCs for this subframe */
@@ -597,6 +600,7 @@ int update_target
597 for (i=0;i<nsf;i++) 600 for (i=0;i<nsf;i++)
598 target[i]=0; 601 target[i]=0;
599} 602}
603#endif
600 604
601 605
602void noise_codebook_unquant( 606void noise_codebook_unquant(
diff --git a/apps/codecs/libspeex/filters.c b/apps/codecs/libspeex/filters.c
index 36b110af30..9c144ebffa 100644
--- a/apps/codecs/libspeex/filters.c
+++ b/apps/codecs/libspeex/filters.c
@@ -124,6 +124,7 @@ void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len)
124 } 124 }
125} 125}
126 126
127#ifndef SPEEX_DISABLE_ENCODER
127void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len) 128void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len)
128{ 129{
129 int i; 130 int i;
@@ -156,6 +157,7 @@ void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int
156 } 157 }
157 } 158 }
158} 159}
160#endif
159 161
160#else 162#else
161 163
@@ -320,6 +322,7 @@ spx_word16_t compute_rms16(const spx_word16_t *x, int len)
320 322
321 323
322 324
325#ifndef SPEEX_DISABLE_ENCODER
323#ifndef OVERRIDE_FILTER_MEM16 326#ifndef OVERRIDE_FILTER_MEM16
324void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) 327void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
325{ 328{
@@ -339,6 +342,7 @@ void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t
339 } 342 }
340} 343}
341#endif 344#endif
345#endif
342 346
343#ifndef OVERRIDE_IIR_MEM16 347#ifndef OVERRIDE_IIR_MEM16
344void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) 348void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
@@ -360,6 +364,7 @@ void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, in
360} 364}
361#endif 365#endif
362 366
367#ifndef SPEEX_DISABLE_ENCODER
363#ifndef OVERRIDE_FIR_MEM16 368#ifndef OVERRIDE_FIR_MEM16
364void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) 369void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
365{ 370{
@@ -477,6 +482,7 @@ void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *y1
477 y2[k] = EXTRACT16(SATURATE(PSHR32(y2k,15),32767)); 482 y2[k] = EXTRACT16(SATURATE(PSHR32(y2k,15),32767));
478 } 483 }
479} 484}
485#endif
480 486
481#ifndef OVERRIDE_QMF_SYNTH 487#ifndef OVERRIDE_QMF_SYNTH
482/* Re-synthesised a signal from the QMF low-band and high-band signals */ 488/* Re-synthesised a signal from the QMF low-band and high-band signals */
diff --git a/apps/codecs/libspeex/ltp.c b/apps/codecs/libspeex/ltp.c
index 6af02e2582..720baaad02 100644
--- a/apps/codecs/libspeex/ltp.c
+++ b/apps/codecs/libspeex/ltp.c
@@ -75,6 +75,7 @@ spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
75} 75}
76#endif 76#endif
77 77
78#ifndef SPEEX_DISABLE_ENCODER
78#ifndef OVERRIDE_PITCH_XCORR 79#ifndef OVERRIDE_PITCH_XCORR
79#if 0 /* HINT: Enable this for machines with enough registers (i.e. not x86) */ 80#if 0 /* HINT: Enable this for machines with enough registers (i.e. not x86) */
80void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack) 81void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
@@ -659,6 +660,7 @@ spx_word32_t *cumul_gain
659#endif 660#endif
660 return pitch; 661 return pitch;
661} 662}
663#endif
662 664
663void pitch_unquant_3tap( 665void pitch_unquant_3tap(
664spx_word16_t exc[], /* Input excitation */ 666spx_word16_t exc[], /* Input excitation */
@@ -760,6 +762,7 @@ int cdbk_offset
760} 762}
761 763
762 764
765#ifndef SPEEX_DISABLE_ENCODER
763/** Forced pitch delay and gain */ 766/** Forced pitch delay and gain */
764int forced_pitch_quant( 767int forced_pitch_quant(
765spx_word16_t target[], /* Target vector */ 768spx_word16_t target[], /* Target vector */
@@ -809,6 +812,7 @@ spx_word32_t *cumul_gain
809 target[i]=EXTRACT16(SATURATE(SUB32(EXTEND32(target[i]),EXTEND32(res[i])),32700)); 812 target[i]=EXTRACT16(SATURATE(SUB32(EXTEND32(target[i]),EXTEND32(res[i])),32700));
810 return start; 813 return start;
811} 814}
815#endif
812 816
813/** Unquantize forced pitch delay and gain */ 817/** Unquantize forced pitch delay and gain */
814void forced_pitch_unquant( 818void forced_pitch_unquant(
diff --git a/apps/codecs/libspeex/modes.c b/apps/codecs/libspeex/modes.c
index 7906ab5faa..0478f978d1 100644
--- a/apps/codecs/libspeex/modes.c
+++ b/apps/codecs/libspeex/modes.c
@@ -153,6 +153,7 @@ static const SpeexSubmode nb_submode1 = {
153 1, 153 1,
154 0, 154 0,
155 0, 155 0,
156#ifndef SPEEX_DISABLE_ENCODER
156 /* LSP quantization */ 157 /* LSP quantization */
157 lsp_quant_lbr, 158 lsp_quant_lbr,
158 lsp_unquant_lbr, 159 lsp_unquant_lbr,
@@ -163,6 +164,18 @@ static const SpeexSubmode nb_submode1 = {
163 /* No innovation quantization (noise only) */ 164 /* No innovation quantization (noise only) */
164 noise_codebook_quant, 165 noise_codebook_quant,
165 noise_codebook_unquant, 166 noise_codebook_unquant,
167#else
168 /* LSP quantization */
169 NULL,
170 lsp_unquant_lbr,
171 /* No pitch quantization */
172 NULL,
173 forced_pitch_unquant,
174 NULL,
175 /* No innovation quantization (noise only) */
176 NULL,
177 noise_codebook_unquant,
178#endif
166 NULL, 179 NULL,
167 -1, 180 -1,
168 43 181 43
@@ -174,6 +187,7 @@ static const SpeexSubmode nb_submode8 = {
174 1, 187 1,
175 0, 188 0,
176 0, 189 0,
190#ifndef SPEEX_DISABLE_ENCODER
177 /*LSP quantization*/ 191 /*LSP quantization*/
178 lsp_quant_lbr, 192 lsp_quant_lbr,
179 lsp_unquant_lbr, 193 lsp_unquant_lbr,
@@ -185,6 +199,19 @@ static const SpeexSubmode nb_submode8 = {
185 split_cb_search_shape_sign, 199 split_cb_search_shape_sign,
186 split_cb_shape_sign_unquant, 200 split_cb_shape_sign_unquant,
187 &split_cb_nb_ulbr, 201 &split_cb_nb_ulbr,
202#else
203 /*LSP quantization*/
204 NULL,
205 lsp_unquant_lbr,
206 /*No pitch quantization*/
207 NULL,
208 forced_pitch_unquant,
209 NULL,
210 /*Innovation quantization*/
211 NULL,
212 split_cb_shape_sign_unquant,
213 &split_cb_nb_ulbr,
214#endif
188 QCONST16(.5,15), 215 QCONST16(.5,15),
189 79 216 79
190}; 217};
@@ -195,6 +222,7 @@ static const SpeexSubmode nb_submode2 = {
195 0, 222 0,
196 0, 223 0,
197 0, 224 0,
225#ifndef SPEEX_DISABLE_ENCODER
198 /*LSP quantization*/ 226 /*LSP quantization*/
199 lsp_quant_lbr, 227 lsp_quant_lbr,
200 lsp_unquant_lbr, 228 lsp_unquant_lbr,
@@ -206,6 +234,19 @@ static const SpeexSubmode nb_submode2 = {
206 split_cb_search_shape_sign, 234 split_cb_search_shape_sign,
207 split_cb_shape_sign_unquant, 235 split_cb_shape_sign_unquant,
208 &split_cb_nb_vlbr, 236 &split_cb_nb_vlbr,
237#else
238 /*LSP quantization*/
239 NULL,
240 lsp_unquant_lbr,
241 /*No pitch quantization*/
242 NULL,
243 pitch_unquant_3tap,
244 &ltp_params_vlbr,
245 /*Innovation quantization*/
246 NULL,
247 split_cb_shape_sign_unquant,
248 &split_cb_nb_vlbr,
249#endif
209 QCONST16(.6,15), 250 QCONST16(.6,15),
210 119 251 119
211}; 252};
@@ -216,6 +257,7 @@ static const SpeexSubmode nb_submode3 = {
216 0, 257 0,
217 1, 258 1,
218 0, 259 0,
260#ifndef SPEEX_DISABLE_ENCODER
219 /*LSP quantization*/ 261 /*LSP quantization*/
220 lsp_quant_lbr, 262 lsp_quant_lbr,
221 lsp_unquant_lbr, 263 lsp_unquant_lbr,
@@ -227,6 +269,19 @@ static const SpeexSubmode nb_submode3 = {
227 split_cb_search_shape_sign, 269 split_cb_search_shape_sign,
228 split_cb_shape_sign_unquant, 270 split_cb_shape_sign_unquant,
229 &split_cb_nb_lbr, 271 &split_cb_nb_lbr,
272#else
273 /*LSP quantization*/
274 NULL,
275 lsp_unquant_lbr,
276 /*Pitch quantization*/
277 NULL,
278 pitch_unquant_3tap,
279 &ltp_params_lbr,
280 /*Innovation quantization*/
281 NULL,
282 split_cb_shape_sign_unquant,
283 &split_cb_nb_lbr,
284#endif
230 QCONST16(.55,15), 285 QCONST16(.55,15),
231 160 286 160
232}; 287};
@@ -237,6 +292,7 @@ static const SpeexSubmode nb_submode4 = {
237 0, 292 0,
238 1, 293 1,
239 0, 294 0,
295#ifndef SPEEX_DISABLE_ENCODER
240 /*LSP quantization*/ 296 /*LSP quantization*/
241 lsp_quant_lbr, 297 lsp_quant_lbr,
242 lsp_unquant_lbr, 298 lsp_unquant_lbr,
@@ -248,6 +304,19 @@ static const SpeexSubmode nb_submode4 = {
248 split_cb_search_shape_sign, 304 split_cb_search_shape_sign,
249 split_cb_shape_sign_unquant, 305 split_cb_shape_sign_unquant,
250 &split_cb_nb_med, 306 &split_cb_nb_med,
307#else
308 /*LSP quantization*/
309 NULL,
310 lsp_unquant_lbr,
311 /*Pitch quantization*/
312 NULL,
313 pitch_unquant_3tap,
314 &ltp_params_med,
315 /*Innovation quantization*/
316 NULL,
317 split_cb_shape_sign_unquant,
318 &split_cb_nb_med,
319#endif
251 QCONST16(.45,15), 320 QCONST16(.45,15),
252 220 321 220
253}; 322};
@@ -258,6 +327,7 @@ static const SpeexSubmode nb_submode5 = {
258 0, 327 0,
259 3, 328 3,
260 0, 329 0,
330#ifndef SPEEX_DISABLE_ENCODER
261 /*LSP quantization*/ 331 /*LSP quantization*/
262 lsp_quant_nb, 332 lsp_quant_nb,
263 lsp_unquant_nb, 333 lsp_unquant_nb,
@@ -269,6 +339,19 @@ static const SpeexSubmode nb_submode5 = {
269 split_cb_search_shape_sign, 339 split_cb_search_shape_sign,
270 split_cb_shape_sign_unquant, 340 split_cb_shape_sign_unquant,
271 &split_cb_nb, 341 &split_cb_nb,
342#else
343 /*LSP quantization*/
344 NULL,
345 lsp_unquant_nb,
346 /*Pitch quantization*/
347 NULL,
348 pitch_unquant_3tap,
349 &ltp_params_nb,
350 /*Innovation quantization*/
351 NULL,
352 split_cb_shape_sign_unquant,
353 &split_cb_nb,
354#endif
272 QCONST16(.3,15), 355 QCONST16(.3,15),
273 300 356 300
274}; 357};
@@ -279,6 +362,7 @@ static const SpeexSubmode nb_submode6 = {
279 0, 362 0,
280 3, 363 3,
281 0, 364 0,
365#ifndef SPEEX_DISABLE_ENCODER
282 /*LSP quantization*/ 366 /*LSP quantization*/
283 lsp_quant_nb, 367 lsp_quant_nb,
284 lsp_unquant_nb, 368 lsp_unquant_nb,
@@ -290,6 +374,19 @@ static const SpeexSubmode nb_submode6 = {
290 split_cb_search_shape_sign, 374 split_cb_search_shape_sign,
291 split_cb_shape_sign_unquant, 375 split_cb_shape_sign_unquant,
292 &split_cb_sb, 376 &split_cb_sb,
377#else
378 /*LSP quantization*/
379 NULL,
380 lsp_unquant_nb,
381 /*Pitch quantization*/
382 NULL,
383 pitch_unquant_3tap,
384 &ltp_params_nb,
385 /*Innovation quantization*/
386 NULL,
387 split_cb_shape_sign_unquant,
388 &split_cb_sb,
389#endif
293 QCONST16(.2,15), 390 QCONST16(.2,15),
294 364 391 364
295}; 392};
@@ -300,6 +397,7 @@ static const SpeexSubmode nb_submode7 = {
300 0, 397 0,
301 3, 398 3,
302 1, 399 1,
400#ifndef SPEEX_DISABLE_ENCODER
303 /*LSP quantization*/ 401 /*LSP quantization*/
304 lsp_quant_nb, 402 lsp_quant_nb,
305 lsp_unquant_nb, 403 lsp_unquant_nb,
@@ -311,6 +409,19 @@ static const SpeexSubmode nb_submode7 = {
311 split_cb_search_shape_sign, 409 split_cb_search_shape_sign,
312 split_cb_shape_sign_unquant, 410 split_cb_shape_sign_unquant,
313 &split_cb_nb, 411 &split_cb_nb,
412#else
413 /*LSP quantization*/
414 NULL,
415 lsp_unquant_nb,
416 /*Pitch quantization*/
417 NULL,
418 pitch_unquant_3tap,
419 &ltp_params_nb,
420 /*Innovation quantization*/
421 NULL,
422 split_cb_shape_sign_unquant,
423 &split_cb_nb,
424#endif
314 QCONST16(.1,15), 425 QCONST16(.1,15),
315 492 426 492
316}; 427};
@@ -347,6 +458,7 @@ const SpeexMode speex_nb_mode = {
347 "narrowband", 458 "narrowband",
348 0, 459 0,
349 4, 460 4,
461#ifndef SPEEX_DISABLE_ENCODER
350 &nb_encoder_init, 462 &nb_encoder_init,
351 &nb_encoder_destroy, 463 &nb_encoder_destroy,
352 &nb_encode, 464 &nb_encode,
@@ -355,6 +467,16 @@ const SpeexMode speex_nb_mode = {
355 &nb_decode, 467 &nb_decode,
356 &nb_encoder_ctl, 468 &nb_encoder_ctl,
357 &nb_decoder_ctl, 469 &nb_decoder_ctl,
470#else
471 NULL,
472 NULL,
473 NULL,
474 &nb_decoder_init,
475 &nb_decoder_destroy,
476 &nb_decode,
477 NULL,
478 &nb_decoder_ctl,
479#endif
358}; 480};
359 481
360 482
@@ -388,6 +510,7 @@ static const SpeexSubmode nb_48k_submode = {
388 0, 510 0,
389 0, 511 0,
390 0, 512 0,
513#ifndef SPEEX_DISABLE_ENCODER
391 /*LSP quantization*/ 514 /*LSP quantization*/
392 lsp_quant_48k, 515 lsp_quant_48k,
393 lsp_unquant_48k, 516 lsp_unquant_48k,
@@ -399,6 +522,19 @@ static const SpeexSubmode nb_48k_submode = {
399 split_cb_search_shape_sign, 522 split_cb_search_shape_sign,
400 split_cb_shape_sign_unquant, 523 split_cb_shape_sign_unquant,
401 &split_cb_nb_48k, 524 &split_cb_nb_48k,
525#else
526 /*LSP quantization*/
527 NULL,
528 lsp_unquant_48k,
529 /*No pitch quantization*/
530 NULL,
531 pitch_unquant_3tap,
532 &ltp_params_48k,
533 /*Innovation quantization*/
534 NULL,
535 split_cb_shape_sign_unquant,
536 &split_cb_nb_48k,
537#endif
402 QCONST16(.7,15), 538 QCONST16(.7,15),
403 144 539 144
404}; 540};
@@ -429,6 +565,7 @@ const SpeexMode speex_nb_48k_mode = {
429 "narrowband 4.8 kbps", 565 "narrowband 4.8 kbps",
430 1000, 566 1000,
431 4, 567 4,
568#ifndef SPEEX_DISABLE_ENCODER
432 &nb_encoder_init, 569 &nb_encoder_init,
433 &nb_encoder_destroy, 570 &nb_encoder_destroy,
434 &nb_encode, 571 &nb_encode,
@@ -437,6 +574,16 @@ const SpeexMode speex_nb_48k_mode = {
437 &nb_decode, 574 &nb_decode,
438 &nb_encoder_ctl, 575 &nb_encoder_ctl,
439 &nb_decoder_ctl, 576 &nb_decoder_ctl,
577#else
578 NULL,
579 NULL,
580 NULL,
581 &nb_decoder_init,
582 &nb_decoder_destroy,
583 &nb_decode,
584 NULL,
585 &nb_decoder_ctl,
586#endif
440}; 587};
441 588
442 589
diff --git a/apps/codecs/libspeex/modes_wb.c b/apps/codecs/libspeex/modes_wb.c
index 862bd6fa31..e4c95a85bc 100644
--- a/apps/codecs/libspeex/modes_wb.c
+++ b/apps/codecs/libspeex/modes_wb.c
@@ -87,8 +87,13 @@ static const SpeexSubmode wb_submode1 = {
87 1, 87 1,
88 0, 88 0,
89 /*LSP quantization*/ 89 /*LSP quantization*/
90#ifndef SPEEX_DISABLE_ENCODER
90 lsp_quant_high, 91 lsp_quant_high,
91 lsp_unquant_high, 92 lsp_unquant_high,
93#else
94 NULL,
95 lsp_unquant_high,
96#endif
92 /*Pitch quantization*/ 97 /*Pitch quantization*/
93 NULL, 98 NULL,
94 NULL, 99 NULL,
@@ -107,6 +112,7 @@ static const SpeexSubmode wb_submode2 = {
107 0, 112 0,
108 1, 113 1,
109 0, 114 0,
115#ifndef SPEEX_DISABLE_ENCODER
110 /*LSP quantization*/ 116 /*LSP quantization*/
111 lsp_quant_high, 117 lsp_quant_high,
112 lsp_unquant_high, 118 lsp_unquant_high,
@@ -117,6 +123,18 @@ static const SpeexSubmode wb_submode2 = {
117 /*Innovation quantization*/ 123 /*Innovation quantization*/
118 split_cb_search_shape_sign, 124 split_cb_search_shape_sign,
119 split_cb_shape_sign_unquant, 125 split_cb_shape_sign_unquant,
126#else
127 /*LSP quantization*/
128 NULL,
129 lsp_unquant_high,
130 /*Pitch quantization*/
131 NULL,
132 NULL,
133 NULL,
134 /*Innovation quantization*/
135 NULL,
136 split_cb_shape_sign_unquant,
137#endif
120#ifdef DISABLE_WIDEBAND 138#ifdef DISABLE_WIDEBAND
121 NULL, 139 NULL,
122#else 140#else
@@ -132,6 +150,7 @@ static const SpeexSubmode wb_submode3 = {
132 0, 150 0,
133 1, 151 1,
134 0, 152 0,
153#ifndef SPEEX_DISABLE_ENCODER
135 /*LSP quantization*/ 154 /*LSP quantization*/
136 lsp_quant_high, 155 lsp_quant_high,
137 lsp_unquant_high, 156 lsp_unquant_high,
@@ -142,6 +161,18 @@ static const SpeexSubmode wb_submode3 = {
142 /*Innovation quantization*/ 161 /*Innovation quantization*/
143 split_cb_search_shape_sign, 162 split_cb_search_shape_sign,
144 split_cb_shape_sign_unquant, 163 split_cb_shape_sign_unquant,
164#else
165 /*LSP quantization*/
166 NULL,
167 lsp_unquant_high,
168 /*Pitch quantization*/
169 NULL,
170 NULL,
171 NULL,
172 /*Innovation quantization*/
173 NULL,
174 split_cb_shape_sign_unquant,
175#endif
145#ifdef DISABLE_WIDEBAND 176#ifdef DISABLE_WIDEBAND
146 NULL, 177 NULL,
147#else 178#else
@@ -156,6 +187,7 @@ static const SpeexSubmode wb_submode4 = {
156 0, 187 0,
157 1, 188 1,
158 1, 189 1,
190#ifndef SPEEX_DISABLE_ENCODER
159 /*LSP quantization*/ 191 /*LSP quantization*/
160 lsp_quant_high, 192 lsp_quant_high,
161 lsp_unquant_high, 193 lsp_unquant_high,
@@ -166,6 +198,18 @@ static const SpeexSubmode wb_submode4 = {
166 /*Innovation quantization*/ 198 /*Innovation quantization*/
167 split_cb_search_shape_sign, 199 split_cb_search_shape_sign,
168 split_cb_shape_sign_unquant, 200 split_cb_shape_sign_unquant,
201#else
202 /*LSP quantization*/
203 NULL,
204 lsp_unquant_high,
205 /*Pitch quantization*/
206 NULL,
207 NULL,
208 NULL,
209 /*Innovation quantization*/
210 NULL,
211 split_cb_shape_sign_unquant,
212#endif
169#ifdef DISABLE_WIDEBAND 213#ifdef DISABLE_WIDEBAND
170 NULL, 214 NULL,
171#else 215#else
@@ -195,7 +239,11 @@ static const SpeexSBMode sb_wb_mode = {
195 3, 239 3,
196 {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7}, 240 {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
197 {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4}, 241 {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
242#ifndef SPEEX_DISABLE_ENCODER
198 vbr_hb_thresh, 243 vbr_hb_thresh,
244#else
245 NULL,
246#endif
199 5 247 5
200}; 248};
201 249
@@ -206,6 +254,7 @@ const SpeexMode speex_wb_mode = {
206 "wideband (sub-band CELP)", 254 "wideband (sub-band CELP)",
207 1, 255 1,
208 4, 256 4,
257#ifndef SPEEX_DISABLE_ENCODER
209 &sb_encoder_init, 258 &sb_encoder_init,
210 &sb_encoder_destroy, 259 &sb_encoder_destroy,
211 &sb_encode, 260 &sb_encode,
@@ -214,6 +263,16 @@ const SpeexMode speex_wb_mode = {
214 &sb_decode, 263 &sb_decode,
215 &sb_encoder_ctl, 264 &sb_encoder_ctl,
216 &sb_decoder_ctl, 265 &sb_decoder_ctl,
266#else
267 NULL,
268 NULL,
269 NULL,
270 &sb_decoder_init,
271 &sb_decoder_destroy,
272 &sb_decode,
273 NULL,
274 &sb_decoder_ctl,
275#endif
217}; 276};
218 277
219 278
@@ -241,7 +300,11 @@ static const SpeexSBMode sb_uwb_mode = {
241 1, 300 1,
242 {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 301 {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
243 {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 302 {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
303#ifndef SPEEX_DISABLE_ENCODER
244 vbr_uhb_thresh, 304 vbr_uhb_thresh,
305#else
306 NULL,
307#endif
245 2 308 2
246}; 309};
247 310
@@ -276,6 +339,7 @@ const SpeexMode speex_uwb_mode = {
276 "ultra-wideband (sub-band CELP)", 339 "ultra-wideband (sub-band CELP)",
277 2, 340 2,
278 4, 341 4,
342#ifndef SPEEX_DISABLE_ENCODER
279 &sb_encoder_init, 343 &sb_encoder_init,
280 &sb_encoder_destroy, 344 &sb_encoder_destroy,
281 &sb_encode, 345 &sb_encode,
@@ -284,6 +348,16 @@ const SpeexMode speex_uwb_mode = {
284 &sb_decode, 348 &sb_decode,
285 &sb_encoder_ctl, 349 &sb_encoder_ctl,
286 &sb_decoder_ctl, 350 &sb_decoder_ctl,
351#else
352 NULL,
353 NULL,
354 NULL,
355 &sb_decoder_init,
356 &sb_decoder_destroy,
357 &sb_decode,
358 NULL,
359 &sb_decoder_ctl,
360#endif
287}; 361};
288 362
289/* We have defined speex_lib_get_mode() as a macro in speex.h */ 363/* We have defined speex_lib_get_mode() as a macro in speex.h */
diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c
index aab0b722dc..50e1b11372 100644
--- a/apps/codecs/libspeex/nb_celp.c
+++ b/apps/codecs/libspeex/nb_celp.c
@@ -109,8 +109,8 @@ const float exc_gain_quant_scal1[2]={0.70469f, 1.05127f};
109#define sqr(x) ((x)*(x)) 109#define sqr(x) ((x)*(x))
110 110
111extern const spx_word16_t lpc_window[]; 111extern const spx_word16_t lpc_window[];
112#if 0 112#ifndef SPEEX_DISABLE_ENCODER
113void *nb_encoder_init(const speexmode *m) 113void *nb_encoder_init(const SpeexMode *m)
114{ 114{
115 EncState *st; 115 EncState *st;
116 const SpeexNBMode *mode; 116 const SpeexNBMode *mode;
@@ -1024,18 +1024,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
1024 1024
1025 return 1; 1025 return 1;
1026} 1026}
1027#else
1028void *nb_encoder_init(const SpeexMode *m)
1029{
1030 return NULL;
1031}
1032void nb_encoder_destroy(void *state)
1033{
1034}
1035int nb_encode(void *state, void *vin, SpeexBits *bits)
1036{
1037 return 1;
1038}
1039#endif 1027#endif
1040 1028
1041static DecState global_decstate IBSS_ATTR; 1029static DecState global_decstate IBSS_ATTR;
@@ -1763,7 +1751,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
1763 return 0; 1751 return 0;
1764} 1752}
1765 1753
1766#if 0 1754#ifndef SPEEX_DISABLE_ENCODER
1767int nb_encoder_ctl(void *state, int request, void *ptr) 1755int nb_encoder_ctl(void *state, int request, void *ptr)
1768{ 1756{
1769 EncState *st; 1757 EncState *st;
@@ -1959,11 +1947,6 @@ int nb_encoder_ctl(void *state, int request, void *ptr)
1959 } 1947 }
1960 return 0; 1948 return 0;
1961} 1949}
1962#else
1963int nb_encoder_ctl(void *state, int request, void *ptr)
1964{
1965 return 0;
1966}
1967#endif 1950#endif
1968 1951
1969int nb_decoder_ctl(void *state, int request, void *ptr) 1952int nb_decoder_ctl(void *state, int request, void *ptr)
diff --git a/apps/codecs/libspeex/quant_lsp.c b/apps/codecs/libspeex/quant_lsp.c
index 9a6afa2ca0..b8dcfcc088 100644
--- a/apps/codecs/libspeex/quant_lsp.c
+++ b/apps/codecs/libspeex/quant_lsp.c
@@ -68,6 +68,7 @@
68 68
69#endif 69#endif
70 70
71#ifndef SPEEX_DISABLE_ENCODER
71static void compute_quant_weights(spx_lsp_t *qlsp, spx_word16_t *quant_weight, int order) 72static void compute_quant_weights(spx_lsp_t *qlsp, spx_word16_t *quant_weight, int order)
72{ 73{
73 int i; 74 int i;
@@ -209,6 +210,7 @@ void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
209 for (i=0;i<order;i++) 210 for (i=0;i<order;i++)
210 qlsp[i]=lsp[i]-qlsp[i]; 211 qlsp[i]=lsp[i]-qlsp[i];
211} 212}
213#endif
212 214
213void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits) 215void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits)
214{ 216{
@@ -239,6 +241,7 @@ void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits)
239} 241}
240 242
241 243
244#ifndef SPEEX_DISABLE_ENCODER
242void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits) 245void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
243{ 246{
244 int i; 247 int i;
@@ -279,6 +282,7 @@ void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
279 for (i=0;i<order;i++) 282 for (i=0;i<order;i++)
280 qlsp[i]=lsp[i]-qlsp[i]; 283 qlsp[i]=lsp[i]-qlsp[i];
281} 284}
285#endif
282 286
283void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits) 287void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits)
284{ 288{
@@ -316,6 +320,7 @@ extern const signed char high_lsp_cdbk[];
316extern const signed char high_lsp_cdbk2[]; 320extern const signed char high_lsp_cdbk2[];
317 321
318 322
323#ifndef SPEEX_DISABLE_ENCODER
319void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits) 324void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
320{ 325{
321 int i; 326 int i;
@@ -362,6 +367,7 @@ void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
362 for (i=0;i<order;i++) 367 for (i=0;i<order;i++)
363 qlsp[i]=lsp[i]-qlsp[i]; 368 qlsp[i]=lsp[i]-qlsp[i];
364} 369}
370#endif
365 371
366void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits) 372void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
367{ 373{
@@ -389,6 +395,7 @@ void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
389extern const signed char cdbk_lsp_vlbr[5120]; 395extern const signed char cdbk_lsp_vlbr[5120];
390extern const signed char cdbk_lsp2_vlbr[160]; 396extern const signed char cdbk_lsp2_vlbr[160];
391 397
398#ifndef SPEEX_DISABLE_ENCODER
392void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits) 399void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
393{ 400{
394 int i; 401 int i;
@@ -427,6 +434,7 @@ void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
427 for (i=0;i<order;i++) 434 for (i=0;i<order;i++)
428 qlsp[i]=lsp[i]-qlsp[i]; 435 qlsp[i]=lsp[i]-qlsp[i];
429} 436}
437#endif
430 438
431void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits) 439void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits)
432{ 440{
diff --git a/apps/codecs/libspeex/sb_celp.c b/apps/codecs/libspeex/sb_celp.c
index c67197144c..cd6da32476 100644
--- a/apps/codecs/libspeex/sb_celp.c
+++ b/apps/codecs/libspeex/sb_celp.c
@@ -185,7 +185,7 @@ static const float h0[64] = {
185 185
186extern const spx_word16_t lpc_window[]; 186extern const spx_word16_t lpc_window[];
187 187
188#if 0 188#ifndef SPEEX_DISABLE_ENCODER
189void *sb_encoder_init(const SpeexMode *m) 189void *sb_encoder_init(const SpeexMode *m)
190{ 190{
191 int i; 191 int i;
@@ -751,18 +751,6 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
751 751
752 return 1; 752 return 1;
753} 753}
754#else
755void *sb_encoder_init(const SpeexMode *m)
756{
757 return NULL;
758}
759void sb_encoder_destroy(void *state)
760{
761}
762int sb_encode(void *state, void *vin, SpeexBits *bits)
763{
764 return 1;
765}
766#endif 754#endif
767 755
768 756
@@ -1127,7 +1115,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
1127 return 0; 1115 return 0;
1128} 1116}
1129 1117
1130#if 0 1118#ifndef SPEEX_DISABLE_ENCODER
1131int sb_encoder_ctl(void *state, int request, void *ptr) 1119int sb_encoder_ctl(void *state, int request, void *ptr)
1132{ 1120{
1133 SBEncState *st; 1121 SBEncState *st;
@@ -1375,11 +1363,6 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
1375 } 1363 }
1376 return 0; 1364 return 0;
1377} 1365}
1378#else
1379int sb_encoder_ctl(void *state, int request, void *ptr)
1380{
1381 return 0;
1382}
1383#endif 1366#endif
1384 1367
1385int sb_decoder_ctl(void *state, int request, void *ptr) 1368int sb_decoder_ctl(void *state, int request, void *ptr)
diff --git a/apps/codecs/libspeex/speex_header.c b/apps/codecs/libspeex/speex_header.c
index 2e7c415686..8fd166576b 100644
--- a/apps/codecs/libspeex/speex_header.c
+++ b/apps/codecs/libspeex/speex_header.c
@@ -67,6 +67,7 @@ typedef struct SpeexHeader {
67} SpeexHeader; 67} SpeexHeader;
68*/ 68*/
69 69
70#ifndef SPEEX_DISABLE_ENCODER
70void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m) 71void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m)
71{ 72{
72 int i; 73 int i;
@@ -125,6 +126,7 @@ char *speex_header_to_packet(SpeexHeader *header, int *size)
125 *size = sizeof(SpeexHeader); 126 *size = sizeof(SpeexHeader);
126 return (char *)le_header; 127 return (char *)le_header;
127} 128}
129#endif
128 130
129SpeexHeader *speex_packet_to_header(char *packet, int size) 131SpeexHeader *speex_packet_to_header(char *packet, int size)
130{ 132{
diff --git a/apps/codecs/libspeex/stereo.c b/apps/codecs/libspeex/stereo.c
index ced56b1134..b0c65b812f 100644
--- a/apps/codecs/libspeex/stereo.c
+++ b/apps/codecs/libspeex/stereo.c
@@ -41,6 +41,7 @@
41/*float e_ratio_quant[4] = {1, 1.26, 1.587, 2};*/ 41/*float e_ratio_quant[4] = {1, 1.26, 1.587, 2};*/
42static const float e_ratio_quant[4] = {.25f, .315f, .397f, .5f}; 42static const float e_ratio_quant[4] = {.25f, .315f, .397f, .5f};
43 43
44#ifndef SPEEX_DISABLE_ENCODER
44void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits) 45void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
45{ 46{
46 int i, tmp; 47 int i, tmp;
@@ -114,6 +115,7 @@ void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits)
114 tmp=vq_index(&e_ratio, e_ratio_quant, 1, 4); 115 tmp=vq_index(&e_ratio, e_ratio_quant, 1, 4);
115 speex_bits_pack(bits, tmp, 2); 116 speex_bits_pack(bits, tmp, 2);
116} 117}
118#endif
117 119
118void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo) 120void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo)
119{ 121{