[xiph-commits] r12018 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Sat Nov 4 21:03:31 PST 2006
Author: jm
Date: 2006-11-04 21:03:29 -0800 (Sat, 04 Nov 2006)
New Revision: 12018
Modified:
trunk/speex/libspeex/filterbank.c
trunk/speex/libspeex/preprocess.c
Log:
OK, so allocating 4 bytes per short did tend to increase memory usage
unnecessarily... fixed now.
Modified: trunk/speex/libspeex/filterbank.c
===================================================================
--- trunk/speex/libspeex/filterbank.c 2006-11-05 04:16:57 UTC (rev 12017)
+++ trunk/speex/libspeex/filterbank.c 2006-11-05 05:03:29 UTC (rev 12018)
@@ -59,16 +59,16 @@
max_mel = toBARK(.5*sampling);
mel_interval = max_mel/(banks-1);
- bank = speex_alloc(sizeof(FilterBank));
+ bank = (FilterBank*)speex_alloc(sizeof(FilterBank));
bank->nb_banks = banks;
bank->len = len;
- bank->bank_left = speex_alloc(len*sizeof(int));
- bank->bank_right = speex_alloc(len*sizeof(int));
- bank->filter_left = speex_alloc(len*sizeof(spx_word16_t));
- bank->filter_right = speex_alloc(len*sizeof(spx_word16_t));
+ bank->bank_left = (int*)speex_alloc(len*sizeof(int));
+ bank->bank_right = (int*)speex_alloc(len*sizeof(int));
+ bank->filter_left = (spx_word16_t*)speex_alloc(len*sizeof(spx_word16_t));
+ bank->filter_right = (spx_word16_t*)speex_alloc(len*sizeof(spx_word16_t));
/* Think I can safely disable normalisation that for fixed-point (and probably float as well) */
#ifndef FIXED_POINT
- bank->scaling = speex_alloc(banks*sizeof(float));
+ bank->scaling = (float*)speex_alloc(banks*sizeof(float));
#endif
for (i=0;i<len;i++)
{
Modified: trunk/speex/libspeex/preprocess.c
===================================================================
--- trunk/speex/libspeex/preprocess.c 2006-11-05 04:16:57 UTC (rev 12017)
+++ trunk/speex/libspeex/preprocess.c 2006-11-05 05:03:29 UTC (rev 12018)
@@ -386,31 +386,31 @@
M = st->nbands;
st->bank = filterbank_new(M, sampling_rate, N, 1);
- st->frame = (spx_word16_t*)speex_alloc(2*N*sizeof(float));
- st->window = (spx_word16_t*)speex_alloc(2*N*sizeof(float));
- st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(float));
+ st->frame = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
+ st->window = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
+ st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
- st->ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
- st->noise = (spx_word32_t*)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 = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
- st->old_ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(float));
- st->prior = (spx_word16_t*)speex_alloc((N+M)*sizeof(float));
- st->post = (spx_word16_t*)speex_alloc((N+M)*sizeof(float));
- st->gain = (spx_word16_t*)speex_alloc((N+M)*sizeof(float));
- st->gain2 = (spx_word16_t*)speex_alloc((N+M)*sizeof(float));
- st->gain_floor = (spx_word16_t*)speex_alloc((N+M)*sizeof(float));
- st->zeta = (spx_word16_t*)speex_alloc((N+M)*sizeof(float));
+ st->ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+ st->noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+ st->echo_noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+ st->residual_echo = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+ st->reverb_estimate = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+ st->old_ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
+ st->prior = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+ st->post = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+ st->gain = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+ st->gain2 = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+ st->gain_floor = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
+ st->zeta = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
- st->S = (spx_word32_t*)speex_alloc(N*sizeof(float));
- st->Smin = (spx_word32_t*)speex_alloc(N*sizeof(float));
- st->Stmp = (spx_word32_t*)speex_alloc(N*sizeof(float));
- st->update_prob = (int*)speex_alloc(N*sizeof(float));
+ st->S = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
+ st->Smin = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
+ st->Stmp = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
+ st->update_prob = (int*)speex_alloc(N*sizeof(int));
st->loudness_weight = (float*)speex_alloc(N*sizeof(float));
- st->inbuf = (spx_word16_t*)speex_alloc(N3*sizeof(float));
- st->outbuf = (spx_word16_t*)speex_alloc(N3*sizeof(float));
+ st->inbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t));
+ st->outbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t));
conj_window(st->window, 2*N3);
for (i=2*N3;i<2*st->ps_size;i++)
More information about the commits
mailing list