[linux-audio-dev] Re: Looking for fast integer resampling code

Erik de Castro Lopo erikd-lad at mega-nerd.com
Mon Jun 13 06:59:57 UTC 2005


Kjetil Svalastog Matheussen wrote:

> 
> I recently did a lot of benchmarking between libsamplerate and mus_src
> in clm/sndlib. My result was quite interesting, the fastest mus_src sinc
> resampler where a lot faster than the fastest libsamplerate resampler.

I think most people would agree that speed is not the most important
aspect when measuring the quality of a sample rate converter.

> I don't have the results available right now, but I remember that mus_src
> performance wasn't very far from beating the linear resampler in 
> libsamplerate.

Did you test anything other than speed?

> I did not hear any difference in soundquality, but I guess there might be
> a difference.

If you pick the right kind of source signal and/or chose the right
source and destination sample rate, then even a linear converter can
sound good. However, a converter that sounds good in that example may
not sound good with other real world signals that converters have to
handle.

With libsamplerate, I can state that the three sinc based converters
have the following characteristics:

                                SNR        Bandwidth
    SRC_SINC_FASTEST         102.42 dB      80.23 %
    SRC_SINC_MEDIUM_QUALITY   98.99 dB      90.68 %
    SRC_SINC_BEST_QUALITY     97.43 dB      96.96%

where SNR is signal to noise ratio and Bandwidth its a percentage of
the theoretical best bandwidth (ie half of the minimum of the source
and desination sample rate).

> A third program is the original sinc-resampler from Julius Smith:
> http://ccrma-www.stanford.edu/~jos/resample/
> I don't know how this one performs compaired to the other two though.

libsamplerate the same algorithm as this one. I think Julius O. Smith
developed this algorithm.

However, the JOS has a filter that is calculated at run time and is not
optimal while libsamplerate has pre-calculated filters that are near
optimal for a given quality of conversion. When I tested libsamplerate
against the JOS converter and tweaked the JOS converters parameters
to get the same SNR and Bandwidth, then libsamplerate as about 10-20% 
quicker.

The bottom line is that doing sample rate conversion well requires
CPU. If you find a converter that is fast, it is unlikely to be good.
Measuring converters is not that difficult. See the test programs
distrubuted with libsamplerate for information on how to test them.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"There are only two things wrong with C++: The initial concept and
the implementation." -- Bertrand Meyer



More information about the Linux-audio-dev mailing list