Reformat the WebRTC code base

Running clang-format with chromium's style guide.

The goal is n-fold:
 * providing consistency and readability (that's what code guidelines are for)
 * preventing noise with presubmit checks and git cl format
 * building on the previous point: making it easier to automatically fix format issues
 * you name it

Please consider using git-hyper-blame to ignore this commit.

Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
Yves Gerey
2018-06-19 15:03:05 +02:00
parent b602123a5a
commit 665174fdbb
1569 changed files with 30495 additions and 30309 deletions

View File

@ -69,12 +69,12 @@ int LevelFromGainError(int gain_error, int level) {
int new_level = level;
if (gain_error > 0) {
while (kGainMap[new_level] - kGainMap[level] < gain_error &&
new_level < kMaxMicLevel) {
new_level < kMaxMicLevel) {
++new_level;
}
} else {
while (kGainMap[new_level] - kGainMap[level] > gain_error &&
new_level > kMinMicLevel) {
new_level > kMinMicLevel) {
--new_level;
}
}
@ -88,26 +88,21 @@ int LevelFromGainError(int gain_error, int level) {
class DebugFile {
#ifdef WEBRTC_AGC_DEBUG_DUMP
public:
explicit DebugFile(const char* filename)
: file_(fopen(filename, "wb")) {
explicit DebugFile(const char* filename) : file_(fopen(filename, "wb")) {
RTC_DCHECK(file_);
}
~DebugFile() {
fclose(file_);
}
~DebugFile() { fclose(file_); }
void Write(const int16_t* data, size_t length_samples) {
fwrite(data, 1, length_samples * sizeof(int16_t), file_);
}
private:
FILE* file_;
#else
public:
explicit DebugFile(const char* filename) {
}
~DebugFile() {
}
void Write(const int16_t* data, size_t length_samples) {
}
explicit DebugFile(const char* filename) {}
~DebugFile() {}
void Write(const int16_t* data, size_t length_samples) {}
#endif // WEBRTC_AGC_DEBUG_DUMP
};
@ -272,7 +267,8 @@ void AgcManagerDirect::SetLevel(int new_level) {
if (voe_level > level_ + kLevelQuantizationSlack ||
voe_level < level_ - kLevelQuantizationSlack) {
RTC_DLOG(LS_INFO) << "[agc] Mic volume was manually adjusted. Updating "
"stored level from " << level_ << " to " << voe_level;
"stored level from "
<< level_ << " to " << voe_level;
level_ = voe_level;
// Always allow the user to increase the volume.
if (level_ > max_level_) {
@ -383,15 +379,15 @@ void AgcManagerDirect::UpdateGain() {
// target and the newly received target. This serves to soften perceptible
// intra-talkspurt adjustments, at the cost of some adaptation speed.
if ((raw_compression == max_compression_gain_ &&
target_compression_ == max_compression_gain_ - 1) ||
target_compression_ == max_compression_gain_ - 1) ||
(raw_compression == kMinCompressionGain &&
target_compression_ == kMinCompressionGain + 1)) {
target_compression_ == kMinCompressionGain + 1)) {
// Special case to allow the target to reach the endpoints of the
// compression range. The deemphasis would otherwise halt it at 1 dB shy.
target_compression_ = raw_compression;
} else {
target_compression_ = (raw_compression - target_compression_) / 2
+ target_compression_;
target_compression_ =
(raw_compression - target_compression_) / 2 + target_compression_;
}
// Residual error will be handled by adjusting the volume slider. Use the

View File

@ -14,262 +14,23 @@
static const int kGainMapSize = 256;
// Uses parameters: si = 2, sf = 0.25, D = 8/256
static const int kGainMap[kGainMapSize] = {
-56,
-54,
-52,
-50,
-48,
-47,
-45,
-43,
-42,
-40,
-38,
-37,
-35,
-34,
-33,
-31,
-30,
-29,
-27,
-26,
-25,
-24,
-23,
-22,
-20,
-19,
-18,
-17,
-16,
-15,
-14,
-14,
-13,
-12,
-11,
-10,
-9,
-8,
-8,
-7,
-6,
-5,
-5,
-4,
-3,
-2,
-2,
-1,
0,
0,
1,
1,
2,
3,
3,
4,
4,
5,
5,
6,
6,
7,
7,
8,
8,
9,
9,
10,
10,
11,
11,
12,
12,
13,
13,
13,
14,
14,
15,
15,
15,
16,
16,
17,
17,
17,
18,
18,
18,
19,
19,
19,
20,
20,
21,
21,
21,
22,
22,
22,
23,
23,
23,
24,
24,
24,
24,
25,
25,
25,
26,
26,
26,
27,
27,
27,
28,
28,
28,
28,
29,
29,
29,
30,
30,
30,
30,
31,
31,
31,
32,
32,
32,
32,
33,
33,
33,
33,
34,
34,
34,
35,
35,
35,
35,
36,
36,
36,
36,
37,
37,
37,
38,
38,
38,
38,
39,
39,
39,
39,
40,
40,
40,
40,
41,
41,
41,
41,
42,
42,
42,
42,
43,
43,
43,
44,
44,
44,
44,
45,
45,
45,
45,
46,
46,
46,
46,
47,
47,
47,
47,
48,
48,
48,
48,
49,
49,
49,
49,
50,
50,
50,
50,
51,
51,
51,
51,
52,
52,
52,
52,
53,
53,
53,
53,
54,
54,
54,
54,
55,
55,
55,
55,
56,
56,
56,
56,
57,
57,
57,
57,
58,
58,
58,
58,
59,
59,
59,
59,
60,
60,
60,
60,
61,
61,
61,
61,
62,
62,
62,
62,
63,
63,
63,
63,
64
};
-56, -54, -52, -50, -48, -47, -45, -43, -42, -40, -38, -37, -35, -34, -33,
-31, -30, -29, -27, -26, -25, -24, -23, -22, -20, -19, -18, -17, -16, -15,
-14, -14, -13, -12, -11, -10, -9, -8, -8, -7, -6, -5, -5, -4, -3,
-2, -2, -1, 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6,
6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13,
13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 18, 19,
19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24,
24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28,
29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33,
33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37,
37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41,
41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 44, 44, 44, 44, 45,
45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48,
49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52,
52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56,
56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60,
60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, 63,
64};
#endif // MODULES_AUDIO_PROCESSING_AGC_GAIN_MAP_INTERNAL_H_

View File

@ -20,8 +20,8 @@ namespace webrtc {
class MockAgc : public Agc {
public:
MOCK_METHOD2(AnalyzePreproc, float(const int16_t* audio, size_t length));
MOCK_METHOD3(Process, void(const int16_t* audio, size_t length,
int sample_rate_hz));
MOCK_METHOD3(Process,
void(const int16_t* audio, size_t length, int sample_rate_hz));
MOCK_METHOD1(GetRmsErrorDb, bool(int* error));
MOCK_METHOD0(Reset, void());
MOCK_METHOD1(set_target_level_dbfs, int(int level));