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

Unified Diff: media/base/simd/vector_math_sse.cc

Issue 13726011: Add vector_math::FMUL. Replace audio_util::AdjustVolume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix volume == 1 case. Created 7 years, 8 months 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/audio_converter.cc ('k') | media/base/vector_math.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/simd/vector_math_sse.cc
diff --git a/media/base/simd/vector_math_sse.cc b/media/base/simd/vector_math_sse.cc
index 5cc2df96325ad16701961abd52a3a0faf2bcd0d4..39bcaa0c195fd0dd2570b37065f0df7fdd3a9b7d 100644
--- a/media/base/simd/vector_math_sse.cc
+++ b/media/base/simd/vector_math_sse.cc
@@ -9,6 +9,18 @@
namespace media {
namespace vector_math {
+void FMUL_SSE(const float src[], float scale, int len, float dest[]) {
+ const int rem = len % 4;
+ const int last_index = len - rem;
+ __m128 m_scale = _mm_set_ps1(scale);
+ for (int i = 0; i < last_index; i += 4)
+ _mm_store_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.
+ for (int i = last_index; i < len; ++i)
+ dest[i] = src[i] * scale;
+}
+
void FMAC_SSE(const float src[], float scale, int len, float dest[]) {
const int rem = len % 4;
const int last_index = len - rem;
« no previous file with comments | « media/base/audio_converter.cc ('k') | media/base/vector_math.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698