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 // This file includes specific signal processing tools used in vad_core.c.
12 
13 #ifndef COMMON_AUDIO_VAD_VAD_SP_H_
14 #define COMMON_AUDIO_VAD_VAD_SP_H_
15 
16 #include "common_audio/vad/vad_core.h"
17 
18 // Downsamples the signal by a factor 2, eg. 32->16 or 16->8.
19 //
20 // Inputs:
21 //      - signal_in     : Input signal.
22 //      - in_length     : Length of input signal in samples.
23 //
24 // Input & Output:
25 //      - filter_state  : Current filter states of the two all-pass filters. The
26 //                        |filter_state| is updated after all samples have been
27 //                        processed.
28 //
29 // Output:
30 //      - signal_out    : Downsampled signal (of length |in_length| / 2).
31 void WebRtcVad_Downsampling(const int16_t* signal_in,
32                             int16_t* signal_out,
33                             int32_t* filter_state,
34                             size_t in_length);
35 
36 // Updates and returns the smoothed feature minimum. As minimum we use the
37 // median of the five smallest feature values in a 100 frames long window.
38 // As long as |handle->frame_counter| is zero, that is, we haven't received any
39 // "valid" data, FindMinimum() outputs the default value of 1600.
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  // COMMON_AUDIO_VAD_VAD_SP_H_
55