webrtc-audio-processing/fix-i586.patch
Takashi Iwai e822930c68 This goes together with https://build.opensuse.org/request/show/1241613
which provides webrtc-audio-processing-1 for packages that haven't
updated to the breaking changes in w-a-p-2 yet.

- Update to version 2.1:
  * Build-system fixups to install more headers
  * add a missing absl dependency
  * forward port some missing patches to fix Windows builds.
- Update to version 2.0:
  * Bump to code from WebRTC M131 version.
  * Minor (breaking) API changes upstream
  * Various improvements to the AEC implementation
  * Transient suppression is removed
  * ExperimentalAgc and ExperimentalNs are removed
  * iSAC and the webrtc-audio-coding library were removed
  * abseil-cpp dependency bumped to 20240722
  * NEON runtime detection dropped following upstream
  * Fixes for building on i686 and MIPS
  * Support for BSDs is added
  * Other build-system cleanups
  * Patches to upstream are now also tracked in patches/
- Do not generate libwebrtc-audio-coding-* subpackages
  since the library was removed by upstream.
- Drop patches that aren't needed anymore:
  * big_endian_support.patch
  * big_endian_support_2.patch
  * fix-i586.patch
  * reduce-meson-dep.patch
  * webrtc-ppc64.patch
  * webrtc-s390x.patch
- Rebase patch to fix build with the new sources:
  * fix-build.patch

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/webrtc-audio-processing?expand=0&rev=29
2025-02-03 12:23:15 +00:00

127 lines
6.2 KiB
Diff

Index: webrtc-audio-processing-1.3/webrtc/third_party/pffft/src/pffft.c
===================================================================
--- webrtc-audio-processing-1.3.orig/webrtc/third_party/pffft/src/pffft.c
+++ webrtc-audio-processing-1.3/webrtc/third_party/pffft/src/pffft.c
@@ -131,7 +131,7 @@ inline v4sf ld_ps1(const float *p) { v4s
/*
SSE1 support macros
*/
-#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(__i386__) || defined(_M_IX86))
+#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(__i386__) || defined(_M_IX86)) && defined(__SSE2__)
#include <xmmintrin.h>
typedef __m128 v4sf;
Index: webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.cc
===================================================================
--- webrtc-audio-processing-1.3.orig/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.cc
+++ webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.cc
@@ -88,6 +88,7 @@ void ComputeFrequencyResponse_Neon(
#if defined(WEBRTC_ARCH_X86_FAMILY)
// Computes and stores the frequency response of the filter.
+__attribute__((target("sse2")))
void ComputeFrequencyResponse_Sse2(
size_t num_partitions,
const std::vector<std::vector<FftData>>& H,
@@ -207,9 +208,10 @@ void AdaptPartitions_Neon(const RenderBu
} while (p < lim2);
}
#endif
-
+
#if defined(WEBRTC_ARCH_X86_FAMILY)
// Adapts the filter partitions. (SSE2 variant)
+__attribute__((target("sse2")))
void AdaptPartitions_Sse2(const RenderBuffer& render_buffer,
const FftData& G,
size_t num_partitions,
@@ -375,6 +377,7 @@ void ApplyFilter_Neon(const RenderBuffer
#if defined(WEBRTC_ARCH_X86_FAMILY)
// Produces the filter output (SSE2 variant).
+__attribute__((target("sse2")))
void ApplyFilter_Sse2(const RenderBuffer& render_buffer,
size_t num_partitions,
const std::vector<std::vector<FftData>>& H,
Index: webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/matched_filter.cc
===================================================================
--- webrtc-audio-processing-1.3.orig/webrtc/modules/audio_processing/aec3/matched_filter.cc
+++ webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/matched_filter.cc
@@ -143,7 +143,7 @@ void MatchedFilterCore_NEON(size_t x_sta
#endif
#if defined(WEBRTC_ARCH_X86_FAMILY)
-
+__attribute__((target("sse2")))
void MatchedFilterCore_SSE2(size_t x_start_index,
float x2_sum_threshold,
float smoothing,
Index: webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/fft_data.h
===================================================================
--- webrtc-audio-processing-1.3.orig/webrtc/modules/audio_processing/aec3/fft_data.h
+++ webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/fft_data.h
@@ -48,7 +48,7 @@ struct FftData {
rtc::ArrayView<float> 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;
Index: webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/vector_math.h
===================================================================
--- webrtc-audio-processing-1.3.orig/webrtc/modules/audio_processing/aec3/vector_math.h
+++ webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/vector_math.h
@@ -43,7 +43,7 @@ class VectorMath {
void SqrtAVX2(rtc::ArrayView<float> x);
void Sqrt(rtc::ArrayView<float> 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<int>(x.size());
const int vector_limit = x_size >> 2;
@@ -123,7 +123,7 @@ class VectorMath {
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<int>(x.size());
const int vector_limit = x_size >> 2;
@@ -173,7 +173,7 @@ class VectorMath {
void Accumulate(rtc::ArrayView<const float> x, rtc::ArrayView<float> 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<int>(x.size());
const int vector_limit = x_size >> 2;
Index: webrtc-audio-processing-1.3/webrtc/modules/audio_processing/agc2/rnn_vad/rnn.cc
===================================================================
--- webrtc-audio-processing-1.3.orig/webrtc/modules/audio_processing/agc2/rnn_vad/rnn.cc
+++ webrtc-audio-processing-1.3/webrtc/modules/audio_processing/agc2/rnn_vad/rnn.cc
@@ -229,6 +229,7 @@ void ComputeFullyConnectedLayerOutput(
#if defined(WEBRTC_ARCH_X86_FAMILY)
// Fully connected layer SSE2 implementation.
+__attribute__((target("sse2")))
void ComputeFullyConnectedLayerOutputSse2(
size_t input_size,
size_t output_size,
Index: webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl.cc
===================================================================
--- webrtc-audio-processing-1.3.orig/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl.cc
+++ webrtc-audio-processing-1.3/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl.cc
@@ -57,6 +57,7 @@ void ErlComputer_NEON(
#if defined(WEBRTC_ARCH_X86_FAMILY)
// Computes and stores the echo return loss estimate of the filter, which is the
// sum of the partition frequency responses.
+__attribute__((target("sse2")))
void ErlComputer_SSE2(
const std::vector<std::array<float, kFftLengthBy2Plus1>>& H2,
rtc::ArrayView<float> erl) {