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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 double p; | 68 double p; |
69 double gmm_features[3]; | 69 double gmm_features[3]; |
70 double pdf_features_given_voice; | 70 double pdf_features_given_voice; |
71 double pdf_features_given_noise; | 71 double pdf_features_given_noise; |
72 // These limits are the same in matlab implementation 'VoicingProbGMM().' | 72 // These limits are the same in matlab implementation 'VoicingProbGMM().' |
73 const double kLimLowLogPitchGain = -2.0; | 73 const double kLimLowLogPitchGain = -2.0; |
74 const double kLimHighLogPitchGain = -0.9; | 74 const double kLimHighLogPitchGain = -0.9; |
75 const double kLimLowSpectralPeak = 200; | 75 const double kLimLowSpectralPeak = 200; |
76 const double kLimHighSpectralPeak = 2000; | 76 const double kLimHighSpectralPeak = 2000; |
77 const double kEps = 1e-12; | 77 const double kEps = 1e-12; |
78 for (int n = 0; n < features.num_frames; n++) { | 78 for (size_t n = 0; n < features.num_frames; n++) { |
79 gmm_features[0] = features.log_pitch_gain[n]; | 79 gmm_features[0] = features.log_pitch_gain[n]; |
80 gmm_features[1] = features.spectral_peak[n]; | 80 gmm_features[1] = features.spectral_peak[n]; |
81 gmm_features[2] = features.pitch_lag_hz[n]; | 81 gmm_features[2] = features.pitch_lag_hz[n]; |
82 | 82 |
83 pdf_features_given_voice = EvaluateGmm(gmm_features, voice_gmm_); | 83 pdf_features_given_voice = EvaluateGmm(gmm_features, voice_gmm_); |
84 pdf_features_given_noise = EvaluateGmm(gmm_features, noise_gmm_); | 84 pdf_features_given_noise = EvaluateGmm(gmm_features, noise_gmm_); |
85 | 85 |
86 if (features.spectral_peak[n] < kLimLowSpectralPeak || | 86 if (features.spectral_peak[n] < kLimLowSpectralPeak || |
87 features.spectral_peak[n] > kLimHighSpectralPeak || | 87 features.spectral_peak[n] > kLimHighSpectralPeak || |
88 features.log_pitch_gain[n] < kLimLowLogPitchGain) { | 88 features.log_pitch_gain[n] < kLimLowLogPitchGain) { |
(...skipping 26 matching lines...) Expand all 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 |