[Speex-dev] [patch] speex_preprocess_ctl
Mikael Magnusson
mikma264 at gmail.com
Mon Oct 29 16:14:13 PDT 2007
There is a problem in speex_preprocess_ctl. Both speech_prob_start and
speech_prob_continue are set to 327.67 for all input values except 0
which results in 0. This is in floating point mode.
I think the included patch fixes the problem.
Mikael
-------------- next part --------------
Index: libspeex/preprocess.c
===================================================================
--- libspeex/preprocess.c (revision 13983)
+++ libspeex/preprocess.c (arbetskopia)
@@ -1126,16 +1126,16 @@
break;
case SPEEX_PREPROCESS_SET_PROB_START:
- *(spx_int32_t*)ptr = MIN32(Q15_ONE,MAX32(0, *(spx_int32_t*)ptr));
- st->speech_prob_start = DIV32_16(MULT16_16(32767,*(spx_int32_t*)ptr), 100);
+ *(spx_int32_t*)ptr = MIN32(100,MAX32(0, *(spx_int32_t*)ptr));
+ st->speech_prob_start = DIV32_16(MULT16_16(Q15ONE,*(spx_int32_t*)ptr), 100);
break;
case SPEEX_PREPROCESS_GET_PROB_START:
(*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob_start, 100);
break;
case SPEEX_PREPROCESS_SET_PROB_CONTINUE:
- *(spx_int32_t*)ptr = MIN32(Q15_ONE,MAX32(0, *(spx_int32_t*)ptr));
- st->speech_prob_continue = DIV32_16(MULT16_16(32767,*(spx_int32_t*)ptr), 100);
+ *(spx_int32_t*)ptr = MIN32(100,MAX32(0, *(spx_int32_t*)ptr));
+ st->speech_prob_continue = DIV32_16(MULT16_16(Q15ONE,*(spx_int32_t*)ptr), 100);
break;
case SPEEX_PREPROCESS_GET_PROB_CONTINUE:
(*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob_continue, 100);
More information about the Speex-dev
mailing list