Changeset 76562 in webkit


Ignore:
Timestamp:
Jan 24, 2011 6:39:50 PM (13 years ago)
Author:
kbr@google.com
Message:

2011-01-24 Kenneth Russell <kbr@google.com>

Reviewed by James Robinson.

Web Audio API: port FFTFrame to FFTW
https://bugs.webkit.org/show_bug.cgi?id=52989

Ported FFTFrame class to the open-source FFTW library. Tested with
unit tests from Chris Rogers. Made preliminary changes to GYP
files for conditional compilation of these files; will need to be
adjusted once FFTW is integrated as third-party source.

  • WebCore.gyp/WebCore.gyp:
  • WebCore.gypi:
  • platform/audio/FFTFrame.h:
  • platform/audio/fftw: Added.
  • platform/audio/fftw/FFTFrameFFTW.cpp: Added. (WebCore::FFTFrame::FFTFrame): (WebCore::FFTFrame::~FFTFrame): (WebCore::FFTFrame::multiply): (WebCore::FFTFrame::doFFT): (WebCore::FFTFrame::doInverseFFT): (WebCore::FFTFrame::cleanup): (WebCore::FFTFrame::realData): (WebCore::FFTFrame::imagData): (WebCore::FFTFrame::fftwPlanForSize):
Location:
trunk/Source/WebCore
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76561 r76562  
     12011-01-24  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by James Robinson.
     4
     5        Web Audio API: port FFTFrame to FFTW
     6        https://bugs.webkit.org/show_bug.cgi?id=52989
     7
     8        Ported FFTFrame class to the open-source FFTW library. Tested with
     9        unit tests from Chris Rogers. Made preliminary changes to GYP
     10        files for conditional compilation of these files; will need to be
     11        adjusted once FFTW is integrated as third-party source.
     12
     13        * WebCore.gyp/WebCore.gyp:
     14        * WebCore.gypi:
     15        * platform/audio/FFTFrame.h:
     16        * platform/audio/fftw: Added.
     17        * platform/audio/fftw/FFTFrameFFTW.cpp: Added.
     18        (WebCore::FFTFrame::FFTFrame):
     19        (WebCore::FFTFrame::~FFTFrame):
     20        (WebCore::FFTFrame::multiply):
     21        (WebCore::FFTFrame::doFFT):
     22        (WebCore::FFTFrame::doInverseFFT):
     23        (WebCore::FFTFrame::cleanup):
     24        (WebCore::FFTFrame::realData):
     25        (WebCore::FFTFrame::imagData):
     26        (WebCore::FFTFrame::fftwPlanForSize):
     27
    1282011-01-24  Anders Carlsson  <andersca@apple.com>
    229
  • trunk/Source/WebCore/WebCore.gyp/WebCore.gyp

    r76380 r76562  
    853853        }],
    854854        # FIXME: (kbr) ideally this target should just depend on webcore_prerequisites
    855         # to pick up this include directory, but I'm nervous about making that change.
     855        # to pick up these include directories, but I'm nervous about making that change.
    856856        ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_MKL=1" in feature_defines', {
    857857          'include_dirs': [
    858858            '<(chromium_src_dir)/third_party/mkl/include',
     859          ],
     860        }],
     861        ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
     862          'include_dirs': [
     863            '<(chromium_src_dir)/third_party/fftw/api',
    859864          ],
    860865        }],
     
    10351040          },
    10361041        }],
     1042        ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
     1043          # This directory needs to be on the include path for multiple sub-targets of webcore.
     1044          'direct_dependent_settings': {
     1045            'include_dirs': [
     1046              '<(chromium_src_dir)/third_party/fftw/api',
     1047            ],
     1048          },
     1049        }],
    10371050      ],
    10381051    },
     
    10971110        # of their enclosing directories and tags at the ends of their
    10981111        # filenames.
    1099         ['exclude', '(android|cairo|cf|cg|curl|gtk|haiku|linux|mac|mkl|opentype|posix|qt|soup|svg|symbian|win|wx)/'],
     1112        ['exclude', '(android|cairo|cf|cg|curl|fftw|gtk|haiku|linux|mac|mkl|opentype|posix|qt|soup|svg|symbian|win|wx)/'],
    11001113        ['exclude', '(?<!Chromium)(Android|Cairo|CF|CG|Curl|Gtk|Linux|Mac|OpenType|POSIX|Posix|Qt|Safari|Soup|Symbian|Win|Wx)\\.(cpp|mm?)$'],
    11011114
     
    12691282          'sources/': [
    12701283            ['include', 'platform/audio/mkl/FFTFrameMKL\\.cpp$'],
     1284          ],
     1285        }],
     1286        ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
     1287          'sources/': [
     1288            ['include', 'platform/audio/fftw/FFTFrameFFTW\\.cpp$'],
    12711289          ],
    12721290        }],
     
    15021520          },
    15031521        }],
     1522        ['OS=="linux" and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
     1523          # FIXME: (kbr) figure out how to make these dependencies
     1524          # work in a cross-platform way. Attempts to use
     1525          # "link_settings" and "libraries" in conjunction with the
     1526          # msvs-specific settings didn't work so far.
     1527          'all_dependent_settings': {
     1528            'ldflags': [
     1529              # FIXME: (kbr) build the FFTW into PRODUCT_DIR using GYP.
     1530              '-Lthird_party/fftw/.libs',
     1531            ],
     1532            'link_settings': {
     1533              'libraries': [
     1534                '-lfftw3f'
     1535              ],
     1536            },
     1537          },
     1538        }],
    15041539        ['enable_svg!=0', {
    15051540          'dependencies': [
  • trunk/Source/WebCore/WebCore.gypi

    r76541 r76562  
    24362436            'platform/audio/VectorMath.cpp',
    24372437            'platform/audio/chromium/AudioBusChromium.cpp',
     2438            'platform/audio/fftw/FFTFrameFFTW.cpp',
    24382439            'platform/audio/mac/AudioBusMac.mm',
    24392440            'platform/audio/mac/AudioDestinationMac.h',
  • trunk/Source/WebCore/platform/audio/FFTFrame.h

    r74147 r76562  
    3636#endif
    3737
    38 #if !OS(DARWIN) && USE(WEBAUDIO_MKL)
     38#if !OS(DARWIN)
     39#if USE(WEBAUDIO_MKL)
    3940#include "mkl_dfti.h"
     41#endif // USE(WEBAUDIO_MKL)
     42#if USE(WEBAUDIO_FFTW)
     43#include "fftw3.h"
     44#endif // USE(WEBAUDIO_FFTW)
    4045#endif
    4146
     
    99104    AudioFloatArray m_realData;
    100105    AudioFloatArray m_imagData;
    101 #endif // OS(DARWIN)
    102 #if !OS(DARWIN) && USE(WEBAUDIO_MKL)
     106#else // !OS(DARWIN)
     107#if USE(WEBAUDIO_MKL)
    103108    // Interleaves the planar real and imaginary data and returns a
    104109    // pointer to the resulting storage which can be used for in-place
     
    116121    AudioFloatArray m_realData;
    117122    AudioFloatArray m_imagData;
    118 #endif // !OS(DARWIN) && USE(WEBAUDIO_MKL)
     123#endif // USE(WEBAUDIO_MKL)
     124#if USE(WEBAUDIO_FFTW)
     125    fftwf_plan m_forwardPlan;
     126    fftwf_plan m_backwardPlan;
     127
     128    enum Direction {
     129        Forward,
     130        Backward
     131    };
     132
     133    AudioFloatArray m_realData;
     134    AudioFloatArray m_imagData;
     135
     136    static fftwf_plan* fftwForwardPlans;
     137    static fftwf_plan* fftwBackwardPlans;
     138
     139    static fftwf_plan fftwPlanForSize(unsigned fftSize, Direction,
     140                                      float*, float*, float*);
     141#endif // USE(WEBAUDIO_FFTW)
     142#endif // !OS(DARWIN)
    119143};
    120144
Note: See TracChangeset for help on using the changeset viewer.