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 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 static void DitherSilence(AudioFrame* frame) { | 58 static void DitherSilence(AudioFrame* frame) { |
59 ASSERT_EQ(1, frame->num_channels_); | 59 ASSERT_EQ(1, frame->num_channels_); |
60 const double kRmsSilence = 5; | 60 const double kRmsSilence = 5; |
61 const double sum_squared_silence = kRmsSilence * kRmsSilence * | 61 const double sum_squared_silence = kRmsSilence * kRmsSilence * |
62 frame->samples_per_channel_; | 62 frame->samples_per_channel_; |
63 double sum_squared = 0; | 63 double sum_squared = 0; |
64 for (size_t n = 0; n < frame->samples_per_channel_; n++) | 64 for (size_t n = 0; n < frame->samples_per_channel_; n++) |
65 sum_squared += frame->data_[n] * frame->data_[n]; | 65 sum_squared += frame->data_[n] * frame->data_[n]; |
66 if (sum_squared <= sum_squared_silence) { | 66 if (sum_squared <= sum_squared_silence) { |
67 for (size_t n = 0; n < frame->samples_per_channel_; n++) | 67 for (size_t n = 0; n < frame->samples_per_channel_; n++) |
68 frame->data_[n] = (rand() & 0xF) - 8; | 68 frame->data_[n] = (rand() & 0xF) - 8; // NOLINT: ignore non-threadsafe. |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 class AgcStat { | 72 class AgcStat { |
73 public: | 73 public: |
74 AgcStat() | 74 AgcStat() |
75 : video_index_(0), | 75 : video_index_(0), |
76 activity_threshold_(kDefaultActivityThreshold), | 76 activity_threshold_(kDefaultActivityThreshold), |
77 audio_content_(Histogram::Create(kAgcAnalWindowSamples)), | 77 audio_content_(Histogram::Create(kAgcAnalWindowSamples)), |
78 audio_processing_(new VadAudioProc()), | 78 audio_processing_(new VadAudioProc()), |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 " one probability per frame.\n" | 375 " one probability per frame.\n" |
376 "\nUsage:\n\n" | 376 "\nUsage:\n\n" |
377 "activity_metric input_pcm [options]\n" | 377 "activity_metric input_pcm [options]\n" |
378 "where 'input_pcm' is the input audio sampled at 16 kHz in 16 bits " | 378 "where 'input_pcm' is the input audio sampled at 16 kHz in 16 bits " |
379 "format.\n\n"; | 379 "format.\n\n"; |
380 google::SetUsageMessage(kUsage); | 380 google::SetUsageMessage(kUsage); |
381 google::ParseCommandLineFlags(&argc, &argv, true); | 381 google::ParseCommandLineFlags(&argc, &argv, true); |
382 webrtc::void_main(argc, argv); | 382 webrtc::void_main(argc, argv); |
383 return 0; | 383 return 0; |
384 } | 384 } |
OLD | NEW |