• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "webrtc/common_audio/vad/vad_core.h"
18 #include "webrtc/typedefs.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(const int16_t* signal_in,
34                             int16_t* signal_out,
35                             int32_t* filter_state,
36                             size_t 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 // As long as |handle->frame_counter| is zero, that is, we haven't received any
41 // "valid" data, FindMinimum() outputs the default value of 1600.
42 //
43 // Inputs:
44 //      - feature_value : New feature value to update with.
45 //      - channel       : Channel number.
46 //
47 // Input & Output:
48 //      - handle        : State information of the VAD.
49 //
50 // Returns:
51 //                      : Smoothed minimum value for a moving window.
52 int16_t WebRtcVad_FindMinimum(VadInstT* handle,
53                               int16_t feature_value,
54                               int channel);
55 
56 #endif  // WEBRTC_COMMON_AUDIO_VAD_VAD_SP_H_
57