suppress uninit error at WebEmbeddedWorkerImpl::startWorkerContext
[chromium-blink-merge.git] / media / base / vector_math.h
bloba148ca050f1c399c7caa0b772870fb65fcc7d4e5
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_VECTOR_MATH_H_
6 #define MEDIA_BASE_VECTOR_MATH_H_
8 #include <utility>
10 #include "media/base/media_export.h"
12 namespace media {
13 namespace vector_math {
15 // Required alignment for inputs and outputs to all vector math functions
16 enum { kRequiredAlignment = 16 };
18 // Multiply each element of |src| (up to |len|) by |scale| and add to |dest|.
19 // |src| and |dest| must be aligned by kRequiredAlignment.
20 MEDIA_EXPORT void FMAC(const float src[], float scale, int len, float dest[]);
22 // Multiply each element of |src| by |scale| and store in |dest|. |src| and
23 // |dest| must be aligned by kRequiredAlignment.
24 MEDIA_EXPORT void FMUL(const float src[], float scale, int len, float dest[]);
26 // Computes the exponentially-weighted moving average power of a signal by
27 // iterating the recurrence:
29 // y[-1] = initial_value
30 // y[n] = smoothing_factor * src[n]^2 + (1-smoothing_factor) * y[n-1]
32 // Returns the final average power and the maximum squared element value.
33 MEDIA_EXPORT std::pair<float, float> EWMAAndMaxPower(
34 float initial_value, const float src[], int len, float smoothing_factor);
36 MEDIA_EXPORT void Crossfade(const float src[], int len, float dest[]);
38 } // namespace vector_math
39 } // namespace media
41 #endif // MEDIA_BASE_VECTOR_MATH_H_