summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-11-10 01:26:21 +0000
committerThom Johansen <thomj@rockbox.org>2007-11-10 01:26:21 +0000
commitf32b7748dddf0146e66af2120ac2cb6bcd363ae8 (patch)
tree5452c530e9eb2d7f7a8e23eec888257919bb0e11 /apps/codecs
parente35d7abd1a4fb9e517a8aeb4ee13ade9cc2a572f (diff)
downloadrockbox-f32b7748dddf0146e66af2120ac2cb6bcd363ae8.tar.gz
rockbox-f32b7748dddf0146e66af2120ac2cb6bcd363ae8.zip
Remove unneeded file from SOURCES and partial SVN sync.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15551 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libspeex/SOURCES2
-rw-r--r--apps/codecs/libspeex/modes.c111
-rw-r--r--apps/codecs/libspeex/modes.h5
-rw-r--r--apps/codecs/libspeex/modes_wb.c6
-rw-r--r--apps/codecs/libspeex/nb_celp.c171
-rw-r--r--apps/codecs/libspeex/nb_celp.h8
-rw-r--r--apps/codecs/libspeex/quant_lsp.c64
-rw-r--r--apps/codecs/libspeex/quant_lsp.h9
8 files changed, 9 insertions, 367 deletions
diff --git a/apps/codecs/libspeex/SOURCES b/apps/codecs/libspeex/SOURCES
index 89e3f1db03..f775a7cd9f 100644
--- a/apps/codecs/libspeex/SOURCES
+++ b/apps/codecs/libspeex/SOURCES
@@ -12,8 +12,6 @@ gain_table_lbr.c
12hexc_10_32_table.c 12hexc_10_32_table.c
13hexc_table.c 13hexc_table.c
14high_lsp_tables.c 14high_lsp_tables.c
15lbr_48k_tables.c
16lpc.c
17lsp.c 15lsp.c
18lsp_tables_nb.c 16lsp_tables_nb.c
19ltp.c 17ltp.c
diff --git a/apps/codecs/libspeex/modes.c b/apps/codecs/libspeex/modes.c
index 0478f978d1..cf4ef3246c 100644
--- a/apps/codecs/libspeex/modes.c
+++ b/apps/codecs/libspeex/modes.c
@@ -441,9 +441,6 @@ static const SpeexNBMode nb_mode = {
441#endif 441#endif
442 .012, /*lag_factor*/ 442 .012, /*lag_factor*/
443 QCONST16(.0002,15), /*lpc_floor*/ 443 QCONST16(.0002,15), /*lpc_floor*/
444#ifdef EPIC_48K
445 0,
446#endif
447 {NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7, 444 {NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
448 &nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, 445 &nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
449 5, 446 5,
@@ -480,114 +477,6 @@ const SpeexMode speex_nb_mode = {
480}; 477};
481 478
482 479
483/* Wideband part */
484
485
486#ifdef EPIC_48K
487
488extern const signed char gain_cdbk_ulbr[];
489extern const signed char exc_12_32_table[];
490
491/* Parameters for Long-Term Prediction (LTP)*/
492static const ltp_params ltp_params_48k = {
493 gain_cdbk_ulbr,
494 3,
495 0
496};
497
498static const split_cb_params split_cb_nb_48k = {
499 12, /*subvect_size*/
500 4, /*nb_subvect*/
501 exc_12_32_table, /*shape_cb*/
502 5, /*shape_bits*/
503 0,
504};
505
506
507/* 4.8 kbps very low bit-rate mode */
508static const SpeexSubmode nb_48k_submode = {
509 0,
510 0,
511 0,
512 0,
513#ifndef SPEEX_DISABLE_ENCODER
514 /*LSP quantization*/
515 lsp_quant_48k,
516 lsp_unquant_48k,
517 /*No pitch quantization*/
518 pitch_search_3tap,
519 pitch_unquant_3tap,
520 &ltp_params_48k,
521 /*Innovation quantization*/
522 split_cb_search_shape_sign,
523 split_cb_shape_sign_unquant,
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
538 QCONST16(.7,15),
539 144
540};
541
542
543/* Special, non-standard 4.8 kbps mode */
544static const SpeexNBMode nb_48k_mode = {
545 240, /*frameSize*/
546 48, /*subframeSize*/
547 10, /*lpcSize*/
548 17, /*pitchStart*/
549 144, /*pitchEnd*/
550 0.9, /*gamma1*/
551 0.6, /*gamma2*/
552 .01, /*lag_factor*/
553 QCONST16(.0003,15), /*lpc_floor*/
554 1,
555 {NULL, NULL, &nb_48k_submode, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
556 2,
557 {2,2,2,2,2,2,2,2,2,2,2}
558};
559
560
561/* Default mode for narrowband */
562const SpeexMode speex_nb_48k_mode = {
563 &nb_48k_mode,
564 nb_mode_query,
565 "narrowband 4.8 kbps",
566 1000,
567 4,
568#ifndef SPEEX_DISABLE_ENCODER
569 &nb_encoder_init,
570 &nb_encoder_destroy,
571 &nb_encode,
572 &nb_decoder_init,
573 &nb_decoder_destroy,
574 &nb_decode,
575 &nb_encoder_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
587};
588
589
590#endif
591 480
592int speex_mode_query(const SpeexMode *mode, int request, void *ptr) 481int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
593{ 482{
diff --git a/apps/codecs/libspeex/modes.h b/apps/codecs/libspeex/modes.h
index 730c80fb07..9ce674a498 100644
--- a/apps/codecs/libspeex/modes.h
+++ b/apps/codecs/libspeex/modes.h
@@ -126,10 +126,6 @@ typedef struct SpeexNBMode {
126 float lag_factor; /**< Lag-windowing parameter */ 126 float lag_factor; /**< Lag-windowing parameter */
127 spx_word16_t lpc_floor; /**< Noise floor for LPC analysis */ 127 spx_word16_t lpc_floor; /**< Noise floor for LPC analysis */
128 128
129#ifdef EPIC_48K
130 int lbr48k; /**< 1 for the special 4.8 kbps mode */
131#endif
132
133 const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */ 129 const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
134 int defaultSubmode; /**< Default sub-mode to use when encoding */ 130 int defaultSubmode; /**< Default sub-mode to use when encoding */
135 int quality_map[11]; /**< Mode corresponding to each quality setting */ 131 int quality_map[11]; /**< Mode corresponding to each quality setting */
@@ -142,7 +138,6 @@ typedef struct SpeexSBMode {
142 int frameSize; /**< Size of frames used for encoding */ 138 int frameSize; /**< Size of frames used for encoding */
143 int subframeSize; /**< Size of sub-frames used for encoding */ 139 int subframeSize; /**< Size of sub-frames used for encoding */
144 int lpcSize; /**< Order of LPC filter */ 140 int lpcSize; /**< Order of LPC filter */
145 int bufSize; /**< Signal buffer size in encoder */
146 spx_word16_t gamma1; /**< Perceptual filter parameter #1 */ 141 spx_word16_t gamma1; /**< Perceptual filter parameter #1 */
147 spx_word16_t gamma2; /**< Perceptual filter parameter #1 */ 142 spx_word16_t gamma2; /**< Perceptual filter parameter #1 */
148 float lag_factor; /**< Lag-windowing parameter */ 143 float lag_factor; /**< Lag-windowing parameter */
diff --git a/apps/codecs/libspeex/modes_wb.c b/apps/codecs/libspeex/modes_wb.c
index e4c95a85bc..1684ba6493 100644
--- a/apps/codecs/libspeex/modes_wb.c
+++ b/apps/codecs/libspeex/modes_wb.c
@@ -226,7 +226,6 @@ static const SpeexSBMode sb_wb_mode = {
226 160, /*frameSize*/ 226 160, /*frameSize*/
227 40, /*subframeSize*/ 227 40, /*subframeSize*/
228 8, /*lpcSize*/ 228 8, /*lpcSize*/
229 640, /*bufSize*/
230#ifdef FIXED_POINT 229#ifdef FIXED_POINT
231 29491, 19661, /* gamma1, gamma2 */ 230 29491, 19661, /* gamma1, gamma2 */
232#else 231#else
@@ -287,7 +286,6 @@ static const SpeexSBMode sb_uwb_mode = {
287 320, /*frameSize*/ 286 320, /*frameSize*/
288 80, /*subframeSize*/ 287 80, /*subframeSize*/
289 8, /*lpcSize*/ 288 8, /*lpcSize*/
290 1280, /*bufSize*/
291#ifdef FIXED_POINT 289#ifdef FIXED_POINT
292 29491, 19661, /* gamma1, gamma2 */ 290 29491, 19661, /* gamma1, gamma2 */
293#else 291#else
@@ -365,10 +363,6 @@ const SpeexMode speex_uwb_mode = {
365 363
366const SpeexMode * speex_lib_get_mode (int mode) 364const SpeexMode * speex_lib_get_mode (int mode)
367{ 365{
368#ifdef EPIC_48K
369 if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
370#endif
371
372 if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL; 366 if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
373 367
374 return speex_mode_list[mode]; 368 return speex_mode_list[mode];
diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c
index f3810894e1..3de623a482 100644
--- a/apps/codecs/libspeex/nb_celp.c
+++ b/apps/codecs/libspeex/nb_celp.c
@@ -145,9 +145,6 @@ void *nb_encoder_init(const SpeexMode *m)
145 st->bounded_pitch = 1; 145 st->bounded_pitch = 1;
146 146
147 st->encode_submode = 1; 147 st->encode_submode = 1;
148#ifdef EPIC_48K
149 st->lbr_48k=mode->lbr48k;
150#endif
151 148
152#ifdef VORBIS_PSYCHO 149#ifdef VORBIS_PSYCHO
153 st->psy = vorbis_psy_init(8000, 256); 150 st->psy = vorbis_psy_init(8000, 256);
@@ -277,10 +274,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
277 char *stack; 274 char *stack;
278 VARDECL(spx_word16_t *syn_resp); 275 VARDECL(spx_word16_t *syn_resp);
279 VARDECL(spx_word16_t *real_exc); 276 VARDECL(spx_word16_t *real_exc);
280#ifdef EPIC_48K 277
281 int pitch_half[2];
282 int ol_pitch_id=0;
283#endif
284 spx_word32_t ener=0; 278 spx_word32_t ener=0;
285 spx_word16_t fine_gain; 279 spx_word16_t fine_gain;
286 spx_word16_t *in = (spx_word16_t*)vin; 280 spx_word16_t *in = (spx_word16_t*)vin;
@@ -394,19 +388,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
394 ol_pitch/=2;*/ 388 ol_pitch/=2;*/
395 /*ol_pitch_coef = sqrt(ol_pitch_coef);*/ 389 /*ol_pitch_coef = sqrt(ol_pitch_coef);*/
396 390
397#ifdef EPIC_48K
398 if (st->lbr_48k)
399 {
400 if (ol_pitch < st->min_pitch+2)
401 ol_pitch = st->min_pitch+2;
402 if (ol_pitch > st->max_pitch-2)
403 ol_pitch = st->max_pitch-2;
404 open_loop_nbest_pitch(st->sw, ol_pitch-2, ol_pitch+2, st->frameSize>>1,
405 &pitch_half[0], nol_pitch_coef, 1, stack);
406 open_loop_nbest_pitch(st->sw+(st->frameSize>>1), pitch_half[0]-1, pitch_half[0]+2, st->frameSize>>1,
407 &pitch_half[1], nol_pitch_coef, 1, stack);
408 }
409#endif
410 } else { 391 } else {
411 ol_pitch=0; 392 ol_pitch=0;
412 ol_pitch_coef=0; 393 ol_pitch_coef=0;
@@ -420,25 +401,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
420 fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack); 401 fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack);
421 402
422 /* Compute open-loop excitation gain */ 403 /* Compute open-loop excitation gain */
423#ifdef EPIC_48K
424 if (st->lbr_48k)
425 {
426 float ol1=0,ol2=0;
427 float ol_gain2;
428 ol1 = compute_rms16(st->exc, st->frameSize>>1);
429 ol2 = compute_rms16(st->exc+(st->frameSize>>1), st->frameSize>>1);
430 ol1 *= ol1*(st->frameSize>>1);
431 ol2 *= ol2*(st->frameSize>>1);
432
433 ol_gain2=ol1;
434 if (ol2>ol1)
435 ol_gain2=ol2;
436 ol_gain2 = sqrt(2*ol_gain2*(ol1+ol2))*1.3*(1-.5*GAIN_SCALING_1*GAIN_SCALING_1*ol_pitch_coef*ol_pitch_coef);
437
438 ol_gain=SHR32(sqrt(1+ol_gain2/st->frameSize),SIG_SHIFT);
439
440 } else
441#endif
442 { 404 {
443 spx_word16_t g = compute_rms16(st->exc, st->frameSize); 405 spx_word16_t g = compute_rms16(st->exc, st->frameSize);
444 if (st->submodeID!=1 && ol_pitch>0) 406 if (st->submodeID!=1 && ol_pitch>0)
@@ -576,19 +538,12 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
576 538
577 if (st->encode_submode) 539 if (st->encode_submode)
578 { 540 {
579#ifdef EPIC_48K 541 /* First, transmit a zero for narrowband */
580 if (!st->lbr_48k) { 542 speex_bits_pack(bits, 0, 1);
581#endif
582
583 /* First, transmit a zero for narrowband */
584 speex_bits_pack(bits, 0, 1);
585 543
586 /* Transmit the sub-mode we use for this frame */ 544 /* Transmit the sub-mode we use for this frame */
587 speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS); 545 speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS);
588 546
589#ifdef EPIC_48K
590 }
591#endif
592 } 547 }
593 548
594 /* If null mode (no transmission), just set a couple things to zero*/ 549 /* If null mode (no transmission), just set a couple things to zero*/
@@ -627,35 +582,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
627 qlsp[i]=lsp[i]; 582 qlsp[i]=lsp[i];
628#endif 583#endif
629 584
630#ifdef EPIC_48K
631 if (st->lbr_48k) {
632 speex_bits_pack(bits, pitch_half[0]-st->min_pitch, 7);
633 speex_bits_pack(bits, pitch_half[1]-pitch_half[0]+1, 2);
634
635 {
636 int quant = (int)floor(.5+7.4*GAIN_SCALING_1*ol_pitch_coef);
637 if (quant>7)
638 quant=7;
639 if (quant<0)
640 quant=0;
641 ol_pitch_id=quant;
642 speex_bits_pack(bits, quant, 3);
643 ol_pitch_coef=GAIN_SCALING*0.13514*quant;
644
645 }
646 {
647 int qe = (int)(floor(.5+2.1*log(ol_gain*1.0/SIG_SCALING)))-2;
648 if (qe<0)
649 qe=0;
650 if (qe>15)
651 qe=15;
652 ol_gain = exp((qe+2)/2.1)*SIG_SCALING;
653 speex_bits_pack(bits, qe, 4);
654 }
655
656 } else {
657#endif
658
659 /*If we use low bit-rate pitch mode, transmit open-loop pitch*/ 585 /*If we use low bit-rate pitch mode, transmit open-loop pitch*/
660 if (SUBMODE(lbr_pitch)!=-1) 586 if (SUBMODE(lbr_pitch)!=-1)
661 { 587 {
@@ -700,10 +626,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
700#endif 626#endif
701 627
702 628
703#ifdef EPIC_48K
704 }
705#endif
706
707 629
708 /* Special case for first frame */ 630 /* Special case for first frame */
709 if (st->first) 631 if (st->first)
@@ -729,15 +651,6 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
729 spx_word16_t *exc; 651 spx_word16_t *exc;
730 int pitch; 652 int pitch;
731 int response_bound = st->subframeSize; 653 int response_bound = st->subframeSize;
732#ifdef EPIC_48K
733 if (st->lbr_48k)
734 {
735 if (sub*2 < st->nbSubframes)
736 ol_pitch = pitch_half[0];
737 else
738 ol_pitch = pitch_half[1];
739 }
740#endif
741 654
742 /* Offset relative to start of frame */ 655 /* Offset relative to start of frame */
743 offset = st->subframeSize*sub; 656 offset = st->subframeSize*sub;
@@ -876,24 +789,11 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
876 if (st->bounded_pitch && pit_max>offset) 789 if (st->bounded_pitch && pit_max>offset)
877 pit_max=offset; 790 pit_max=offset;
878 791
879#ifdef EPIC_48K
880 if (st->lbr_48k)
881 {
882 pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
883 exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
884 st->lpcSize, st->subframeSize, bits, stack,
885 exc, syn_resp, st->complexity, ol_pitch_id, st->plc_tuning, &st->cumul_gain);
886 } else {
887#endif
888
889 /* Perform pitch search */ 792 /* Perform pitch search */
890 pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2, 793 pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
891 exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef, 794 exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
892 st->lpcSize, st->subframeSize, bits, stack, 795 st->lpcSize, st->subframeSize, bits, stack,
893 exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain); 796 exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain);
894#ifdef EPIC_48K
895 }
896#endif
897 797
898 st->pitch[sub]=pitch; 798 st->pitch[sub]=pitch;
899 } 799 }
@@ -1054,9 +954,6 @@ void *nb_decoder_init(const SpeexMode *m)
1054 954
1055 955
1056 st->encode_submode = 1; 956 st->encode_submode = 1;
1057#ifdef EPIC_48K
1058 st->lbr_48k=mode->lbr48k;
1059#endif
1060 957
1061 st->first=1; 958 st->first=1;
1062 /* Codec parameters, should eventually have several "modes"*/ 959 /* Codec parameters, should eventually have several "modes"*/
@@ -1222,10 +1119,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
1222 VARDECL(spx_coef_t *ak); 1119 VARDECL(spx_coef_t *ak);
1223 VARDECL(spx_lsp_t *qlsp); 1120 VARDECL(spx_lsp_t *qlsp);
1224 spx_word16_t pitch_average=0; 1121 spx_word16_t pitch_average=0;
1225#ifdef EPIC_48K 1122
1226 int pitch_half[2] = {0, 0};
1227 int ol_pitch_id=0;
1228#endif
1229 spx_word16_t *out = (spx_word16_t*)vout; 1123 spx_word16_t *out = (spx_word16_t*)vout;
1230 VARDECL(spx_lsp_t *interp_qlsp); 1124 VARDECL(spx_lsp_t *interp_qlsp);
1231 1125
@@ -1247,9 +1141,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
1247 1141
1248 if (st->encode_submode) 1142 if (st->encode_submode)
1249 { 1143 {
1250#ifdef EPIC_48K
1251 if (!st->lbr_48k) {
1252#endif
1253 1144
1254 /* Search for next narrowband block (handle requests, skip wideband blocks) */ 1145 /* Search for next narrowband block (handle requests, skip wideband blocks) */
1255 do { 1146 do {
@@ -1322,9 +1213,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
1322 1213
1323 /* Get the sub-mode that was used */ 1214 /* Get the sub-mode that was used */
1324 st->submodeID = m; 1215 st->submodeID = m;
1325#ifdef EPIC_48K
1326 }
1327#endif
1328 } 1216 }
1329 1217
1330 } 1218 }
@@ -1387,23 +1275,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
1387 st->old_qlsp[i] = qlsp[i]; 1275 st->old_qlsp[i] = qlsp[i];
1388 } 1276 }
1389 1277
1390#ifdef EPIC_48K
1391 if (st->lbr_48k) {
1392 pitch_half[0] = st->min_pitch+speex_bits_unpack_unsigned(bits, 7);
1393 pitch_half[1] = pitch_half[0]+speex_bits_unpack_unsigned(bits, 2)-1;
1394
1395 ol_pitch_id = speex_bits_unpack_unsigned(bits, 3);
1396 ol_pitch_coef=GAIN_SCALING*0.13514*ol_pitch_id;
1397
1398 {
1399 int qe;
1400 qe = speex_bits_unpack_unsigned(bits, 4);
1401 ol_gain = SIG_SCALING*exp((qe+2)/2.1),SIG_SHIFT;
1402 }
1403
1404 } else {
1405#endif
1406
1407 /* Get open-loop pitch estimation for low bit-rate pitch coding */ 1278 /* Get open-loop pitch estimation for low bit-rate pitch coding */
1408 if (SUBMODE(lbr_pitch)!=-1) 1279 if (SUBMODE(lbr_pitch)!=-1)
1409 { 1280 {
@@ -1428,9 +1299,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
1428 ol_gain = SIG_SCALING*exp(qe/3.5); 1299 ol_gain = SIG_SCALING*exp(qe/3.5);
1429#endif 1300#endif
1430 } 1301 }
1431#ifdef EPIC_48K
1432 }
1433#endif
1434 1302
1435 ALLOC(ak, st->lpcSize, spx_coef_t); 1303 ALLOC(ak, st->lpcSize, spx_coef_t);
1436 ALLOC(innov, st->subframeSize, spx_sig_t); 1304 ALLOC(innov, st->subframeSize, spx_sig_t);
@@ -1458,16 +1326,6 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
1458 spx_word16_t *innov_save = NULL; 1326 spx_word16_t *innov_save = NULL;
1459 spx_word16_t tmp; 1327 spx_word16_t tmp;
1460 1328
1461#ifdef EPIC_48K
1462 if (st->lbr_48k)
1463 {
1464 if (sub*2 < st->nbSubframes)
1465 ol_pitch = pitch_half[0];
1466 else
1467 ol_pitch = pitch_half[1];
1468 }
1469#endif
1470
1471 /* Offset relative to start of frame */ 1329 /* Offset relative to start of frame */
1472 offset = st->subframeSize*sub; 1330 offset = st->subframeSize*sub;
1473 /* Excitation */ 1331 /* Excitation */
@@ -1516,22 +1374,11 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
1516 } 1374 }
1517 1375
1518 1376
1519#ifdef EPIC_48K
1520 if (st->lbr_48k)
1521 {
1522 SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params),
1523 st->subframeSize, &pitch, &pitch_gain[0], bits, stack,
1524 st->count_lost, offset, st->last_pitch_gain, ol_pitch_id);
1525 } else {
1526#endif
1527 1377
1528 SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params), 1378 SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params),
1529 st->subframeSize, &pitch, &pitch_gain[0], bits, stack, 1379 st->subframeSize, &pitch, &pitch_gain[0], bits, stack,
1530 st->count_lost, offset, st->last_pitch_gain, 0); 1380 st->count_lost, offset, st->last_pitch_gain, 0);
1531 1381
1532#ifdef EPIC_48K
1533 }
1534#endif
1535 /* Ensuring that things aren't blowing up as would happen if e.g. an encoder is 1382 /* Ensuring that things aren't blowing up as would happen if e.g. an encoder is
1536 crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat). 1383 crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat).
1537 We can probably be even more aggressive and limit to 15000 or so. */ 1384 We can probably be even more aggressive and limit to 15000 or so. */
diff --git a/apps/codecs/libspeex/nb_celp.h b/apps/codecs/libspeex/nb_celp.h
index 805c43c950..28ee9325a1 100644
--- a/apps/codecs/libspeex/nb_celp.h
+++ b/apps/codecs/libspeex/nb_celp.h
@@ -64,10 +64,6 @@ typedef struct EncState {
64 int ol_voiced; /**< Open-loop voiced/non-voiced decision */ 64 int ol_voiced; /**< Open-loop voiced/non-voiced decision */
65 int *pitch; 65 int *pitch;
66 66
67#ifdef EPIC_48K
68 int lbr_48k;
69#endif
70
71#ifdef VORBIS_PSYCHO 67#ifdef VORBIS_PSYCHO
72 VorbisPsy *psy; 68 VorbisPsy *psy;
73 float *psy_window; 69 float *psy_window;
@@ -134,10 +130,6 @@ typedef struct DecState {
134 int max_pitch; /**< Maximum pitch value allowed */ 130 int max_pitch; /**< Maximum pitch value allowed */
135 spx_int32_t sampling_rate; 131 spx_int32_t sampling_rate;
136 132
137#ifdef EPIC_48K
138 int lbr_48k;
139#endif
140
141 spx_word16_t last_ol_gain; /**< Open-loop gain for previous frame */ 133 spx_word16_t last_ol_gain; /**< Open-loop gain for previous frame */
142 134
143 char *stack; /**< Pseudo-stack allocation for temporary memory */ 135 char *stack; /**< Pseudo-stack allocation for temporary memory */
diff --git a/apps/codecs/libspeex/quant_lsp.c b/apps/codecs/libspeex/quant_lsp.c
index 9ab55cfcbd..10d5762017 100644
--- a/apps/codecs/libspeex/quant_lsp.c
+++ b/apps/codecs/libspeex/quant_lsp.c
@@ -390,67 +390,3 @@ void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
390#endif 390#endif
391 391
392 392
393#ifdef EPIC_48K
394
395extern const signed char cdbk_lsp_vlbr[5120];
396extern const signed char cdbk_lsp2_vlbr[160];
397
398#ifndef SPEEX_DISABLE_ENCODER
399void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
400{
401 int i;
402 int id;
403 spx_word16_t quant_weight[10];
404
405 for (i=0;i<order;i++)
406 qlsp[i]=lsp[i];
407
408 compute_quant_weights(qlsp, quant_weight, order);
409
410 for (i=0;i<order;i++)
411 qlsp[i]=SUB16(qlsp[i],LSP_SCALING*(.25*i+.3125));
412#ifndef FIXED_POINT
413 for (i=0;i<order;i++)
414 qlsp[i] = qlsp[i]*LSP_SCALE;
415#endif
416
417 id = lsp_quant(qlsp, cdbk_lsp_vlbr, 512, order);
418 speex_bits_pack(bits, id, 9);
419
420 for (i=0;i<order;i++)
421 qlsp[i]*=4;
422
423 id = lsp_weight_quant(qlsp, quant_weight, cdbk_lsp2_vlbr, 16, 10);
424 speex_bits_pack(bits, id, 4);
425
426#ifdef FIXED_POINT
427 for (i=0;i<order;i++)
428 qlsp[i]=PSHR16(qlsp[i],2);
429#else
430 for (i=0;i<order;i++)
431 qlsp[i]=qlsp[i]*0.00097655;
432#endif
433
434 for (i=0;i<order;i++)
435 qlsp[i]=lsp[i]-qlsp[i];
436}
437#endif /* SPEEX_DISABLE_ENCODER */
438
439void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits)
440{
441 int i, id;
442 for (i=0;i<order;i++)
443 lsp[i]=LSP_SCALING*(.25*i+.3125);
444
445
446 id=speex_bits_unpack_unsigned(bits, 9);
447 for (i=0;i<10;i++)
448 lsp[i] += LSP_SCALING*0.0039062*cdbk_lsp_vlbr[id*10+i];
449
450 id=speex_bits_unpack_unsigned(bits, 4);
451 for (i=0;i<10;i++)
452 lsp[i] += LSP_SCALING*0.00097655*cdbk_lsp2_vlbr[id*10+i];
453
454}
455
456#endif
diff --git a/apps/codecs/libspeex/quant_lsp.h b/apps/codecs/libspeex/quant_lsp.h
index c6d5bb36e1..828dffc4f5 100644
--- a/apps/codecs/libspeex/quant_lsp.h
+++ b/apps/codecs/libspeex/quant_lsp.h
@@ -71,13 +71,4 @@ void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
71/* Decodes high-band LSPs */ 71/* Decodes high-band LSPs */
72void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits); 72void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits);
73 73
74#ifdef EPIC_48K
75/* Quantizes narrowband LSPs with 14 bits */
76void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
77
78/* Decodes quantized narrowband LSPs (14 bits) */
79void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits);
80#endif
81
82
83#endif 74#endif