Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(975)

Unified Diff: media/base/vector_math.h

Issue 2556993002: Experiment with AVX optimizations for FMAC, FMUL operations.
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/sinc_resampler_unittest.cc ('k') | media/base/vector_math.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/vector_math.h
diff --git a/media/base/vector_math.h b/media/base/vector_math.h
index a148ca050f1c399c7caa0b772870fb65fcc7d4e5..dce319495080801eeb820b16e3987f9b48348021 100644
--- a/media/base/vector_math.h
+++ b/media/base/vector_math.h
@@ -12,16 +12,35 @@
namespace media {
namespace vector_math {
-// Required alignment for inputs and outputs to all vector math functions
-enum { kRequiredAlignment = 16 };
+enum {
+ // Kernel size for use with Convolve(); must be a multiple of 32. Higher
+ // values increase the quality of the convolution.
+ kKernelSize = 32,
+
+ // Required alignment for inputs and outputs to all vector math functions
+ kRequiredAlignment = 32
+};
+
+// Sets up CPU specific optimizations.
+MEDIA_EXPORT void Initialize();
+
+// Compute convolution of |k1| and |k2| over |src|, resultant sums are
+// linearly interpolated using |kernel_interpolation_factor|.
+MEDIA_EXPORT float Convolve(const float* src,
+ const float* k1,
+ const float* k2,
+ double kernel_interpolation_factor);
+
+// Computes the dot-product (scalar-product) of two vectors of length |len|.
+MEDIA_EXPORT float DotProduct(const float* a, const float* b, int len);
// Multiply each element of |src| (up to |len|) by |scale| and add to |dest|.
// |src| and |dest| must be aligned by kRequiredAlignment.
-MEDIA_EXPORT void FMAC(const float src[], float scale, int len, float dest[]);
+MEDIA_EXPORT void FMAC(const float* src, float scale, int len, float* dest);
// Multiply each element of |src| by |scale| and store in |dest|. |src| and
// |dest| must be aligned by kRequiredAlignment.
-MEDIA_EXPORT void FMUL(const float src[], float scale, int len, float dest[]);
+MEDIA_EXPORT void FMUL(const float* src, float scale, int len, float* dest);
// Computes the exponentially-weighted moving average power of a signal by
// iterating the recurrence:
@@ -30,10 +49,10 @@ MEDIA_EXPORT void FMUL(const float src[], float scale, int len, float dest[]);
// y[n] = smoothing_factor * src[n]^2 + (1-smoothing_factor) * y[n-1]
//
// Returns the final average power and the maximum squared element value.
-MEDIA_EXPORT std::pair<float, float> EWMAAndMaxPower(
- float initial_value, const float src[], int len, float smoothing_factor);
-
-MEDIA_EXPORT void Crossfade(const float src[], int len, float dest[]);
+MEDIA_EXPORT std::pair<float, float> EWMAAndMaxPower(float initial_value,
+ const float* src,
+ int len,
+ float smoothing_factor);
} // namespace vector_math
} // namespace media
« no previous file with comments | « media/base/sinc_resampler_unittest.cc ('k') | media/base/vector_math.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698