diff options
Diffstat (limited to 'apps/codecs/libspeex/modes.c')
-rw-r--r-- | apps/codecs/libspeex/modes.c | 219 |
1 files changed, 0 insertions, 219 deletions
diff --git a/apps/codecs/libspeex/modes.c b/apps/codecs/libspeex/modes.c index 1d30ce4a15..7906ab5faa 100644 --- a/apps/codecs/libspeex/modes.c +++ b/apps/codecs/libspeex/modes.c | |||
@@ -50,21 +50,16 @@ | |||
50 | #define NULL 0 | 50 | #define NULL 0 |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #define MAX_IN_SAMPLES 640 | ||
54 | |||
55 | const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode}; | ||
56 | 53 | ||
57 | /* Extern declarations for all codebooks we use here */ | 54 | /* Extern declarations for all codebooks we use here */ |
58 | extern const signed char gain_cdbk_nb[]; | 55 | extern const signed char gain_cdbk_nb[]; |
59 | extern const signed char gain_cdbk_lbr[]; | 56 | extern const signed char gain_cdbk_lbr[]; |
60 | extern const signed char hexc_table[]; | ||
61 | extern const signed char exc_5_256_table[]; | 57 | extern const signed char exc_5_256_table[]; |
62 | extern const signed char exc_5_64_table[]; | 58 | extern const signed char exc_5_64_table[]; |
63 | extern const signed char exc_8_128_table[]; | 59 | extern const signed char exc_8_128_table[]; |
64 | extern const signed char exc_10_32_table[]; | 60 | extern const signed char exc_10_32_table[]; |
65 | extern const signed char exc_10_16_table[]; | 61 | extern const signed char exc_10_16_table[]; |
66 | extern const signed char exc_20_32_table[]; | 62 | extern const signed char exc_20_32_table[]; |
67 | extern const signed char hexc_10_32_table[]; | ||
68 | 63 | ||
69 | 64 | ||
70 | /* Parameters for Long-Term Prediction (LTP)*/ | 65 | /* Parameters for Long-Term Prediction (LTP)*/ |
@@ -150,29 +145,8 @@ static const split_cb_params split_cb_sb = { | |||
150 | 0, | 145 | 0, |
151 | }; | 146 | }; |
152 | 147 | ||
153 | #ifndef DISABLE_WIDEBAND | ||
154 | |||
155 | /* Split-VQ innovation for high-band wideband */ | ||
156 | static const split_cb_params split_cb_high = { | ||
157 | 8, /*subvect_size*/ | ||
158 | 5, /*nb_subvect*/ | ||
159 | hexc_table, /*shape_cb*/ | ||
160 | 7, /*shape_bits*/ | ||
161 | 1, | ||
162 | }; | ||
163 | 148 | ||
164 | 149 | ||
165 | /* Split-VQ innovation for high-band wideband */ | ||
166 | static const split_cb_params split_cb_high_lbr = { | ||
167 | 10, /*subvect_size*/ | ||
168 | 4, /*nb_subvect*/ | ||
169 | hexc_10_32_table, /*shape_cb*/ | ||
170 | 5, /*shape_bits*/ | ||
171 | 0, | ||
172 | }; | ||
173 | |||
174 | #endif | ||
175 | |||
176 | /* 2150 bps "vocoder-like" mode for comfort noise */ | 150 | /* 2150 bps "vocoder-like" mode for comfort noise */ |
177 | static const SpeexSubmode nb_submode1 = { | 151 | static const SpeexSubmode nb_submode1 = { |
178 | 0, | 152 | 0, |
@@ -386,189 +360,6 @@ const SpeexMode speex_nb_mode = { | |||
386 | 360 | ||
387 | /* Wideband part */ | 361 | /* Wideband part */ |
388 | 362 | ||
389 | static const SpeexSubmode wb_submode1 = { | ||
390 | 0, | ||
391 | 0, | ||
392 | 1, | ||
393 | 0, | ||
394 | /*LSP quantization*/ | ||
395 | lsp_quant_high, | ||
396 | lsp_unquant_high, | ||
397 | /*Pitch quantization*/ | ||
398 | NULL, | ||
399 | NULL, | ||
400 | NULL, | ||
401 | /*No innovation quantization*/ | ||
402 | NULL, | ||
403 | NULL, | ||
404 | NULL, | ||
405 | -1, | ||
406 | 36 | ||
407 | }; | ||
408 | |||
409 | |||
410 | static const SpeexSubmode wb_submode2 = { | ||
411 | 0, | ||
412 | 0, | ||
413 | 1, | ||
414 | 0, | ||
415 | /*LSP quantization*/ | ||
416 | lsp_quant_high, | ||
417 | lsp_unquant_high, | ||
418 | /*Pitch quantization*/ | ||
419 | NULL, | ||
420 | NULL, | ||
421 | NULL, | ||
422 | /*Innovation quantization*/ | ||
423 | split_cb_search_shape_sign, | ||
424 | split_cb_shape_sign_unquant, | ||
425 | #ifdef DISABLE_WIDEBAND | ||
426 | NULL, | ||
427 | #else | ||
428 | &split_cb_high_lbr, | ||
429 | #endif | ||
430 | -1, | ||
431 | 112 | ||
432 | }; | ||
433 | |||
434 | |||
435 | static const SpeexSubmode wb_submode3 = { | ||
436 | 0, | ||
437 | 0, | ||
438 | 1, | ||
439 | 0, | ||
440 | /*LSP quantization*/ | ||
441 | lsp_quant_high, | ||
442 | lsp_unquant_high, | ||
443 | /*Pitch quantization*/ | ||
444 | NULL, | ||
445 | NULL, | ||
446 | NULL, | ||
447 | /*Innovation quantization*/ | ||
448 | split_cb_search_shape_sign, | ||
449 | split_cb_shape_sign_unquant, | ||
450 | #ifdef DISABLE_WIDEBAND | ||
451 | NULL, | ||
452 | #else | ||
453 | &split_cb_high, | ||
454 | #endif | ||
455 | -1, | ||
456 | 192 | ||
457 | }; | ||
458 | |||
459 | static const SpeexSubmode wb_submode4 = { | ||
460 | 0, | ||
461 | 0, | ||
462 | 1, | ||
463 | 1, | ||
464 | /*LSP quantization*/ | ||
465 | lsp_quant_high, | ||
466 | lsp_unquant_high, | ||
467 | /*Pitch quantization*/ | ||
468 | NULL, | ||
469 | NULL, | ||
470 | NULL, | ||
471 | /*Innovation quantization*/ | ||
472 | split_cb_search_shape_sign, | ||
473 | split_cb_shape_sign_unquant, | ||
474 | #ifdef DISABLE_WIDEBAND | ||
475 | NULL, | ||
476 | #else | ||
477 | &split_cb_high, | ||
478 | #endif | ||
479 | -1, | ||
480 | 352 | ||
481 | }; | ||
482 | |||
483 | |||
484 | /* Split-band wideband CELP mode*/ | ||
485 | static const SpeexSBMode sb_wb_mode = { | ||
486 | &speex_nb_mode, | ||
487 | 160, /*frameSize*/ | ||
488 | 40, /*subframeSize*/ | ||
489 | 8, /*lpcSize*/ | ||
490 | 640, /*bufSize*/ | ||
491 | #ifdef FIXED_POINT | ||
492 | 29491, 19661, /* gamma1, gamma2 */ | ||
493 | #else | ||
494 | 0.9, 0.6, /* gamma1, gamma2 */ | ||
495 | #endif | ||
496 | .012, /*lag_factor*/ | ||
497 | QCONST16(.0002,15), /*lpc_floor*/ | ||
498 | QCONST16(0.9f,15), | ||
499 | {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL}, | ||
500 | 3, | ||
501 | {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7}, | ||
502 | {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4}, | ||
503 | vbr_hb_thresh, | ||
504 | 5 | ||
505 | }; | ||
506 | |||
507 | |||
508 | const SpeexMode speex_wb_mode = { | ||
509 | &sb_wb_mode, | ||
510 | wb_mode_query, | ||
511 | "wideband (sub-band CELP)", | ||
512 | 1, | ||
513 | 4, | ||
514 | &sb_encoder_init, | ||
515 | &sb_encoder_destroy, | ||
516 | &sb_encode, | ||
517 | &sb_decoder_init, | ||
518 | &sb_decoder_destroy, | ||
519 | &sb_decode, | ||
520 | &sb_encoder_ctl, | ||
521 | &sb_decoder_ctl, | ||
522 | }; | ||
523 | |||
524 | |||
525 | |||
526 | /* "Ultra-wideband" mode stuff */ | ||
527 | |||
528 | |||
529 | |||
530 | /* Split-band "ultra-wideband" (32 kbps) CELP mode*/ | ||
531 | static const SpeexSBMode sb_uwb_mode = { | ||
532 | &speex_wb_mode, | ||
533 | 320, /*frameSize*/ | ||
534 | 80, /*subframeSize*/ | ||
535 | 8, /*lpcSize*/ | ||
536 | 1280, /*bufSize*/ | ||
537 | #ifdef FIXED_POINT | ||
538 | 29491, 19661, /* gamma1, gamma2 */ | ||
539 | #else | ||
540 | 0.9, 0.6, /* gamma1, gamma2 */ | ||
541 | #endif | ||
542 | .012, /*lag_factor*/ | ||
543 | QCONST16(.0002,15), /*lpc_floor*/ | ||
544 | QCONST16(0.7f,15), | ||
545 | {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL}, | ||
546 | 1, | ||
547 | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, | ||
548 | {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, | ||
549 | vbr_uhb_thresh, | ||
550 | 2 | ||
551 | }; | ||
552 | |||
553 | |||
554 | const SpeexMode speex_uwb_mode = { | ||
555 | &sb_uwb_mode, | ||
556 | wb_mode_query, | ||
557 | "ultra-wideband (sub-band CELP)", | ||
558 | 2, | ||
559 | 4, | ||
560 | &sb_encoder_init, | ||
561 | &sb_encoder_destroy, | ||
562 | &sb_encode, | ||
563 | &sb_decoder_init, | ||
564 | &sb_decoder_destroy, | ||
565 | &sb_decode, | ||
566 | &sb_encoder_ctl, | ||
567 | &sb_decoder_ctl, | ||
568 | }; | ||
569 | |||
570 | |||
571 | |||
572 | 363 | ||
573 | #ifdef EPIC_48K | 364 | #ifdef EPIC_48K |
574 | 365 | ||
@@ -656,13 +447,3 @@ int speex_mode_query(const SpeexMode *mode, int request, void *ptr) | |||
656 | return mode->query(mode->mode, request, ptr); | 447 | return mode->query(mode->mode, request, ptr); |
657 | } | 448 | } |
658 | 449 | ||
659 | const SpeexMode * speex_lib_get_mode (int mode) | ||
660 | { | ||
661 | #ifdef EPIC_48K | ||
662 | if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode; | ||
663 | #endif | ||
664 | |||
665 | if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL; | ||
666 | |||
667 | return speex_mode_list[mode]; | ||
668 | } | ||