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

Side by Side Diff: media/base/vector_math.cc

Issue 156783003: Enhance AudioSplicer to crossfade marked splice frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve comments. Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« media/base/audio_splicer.cc ('K') | « media/base/vector_math.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« media/base/audio_splicer.cc ('K') | « media/base/vector_math.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698