[GStreamer] FFTFrame implementation
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 08:04:02 +0000 (08:04 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 08:04:02 +0000 (08:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=73545

Reviewed by Chris Rogers.

.:

* configure.ac: Enable the WebAudio option again and remove
libfftw checks.

Source/WebCore:

FFTFrame implementation based on GStreamer's FFT processing
library.

No new tests, existing WebAudio tests cover this.

* GNUmakefile.am:
* GNUmakefile.list.am:
* platform/audio/FFTFrame.h:
* platform/audio/FFTFrameStub.cpp:
* platform/audio/gstreamer/FFTFrameGStreamer.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):

Source/WebKit/gtk:

* GNUmakefile.am: Remove libfftw compilation flags.

Source/WebKit2:

* GNUmakefile.am: Remove libfftw compilation flags.

LayoutTests:

* webaudio/resources/convolution-testing.js:
(checkTail1): Adapt convolution threshold for GStreamerFFTFrame
implementation, as advised by Chris Rogers.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106537 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/webaudio/resources/convolution-testing.js
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebCore/platform/audio/FFTFrame.h
Source/WebCore/platform/audio/FFTFrameStub.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/GNUmakefile.am
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.am
configure.ac

index b46b38f..dae9ee0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-02-01  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] FFTFrame implementation
+        https://bugs.webkit.org/show_bug.cgi?id=73545
+
+        Reviewed by Chris Rogers.
+
+        * configure.ac: Enable the WebAudio option again and remove
+        libfftw checks.
+
 2012-01-31  Ryosuke Niwa  <rniwa@webkit.org>
 
         webkit-perf.appspot.com should accept test results without medians
index cfc7adc..0f0713f 100644 (file)
@@ -1,3 +1,14 @@
+2012-02-01  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] FFTFrame implementation
+        https://bugs.webkit.org/show_bug.cgi?id=73545
+
+        Reviewed by Chris Rogers.
+
+        * webaudio/resources/convolution-testing.js:
+        (checkTail1): Adapt convolution threshold for GStreamerFFTFrame
+        implementation, as advised by Chris Rogers.
+
 2012-02-01  Eric Carlson  <eric.carlson@apple.com>
 
         Consider user's preferred language when choosing text tracks
index 01d2714..d7ef8ea 100644 (file)
@@ -127,13 +127,13 @@ function checkTail1(data, reference, breakpoint) {
 
     // This threshold is experimentally determined by examining the
     // value of tail1MaxDecibels.
-    var threshold1 = -146.7;
+    var threshold1 = -129.7;
 
     var tail1MaxDecibels = linearToDecibel(tail1Max/refMax);
     if (tail1MaxDecibels <= threshold1) {
         testPassed("First part of tail of convolution is sufficiently small.");
     } else {
-        testFailed("First part of tail of convolution is not sufficiently small: " + tail1Max + " dB");
+        testFailed("First part of tail of convolution is not sufficiently small: " + tail1MaxDecibels + " dB");
         isZero = false;
     }
 
index f1fac93..b14313d 100644 (file)
@@ -1,3 +1,30 @@
+2012-02-01  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] FFTFrame implementation
+        https://bugs.webkit.org/show_bug.cgi?id=73545
+
+        Reviewed by Chris Rogers.
+
+        FFTFrame implementation based on GStreamer's FFT processing
+        library.
+
+        No new tests, existing WebAudio tests cover this.
+
+        * GNUmakefile.am:
+        * GNUmakefile.list.am:
+        * platform/audio/FFTFrame.h:
+        * platform/audio/FFTFrameStub.cpp:
+        * platform/audio/gstreamer/FFTFrameGStreamer.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):
+
 2012-02-02  Kentaro Hara  <haraken@chromium.org>
 
         Rename [CheckFrameSecurity] and [SVGCheckSecurity] to [CheckAccessToNode]
index 701fa33..efdef69 100644 (file)
@@ -512,6 +512,10 @@ FEATURE_DEFINES += ENABLE_WEB_AUDIO=1
 webcore_cppflags += -DENABLE_WEB_AUDIO=1
 endif
 
+if USE_WEBAUDIO_GSTREAMER
+webcore_cppflags += -DWTF_USE_WEBAUDIO_GSTREAMER=1
+endif
+
 # ----
 # Web Sockets Support
 # ----
@@ -871,7 +875,6 @@ libWebCoreGtk_la_CPPFLAGS = \
        $(GSTREAMER_CFLAGS) \
        $(GTK_CFLAGS) \
        $(HILDON_CFLAGS) \
-       $(LIBFFTW_CFLAGS) \
        $(LIBSOUP_CFLAGS) \
        $(LIBXML_CFLAGS) \
        $(LIBXSLT_CFLAGS) \
index f36a93d..cfedff2 100644 (file)
@@ -5414,6 +5414,7 @@ webcore_sources += \
        Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp \
        Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.h \
        Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp \
+       Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp \
        Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp \
        Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.h \
        Source/WebCore/platform/audio/gtk/AudioBusGtk.cpp
index 042633c..db1d042 100644 (file)
 #include "mkl_dfti.h"
 #endif // USE(WEBAUDIO_MKL)
 
+#if USE(WEBAUDIO_GSTREAMER)
+#include <glib.h>
+G_BEGIN_DECLS
+#include <gst/fft/gstfftf32.h>
+G_END_DECLS
+#endif // USE(WEBAUDIO_GSTREAMER)
+
 #if USE(WEBAUDIO_FFMPEG)
 struct RDFTContext;
 #endif // USE(WEBAUDIO_FFMPEG)
@@ -146,6 +153,14 @@ private:
     AudioFloatArray m_imagData;
 #endif // USE(WEBAUDIO_FFMPEG)
 
+#if USE(WEBAUDIO_GSTREAMER)
+    GstFFTF32* m_fft;
+    GstFFTF32* m_inverseFft;
+    GstFFTF32Complex* m_complexData;
+    AudioFloatArray m_realData;
+    AudioFloatArray m_imagData;
+#endif // USE(WEBAUDIO_GSTREAMER)
+
 #endif // !USE_ACCELERATE_FFT
 };
 
index dfc52a2..aa26ec6 100644 (file)
@@ -29,7 +29,7 @@
 
 #if ENABLE(WEB_AUDIO)
 
-#if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFMPEG)
+#if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_GSTREAMER)
 
 #include "FFTFrame.h"
 
@@ -102,6 +102,6 @@ float* FFTFrame::imagData() const
 
 } // namespace WebCore
 
-#endif // !OS(DARWIN) && !USE(WEBAUDIO_MKL)
+#endif // !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_GSTREAMER)
 
 #endif // ENABLE(WEB_AUDIO)
index 15b5dee..fc88e9a 100644 (file)
@@ -1,5 +1,14 @@
 2012-02-01  Philippe Normand  <pnormand@igalia.com>
 
+        [GStreamer] FFTFrame implementation
+        https://bugs.webkit.org/show_bug.cgi?id=73545
+
+        Reviewed by Chris Rogers.
+
+        * GNUmakefile.am: Remove libfftw compilation flags.
+
+2012-02-01  Philippe Normand  <pnormand@igalia.com>
+
         [GTK] unittests/testloading crashes
         https://bugs.webkit.org/show_bug.cgi?id=77544
 
index 5768db7..2472212 100644 (file)
@@ -68,7 +68,6 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPPF
        $(GSTREAMER_CFLAGS) \
        $(GTK_CFLAGS) \
        $(HILDON_CFLAGS) \
-       $(LIBFFTW_CFLAGS) \
        $(LIBSOUP_CFLAGS) \
        $(LIBXML_CFLAGS) \
        $(LIBXSLT_CFLAGS) \
@@ -101,7 +100,6 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBA
        $(GTK_LIBS) \
        $(HILDON_LIBS) \
        $(JPEG_LIBS) \
-       $(LIBFFTW_LIBS) \
        $(LIBSOUP_LIBS) \
        $(LIBXML_LIBS) \
        $(LIBXSLT_LIBS) \
index 65cc509..17380c3 100644 (file)
@@ -1,3 +1,12 @@
+2012-02-01  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] FFTFrame implementation
+        https://bugs.webkit.org/show_bug.cgi?id=73545
+
+        Reviewed by Chris Rogers.
+
+        * GNUmakefile.am: Remove libfftw compilation flags.
+
 2012-02-01  No'am Rosenthal  <noam.rosenthal@nokia.com>
 
         [Texmap] Use glScissors for clipping in TextureMapperGL when possible
index b76b21f..1cf1a2d 100644 (file)
@@ -1479,7 +1479,6 @@ Programs_WebKitPluginProcess_LDADD = \
        $(XRENDER_LIBS) \
        $(XT_LIBS) \
        $(WINMM_LIBS) \
-       $(LIBFFTW_LIBS) \
        $(ZLIB_LIBS)
 
 Programs_WebKitPluginProcess_LDFLAGS = \
index b067b5e..ed95f06 100644 (file)
@@ -784,7 +784,11 @@ AC_ARG_ENABLE(web_sockets,
 AC_MSG_RESULT([$enable_web_sockets])
 
 # check whether to enable Web Audio support
-enable_web_audio=no
+AC_MSG_CHECKING([whether to enable Web Audio support])
+AC_ARG_ENABLE(web_audio,
+              AC_HELP_STRING([--enable-web-audio],
+                             [enable support for Web Audio [default=no]]),
+              [],[enable_web_audio="no"])
 AC_MSG_RESULT([$enable_web_audio])
 
 # check whether to enable Web Timing support
@@ -1052,6 +1056,7 @@ if test "$enable_video" = "yes" || test "$enable_web_audio" = "yes"; then
                      [gstreamer-$GST_API_VERSION >= $GSTREAMER_REQUIRED_VERSION
                      gstreamer-app-$GST_API_VERSION
                      gstreamer-audio-$GST_API_VERSION
+                     gstreamer-fft-$GST_API_VERSION
                      gstreamer-base-$GST_API_VERSION
                      gstreamer-interfaces-$GST_API_VERSION
                      gstreamer-pbutils-$GST_API_VERSION
@@ -1063,16 +1068,6 @@ if test "$enable_video" = "yes" || test "$enable_web_audio" = "yes"; then
    AC_SUBST([GSTREAMER_LIBS])
 fi
 
-# check if libfftw is available
-if test "$enable_web_audio" = "yes"; then
-   PKG_CHECK_MODULES([LIBFFTW],
-                     [fftw3 >= $LIBFFTW_REQUIRED_VERSION
-                     fftw3f >= $LIBFFTW_REQUIRED_VERSION],
-                     [have_fftw=yes])
-
-    AC_SUBST([LIBFFTW_CFLAGS])
-    AC_SUBST([LIBFFTW_LIBS])
-fi
 
 if test "$with_accelerated_compositing" = "clutter"; then
    PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= $CLUTTER_REQUIRED_VERSION)
@@ -1174,6 +1169,7 @@ AM_CONDITIONAL([USE_PANGO], [test "$with_font_backend" = "pango"])
 
 # GStreamer feature conditional
 AM_CONDITIONAL([USE_GSTREAMER], [test "$have_gstreamer" = "yes"])
+AM_CONDITIONAL([USE_WEBAUDIO_GSTREAMER], [test "$enable_web_audio" = "yes"])
 
 # ATSPI2 conditional
 AM_CONDITIONAL([HAVE_ATSPI2], [test "$have_atspi2" = "yes"])