OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #include "webrtc/tools/agc/test_utils.h" | 11 #include "webrtc/tools/agc/test_utils.h" |
12 | 12 |
13 #include <cmath> | 13 #include <cmath> |
14 | 14 |
15 #include <algorithm> | 15 #include <algorithm> |
16 | 16 |
17 #include "webrtc/modules/interface/module_common_types.h" | 17 #include "webrtc/modules/include/module_common_types.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 float MicLevel2Gain(int gain_range_db, int level) { | 21 float MicLevel2Gain(int gain_range_db, int level) { |
22 return (level - 127.0f) / 128.0f * gain_range_db / 2; | 22 return (level - 127.0f) / 128.0f * gain_range_db / 2; |
23 } | 23 } |
24 | 24 |
25 float Db2Linear(float db) { | 25 float Db2Linear(float db) { |
26 return powf(10.0f, db / 20.0f); | 26 return powf(10.0f, db / 20.0f); |
27 } | 27 } |
(...skipping 27 matching lines...) Expand all Loading... |
55 | 55 |
56 void SimulateMic(int gain_map[255], int mic_level, int last_mic_level, | 56 void SimulateMic(int gain_map[255], int mic_level, int last_mic_level, |
57 AudioFrame* frame) { | 57 AudioFrame* frame) { |
58 assert(mic_level >= 0 && mic_level <= 255); | 58 assert(mic_level >= 0 && mic_level <= 255); |
59 assert(last_mic_level >= 0 && last_mic_level <= 255); | 59 assert(last_mic_level >= 0 && last_mic_level <= 255); |
60 ApplyGain(gain_map[mic_level], gain_map[last_mic_level], frame); | 60 ApplyGain(gain_map[mic_level], gain_map[last_mic_level], frame); |
61 } | 61 } |
62 | 62 |
63 } // namespace webrtc | 63 } // namespace webrtc |
64 | 64 |
OLD | NEW |