[xiph-commits] r14229 - in trunk/speex: . libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Sun Nov 25 06:16:13 PST 2007
Author: jm
Date: 2007-11-25 06:16:13 -0800 (Sun, 25 Nov 2007)
New Revision: 14229
Modified:
trunk/speex/TODO
trunk/speex/libspeex/resample.c
Log:
resampler: fixed a couple segfaults when passing NULL as the input
Modified: trunk/speex/TODO
===================================================================
--- trunk/speex/TODO 2007-11-25 10:01:12 UTC (rev 14228)
+++ trunk/speex/TODO 2007-11-25 14:16:13 UTC (rev 14229)
@@ -1,18 +1,16 @@
For 1.2beta3:
Control delay in new AEC API.
-Implement speex_header_free()
better error reporting
-improve float<->int conversion
NaN checks?
Eventually:
+improve float<->int conversion
Fix last frame of speexenc
split encoder and decoder?
Merge TriMedia stuff
packet dump
Do VAD properly
-Warning/error handling
--enable-{aec,preprocessor,jitter,resampler}
Optimisations
Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c 2007-11-25 10:01:12 UTC (rev 14228)
+++ trunk/speex/libspeex/resample.c 2007-11-25 14:16:13 UTC (rev 14229)
@@ -840,9 +840,14 @@
for (j=0;j<N-1-(spx_int32_t)*in_len;j++)
mem[j] = mem[j+*in_len];
- for (;j<N-1;j++)
- mem[j] = in[st->in_stride*(j+*in_len-N+1)];
-
+ if (in != NULL)
+ {
+ for (;j<N-1;j++)
+ mem[j] = in[st->in_stride*(j+*in_len-N+1)];
+ } else {
+ for (;j<N-1;j++)
+ mem[j] = 0;
+ }
return RESAMPLER_ERR_SUCCESS;
}
@@ -862,10 +867,16 @@
ALLOC(y, *out_len, spx_word16_t);*/
istride_save = st->in_stride;
ostride_save = st->out_stride;
- for (i=0;i<*in_len;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);
+ if (in != NULL)
+ {
+ for (i=0;i<*in_len;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);
+ } else {
+ st->in_stride = st->out_stride = 1;
+ speex_resampler_process_native(st, channel_index, NULL, in_len, y, out_len);
+ }
st->in_stride = istride_save;
st->out_stride = ostride_save;
for (i=0;i<*out_len;i++)
@@ -885,10 +896,16 @@
ichunk=FIXED_STACK_ALLOC;
if (ochunk>FIXED_STACK_ALLOC)
ochunk=FIXED_STACK_ALLOC;
- for (i=0;i<ichunk;i++)
- x[i] = WORD2INT(in[i*st->in_stride]);
- st->in_stride = st->out_stride = 1;
- speex_resampler_process_native(st, channel_index, x, &ichunk, y, &ochunk);
+ if (in != NULL)
+ {
+ for (i=0;i<ichunk;i++)
+ x[i] = WORD2INT(in[i*st->in_stride]);
+ st->in_stride = st->out_stride = 1;
+ speex_resampler_process_native(st, channel_index, x, &ichunk, y, &ochunk);
+ } else {
+ st->in_stride = st->out_stride = 1;
+ speex_resampler_process_native(st, channel_index, NULL, &ichunk, y, &ochunk);
+ }
st->in_stride = istride_save;
st->out_stride = ostride_save;
for (i=0;i<ochunk;i++)
@@ -925,10 +942,16 @@
ALLOC(y, *out_len, spx_word16_t);*/
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);
+ if (in != NULL)
+ {
+ 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);
+ } else {
+ st->in_stride = st->out_stride = 1;
+ speex_resampler_process_native(st, channel_index, NULL, in_len, y, out_len);
+ }
st->in_stride = istride_save;
st->out_stride = ostride_save;
for (i=0;i<*out_len;i++)
@@ -948,10 +971,16 @@
ichunk=FIXED_STACK_ALLOC;
if (ochunk>FIXED_STACK_ALLOC)
ochunk=FIXED_STACK_ALLOC;
- for (i=0;i<ichunk;i++)
- x[i] = in[i*st->in_stride];
- st->in_stride = st->out_stride = 1;
- speex_resampler_process_native(st, channel_index, x, &ichunk, y, &ochunk);
+ if (in != NULL)
+ {
+ for (i=0;i<ichunk;i++)
+ x[i] = in[i*st->in_stride];
+ st->in_stride = st->out_stride = 1;
+ speex_resampler_process_native(st, channel_index, x, &ichunk, y, &ochunk);
+ } else {
+ st->in_stride = st->out_stride = 1;
+ speex_resampler_process_native(st, channel_index, NULL, &ichunk, y, &ochunk);
+ }
st->in_stride = istride_save;
st->out_stride = ostride_save;
for (i=0;i<ochunk;i++)
More information about the commits
mailing list