summaryrefslogtreecommitdiff
path: root/apps/codecs/libspeex/nb_celp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libspeex/nb_celp.c')
-rw-r--r--apps/codecs/libspeex/nb_celp.c19
1 files changed, 13 insertions, 6 deletions
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: