[Speex-dev] Little bug in the libspeexdsp resampler
John Ridges
jridges at masque.com
Fri Oct 23 13:59:15 PDT 2009
Hi Jean-Marc,
I reported this bug a couple of months ago and either it got lost or I
just didn't make my case very well. Let me see if I can explain why
"speex_resampler_process_interleaved_int" and
"speex_resampler_process_interleaved_float" in the resampler have a problem.
If you call "speex_resampler_process_interleaved_int" with a small
"out_len" (and therefore is output limited), then the first time the
function calls "speex_resampler_process_int", it changes "in_len" to the
number of input samples it no longer needs to see again (I note that
this is different than the number of samples it may have *used*). The
problem is that for the second (and subsiquent) channels, while
"out_len" is reset to the original value, "in_len" is not, and so it is
possible that the subsiquent calls to "speex_resampler_process_int"
could be *input* limited, which will make that channel produce a
different number of output samples than the first channel. An example:
resampler set to an input rate of 8000 Hz, and an output rate of 16000
Hz, and "speex_resampler_process_interleaved_int" is called with in_len
= 1000000 and out_len = 101. This is what happens inside the function:
before first call to speex_resampler_process_int, in_len = 1000000,
out_len = 101
after first call to speex_resampler_process_int, in_len = 50, out_len =
101 (output limited)
out_len reset to 101 so -
before second call to speex_resampler_process_int, in_len = 50, out_len
= 101
after second call to speex_resampler_process_int, in_len = 50, out_len =
100 (input limited)
and so "speex_resampler_process_interleaved_int" returns an in_len = 50
and out_len = 100, and I think the expectation of that function is that
either it will change in_len or out_len, but not both.
--John Ridges
More information about the Speex-dev
mailing list