summaryrefslogtreecommitdiff
path: root/media/base/vector_math.cc
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-03-28 15:31:22 +0000
committerTorne (Richard Coles) <torne@google.com>2013-03-28 15:31:22 +0000
commit2a99a7e74a7f215066514fe81d2bfa6639d9eddd (patch)
tree7c2d04841fcd599fd83b0f0bb1100e1c89a35bae /media/base/vector_math.cc
parent61c449bbbb53310a8c041d8cefdd6b01a126cc7e (diff)
downloadchromium_org-2a99a7e74a7f215066514fe81d2bfa6639d9eddd.tar.gz
Merge from Chromium at DEPS revision r190564
This commit was generated by merge_to_master.py. Change-Id: Icadecbce29854b8fa25fd335b2c1949b5ca5d170
Diffstat (limited to 'media/base/vector_math.cc')
-rw-r--r--media/base/vector_math.cc26
1 files changed, 5 insertions, 21 deletions
diff --git a/media/base/vector_math.cc b/media/base/vector_math.cc
index edd95cd5e9..96f94d95e4 100644
--- a/media/base/vector_math.cc
+++ b/media/base/vector_math.cc
@@ -7,11 +7,6 @@
#include "base/cpu.h"
#include "base/logging.h"
-#include "build/build_config.h"
-
-#if defined(ARCH_CPU_X86_FAMILY) && defined(__SSE__)
-#include <xmmintrin.h>
-#endif
namespace media {
namespace vector_math {
@@ -25,9 +20,13 @@ void FMAC(const float src[], float scale, int len, float dest[]) {
// selection thread safe.
typedef void (*VectorFMACProc)(const float src[], float scale, int len,
float dest[]);
-#if defined(ARCH_CPU_X86_FAMILY) && defined(__SSE__)
+#if defined(ARCH_CPU_X86_FAMILY)
+#if defined(__SSE__)
+ static const VectorFMACProc kVectorFMACProc = FMAC_SSE;
+#else
static const VectorFMACProc kVectorFMACProc =
base::CPU().has_sse() ? FMAC_SSE : FMAC_C;
+#endif
#else
static const VectorFMACProc kVectorFMACProc = FMAC_C;
#endif
@@ -40,20 +39,5 @@ void FMAC_C(const float src[], float scale, int len, float dest[]) {
dest[i] += src[i] * scale;
}
-#if defined(ARCH_CPU_X86_FAMILY) && defined(__SSE__)
-void FMAC_SSE(const float src[], float scale, int len, float dest[]) {
- __m128 m_scale = _mm_set_ps1(scale);
- int rem = len % 4;
- for (int i = 0; i < len - rem; i += 4) {
- _mm_store_ps(dest + i, _mm_add_ps(_mm_load_ps(dest + i),
- _mm_mul_ps(_mm_load_ps(src + i), m_scale)));
- }
-
- // Handle any remaining values that wouldn't fit in an SSE pass.
- if (rem)
- FMAC_C(src + len - rem, scale, rem, dest + len - rem);
-}
-#endif
-
} // namespace vector_math
} // namespace media