• dalecurtis@chromium.org's avatar
    Add SincResampler ported from WebKit. · a5e97e2b
    dalecurtis@chromium.org authored
    This is a partial port of WebAudio's SincResampler from WebKit formatted and
    culled for use by Chrome Media.
    
    We can't directly use the one in WebKit as it's layed under a ton of abstraction
    and is tightly coupled with WebKit objects.
    
    Test generates a swept sine wave and calculates the RMS error for common sample
    rates (via UMA stats).
    
    MultiChannelResampler and AudioRenderMixer changes to support resampling will
    come in later CLs.
    
    The 1000 ft view is that MultiChannelResampler will implement SincResampler::
    AudioSourceProvider and AudioRendererMixer will implement a new
    MultiChannelResampler::MultiChannelAudioSourceProvider interface.
    
    When resampling is necessary AudioRenderMixer will feed itself into a
    MultiChannelResampler instance which will poll data as necessary and feed it
    channel by channel into a set of SincResamplers (one for each channel).
    
    We want to resample post-mixing since resampling is a much more expensive
    operation.
    
    Original for reference:
    http://git.chromium.org/gitweb/?p=external/Webkit.git&a=blob&f=Source/WebCore/platform/audio/SincResampler.cpp
    
    Visual plot of 44100 to 48000 for reference; red line is the resampled signal
    and the green line is the reference signal. Ideally only the pure signal (green)
    should be seen.  Any bit of the resampled signal showing (red) is where the
    resampling algorithm is incorrect: http://i.imgur.com/1vsaI.png
    
    BUG=133637
    TEST=New unittests.
    
    Review URL: https://chromiumcodereview.appspot.com/10702050
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146219 0039d316-1c4b-4281-b951-d872f2087c98
    a5e97e2b
sinc_resampler.h 2.33 KB