fixed-point: Got rid of the three last float bits in the
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Mon, 19 Nov 2007 12:54:38 +0000 (12:54 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Mon, 19 Nov 2007 12:54:38 +0000 (12:54 +0000)
preprocessor and echo canceller.

git-svn-id: http://svn.xiph.org/trunk/speex@14185 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/mdf.c
libspeex/preprocess.c

index 1b63c0e..1fbb4d6 100644 (file)
@@ -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;
    }
index 75a20be..d94a75a 100644 (file)
@@ -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: