blob: 21fed11b1afa1f356a5ed2ebf469de8b8bb32d74 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +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
bjornv@webrtc.org226c5a12012-01-04 09:15:12 +000012// This file includes specific signal processing tools used in vad_core.c.
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#ifndef COMMON_AUDIO_VAD_VAD_SP_H_
15#define COMMON_AUDIO_VAD_VAD_SP_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000016
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "common_audio/vad/vad_core.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020018#include "typedefs.h" // NOLINT(build/include)
niklase@google.com470e71d2011-07-07 08:21:25 +000019
bjornv@webrtc.org226c5a12012-01-04 09:15:12 +000020// 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.org65f93382014-04-30 16:44:13 +000033void WebRtcVad_Downsampling(const int16_t* signal_in,
bjornv@webrtc.org226c5a12012-01-04 09:15:12 +000034 int16_t* signal_out,
35 int32_t* filter_state,
Peter Kastingdce40cf2015-08-24 14:52:23 -070036 size_t in_length);
niklase@google.com470e71d2011-07-07 08:21:25 +000037
bjornv@webrtc.org226c5a12012-01-04 09:15:12 +000038// 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.
bjornv@webrtc.orge6471ba2012-01-09 09:54:07 +000040// 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.
bjornv@webrtc.org226c5a12012-01-04 09:15:12 +000042//
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);
niklase@google.com470e71d2011-07-07 08:21:25 +000055
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020056#endif // COMMON_AUDIO_VAD_VAD_SP_H_