Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1136)

Unified Diff: webrtc/modules/audio_processing/aec3/vector_math.h

Issue 2856113003: Revert of Added ARM Neon SIMD optimizations for AEC3 (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/aec3/vector_math.h
diff --git a/webrtc/modules/audio_processing/aec3/vector_math.h b/webrtc/modules/audio_processing/aec3/vector_math.h
index b943f2beddf91989544409338daaeb2cb61ddbc1..afd4262b6ba07ee6d58389ad7e991176360ba167 100644
--- a/webrtc/modules/audio_processing/aec3/vector_math.h
+++ b/webrtc/modules/audio_processing/aec3/vector_math.h
@@ -12,9 +12,6 @@
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_VECTOR_MATH_H_
#include "webrtc/typedefs.h"
-#if defined(WEBRTC_HAS_NEON)
-#include <arm_neon.h>
-#endif
#if defined(WEBRTC_ARCH_X86_FAMILY)
#include <emmintrin.h>
#endif
@@ -56,51 +53,6 @@
}
} break;
#endif
-#if defined(WEBRTC_HAS_NEON)
- case Aec3Optimization::kNeon: {
- const int x_size = static_cast<int>(x.size());
- const int vector_limit = x_size >> 2;
-
- int j = 0;
- for (; j < vector_limit * 4; j += 4) {
- float32x4_t g = vld1q_f32(&x[j]);
-#if !defined(WEBRTC_ARCH_ARM64)
- float32x4_t y = vrsqrteq_f32(g);
-
- // Code to handle sqrt(0).
- // If the input to sqrtf() is zero, a zero will be returned.
- // If the input to vrsqrteq_f32() is zero, positive infinity is
- // returned.
- const uint32x4_t vec_p_inf = vdupq_n_u32(0x7F800000);
- // check for divide by zero
- const uint32x4_t div_by_zero =
- vceqq_u32(vec_p_inf, vreinterpretq_u32_f32(y));
- // zero out the positive infinity results
- y = vreinterpretq_f32_u32(
- vandq_u32(vmvnq_u32(div_by_zero), vreinterpretq_u32_f32(y)));
- // from arm documentation
- // The Newton-Raphson iteration:
- // y[n+1] = y[n] * (3 - d * (y[n] * y[n])) / 2)
- // converges to (1/√d) if y0 is the result of VRSQRTE applied to d.
- //
- // Note: The precision did not improve after 2 iterations.
- for (int i = 0; i < 2; i++) {
- y = vmulq_f32(vrsqrtsq_f32(vmulq_f32(y, y), g), y);
- }
- // sqrt(g) = g * 1/sqrt(g)
- g = vmulq_f32(g, y);
-#else
- g = vsqrtq_f32(g);
-#endif
- vst1q_f32(&x[j], g);
- }
-
- for (; j < x_size; ++j) {
- x[j] = sqrtf(x[j]);
- }
- }
-#endif
- break;
default:
std::for_each(x.begin(), x.end(), [](float& a) { a = sqrtf(a); });
}
@@ -124,24 +76,6 @@
const __m128 y_j = _mm_loadu_ps(&y[j]);
const __m128 z_j = _mm_mul_ps(x_j, y_j);
_mm_storeu_ps(&z[j], z_j);
- }
-
- for (; j < x_size; ++j) {
- z[j] = x[j] * y[j];
- }
- } break;
-#endif
-#if defined(WEBRTC_HAS_NEON)
- case Aec3Optimization::kNeon: {
- const int x_size = static_cast<int>(x.size());
- const int vector_limit = x_size >> 2;
-
- int j = 0;
- for (; j < vector_limit * 4; j += 4) {
- const float32x4_t x_j = vld1q_f32(&x[j]);
- const float32x4_t y_j = vld1q_f32(&y[j]);
- const float32x4_t z_j = vmulq_f32(x_j, y_j);
- vst1q_f32(&z[j], z_j);
}
for (; j < x_size; ++j) {
@@ -177,24 +111,6 @@
}
} break;
#endif
-#if defined(WEBRTC_HAS_NEON)
- case Aec3Optimization::kNeon: {
- const int x_size = static_cast<int>(x.size());
- const int vector_limit = x_size >> 2;
-
- int j = 0;
- for (; j < vector_limit * 4; j += 4) {
- const float32x4_t x_j = vld1q_f32(&x[j]);
- float32x4_t z_j = vld1q_f32(&z[j]);
- z_j = vaddq_f32(z_j, x_j);
- vst1q_f32(&z[j], z_j);
- }
-
- for (; j < x_size; ++j) {
- z[j] += x[j];
- }
- } break;
-#endif
default:
std::transform(x.begin(), x.end(), z.begin(), z.begin(),
std::plus<float>());

Powered by Google App Engine
This is Rietveld 408576698