diff options
author | jm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2007-11-19 15:54:38 +0300 |
---|---|---|
committer | jm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2007-11-19 15:54:38 +0300 |
commit | 37657c2b0b228b26ebecf31e36c69327489e66f1 (patch) | |
tree | 0a9ff0ff613f6602df5950a4518edfdbd24f62b4 /libspeex | |
parent | e251708432ca796b373d056bbd9c8744738e6079 (diff) |
fixed-point: Got rid of the three last float bits in the
preprocessor and echo canceller.
git-svn-id: http://svn.xiph.org/trunk/speex@14185 0101bb08-14d6-0310-b084-bc0e0c8e3800
Diffstat (limited to 'libspeex')
-rw-r--r-- | libspeex/mdf.c | 2 | ||||
-rw-r--r-- | libspeex/preprocess.c | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/libspeex/mdf.c b/libspeex/mdf.c index 1b63c0e..1fbb4d6 100644 --- a/libspeex/mdf.c +++ b/libspeex/mdf.c @@ -1042,7 +1042,7 @@ void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, const sp #endif /* We consider that the filter has had minimal adaptation if the following is true*/ - if (!st->adapted && st->sum_adapt > QCONST32(M,15) && MULT16_32_Q15(st->leak_estimate,Syy) > MULT16_32_Q15(QCONST16(.03f,15),Syy)) + if (!st->adapted && st->sum_adapt > SHL32(EXTEND32(M),15) && MULT16_32_Q15(st->leak_estimate,Syy) > MULT16_32_Q15(QCONST16(.03f,15),Syy)) { st->adapted = 1; } diff --git a/libspeex/preprocess.c b/libspeex/preprocess.c index 75a20be..d94a75a 100644 --- a/libspeex/preprocess.c +++ b/libspeex/preprocess.c @@ -277,7 +277,7 @@ static void conj_window(spx_word16_t *w, int len) x=QCONST16(2.f,13)-x+QCONST16(2.f,13); /* 4 - x */ } x = MULT16_16_Q14(QCONST16(1.271903f,14), x); - tmp = SQR16_Q15(QCONST16(.5f,15)-MULT16_16_P15(QCONST16(.5f,15),spx_cos_norm(QCONST32(x,2)))); + tmp = SQR16_Q15(QCONST16(.5f,15)-MULT16_16_P15(QCONST16(.5f,15),spx_cos_norm(SHL32(EXTEND32(x),2)))); if (inv) tmp=SUB16(Q15_ONE,tmp); w[i]=spx_sqrt(SHL32(EXTEND32(tmp),15)); @@ -1067,14 +1067,14 @@ int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *ptr) break; case SPEEX_PREPROCESS_SET_AGC_LEVEL: - st->agc_level = (*(float*)ptr); + st->agc_level = (*(spx_int32_t*)ptr); if (st->agc_level<1) st->agc_level=1; if (st->agc_level>32768) st->agc_level=32768; break; case SPEEX_PREPROCESS_GET_AGC_LEVEL: - (*(float*)ptr) = st->agc_level; + (*(spx_int32_t*)ptr) = st->agc_level; break; case SPEEX_PREPROCESS_SET_AGC_INCREMENT: st->max_increase_step = exp(0.11513f * (*(spx_int32_t*)ptr)*st->frame_size / st->sampling_rate); @@ -1113,17 +1113,21 @@ int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *ptr) break; case SPEEX_PREPROCESS_SET_DEREVERB_LEVEL: - st->reverb_level = (*(float*)ptr); + /* FIXME: Re-enable when de-reverberation is actually enabled again */ + /*st->reverb_level = (*(float*)ptr);*/ break; case SPEEX_PREPROCESS_GET_DEREVERB_LEVEL: - (*(float*)ptr) = st->reverb_level; + /* FIXME: Re-enable when de-reverberation is actually enabled again */ + /*(*(float*)ptr) = st->reverb_level;*/ break; case SPEEX_PREPROCESS_SET_DEREVERB_DECAY: - st->reverb_decay = (*(float*)ptr); + /* FIXME: Re-enable when de-reverberation is actually enabled again */ + /*st->reverb_decay = (*(float*)ptr);*/ break; case SPEEX_PREPROCESS_GET_DEREVERB_DECAY: - (*(float*)ptr) = st->reverb_decay; + /* FIXME: Re-enable when de-reverberation is actually enabled again */ + /*(*(float*)ptr) = st->reverb_decay;*/ break; case SPEEX_PREPROCESS_SET_PROB_START: |