xiph / speexdsp

Speex audio processing library - THIS IS A MIRROR, DEVELOPMENT HAPPENS AT https://gitlab.xiph.org/xiph/speexdsp
https://speex.org
Other
469 stars 190 forks source link

Test the interleaved resampler #40

Open lu-zero opened 2 years ago

lu-zero commented 2 years ago

It expose apparently a problem in the interleaved codepath, valgrind complains this way:

==22162== Invalid read of size 4
==22162==    at 0x10A000: speex_resampler_process_float (resample.c:947)
==22162==    by 0x10A53D: speex_resampler_process_interleaved_float (resample.c:1052)
==22162==    by 0x108B62: main (testresample2.c:72)
==22162==  Address 0x554dff0 is 0 bytes after a block of size 8,192 alloc'd
==22162==    at 0x4C38305: malloc (vg_replace_malloc.c:380)
==22162==    by 0x108A52: main (testresample2.c:56)
==22162==
==22162== Invalid read of size 4
==22162==    at 0x10A013: speex_resampler_process_float (resample.c:946)
==22162==    by 0x10A53D: speex_resampler_process_interleaved_float (resample.c:1052)
==22162==    by 0x108B62: main (testresample2.c:72)
==22162==  Address 0x554dff8 is 8 bytes after a block of size 8,192 alloc'd
==22162==    at 0x4C38305: malloc (vg_replace_malloc.c:380)
==22162==    by 0x108A52: main (testresample2.c:56)
==22162==

To reproduce:

./configure --enable-examples --enable-static --disable-shared
make clean && make -j 8
valgrind ./libspeexdsp/testresample2 > /tmp/out
tmatth commented 2 years ago

@lu-zero thanks, could you make this a command-line argument (like a boolean for stereo or interleaved) as I know @wtay was using this for evaluating this resampler against others (presumably also in mono) and I don't want to break that use case.

lu-zero commented 2 years ago

Sure

tmatth commented 2 years ago

@lu-zero can't reproduce here, seems to be valgrind clean.

lu-zero commented 2 years ago

I fixed its usage mistake, I have yet to make sure that resampling all the channels produces the same result per-channel, but maybe it is better to write it as a different test application.