[xiph-commits] r12425 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Sun Feb 4 03:55:31 PST 2007
Author: jm
Date: 2007-02-04 03:55:24 -0800 (Sun, 04 Feb 2007)
New Revision: 12425
Modified:
trunk/speex/libspeex/resample.c
Log:
float<->int conversion with a few less bugs (actually works for the first time)
Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c 2007-02-04 10:48:03 UTC (rev 12424)
+++ trunk/speex/libspeex/resample.c 2007-02-04 11:55:24 UTC (rev 12425)
@@ -491,14 +491,19 @@
void speex_resampler_process_float(SpeexResamplerState *st, int channel_index, const float *in, int *in_len, float *out, int *out_len)
{
int i;
+ int istride_save, ostride_save;
spx_word16_t x[*in_len];
spx_word16_t y[*out_len];
+ istride_save = st->in_stride;
+ ostride_save = st->out_stride;
for (i=0;i<*in_len;i++)
- x[i] = WORD2INT(in[i]);
+ x[i] = WORD2INT(in[i*st->in_stride]);
+ st->in_stride = st->out_stride = 1;
speex_resampler_process_native(st, channel_index, x, in_len, y, out_len);
+ st->in_stride = istride_save;
+ st->out_stride = ostride_save;
for (i=0;i<*out_len;i++)
- out[i] = y[i];
-
+ out[i*st->out_stride] = y[i];
}
void speex_resampler_process_int(SpeexResamplerState *st, int channel_index, const spx_int16_t *in, int *in_len, spx_int16_t *out, int *out_len)
{
@@ -512,13 +517,19 @@
void speex_resampler_process_int(SpeexResamplerState *st, int channel_index, const spx_int16_t *in, int *in_len, spx_int16_t *out, int *out_len)
{
int i;
+ int istride_save, ostride_save;
spx_word16_t x[*in_len];
spx_word16_t y[*out_len];
+ istride_save = st->in_stride;
+ ostride_save = st->out_stride;
+ for (i=0;i<*in_len;i++)
+ x[i] = in[i+st->in_stride];
+ st->in_stride = st->out_stride = 1;
+ speex_resampler_process_native(st, channel_index, x, in_len, y, out_len);
+ st->in_stride = istride_save;
+ st->out_stride = ostride_save;
for (i=0;i<*out_len;i++)
- x[i] = in[i];
- speex_resampler_process_native(st, channel_index, x, in_len, y, out_len);
- for (i=0;i<*in_len;i++)
- out[i] = WORD2INT(y[i]);
+ out[i+st->out_stride] = WORD2INT(y[i]);
}
#endif
More information about the commits
mailing list