fast_math.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #ifndef MODULES_AUDIO_PROCESSING_NS_FAST_MATH_H_
  11. #define MODULES_AUDIO_PROCESSING_NS_FAST_MATH_H_
  12. #include "api/array_view.h"
  13. namespace webrtc {
  14. // Sqrt approximation.
  15. float SqrtFastApproximation(float f);
  16. // Log base conversion log(x) = log2(x)/log2(e).
  17. float LogApproximation(float x);
  18. void LogApproximation(rtc::ArrayView<const float> x, rtc::ArrayView<float> y);
  19. // 2^x approximation.
  20. float Pow2Approximation(float p);
  21. // x^p approximation.
  22. float PowApproximation(float x, float p);
  23. // e^x approximation.
  24. float ExpApproximation(float x);
  25. void ExpApproximation(rtc::ArrayView<const float> x, rtc::ArrayView<float> y);
  26. void ExpApproximationSignFlip(rtc::ArrayView<const float> x,
  27. rtc::ArrayView<float> y);
  28. } // namespace webrtc
  29. #endif // MODULES_AUDIO_PROCESSING_NS_FAST_MATH_H_