Home | History | Annotate | Download | only in vad
      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 
     11 // Gaussian probability calculations internally used in vad_core.c.
     12 
     13 #ifndef WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_
     14 #define WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_
     15 
     16 #include "typedefs.h"
     17 
     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);
     38 
     39 #endif  // WEBRTC_COMMON_AUDIO_VAD_VAD_GMM_H_
     40