blob: 0aefee940bb000499d42c695c1796297b3fd2129 [file] [log] [blame]
Per Ã…hgren0cbb58e2019-10-29 22:59:44 +01001/*
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
16namespace webrtc {
17
18// Sqrt approximation.
19float SqrtFastApproximation(float f);
20
21// Log base conversion log(x) = log2(x)/log2(e).
22float LogApproximation(float x);
23void LogApproximation(rtc::ArrayView<const float> x, rtc::ArrayView<float> y);
24
25// 2^x approximation.
26float Pow2Approximation(float p);
27
28// x^p approximation.
29float PowApproximation(float x, float p);
30
31// e^x approximation.
32float ExpApproximation(float x);
33void ExpApproximation(rtc::ArrayView<const float> x, rtc::ArrayView<float> y);
34void ExpApproximationSignFlip(rtc::ArrayView<const float> x,
35 rtc::ArrayView<float> y);
36} // namespace webrtc
37
38#endif // MODULES_AUDIO_PROCESSING_NS_FAST_MATH_H_