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

Side by Side Diff: webrtc/modules/audio_processing/level_controller/level_controller.cc

Issue 2718953002: Roll chromium_revision 33a7a547b9..0e44c5e141 (452838:453130) (Closed)
Patch Set: Disabling test for iOS Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 audio.channels_const_f()[k] + audio.num_frames(), 0, 52 audio.channels_const_f()[k] + audio.num_frames(), 0,
53 [](float a, float b) -> float { return a + b * b; }); 53 [](float a, float b) -> float { return a + b * b; });
54 energy = std::max(channel_energy, energy); 54 energy = std::max(channel_energy, energy);
55 } 55 }
56 return energy; 56 return energy;
57 } 57 }
58 58
59 float PeakLevel(const AudioBuffer& audio) { 59 float PeakLevel(const AudioBuffer& audio) {
60 float peak_level = 0.f; 60 float peak_level = 0.f;
61 for (size_t k = 0; k < audio.num_channels(); ++k) { 61 for (size_t k = 0; k < audio.num_channels(); ++k) {
62 auto channel_peak_level = std::max_element( 62 auto* channel_peak_level = std::max_element(
63 audio.channels_const_f()[k], 63 audio.channels_const_f()[k],
64 audio.channels_const_f()[k] + audio.num_frames(), 64 audio.channels_const_f()[k] + audio.num_frames(),
65 [](float a, float b) { return std::abs(a) < std::abs(b); }); 65 [](float a, float b) { return std::abs(a) < std::abs(b); });
66 peak_level = std::max(*channel_peak_level, peak_level); 66 peak_level = std::max(*channel_peak_level, peak_level);
67 } 67 }
68 return peak_level; 68 return peak_level;
69 } 69 }
70 70
71 const int kMetricsFrameInterval = 1000; 71 const int kMetricsFrameInterval = 1000;
72 72
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 bool LevelController::Validate( 285 bool LevelController::Validate(
286 const AudioProcessing::Config::LevelController& config) { 286 const AudioProcessing::Config::LevelController& config) {
287 return (config.initial_peak_level_dbfs < 287 return (config.initial_peak_level_dbfs <
288 std::numeric_limits<float>::epsilon() && 288 std::numeric_limits<float>::epsilon() &&
289 config.initial_peak_level_dbfs > 289 config.initial_peak_level_dbfs >
290 -(100.f + std::numeric_limits<float>::epsilon())); 290 -(100.f + std::numeric_limits<float>::epsilon()));
291 } 291 }
292 292
293 } // namespace webrtc 293 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec3/cascaded_biquad_filter.cc ('k') | webrtc/pc/channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698