niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
bjornv@webrtc.org | c68f80a | 2011-12-20 14:08:34 +0000 | [diff] [blame] | 11 | // Gaussian probability calculations internally used in vad_core.c. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
bjornv@webrtc.org | c68f80a | 2011-12-20 14:08:34 +0000 | [diff] [blame] | 13 | #ifndef WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_ |
| 14 | #define WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 15 | |
pbos@webrtc.org | aa30bb7 | 2013-05-27 09:49:58 +0000 | [diff] [blame] | 16 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 17 | |
bjornv@webrtc.org | c68f80a | 2011-12-20 14:08:34 +0000 | [diff] [blame] | 18 | // Calculates the probability for |input|, given that |input| comes from a |
| 19 | // normal distribution with mean and standard deviation (|mean|, |std|). |
| 20 | // |
| 21 | // Inputs: |
| 22 | // - input : input sample in Q4. |
| 23 | // - mean : mean input in the statistical model, Q7. |
| 24 | // - std : standard deviation, Q7. |
| 25 | // |
| 26 | // Output: |
| 27 | // |
| 28 | // - delta : input used when updating the model, Q11. |
| 29 | // |delta| = (|input| - |mean|) / |std|^2. |
| 30 | // |
| 31 | // Return: |
| 32 | // (probability for |input|) = |
| 33 | // 1 / |std| * exp(-(|input| - |mean|)^2 / (2 * |std|^2)); |
| 34 | int32_t WebRtcVad_GaussianProbability(int16_t input, |
| 35 | int16_t mean, |
| 36 | int16_t std, |
| 37 | int16_t* delta); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 38 | |
bjornv@webrtc.org | c68f80a | 2011-12-20 14:08:34 +0000 | [diff] [blame] | 39 | #endif // WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_ |