[xiph-commits] r11959 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Fri Oct 27 04:36:08 PDT 2006
Author: jm
Date: 2006-10-27 04:36:04 -0700 (Fri, 27 Oct 2006)
New Revision: 11959
Modified:
trunk/speex/libspeex/filterbank.c
trunk/speex/libspeex/filterbank.h
trunk/speex/libspeex/preprocess.c
Log:
ps and echo_noise in fixed-point.
Modified: trunk/speex/libspeex/filterbank.c
===================================================================
--- trunk/speex/libspeex/filterbank.c 2006-10-27 10:35:54 UTC (rev 11958)
+++ trunk/speex/libspeex/filterbank.c 2006-10-27 11:36:04 UTC (rev 11959)
@@ -111,6 +111,24 @@
speex_free(bank);
}
+void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel)
+{
+ int i;
+ for (i=0;i<bank->nb_banks;i++)
+ mel[i] = 0;
+
+ for (i=0;i<bank->len;i++)
+ {
+ int id = bank->bank_left[i];
+ mel[id] += bank->filter_left[i]*ps[i];
+ id = bank->bank_right[i];
+ mel[id] += bank->filter_right[i]*ps[i];
+ }
+ for (i=0;i<bank->nb_banks;i++)
+ mel[i] *= bank->scaling[i];
+
+}
+
void filterbank_compute_bank(FilterBank *bank, float *ps, float *mel)
{
int i;
Modified: trunk/speex/libspeex/filterbank.h
===================================================================
--- trunk/speex/libspeex/filterbank.h 2006-10-27 10:35:54 UTC (rev 11958)
+++ trunk/speex/libspeex/filterbank.h 2006-10-27 11:36:04 UTC (rev 11959)
@@ -53,6 +53,8 @@
void filterbank_compute_bank(FilterBank *bank, float *psd, float *mel);
+void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel);
+
void filterbank_compute_psd(FilterBank *bank, float *mel, float *psd);
Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c 2006-10-27 10:35:54 UTC (rev 11958)
+++ trunk/speex/libspeex/preprocess.c 2006-10-27 11:36:04 UTC (rev 11959)
@@ -114,7 +114,7 @@
/* DSP-related arrays */
spx_word16_t *frame; /**< Processing frame (2*ps_size) */
spx_word16_t *ft; /**< Processing frame in freq domain (2*ps_size) */
- float *ps; /**< Current power spectrum */
+ spx_word32_t *ps; /**< Current power spectrum */
float *gain2; /**< Adjusted gains */
float *gain_floor; /**< Minimum gain allowed */
float *window; /**< Analysis/Synthesis window */
@@ -134,7 +134,7 @@
float *loudness_weight; /**< Perceptual loudness curve */
- float *echo_noise;
+ spx_word32_t *echo_noise;
spx_word32_t *residual_echo;
/* Misc */
@@ -268,9 +268,9 @@
st->window = (float*)speex_alloc(2*N*sizeof(float));
st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(float));
- st->ps = (float*)speex_alloc((N+M)*sizeof(float));
+ st->ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
st->noise = (float*)speex_alloc((N+M)*sizeof(float));
- st->echo_noise = (float*)speex_alloc((N+M)*sizeof(float));
+ st->echo_noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
st->residual_echo = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
st->reverb_estimate = (float*)speex_alloc((N+M)*sizeof(float));
st->old_ps = (float*)speex_alloc((N+M)*sizeof(float));
@@ -438,7 +438,7 @@
int N = st->ps_size;
int N3 = 2*N - st->frame_size;
int N4 = st->frame_size - N3;
- float *ps=st->ps;
+ spx_word32_t *ps=st->ps;
/* 'Build' input frame */
for (i=0;i<N3;i++)
@@ -462,7 +462,7 @@
for (i=1;i<N;i++)
ps[i]=1+MULT16_16(st->ft[2*i-1],st->ft[2*i-1]) + MULT16_16(st->ft[2*i],st->ft[2*i]);
- filterbank_compute_bank(st->bank, ps, ps+N);
+ filterbank_compute_bank32(st->bank, ps, ps+N);
}
static void update_noise_prob(SpeexPreprocessState *st)
@@ -532,7 +532,7 @@
int N = st->ps_size;
int N3 = 2*N - st->frame_size;
int N4 = st->frame_size - N3;
- float *ps=st->ps;
+ spx_word32_t *ps=st->ps;
float Zframe=0, Pframe;
float beta, beta_1;
float echo_floor;
@@ -552,7 +552,7 @@
speex_echo_get_residual(st->echo_state, st->residual_echo, N);
for (i=0;i<N;i++)
st->echo_noise[i] = MAX32(.6f*st->echo_noise[i], st->residual_echo[i]);
- filterbank_compute_bank(st->bank, st->echo_noise, st->echo_noise+N);
+ filterbank_compute_bank32(st->bank, st->echo_noise, st->echo_noise+N);
} else {
for (i=0;i<N+M;i++)
st->echo_noise[i] = 0;
@@ -779,7 +779,7 @@
int N = st->ps_size;
int N3 = 2*N - st->frame_size;
int M;
- float *ps=st->ps;
+ spx_word32_t *ps=st->ps;
M = st->nbands;
st->min_count++;
More information about the commits
mailing list