blob: b5e62593c0f4b45e6280779f59542a6ce87ef7ed [file] [log] [blame]
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +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
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
pbos@webrtc.orgabf0cd82013-05-27 09:49:58 +000017#include "webrtc/common_audio/vad/vad_core.h"
18#include "webrtc/typedefs.h"
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000019
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).
andrew@webrtc.orgc2e64382014-04-30 16:44:13 +000033void WebRtcVad_Downsampling(const int16_t* signal_in,
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000034 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// 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.
52int16_t WebRtcVad_FindMinimum(VadInstT* handle,
53 int16_t feature_value,
54 int channel);
55
56#endif // WEBRTC_COMMON_AUDIO_VAD_VAD_SP_H_