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 | 11 |
12 #include <math.h> | 12 #include <math.h> |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 | 15 |
16 #include <algorithm> | 16 #include <algorithm> |
| 17 #include <memory> |
17 | 18 |
18 #include "gflags/gflags.h" | 19 #include "gflags/gflags.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "webrtc/base/scoped_ptr.h" | |
21 #include "webrtc/modules/audio_processing/agc/agc.h" | 21 #include "webrtc/modules/audio_processing/agc/agc.h" |
22 #include "webrtc/modules/audio_processing/agc/histogram.h" | 22 #include "webrtc/modules/audio_processing/agc/histogram.h" |
23 #include "webrtc/modules/audio_processing/agc/utility.h" | 23 #include "webrtc/modules/audio_processing/agc/utility.h" |
24 #include "webrtc/modules/audio_processing/vad/vad_audio_proc.h" | 24 #include "webrtc/modules/audio_processing/vad/vad_audio_proc.h" |
25 #include "webrtc/modules/audio_processing/vad/common.h" | 25 #include "webrtc/modules/audio_processing/vad/common.h" |
26 #include "webrtc/modules/audio_processing/vad/pitch_based_vad.h" | 26 #include "webrtc/modules/audio_processing/vad/pitch_based_vad.h" |
27 #include "webrtc/modules/audio_processing/vad/standalone_vad.h" | 27 #include "webrtc/modules/audio_processing/vad/standalone_vad.h" |
28 #include "webrtc/modules/include/module_common_types.h" | 28 #include "webrtc/modules/include/module_common_types.h" |
29 | 29 |
30 static const int kAgcAnalWindowSamples = 100; | 30 static const int kAgcAnalWindowSamples = 100; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 void SetActivityThreshold(double activity_threshold) { | 150 void SetActivityThreshold(double activity_threshold) { |
151 activity_threshold_ = activity_threshold; | 151 activity_threshold_ = activity_threshold; |
152 } | 152 } |
153 | 153 |
154 private: | 154 private: |
155 int video_index_; | 155 int video_index_; |
156 double activity_threshold_; | 156 double activity_threshold_; |
157 double video_vad_[kMaxNumFrames]; | 157 double video_vad_[kMaxNumFrames]; |
158 rtc::scoped_ptr<Histogram> audio_content_; | 158 std::unique_ptr<Histogram> audio_content_; |
159 rtc::scoped_ptr<VadAudioProc> audio_processing_; | 159 std::unique_ptr<VadAudioProc> audio_processing_; |
160 rtc::scoped_ptr<PitchBasedVad> vad_; | 160 std::unique_ptr<PitchBasedVad> vad_; |
161 rtc::scoped_ptr<StandaloneVad> standalone_vad_; | 161 std::unique_ptr<StandaloneVad> standalone_vad_; |
162 | 162 |
163 FILE* audio_content_fid_; | 163 FILE* audio_content_fid_; |
164 }; | 164 }; |
165 | 165 |
166 | 166 |
167 void void_main(int argc, char* argv[]) { | 167 void void_main(int argc, char* argv[]) { |
168 webrtc::AgcStat agc_stat; | 168 webrtc::AgcStat agc_stat; |
169 | 169 |
170 FILE* pcm_fid = fopen(argv[1], "rb"); | 170 FILE* pcm_fid = fopen(argv[1], "rb"); |
171 ASSERT_TRUE(pcm_fid != NULL) << "Cannot open PCM file " << argv[1]; | 171 ASSERT_TRUE(pcm_fid != NULL) << "Cannot open PCM file " << argv[1]; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 " one probability per frame.\n" | 376 " one probability per frame.\n" |
377 "\nUsage:\n\n" | 377 "\nUsage:\n\n" |
378 "activity_metric input_pcm [options]\n" | 378 "activity_metric input_pcm [options]\n" |
379 "where 'input_pcm' is the input audio sampled at 16 kHz in 16 bits " | 379 "where 'input_pcm' is the input audio sampled at 16 kHz in 16 bits " |
380 "format.\n\n"; | 380 "format.\n\n"; |
381 google::SetUsageMessage(kUsage); | 381 google::SetUsageMessage(kUsage); |
382 google::ParseCommandLineFlags(&argc, &argv, true); | 382 google::ParseCommandLineFlags(&argc, &argv, true); |
383 webrtc::void_main(argc, argv); | 383 webrtc::void_main(argc, argv); |
384 return 0; | 384 return 0; |
385 } | 385 } |
OLD | NEW |