| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/vector_math.h" | 5 #include "media/base/vector_math.h" |
| 6 #include "media/base/vector_math_testing.h" | 6 #include "media/base/vector_math_testing.h" |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/cpu.h" | 10 #include "base/cpu.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 const float sample = src[i]; | 195 const float sample = src[i]; |
| 196 const float sample_squared = sample * sample; | 196 const float sample_squared = sample * sample; |
| 197 result.first += sample_squared * smoothing_factor; | 197 result.first += sample_squared * smoothing_factor; |
| 198 result.second = std::max(result.second, sample_squared); | 198 result.second = std::max(result.second, sample_squared); |
| 199 } | 199 } |
| 200 | 200 |
| 201 return result; | 201 return result; |
| 202 } | 202 } |
| 203 #endif | 203 #endif |
| 204 | 204 |
| 205 |
| 206 // TODO(dalecurtis): Add SIMD versions and performance tests. |
| 207 void Crossfade(const float src[], int len, float dest[]) { |
| 208 float cf_ratio = 0; |
| 209 const float cf_increment = 1.0f / len; |
| 210 for (int i = 0; i < len; ++i, cf_ratio += cf_increment) |
| 211 dest[i] = (1.0f - cf_ratio) * src[i] + cf_ratio * dest[i]; |
| 212 } |
| 213 |
| 205 } // namespace vector_math | 214 } // namespace vector_math |
| 206 } // namespace media | 215 } // namespace media |
| OLD | NEW |