diff options
Diffstat (limited to 'apps/codecs/libspeex')
-rw-r--r-- | apps/codecs/libspeex/arch.h | 4 | ||||
-rw-r--r-- | apps/codecs/libspeex/nb_celp.c | 19 | ||||
-rw-r--r-- | apps/codecs/libspeex/speex_callbacks.c | 3 |
3 files changed, 17 insertions, 9 deletions
diff --git a/apps/codecs/libspeex/arch.h b/apps/codecs/libspeex/arch.h index e2d731acc0..1e48e93388 100644 --- a/apps/codecs/libspeex/arch.h +++ b/apps/codecs/libspeex/arch.h | |||
@@ -68,6 +68,7 @@ typedef spx_word32_t spx_sig_t; | |||
68 | #define LPC_SHIFT 13 | 68 | #define LPC_SHIFT 13 |
69 | #define LSP_SHIFT 13 | 69 | #define LSP_SHIFT 13 |
70 | #define SIG_SHIFT 14 | 70 | #define SIG_SHIFT 14 |
71 | #define GAIN_SHIFT 6 | ||
71 | 72 | ||
72 | #define VERY_SMALL 0 | 73 | #define VERY_SMALL 0 |
73 | #define VERY_LARGE32 ((spx_word32_t)2147483647) | 74 | #define VERY_LARGE32 ((spx_word32_t)2147483647) |
@@ -111,9 +112,6 @@ typedef float spx_word32_t; | |||
111 | #define GAIN_SCALING 1.f | 112 | #define GAIN_SCALING 1.f |
112 | #define GAIN_SCALING_1 1.f | 113 | #define GAIN_SCALING_1 1.f |
113 | 114 | ||
114 | #define LPC_SHIFT 0 | ||
115 | #define LSP_SHIFT 0 | ||
116 | #define SIG_SHIFT 0 | ||
117 | 115 | ||
118 | #define VERY_SMALL 1e-15f | 116 | #define VERY_SMALL 1e-15f |
119 | #define VERY_LARGE32 1e15f | 117 | #define VERY_LARGE32 1e15f |
diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c index 4751068153..f3810894e1 100644 --- a/apps/codecs/libspeex/nb_celp.c +++ b/apps/codecs/libspeex/nb_celp.c | |||
@@ -665,13 +665,17 @@ int nb_encode(void *state, void *vin, SpeexBits *bits) | |||
665 | if (SUBMODE(forced_pitch_gain)) | 665 | if (SUBMODE(forced_pitch_gain)) |
666 | { | 666 | { |
667 | int quant; | 667 | int quant; |
668 | #ifdef FIXED_POINT | ||
669 | quant = PSHR16(MULT16_16_16(15, ol_pitch_coef),GAIN_SHIFT); | ||
670 | #else | ||
668 | quant = (int)floor(.5+15*ol_pitch_coef*GAIN_SCALING_1); | 671 | quant = (int)floor(.5+15*ol_pitch_coef*GAIN_SCALING_1); |
672 | #endif | ||
669 | if (quant>15) | 673 | if (quant>15) |
670 | quant=15; | 674 | quant=15; |
671 | if (quant<0) | 675 | if (quant<0) |
672 | quant=0; | 676 | quant=0; |
673 | speex_bits_pack(bits, quant, 4); | 677 | speex_bits_pack(bits, quant, 4); |
674 | ol_pitch_coef=GAIN_SCALING*0.066667*quant; | 678 | ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT)); |
675 | } | 679 | } |
676 | 680 | ||
677 | 681 | ||
@@ -1410,7 +1414,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) | |||
1410 | { | 1414 | { |
1411 | int quant; | 1415 | int quant; |
1412 | quant = speex_bits_unpack_unsigned(bits, 4); | 1416 | quant = speex_bits_unpack_unsigned(bits, 4); |
1413 | ol_pitch_coef=GAIN_SCALING*0.066667*quant; | 1417 | ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT)); |
1414 | } | 1418 | } |
1415 | 1419 | ||
1416 | /* Get global excitation gain */ | 1420 | /* Get global excitation gain */ |
@@ -1572,11 +1576,9 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) | |||
1572 | /*Fixed codebook contribution*/ | 1576 | /*Fixed codebook contribution*/ |
1573 | SUBMODE(innovation_unquant)(innov, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed); | 1577 | SUBMODE(innovation_unquant)(innov, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed); |
1574 | /* De-normalize innovation and update excitation */ | 1578 | /* De-normalize innovation and update excitation */ |
1575 | #ifdef FIXED_POINT | 1579 | |
1576 | signal_mul(innov, innov, ener, st->subframeSize); | ||
1577 | #else | ||
1578 | signal_mul(innov, innov, ener, st->subframeSize); | 1580 | signal_mul(innov, innov, ener, st->subframeSize); |
1579 | #endif | 1581 | |
1580 | /* Decode second codebook (only for some modes) */ | 1582 | /* Decode second codebook (only for some modes) */ |
1581 | if (SUBMODE(double_codebook)) | 1583 | if (SUBMODE(double_codebook)) |
1582 | { | 1584 | { |
@@ -2026,6 +2028,8 @@ int nb_decoder_ctl(void *state, int request, void *ptr) | |||
2026 | break; | 2028 | break; |
2027 | case SPEEX_GET_ACTIVITY: | 2029 | case SPEEX_GET_ACTIVITY: |
2028 | { | 2030 | { |
2031 | /* We don't use this, dummy it out to get rid of the float stuff */ | ||
2032 | #if 0 | ||
2029 | float ret; | 2033 | float ret; |
2030 | ret = log(st->level/st->min_level)/log(st->max_level/st->min_level); | 2034 | ret = log(st->level/st->min_level)/log(st->max_level/st->min_level); |
2031 | if (ret>1) | 2035 | if (ret>1) |
@@ -2035,6 +2039,9 @@ int nb_decoder_ctl(void *state, int request, void *ptr) | |||
2035 | ret = 0; | 2039 | ret = 0; |
2036 | /*printf ("%f %f %f %f\n", st->level, st->min_level, st->max_level, ret);*/ | 2040 | /*printf ("%f %f %f %f\n", st->level, st->min_level, st->max_level, ret);*/ |
2037 | (*(spx_int32_t*)ptr) = (int)(100*ret); | 2041 | (*(spx_int32_t*)ptr) = (int)(100*ret); |
2042 | #else | ||
2043 | (*(spx_int32_t*)ptr) = (int)(0); | ||
2044 | #endif | ||
2038 | } | 2045 | } |
2039 | break; | 2046 | break; |
2040 | case SPEEX_GET_PI_GAIN: | 2047 | case SPEEX_GET_PI_GAIN: |
diff --git a/apps/codecs/libspeex/speex_callbacks.c b/apps/codecs/libspeex/speex_callbacks.c index 9883d72e50..ca29e1b32b 100644 --- a/apps/codecs/libspeex/speex_callbacks.c +++ b/apps/codecs/libspeex/speex_callbacks.c | |||
@@ -114,9 +114,12 @@ int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data) | |||
114 | 114 | ||
115 | int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data) | 115 | int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data) |
116 | { | 116 | { |
117 | /* We don't use this, get rid of the float reference */ | ||
118 | #if 0 | ||
117 | float qual; | 119 | float qual; |
118 | qual = speex_bits_unpack_unsigned(bits, 4); | 120 | qual = speex_bits_unpack_unsigned(bits, 4); |
119 | speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual); | 121 | speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual); |
122 | #endif | ||
120 | return 0; | 123 | return 0; |
121 | } | 124 | } |
122 | 125 | ||