| Index: media/base/vector_math.cc
|
| diff --git a/media/base/vector_math.cc b/media/base/vector_math.cc
|
| index 96f94d95e4b60846a15001375ac1c8a62b2cf76a..93576a17bfc8b6fed24e8d174ba185600a0ef1cf 100644
|
| --- a/media/base/vector_math.cc
|
| +++ b/media/base/vector_math.cc
|
| @@ -16,14 +16,17 @@ void FMAC(const float src[], float scale, int len, float dest[]) {
|
| DCHECK_EQ(0u, reinterpret_cast<uintptr_t>(src) & (kRequiredAlignment - 1));
|
| DCHECK_EQ(0u, reinterpret_cast<uintptr_t>(dest) & (kRequiredAlignment - 1));
|
|
|
| - // Rely on function level static initialization to keep VectorFMACProc
|
| - // selection thread safe.
|
| typedef void (*VectorFMACProc)(const float src[], float scale, int len,
|
| float dest[]);
|
| -#if defined(ARCH_CPU_X86_FAMILY)
|
| +
|
| + // No NaCl code uses the SSE functionality of AudioBus and plumbing the -msse
|
| + // built library is non-trivial, so simply disable for now.
|
| +#if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_NACL)
|
| #if defined(__SSE__)
|
| static const VectorFMACProc kVectorFMACProc = FMAC_SSE;
|
| #else
|
| + // TODO(dalecurtis): Remove function level static initialization, it's not
|
| + // thread safe: http://crbug.com/224662.
|
| static const VectorFMACProc kVectorFMACProc =
|
| base::CPU().has_sse() ? FMAC_SSE : FMAC_C;
|
| #endif
|
| @@ -39,5 +42,36 @@ void FMAC_C(const float src[], float scale, int len, float dest[]) {
|
| dest[i] += src[i] * scale;
|
| }
|
|
|
| +void FMUL(const float src[], float scale, int len, float dest[]) {
|
| + // Ensure |src| and |dest| are 16-byte aligned.
|
| + DCHECK_EQ(0u, reinterpret_cast<uintptr_t>(src) & (kRequiredAlignment - 1));
|
| + DCHECK_EQ(0u, reinterpret_cast<uintptr_t>(dest) & (kRequiredAlignment - 1));
|
| +
|
| + typedef void (*VectorFMULProc)(const float src[], float scale, int len,
|
| + float dest[]);
|
| +
|
| + // No NaCl code uses the SSE functionality of AudioBus and plumbing the -msse
|
| + // built library is non-trivial, so simply disable for now.
|
| +#if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_NACL)
|
| +#if defined(__SSE__)
|
| + static const VectorFMULProc kVectorFMULProc = FMUL_SSE;
|
| +#else
|
| + // TODO(dalecurtis): Remove function level static initialization, it's not
|
| + // thread safe: http://crbug.com/224662.
|
| + static const VectorFMULProc kVectorFMULProc =
|
| + base::CPU().has_sse() ? FMUL_SSE : FMUL_C;
|
| +#endif
|
| +#else
|
| + static const VectorFMULProc kVectorFMULProc = FMUL_C;
|
| +#endif
|
| +
|
| + return kVectorFMULProc(src, scale, len, dest);
|
| +}
|
| +
|
| +void FMUL_C(const float src[], float scale, int len, float dest[]) {
|
| + for (int i = 0; i < len; ++i)
|
| + dest[i] = src[i] * scale;
|
| +}
|
| +
|
| } // namespace vector_math
|
| } // namespace media
|
|
|