[MPlayer-dev-eng] [PATCH] fix for -srate bug

Michael Niedermayer michaelni at gmx.at
Tue Oct 19 14:52:37 CEST 2004


Hi

On Tuesday 19 October 2004 14:32, Michael Niedermayer wrote:
> Hi
>
> On Monday 18 October 2004 20:19, Ed Wildgoose wrote:
> > >>Would a patch to incorporate libsamplerate be acceptable?  We obviously
> > >>don't want a ton of sample rate convertors, and I would expect it to be
> > >>tricky to completely integrate libsamplerate (if we need to be able to
> > >>compile it on funny architectures for example), but I could make it a
> > >>compile time option to use the internal stuff or libsamplerate?
> > >
> > >why, dont u just use the audio resample code from libavcodec ?
> > >it can easily be extended to support any linear filter, can compensate
> > > for timestamp drift correctly (no ugly sounding duplicated/dropped
> > > samples)
> >
> > Well my goal is very high end audio and video, comparable with 20K
> > systems or more....  Libsamplerate seems to be the highest quality
> > resampler out there, and most likely somewhat better than the libavcodec
> > one (or the mplayer one).  And the CPU requirements are "sufficient" as
> > well.  Also it is very nicely contained with a very simple api
> >
> > I would not have thought that we would need to correct for timestamp
> > drift in general if we are clocking video to audio?  What kind of things
> > did you have in mind?
> >
> > >u shouldnt compare against the MPlayer resampler, IIRC it has modulo,
> > > divide and gotos in the innermost loop
> >
> > Sure, but isn't that yet another reason to consider a high quality,
> > maintained alternative like libsamplerate?  I would suggest
> > incorporating the code directly except that I think there is a fair bit
> > of assembly and this might become a problem with a portable project like
> > mplayer.  It would certainly be beyond my abilities to help porting it
> > to all platforms (assuming it isn't supported already)
>
> ive just downloaded libsamplerate-0.1.2, theres no asm in there except a
> lrintf() implementation and its pure floating point code with divides and
> modulo in the innermost loop, so it cannot be as fast as u claim unless i
> missed some integer resampler

there are also a few test programs inculded in libsamplerate, see attachment 
for the output of one

especially interresting is:
    Worst case Signal-to-Noise Ratio : 97.43 dB.
    Worst case conversion rate       : 84021 samples/sec.
    Measured -3dB rolloff point      : 96.96 %.

which shows that the resampler from which u quoted the scores is not capable 
of resampling 44khz stereo in realtime on an idle 500mhz p3

[...]
-- 
Michael

"I do not agree with what you have to say, but I'll defend to the death your
right to say it." -- Voltaire
-------------- next part --------------

    Converter 3 : ZOH Interpolator
    Zero order hold interpolator, very fast, poor quality.
	Signal-to-Noise Ratio Test 0 : Pass
	Signal-to-Noise Ratio Test 1 : Pass
	Signal-to-Noise Ratio Test 2 : Pass
	Signal-to-Noise Ratio Test 3 : Pass
	Signal-to-Noise Ratio Test 4 : Pass
	Signal-to-Noise Ratio Test 5 : Pass
	Signal-to-Noise Ratio Test 6 : Pass
	Signal-to-Noise Ratio Test 7 : Pass
    Worst case Signal-to-Noise Ratio : 10.28 dB.
    Worst case conversion rate       : 1638400 samples/sec.
    Bandwith test not performed on this converter.

    Converter 4 : Linear Interpolator
    Linear interpolator, very fast, poor quality.
	Signal-to-Noise Ratio Test 0 : Pass
	Signal-to-Noise Ratio Test 1 : Pass
	Signal-to-Noise Ratio Test 2 : Pass
	Signal-to-Noise Ratio Test 3 : Pass
	Signal-to-Noise Ratio Test 4 : Pass
	Signal-to-Noise Ratio Test 5 : Pass
	Signal-to-Noise Ratio Test 6 : Pass
	Signal-to-Noise Ratio Test 7 : Pass
    Worst case Signal-to-Noise Ratio : 22.88 dB.
    Worst case conversion rate       : 1638400 samples/sec.
    Bandwith test not performed on this converter.

    Converter 2 : Fastest Sinc Interpolator
    Band limited sinc interpolation, fastest, 97dB SNR, 80% BW.
	Signal-to-Noise Ratio Test 0 : Pass
	Signal-to-Noise Ratio Test 1 : Pass
	Signal-to-Noise Ratio Test 2 : Pass
	Signal-to-Noise Ratio Test 3 : Pass
	Signal-to-Noise Ratio Test 4 : Pass
	Signal-to-Noise Ratio Test 5 : Pass
	Signal-to-Noise Ratio Test 6 : Pass
	Signal-to-Noise Ratio Test 7 : Pass
	Signal-to-Noise Ratio Test 8 : Pass
    Worst case Signal-to-Noise Ratio : 102.42 dB.
    Worst case conversion rate       : 409600 samples/sec.
    Measured -3dB rolloff point      : 80.23 %.

    Converter 1 : Medium Sinc Interpolator
    Band limited sinc interpolation, medium quality, 97dB SNR, 90% BW.
	Signal-to-Noise Ratio Test 0 : Pass
	Signal-to-Noise Ratio Test 1 : Pass
	Signal-to-Noise Ratio Test 2 : Pass
	Signal-to-Noise Ratio Test 3 : Pass
	Signal-to-Noise Ratio Test 4 : Pass
	Signal-to-Noise Ratio Test 5 : Pass
	Signal-to-Noise Ratio Test 6 : Pass
	Signal-to-Noise Ratio Test 7 : Pass
	Signal-to-Noise Ratio Test 8 : Pass
    Worst case Signal-to-Noise Ratio : 98.99 dB.
    Worst case conversion rate       : 234057 samples/sec.
    Measured -3dB rolloff point      : 90.68 %.

    Converter 0 : Best Sinc Interpolator
    Band limited sinc interpolation, best quality, 97dB SNR, 96% BW.
	Signal-to-Noise Ratio Test 0 : Pass
	Signal-to-Noise Ratio Test 1 : Pass
	Signal-to-Noise Ratio Test 2 : Pass
	Signal-to-Noise Ratio Test 3 : Pass
	Signal-to-Noise Ratio Test 4 : Pass
	Signal-to-Noise Ratio Test 5 : Pass
	Signal-to-Noise Ratio Test 6 : Pass
	Signal-to-Noise Ratio Test 7 : Pass
	Signal-to-Noise Ratio Test 8 : Pass
    Worst case Signal-to-Noise Ratio : 97.43 dB.
    Worst case conversion rate       : 84021 samples/sec.
    Measured -3dB rolloff point      : 96.96 %.



More information about the MPlayer-dev-eng mailing list