blob: e9195e5e37dee850215fc3f0f2ec583422a91572 [file] [log] [blame]
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +00001/*
2 * Copyright (c) 2012 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 feature calculating functionality used in vad_core.c.
13 */
14
15#ifndef WEBRTC_COMMON_AUDIO_VAD_VAD_FILTERBANK_H_
16#define WEBRTC_COMMON_AUDIO_VAD_VAD_FILTERBANK_H_
17
pbos@webrtc.orgabf0cd82013-05-27 09:49:58 +000018#include "webrtc/common_audio/vad/vad_core.h"
19#include "webrtc/typedefs.h"
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000020
21// Takes |data_length| samples of |data_in| and calculates the logarithm of the
22// energy of each of the |kNumChannels| = 6 frequency bands used by the VAD:
23// 80 Hz - 250 Hz
24// 250 Hz - 500 Hz
25// 500 Hz - 1000 Hz
26// 1000 Hz - 2000 Hz
27// 2000 Hz - 3000 Hz
28// 3000 Hz - 4000 Hz
29//
30// The values are given in Q4 and written to |features|. Further, an approximate
31// overall energy is returned. The return value is used in
32// WebRtcVad_GmmProbability() as a signal indicator, hence it is arbitrary above
33// the threshold |kMinEnergy|.
34//
35// - self [i/o] : State information of the VAD.
36// - data_in [i] : Input audio data, for feature extraction.
37// - data_length [i] : Audio data size, in number of samples.
38// - features [o] : 10 * log10(energy in each frequency band), Q4.
39// - returns : Total energy of the signal (NOTE! This value is not
40// exact. It is only used in a comparison.)
41int16_t WebRtcVad_CalculateFeatures(VadInstT* self, const int16_t* data_in,
42 int data_length, int16_t* features);
43
44#endif // WEBRTC_COMMON_AUDIO_VAD_VAD_FILTERBANK_H_