Changeset 84968 in webkit


Ignore:
Timestamp:
Apr 26, 2011 4:01:36 PM (13 years ago)
Author:
crogers@google.com
Message:

2011-04-26 Chris Rogers <crogers@google.com>

Reviewed by Kenneth Russell.

Add FFTFrame implementation for FFmpeg
https://bugs.webkit.org/show_bug.cgi?id=59408

No new tests since audio API is not yet implemented.

  • WebCore.gyp/WebCore.gyp:
  • WebCore.gypi:
  • platform/audio/FFTFrame.h:
  • platform/audio/FFTFrameStub.cpp:
  • platform/audio/ffmpeg: Added.
  • platform/audio/ffmpeg/FFTFrameFFMPEG.cpp: Added. (WebCore::FFTFrame::FFTFrame): (WebCore::FFTFrame::initialize): (WebCore::FFTFrame::cleanup): (WebCore::FFTFrame::~FFTFrame): (WebCore::FFTFrame::multiply): (WebCore::FFTFrame::doFFT): (WebCore::FFTFrame::doInverseFFT): (WebCore::FFTFrame::realData): (WebCore::FFTFrame::imagData): (WebCore::FFTFrame::getUpToDateComplexData): (WebCore::FFTFrame::contextForSize):
  • platform/audio/mac/FFTFrameMac.cpp:
  • webaudio/ConvolverNode.cpp:
Location:
trunk/Source/WebCore
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84958 r84968  
     12011-04-26  Chris Rogers  <crogers@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Add FFTFrame implementation for FFmpeg
     6        https://bugs.webkit.org/show_bug.cgi?id=59408
     7
     8        No new tests since audio API is not yet implemented.
     9
     10        * WebCore.gyp/WebCore.gyp:
     11        * WebCore.gypi:
     12        * platform/audio/FFTFrame.h:
     13        * platform/audio/FFTFrameStub.cpp:
     14        * platform/audio/ffmpeg: Added.
     15        * platform/audio/ffmpeg/FFTFrameFFMPEG.cpp: Added.
     16        (WebCore::FFTFrame::FFTFrame):
     17        (WebCore::FFTFrame::initialize):
     18        (WebCore::FFTFrame::cleanup):
     19        (WebCore::FFTFrame::~FFTFrame):
     20        (WebCore::FFTFrame::multiply):
     21        (WebCore::FFTFrame::doFFT):
     22        (WebCore::FFTFrame::doInverseFFT):
     23        (WebCore::FFTFrame::realData):
     24        (WebCore::FFTFrame::imagData):
     25        (WebCore::FFTFrame::getUpToDateComplexData):
     26        (WebCore::FFTFrame::contextForSize):
     27        * platform/audio/mac/FFTFrameMac.cpp:
     28        * webaudio/ConvolverNode.cpp:
     29
    1302011-04-26  Jeff Miller  <jeffm@apple.com>
    231
  • trunk/Source/WebCore/WebCore.gyp/WebCore.gyp

    r84426 r84968  
    11661166          },
    11671167        }],
    1168         ['(OS=="linux" or OS=="win") and branding=="Chrome"', {
    1169           'dependencies': [
    1170             '<(chromium_src_dir)/third_party/mkl/google/mkl.gyp:mkl_libs',
    1171           ],
    1172         }],
    11731168        ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
    11741169          # This directory needs to be on the include path for multiple sub-targets of webcore.
     
    11781173            ],
    11791174          },
     1175        }],
     1176        ['(OS=="mac" or OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_FFMPEG=1" in feature_defines', {
     1177          # This directory needs to be on the include path for multiple sub-targets of webcore.
     1178          'direct_dependent_settings': {
     1179            'include_dirs': [
     1180              '<(chromium_src_dir)/third_party/ffmpeg/patched-ffmpeg-mt',
     1181            ],
     1182          },
     1183          'dependencies': [
     1184            '<(chromium_src_dir)/third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
     1185          ],
    11801186        }],
    11811187        ['"ENABLE_LEVELDB=1" in feature_defines', {
  • trunk/Source/WebCore/WebCore.gypi

    r84857 r84968  
    37113711            'platform/audio/mac/AudioFileReaderMac.cpp',
    37123712            'platform/audio/mac/AudioFileReaderMac.h',
     3713            'platform/audio/ffmpeg/FFTFrameFFMPEG.cpp',
    37133714            'platform/audio/mac/FFTFrameMac.cpp',
    37143715            'platform/audio/mkl/FFTFrameMKL.cpp',
  • trunk/Source/WebCore/platform/audio/FFTFrame.h

    r78102 r84968  
    3232#include "AudioArray.h"
    3333
    34 #if OS(DARWIN)
     34#if OS(DARWIN) && !USE(WEBAUDIO_FFMPEG)
     35#define USE_ACCELERATE_FFT 1
     36#else
     37#define USE_ACCELERATE_FFT 0
     38#endif
     39
     40#if USE_ACCELERATE_FFT
    3541#include <Accelerate/Accelerate.h>
    3642#endif
    3743
    38 #if !OS(DARWIN)
     44#if !USE_ACCELERATE_FFT
     45
    3946#if USE(WEBAUDIO_MKL)
    4047#include "mkl_dfti.h"
    4148#endif // USE(WEBAUDIO_MKL)
     49
    4250#if USE(WEBAUDIO_FFTW)
    4351#include "fftw3.h"
    4452#endif // USE(WEBAUDIO_FFTW)
    45 #endif
     53
     54#if USE(WEBAUDIO_FFMPEG)
     55struct RDFTContext;
     56#endif // USE(WEBAUDIO_FFMPEG)
     57
     58#endif // !USE_ACCELERATE_FFT
    4659
    4760#include <wtf/PassOwnPtr.h>
     
    93106    void interpolateFrequencyComponents(const FFTFrame& frame1, const FFTFrame& frame2, double x);
    94107
    95 #if OS(DARWIN)
     108#if USE_ACCELERATE_FFT
    96109    DSPSplitComplex& dspSplitComplex() { return m_frame; }
    97110    DSPSplitComplex dspSplitComplex() const { return m_frame; }
     
    106119    AudioFloatArray m_realData;
    107120    AudioFloatArray m_imagData;
    108 #else // !OS(DARWIN)
     121#else // !USE_ACCELERATE_FFT
     122
    109123#if USE(WEBAUDIO_MKL)
    110124    // Interleaves the planar real and imaginary data and returns a
     
    124138    AudioFloatArray m_imagData;
    125139#endif // USE(WEBAUDIO_MKL)
     140
     141#if USE(WEBAUDIO_FFMPEG)
     142    static RDFTContext* contextForSize(unsigned fftSize, int trans);
     143
     144    RDFTContext* m_forwardContext;
     145    RDFTContext* m_inverseContext;
     146
     147    float* getUpToDateComplexData();
     148    AudioFloatArray m_complexData;
     149    AudioFloatArray m_realData;
     150    AudioFloatArray m_imagData;
     151#endif // USE(WEBAUDIO_FFMPEG)
     152
    126153#if USE(WEBAUDIO_FFTW)
    127154    fftwf_plan m_forwardPlan;
     
    147174                                      float*, float*, float*);
    148175#endif // USE(WEBAUDIO_FFTW)
    149 #endif // !OS(DARWIN)
     176
     177#endif // !USE_ACCELERATE_FFT
    150178};
    151179
  • trunk/Source/WebCore/platform/audio/FFTFrameStub.cpp

    r83875 r84968  
    3030#if ENABLE(WEB_AUDIO)
    3131
    32 #if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFTW)
     32#if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFTW) && !USE(WEBAUDIO_FFMPEG)
    3333
    3434#include "FFTFrame.h"
  • trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp

    r78102 r84968  
    3232
    3333#if ENABLE(WEB_AUDIO)
     34
     35#if OS(DARWIN) && !USE(WEBAUDIO_FFMPEG)
    3436
    3537#include "FFTFrame.h"
     
    193195} // namespace WebCore
    194196
     197#endif // #if OS(DARWIN) && !USE(WEBAUDIO_FFMPEG)
     198
    195199#endif // ENABLE(WEB_AUDIO)
  • trunk/Source/WebCore/webaudio/ConvolverNode.cpp

    r82963 r84968  
    4040// it's important not to make this too high.  In this case 8192 is a good value.
    4141// But, the Reverb object is multi-threaded, so we want this as high as possible without losing too much accuracy.
    42 // Very large FFTs will have worse phase errors.  Given these constraints 16384 is a good compromise.
    43 const size_t MaxFFTSize = 16384;
     42// Very large FFTs will have worse phase errors. Given these constraints 32768 is a good compromise.
     43const size_t MaxFFTSize = 32768;
    4444
    4545namespace WebCore {
Note: See TracChangeset for help on using the changeset viewer.