File fix-i586.patch of Package webrtc-audio-processing
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) {