Per Ã…hgren | 0cbb58e | 2019-10-29 22:59:44 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef MODULES_AUDIO_PROCESSING_NS_FAST_MATH_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_NS_FAST_MATH_H_ |
| 13 | |
| 14 | #include "api/array_view.h" |
| 15 | |
| 16 | namespace webrtc { |
| 17 | |
| 18 | // Sqrt approximation. |
| 19 | float SqrtFastApproximation(float f); |
| 20 | |
| 21 | // Log base conversion log(x) = log2(x)/log2(e). |
| 22 | float LogApproximation(float x); |
| 23 | void LogApproximation(rtc::ArrayView<const float> x, rtc::ArrayView<float> y); |
| 24 | |
| 25 | // 2^x approximation. |
| 26 | float Pow2Approximation(float p); |
| 27 | |
| 28 | // x^p approximation. |
| 29 | float PowApproximation(float x, float p); |
| 30 | |
| 31 | // e^x approximation. |
| 32 | float ExpApproximation(float x); |
| 33 | void ExpApproximation(rtc::ArrayView<const float> x, rtc::ArrayView<float> y); |
| 34 | void ExpApproximationSignFlip(rtc::ArrayView<const float> x, |
| 35 | rtc::ArrayView<float> y); |
| 36 | } // namespace webrtc |
| 37 | |
| 38 | #endif // MODULES_AUDIO_PROCESSING_NS_FAST_MATH_H_ |