Bug 1372767 - opus: enable SSE simd optimization. r=kinetik,ted
authorRalph Giles <giles@mozilla.com>
Tue, 13 Jun 2017 16:41:35 -0700
changeset 364210 4175246fd7a1ebb3809484797b62b6b2821d6eaf
parent 364209 7e6229d28b18311bb8f51c3103138b2eade2812e
child 364211 e19a5cc45056f41857c91f9abbb9c74abe2c99b6
push id32036
push userarchaeopteryx@coole-files.de
push dateFri, 16 Jun 2017 07:47:22 +0000
treeherdermozilla-central@64a2ba65f0d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik, ted
bugs1372767
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1372767 - opus: enable SSE simd optimization. r=kinetik,ted Opus now has SSE, SSE2 and SSE 4.1 optimizations. Enable these in our build by adding the extra source files and defines. MozReview-Commit-ID: BKMATikknBU
media/libopus/moz.build
--- a/media/libopus/moz.build
+++ b/media/libopus/moz.build
@@ -81,16 +81,39 @@ if CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
     UNIFIED_SOURCES += silk_sources_float
     UNIFIED_SOURCES += opus_sources_float
 else:
     LOCAL_INCLUDES += [
         'silk/fixed',
     ]
     UNIFIED_SOURCES += silk_sources_fixed
 
+if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'):
+    DEFINES['OPUS_HAVE_RTCD'] = True
+    DEFINES['OPUS_X86_MAY_HAVE_SSE'] = True
+    DEFINES['OPUS_X86_MAY_HAVE_SSE2'] = True
+    DEFINES['OPUS_X86_MAY_HAVE_SSE4_1'] = True
+    DEFINES['OPUS_X86_MAY_HAVE_AVX'] = True
+    SOURCES += celt_sources_sse
+    SOURCES += celt_sources_sse2
+    SOURCES += celt_sources_sse4_1
+    SOURCES += silk_sources_sse4_1
+    if not CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
+        SOURCES += silk_sources_fixed_sse4_1
+    if not CONFIG['_MSC_VER'] or CONFIG['CLANG_CL']:
+        for f in SOURCES:
+            if f in celt_sources_sse:
+                SOURCES[f].flags += CONFIG['SSE_FLAGS']
+            if f in celt_sources_sse2:
+                SOURCES[f].flags += CONFIG['SSE2_FLAGS']
+            if f in celt_sources_sse4_1 or \
+               f in silk_sources_sse4_1 or \
+               f in silk_sources_fixed_sse4_1:
+                SOURCES[f].flags += ['-msse4.1']
+
 if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
     SOURCES += celt_sources_arm
     SOURCES += [
         '!celt_pitch_xcorr_arm-gnu.s'
     ]
     # -Os is significantly slower, enable -O3 unless optimization is disabled
     if CONFIG['MOZ_OPTIMIZE']:
         CFLAGS += [