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/modules/audio_processing/vad/pitch_based_vad.h" | 11 #include "webrtc/modules/audio_processing/vad/pitch_based_vad.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <math.h> | 14 #include <math.h> |
15 #include <string.h> | 15 #include <string.h> |
16 | 16 |
17 #include "webrtc/modules/audio_processing/vad/vad_circular_buffer.h" | 17 #include "webrtc/modules/audio_processing/vad/vad_circular_buffer.h" |
18 #include "webrtc/modules/audio_processing/vad/common.h" | 18 #include "webrtc/modules/audio_processing/vad/common.h" |
19 #include "webrtc/modules/audio_processing/vad/noise_gmm_tables.h" | 19 #include "webrtc/modules/audio_processing/vad/noise_gmm_tables.h" |
20 #include "webrtc/modules/audio_processing/vad/voice_gmm_tables.h" | 20 #include "webrtc/modules/audio_processing/vad/voice_gmm_tables.h" |
21 #include "webrtc/modules/interface/module_common_types.h" | 21 #include "webrtc/modules/include/module_common_types.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 | 24 |
25 static_assert(kNoiseGmmDim == kVoiceGmmDim, | 25 static_assert(kNoiseGmmDim == kVoiceGmmDim, |
26 "noise and voice gmm dimension not equal"); | 26 "noise and voice gmm dimension not equal"); |
27 | 27 |
28 // These values should match MATLAB counterparts for unit-tests to pass. | 28 // These values should match MATLAB counterparts for unit-tests to pass. |
29 static const int kPosteriorHistorySize = 500; // 5 sec of 10 ms frames. | 29 static const int kPosteriorHistorySize = 500; // 5 sec of 10 ms frames. |
30 static const double kInitialPriorProbability = 0.3; | 30 static const double kInitialPriorProbability = 0.3; |
31 static const int kTransientWidthThreshold = 7; | 31 static const int kTransientWidthThreshold = 7; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 int PitchBasedVad::UpdatePrior(double p) { | 115 int PitchBasedVad::UpdatePrior(double p) { |
116 circular_buffer_->Insert(p); | 116 circular_buffer_->Insert(p); |
117 if (circular_buffer_->RemoveTransient(kTransientWidthThreshold, | 117 if (circular_buffer_->RemoveTransient(kTransientWidthThreshold, |
118 kLowProbabilityThreshold) < 0) | 118 kLowProbabilityThreshold) < 0) |
119 return -1; | 119 return -1; |
120 p_prior_ = circular_buffer_->Mean(); | 120 p_prior_ = circular_buffer_->Mean(); |
121 return 0; | 121 return 0; |
122 } | 122 } |
123 | 123 |
124 } // namespace webrtc | 124 } // namespace webrtc |
OLD | NEW |