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 
12 // This file includes specific signal processing tools used in vad_core.c.
13 
14 #ifndef WEBRTC_COMMON_AUDIO_VAD_VAD_SP_H_
15 #define WEBRTC_COMMON_AUDIO_VAD_VAD_SP_H_
16 
17 #include "typedefs.h"
18 #include "vad_core.h"
19 
20 // Downsamples the signal by a factor 2, eg. 32->16 or 16->8.
21 //
22 // Inputs:
23 //      - signal_in     : Input signal.
24 //      - in_length     : Length of input signal in samples.
25 //
26 // Input & Output:
27 //      - filter_state  : Current filter states of the two all-pass filters. The
28 //                        |filter_state| is updated after all samples have been
29 //                        processed.
30 //
31 // Output:
32 //      - signal_out    : Downsampled signal (of length |in_length| / 2).
33 void WebRtcVad_Downsampling(int16_t* signal_in,
34                             int16_t* signal_out,
35                             int32_t* filter_state,
36                             int in_length);
37 
38 // Updates and returns the smoothed feature minimum. As minimum we use the
39 // median of the five smallest feature values in a 100 frames long window.
40 //
41 // Inputs:
42 //      - feature_value : New feature value to update with.
43 //      - channel       : Channel number.
44 //
45 // Input & Output:
46 //      - handle        : State information of the VAD.
47 //
48 // Returns:
49 //                      : Smoothed minimum value for a moving window.
50 int16_t WebRtcVad_FindMinimum(VadInstT* handle,
51                               int16_t feature_value,
52                               int channel);
53 
54 #endif  // WEBRTC_COMMON_AUDIO_VAD_VAD_SP_H_
55