summaryrefslogtreecommitdiff
path: root/apps/codecs/libspeex/modes.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-10-26 01:16:55 +0000
committerThom Johansen <thomj@rockbox.org>2007-10-26 01:16:55 +0000
commitfa971b142d794c9620b823d6b9d1937397c1f1e1 (patch)
tree55565a0765c15be5d1df4cfb1c04dc92de50fe5d /apps/codecs/libspeex/modes.c
parent14da611cd32d084813bb0d2e2318b81c3ea2953a (diff)
downloadrockbox-fa971b142d794c9620b823d6b9d1937397c1f1e1.tar.gz
rockbox-fa971b142d794c9620b823d6b9d1937397c1f1e1.zip
Sync with Speex SVN. Syntactic change in filters_cf.S.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15310 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspeex/modes.c')
-rw-r--r--apps/codecs/libspeex/modes.c219
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
55const 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 */
58extern const signed char gain_cdbk_nb[]; 55extern const signed char gain_cdbk_nb[];
59extern const signed char gain_cdbk_lbr[]; 56extern const signed char gain_cdbk_lbr[];
60extern const signed char hexc_table[];
61extern const signed char exc_5_256_table[]; 57extern const signed char exc_5_256_table[];
62extern const signed char exc_5_64_table[]; 58extern const signed char exc_5_64_table[];
63extern const signed char exc_8_128_table[]; 59extern const signed char exc_8_128_table[];
64extern const signed char exc_10_32_table[]; 60extern const signed char exc_10_32_table[];
65extern const signed char exc_10_16_table[]; 61extern const signed char exc_10_16_table[];
66extern const signed char exc_20_32_table[]; 62extern const signed char exc_20_32_table[];
67extern 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 */
156static 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 */
166static 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 */
177static const SpeexSubmode nb_submode1 = { 151static 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
389static 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
410static 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
435static 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
459static 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*/
485static 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
508const 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*/
531static 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
554const 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
659const 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}