blob: 992a156050a671ff428e33fe728ad9cf05735dca [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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.orgc68f80a2011-12-20 14:08:34 +000011// Gaussian probability calculations internally used in vad_core.c.
niklase@google.com470e71d2011-07-07 08:21:25 +000012
bjornv@webrtc.orgc68f80a2011-12-20 14:08:34 +000013#ifndef WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_
14#define WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000015
pbos@webrtc.orgaa30bb72013-05-27 09:49:58 +000016#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000017
bjornv@webrtc.orgc68f80a2011-12-20 14:08:34 +000018// 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));
34int32_t WebRtcVad_GaussianProbability(int16_t input,
35 int16_t mean,
36 int16_t std,
37 int16_t* delta);
niklase@google.com470e71d2011-07-07 08:21:25 +000038
bjornv@webrtc.orgc68f80a2011-12-20 14:08:34 +000039#endif // WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_