From 6f2a5c0a4318bf7d3a3b8a1a02609541a26d24e8 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Sun, 14 Mar 2021 17:57:10 +0100 Subject: [PATCH] - webrtc-audio-processing updated to 1.0 (parallel installable with webrtc-audio-processing 0.x) - added abseil patch to fix/adjust abseil library name - added nosimd patch to fix build for x86 without SSE2 --- webrtc-audio-processing1-abseil.patch | 11 + webrtc-audio-processing1-nosimd.patch | 219 ++++++++++++++++++ ...sing.spec => webrtc-audio-processing1.spec | 76 +++--- 3 files changed, 275 insertions(+), 31 deletions(-) create mode 100644 webrtc-audio-processing1-abseil.patch create mode 100644 webrtc-audio-processing1-nosimd.patch rename webrtc-audio-processing.spec => webrtc-audio-processing1.spec (63%) diff --git a/webrtc-audio-processing1-abseil.patch b/webrtc-audio-processing1-abseil.patch new file mode 100644 index 0000000..4978c24 --- /dev/null +++ b/webrtc-audio-processing1-abseil.patch @@ -0,0 +1,11 @@ +--- webrtc-audio-processing-1.0/meson.build.orig 2020-11-27 20:30:53.000000000 +0100 ++++ webrtc-audio-processing-1.0/meson.build 2021-03-14 12:53:34.720849883 +0100 +@@ -46,7 +46,7 @@ + cpp.find_library('absl_flags_internal'), + cpp.find_library('absl_flags_marshalling'), + cpp.find_library('absl_flags_parse'), +- cpp.find_library('absl_flags_registry'), ++ cpp.find_library('absl_flags_reflection'), + cpp.find_library('absl_flags_usage_internal'), + cpp.find_library('absl_raw_logging_internal'), + cpp.find_library('absl_strings'), diff --git a/webrtc-audio-processing1-nosimd.patch b/webrtc-audio-processing1-nosimd.patch new file mode 100644 index 0000000..92bb26e --- /dev/null +++ b/webrtc-audio-processing1-nosimd.patch @@ -0,0 +1,219 @@ +--- webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.cc.orig 2020-11-27 20:30:53.000000000 +0100 ++++ webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.cc 2021-03-14 13:27:15.929900062 +0100 +@@ -16,7 +16,7 @@ + #if defined(WEBRTC_HAS_NEON) + #include + #endif +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + #include + #endif + #include +@@ -86,7 +86,7 @@ + } + #endif + +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + // Computes and stores the frequency response of the filter. + void ComputeFrequencyResponse_Sse2( + size_t num_partitions, +@@ -208,7 +208,7 @@ + } + #endif + +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + // Adapts the filter partitions. (SSE2 variant) + void AdaptPartitions_Sse2(const RenderBuffer& render_buffer, + const FftData& G, +@@ -373,7 +373,7 @@ + } + #endif + +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + // Produces the filter output (SSE2 variant). + void ApplyFilter_Sse2(const RenderBuffer& render_buffer, + size_t num_partitions, +@@ -552,7 +552,7 @@ + FftData* S) const { + RTC_DCHECK(S); + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: + aec3::ApplyFilter_Sse2(render_buffer, current_size_partitions_, H_, S); + break; +@@ -596,7 +596,7 @@ + H2->resize(current_size_partitions_); + + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: + aec3::ComputeFrequencyResponse_Sse2(current_size_partitions_, H_, H2); + break; +@@ -621,7 +621,7 @@ + + // Adapt the filter. + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: + aec3::AdaptPartitions_Sse2(render_buffer, G, current_size_partitions_, + &H_); +--- webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl.cc.orig 2020-11-27 20:30:53.000000000 +0100 ++++ webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl.cc 2021-03-14 13:27:55.803017384 +0100 +@@ -16,7 +16,7 @@ + #if defined(WEBRTC_HAS_NEON) + #include + #endif +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + #include + #endif + +@@ -54,7 +54,7 @@ + } + #endif + +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + // Computes and stores the echo return loss estimate of the filter, which is the + // sum of the partition frequency responses. + void ErlComputer_SSE2( +@@ -81,7 +81,7 @@ + RTC_DCHECK_EQ(kFftLengthBy2Plus1, erl.size()); + // Update the frequency response and echo return loss for the filter. + switch (optimization) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: + aec3::ErlComputer_SSE2(H2, erl); + break; +--- webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/fft_data.h.orig 2020-11-27 20:30:53.000000000 +0100 ++++ webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/fft_data.h 2021-03-14 13:28:55.999357940 +0100 +@@ -14,7 +14,7 @@ + // Defines WEBRTC_ARCH_X86_FAMILY, used below. + #include "rtc_base/system/arch.h" + +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + #include + #endif + #include +@@ -48,7 +48,7 @@ + rtc::ArrayView power_spectrum) const { + RTC_DCHECK_EQ(kFftLengthBy2Plus1, power_spectrum.size()); + switch (optimization) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: { + constexpr int kNumFourBinBands = kFftLengthBy2 / 4; + constexpr int kLimit = kNumFourBinBands * 4; +--- webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/vector_math.h.orig 2020-11-27 20:30:53.000000000 +0100 ++++ webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/vector_math.h 2021-03-14 13:29:18.652568550 +0100 +@@ -17,7 +17,7 @@ + #if defined(WEBRTC_HAS_NEON) + #include + #endif +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + #include + #endif + #include +@@ -43,7 +43,7 @@ + void SqrtAVX2(rtc::ArrayView x); + void Sqrt(rtc::ArrayView x) { + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: { + const int x_size = static_cast(x.size()); + const int vector_limit = x_size >> 2; +@@ -123,7 +123,7 @@ + RTC_DCHECK_EQ(z.size(), x.size()); + RTC_DCHECK_EQ(z.size(), y.size()); + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: { + const int x_size = static_cast(x.size()); + const int vector_limit = x_size >> 2; +@@ -173,7 +173,7 @@ + void Accumulate(rtc::ArrayView x, rtc::ArrayView z) { + RTC_DCHECK_EQ(z.size(), x.size()); + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: { + const int x_size = static_cast(x.size()); + const int vector_limit = x_size >> 2; +--- webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/matched_filter.cc.orig 2020-11-27 20:30:53.000000000 +0100 ++++ webrtc-audio-processing-1.0/webrtc/modules/audio_processing/aec3/matched_filter.cc 2021-03-14 13:29:40.592449692 +0100 +@@ -15,7 +15,7 @@ + #if defined(WEBRTC_HAS_NEON) + #include + #endif +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + #include + #endif + #include +@@ -142,7 +142,7 @@ + + #endif + +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + + void MatchedFilterCore_SSE2(size_t x_start_index, + float x2_sum_threshold, +@@ -358,7 +358,7 @@ + render_buffer.buffer.size(); + + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Aec3Optimization::kSse2: + aec3::MatchedFilterCore_SSE2(x_start_index, x2_sum_threshold, + smoothing_, render_buffer.buffer, y, +--- webrtc-audio-processing-1.0/webrtc/modules/audio_processing/agc2/rnn_vad/rnn.cc.orig 2020-11-27 20:30:53.000000000 +0100 ++++ webrtc-audio-processing-1.0/webrtc/modules/audio_processing/agc2/rnn_vad/rnn.cc 2021-03-14 13:42:56.104806702 +0100 +@@ -16,7 +16,7 @@ + #if defined(WEBRTC_HAS_NEON) + #include + #endif +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + #include + #endif + #include +@@ -227,7 +227,7 @@ + } + } + +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + // Fully connected layer SSE2 implementation. + void ComputeFullyConnectedLayerOutputSse2( + size_t input_size, +@@ -295,7 +295,7 @@ + + void FullyConnectedLayer::ComputeOutput(rtc::ArrayView input) { + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Optimization::kSse2: + ComputeFullyConnectedLayerOutputSse2(input_size_, output_size_, input, + bias_, weights_, +@@ -355,7 +355,7 @@ + + void GatedRecurrentLayer::ComputeOutput(rtc::ArrayView input) { + switch (optimization_) { +-#if defined(WEBRTC_ARCH_X86_FAMILY) ++#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__SSE2__) + case Optimization::kSse2: + // TODO(bugs.chromium.org/10480): Handle Optimization::kSse2. + ComputeGruLayerOutput(input_size_, output_size_, input, weights_, diff --git a/webrtc-audio-processing.spec b/webrtc-audio-processing1.spec similarity index 63% rename from webrtc-audio-processing.spec rename to webrtc-audio-processing1.spec index 0fab234..fd57a13 100644 --- a/webrtc-audio-processing.spec +++ b/webrtc-audio-processing1.spec @@ -5,28 +5,32 @@ # [1] http://code.google.com/p/webrtc/ # # Conditional build: -%bcond_without neon # without ARM NEON instructions +%bcond_without neon # ARM NEON instructions +%bcond_with sse2 # SSE2 instructions %ifnarch armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl aarch64 %undefine with_neon %endif +%ifarch pentium4 %{x8664} x32 +%define with_sse2 1 +%endif Summary: WebRTC Audio Processing library Summary(pl.UTF-8): Biblioteka WebRTC Audio Processing -Name: webrtc-audio-processing -Version: 0.3.1 +Name: webrtc-audio-processing1 +Version: 1.0 Release: 1 License: BSD Group: Libraries -Source0: https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/%{name}-%{version}.tar.xz -# Source0-md5: 6e10724ca34bcbc715a4c208273acb0c +Source0: https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/webrtc-audio-processing-%{version}.tar.gz +# Source0-md5: 8ee1b2f3e615c6c2024951c559a9913a +Patch0: %{name}-abseil.patch +Patch1: %{name}-nosimd.patch URL: https://www.freedesktop.org/software/pulseaudio/webrtc-audio-processing/ -BuildRequires: autoconf >= 2.50 -BuildRequires: automake >= 1:1.11 -BuildRequires: libstdc++-devel >= 6:4.7 -BuildRequires: libtool -BuildRequires: tar >= 1:1.22 -BuildRequires: xz +BuildRequires: abseil-cpp-devel >= 20200923 +BuildRequires: libstdc++-devel >= 6:5 +BuildRequires: meson >= 0.54 +BuildRequires: ninja >= 1.5 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description @@ -48,7 +52,8 @@ Summary: Header files for WebRTC Audio Processing library Summary(pl.UTF-8): Pliki nagłówkowe biblioteki WebRTC Audio Processing Group: Development/Libraries Requires: %{name} = %{version}-%{release} -Requires: libstdc++-devel +Requires: abseil-cpp-devel >= 20200923 +Requires: libstdc++-devel >= 6:5 %description devel This package contains the header files needed to develop programs @@ -71,25 +76,31 @@ Static WebRTC Audio Processing library. Biblioteka statyczna WebRTC Audio Processing. %prep -%setup -q +%setup -q -n webrtc-audio-processing-%{version} +%patch0 -p1 +%patch1 -p1 + +%ifarch %{ix86} +%if %{without sse2} +# add -DPFFFT_SIMD_DISABLE +%{__sed} -i -e 's/have_arm and not have_neon.*/& or true/' webrtc/third_party/pffft/meson.build +%endif +%endif %build -%{__libtoolize} -%{__aclocal} -%{__autoconf} -%{__automake} -%configure \ - %{!?with_neon:--disable-neon} \ - --disable-silent-rules -%{__make} +%if %{with sse2} +CFLAGS="%{rpmcflags} -msse2" +CXXFLAGS="%{rpmcxxflags} -msse2" +%endif +%meson build \ + -Dneon=%{?with_neon:runtime}%{!?with_neon:no} + +%ninja_build -C build %install rm -rf $RPM_BUILD_ROOT -%{__make} install \ - DESTDIR=$RPM_BUILD_ROOT -# obsoleted by pkg-config -%{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la +%ninja_install -C build %clean rm -rf $RPM_BUILD_ROOT @@ -100,15 +111,18 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(644,root,root,755) %doc AUTHORS COPYING NEWS README.md webrtc/PATENTS -%attr(755,root,root) %{_libdir}/libwebrtc_audio_processing.so.*.*.* -%attr(755,root,root) %ghost %{_libdir}/libwebrtc_audio_processing.so.1 +%attr(755,root,root) %{_libdir}/libwebrtc-audio-coding-1.so.0 +%attr(755,root,root) %{_libdir}/libwebrtc-audio-processing-1.so.0 %files devel %defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/libwebrtc_audio_processing.so -%{_includedir}/webrtc_audio_processing -%{_pkgconfigdir}/webrtc-audio-processing.pc +%attr(755,root,root) %{_libdir}/libwebrtc-audio-coding-1.so +%attr(755,root,root) %{_libdir}/libwebrtc-audio-processing-1.so +%{_includedir}/webrtc-audio-processing-1 +%{_pkgconfigdir}/webrtc-audio-coding-1.pc +%{_pkgconfigdir}/webrtc-audio-processing-1.pc %files static %defattr(644,root,root,755) -%{_libdir}/libwebrtc_audio_processing.a +%{_libdir}/libwebrtc-audio-coding-1.a +%{_libdir}/libwebrtc-audio-processing-1.a -- 2.44.0