Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.6 KiB
C++
Raw Normal View History

/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/audio_processing/aec3/aec3_common.h"
#include <stdint.h>
#include "rtc_base/checks.h"
#include "rtc_base/system/arch.h"
#include "system_wrappers/include/cpu_features_wrapper.h"
namespace webrtc {
Aec3Optimization DetectOptimization() {
#if defined(WEBRTC_ARCH_X86_FAMILY)
if (WebRtc_GetCPUInfo(kAVX2) != 0) {
return Aec3Optimization::kAvx2;
} else if (WebRtc_GetCPUInfo(kSSE2) != 0) {
return Aec3Optimization::kSse2;
}
#endif
Reland of Added ARM Neon SIMD optimizations for AEC3 (patchset #1 id:1 of https://codereview.webrtc.org/2856113003/ ) Reason for revert: The original patch set was correct, but the Chromium bug number needed to be corrected. Original issue's description: > Revert of Added ARM Neon SIMD optimizations for AEC3 (patchset #2 id:970001 of https://codereview.webrtc.org/2834073005/ ) > > Reason for revert: > The bug number for the chromium bug was wrong. > > Original issue's description: > > Added ARM Neon optimizations for AEC3 > > > > This CL adds Neon SIMD optimizations for AEC3 on ARM, resulting > > in an 8 times complexity reduction. The optimizations are basically > > identical to what was already in place for SSE2. > > > > BUG=chromium:14993, webrtc:6018 > > > > Review-Url: https://codereview.webrtc.org/2834073005 > > Cr-Commit-Position: refs/heads/master@{#17993} > > Committed: https://chromium.googlesource.com/external/webrtc/+/f246b91eba0e8d95bd3fee4634887fb6d3017811 > > TBR=ivoc@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=chromium:14993, webrtc:6018 > > Review-Url: https://codereview.webrtc.org/2856113003 > Cr-Commit-Position: refs/heads/master@{#17994} > Committed: https://chromium.googlesource.com/external/webrtc/+/b70f8cfd4d5cf6fe31a8089df9955b7e7b7ebd32 TBR=ivoc@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chromium:714993, webrtc:6018 Review-Url: https://codereview.webrtc.org/2862573002 Cr-Commit-Position: refs/heads/master@{#17997}
2017-05-03 06:45:44 -07:00
#if defined(WEBRTC_HAS_NEON)
return Aec3Optimization::kNeon;
#endif
return Aec3Optimization::kNone;
}
float FastApproxLog2f(const float in) {
RTC_DCHECK_GT(in, .0f);
// Read and interpret float as uint32_t and then cast to float.
// This is done to extract the exponent (bits 30 - 23).
// "Right shift" of the exponent is then performed by multiplying
// with the constant (1/2^23). Finally, we subtract a constant to
// remove the bias (https://en.wikipedia.org/wiki/Exponent_bias).
union {
float dummy;
uint32_t a;
} x = {in};
float out = x.a;
out *= 1.1920929e-7f; // 1/2^23
out -= 126.942695f; // Remove bias.
return out;
}
float Log2TodB(const float in_log2) {
return 3.0102999566398121 * in_log2;
}
} // namespace webrtc