Refactoring vad_filterbank: Style changes.
Includes: - Correct header guard - Indentations and white spaces - Changed to stdint Review URL: http://webrtc-codereview.appspot.com/330030 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1315 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
9c0aedc28b
commit
f175125e96
@ -8,7 +8,6 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file includes the implementation of the internal filterbank associated functions.
|
* This file includes the implementation of the internal filterbank associated functions.
|
||||||
* For function description, see vad_filterbank.h.
|
* For function description, see vad_filterbank.h.
|
||||||
@ -21,23 +20,25 @@
|
|||||||
#include "vad_defines.h"
|
#include "vad_defines.h"
|
||||||
|
|
||||||
// Constant 160*log10(2) in Q9
|
// Constant 160*log10(2) in Q9
|
||||||
static const WebRtc_Word16 kLogConst = 24660;
|
static const int16_t kLogConst = 24660;
|
||||||
|
|
||||||
// Coefficients used by WebRtcVad_HpOutput, Q14
|
// Coefficients used by WebRtcVad_HpOutput, Q14
|
||||||
static const WebRtc_Word16 kHpZeroCoefs[3] = {6631, -13262, 6631};
|
static const int16_t kHpZeroCoefs[3] = { 6631, -13262, 6631 };
|
||||||
static const WebRtc_Word16 kHpPoleCoefs[3] = {16384, -7756, 5620};
|
static const int16_t kHpPoleCoefs[3] = { 16384, -7756, 5620 };
|
||||||
|
|
||||||
// Allpass filter coefficients, upper and lower, in Q15
|
// Allpass filter coefficients, upper and lower, in Q15
|
||||||
// Upper: 0.64, Lower: 0.17
|
// Upper: 0.64, Lower: 0.17
|
||||||
static const WebRtc_Word16 kAllPassCoefsQ15[2] = {20972, 5571};
|
static const int16_t kAllPassCoefsQ15[2] = { 20972, 5571 };
|
||||||
// Adjustment for division with two in WebRtcVad_SplitFilter
|
|
||||||
static const WebRtc_Word16 kOffsetVector[6] = {368, 368, 272, 176, 176, 176};
|
|
||||||
|
|
||||||
void WebRtcVad_HpOutput(WebRtc_Word16 *in_vector,
|
// Adjustment for division with two in WebRtcVad_SplitFilter
|
||||||
WebRtc_Word16 in_vector_length,
|
static const int16_t kOffsetVector[6] = { 368, 368, 272, 176, 176, 176 };
|
||||||
WebRtc_Word16 *out_vector,
|
|
||||||
WebRtc_Word16 *filter_state)
|
void WebRtcVad_HpOutput(int16_t* in_vector,
|
||||||
{
|
int16_t in_vector_length,
|
||||||
WebRtc_Word16 i, *pi, *outPtr;
|
int16_t* out_vector,
|
||||||
WebRtc_Word32 tmpW32;
|
int16_t* filter_state) {
|
||||||
|
int16_t i, *pi, *outPtr;
|
||||||
|
int32_t tmpW32;
|
||||||
|
|
||||||
pi = &in_vector[0];
|
pi = &in_vector[0];
|
||||||
outPtr = &out_vector[0];
|
outPtr = &out_vector[0];
|
||||||
@ -50,30 +51,30 @@ void WebRtcVad_HpOutput(WebRtc_Word16 *in_vector,
|
|||||||
// The all-pole section has a max amplification of a single sample of: 1.9931
|
// The all-pole section has a max amplification of a single sample of: 1.9931
|
||||||
// Impulse response: 1.0000 0.4734 -0.1189 -0.2187 -0.0627 0.04532
|
// Impulse response: 1.0000 0.4734 -0.1189 -0.2187 -0.0627 0.04532
|
||||||
|
|
||||||
for (i = 0; i < in_vector_length; i++)
|
for (i = 0; i < in_vector_length; i++) {
|
||||||
{
|
|
||||||
// all-zero section (filter coefficients in Q14)
|
// all-zero section (filter coefficients in Q14)
|
||||||
tmpW32 = (WebRtc_Word32)WEBRTC_SPL_MUL_16_16(kHpZeroCoefs[0], (*pi));
|
tmpW32 = (int32_t) WEBRTC_SPL_MUL_16_16(kHpZeroCoefs[0], (*pi));
|
||||||
tmpW32 += (WebRtc_Word32)WEBRTC_SPL_MUL_16_16(kHpZeroCoefs[1], filter_state[0]);
|
tmpW32 += (int32_t) WEBRTC_SPL_MUL_16_16(kHpZeroCoefs[1], filter_state[0]);
|
||||||
tmpW32 += (WebRtc_Word32)WEBRTC_SPL_MUL_16_16(kHpZeroCoefs[2], filter_state[1]); // Q14
|
tmpW32 += (int32_t) WEBRTC_SPL_MUL_16_16(kHpZeroCoefs[2],
|
||||||
|
filter_state[1]); // Q14
|
||||||
filter_state[1] = filter_state[0];
|
filter_state[1] = filter_state[0];
|
||||||
filter_state[0] = *pi++;
|
filter_state[0] = *pi++;
|
||||||
|
|
||||||
// all-pole section
|
// all-pole section
|
||||||
tmpW32 -= (WebRtc_Word32)WEBRTC_SPL_MUL_16_16(kHpPoleCoefs[1], filter_state[2]); // Q14
|
tmpW32 -= (int32_t) WEBRTC_SPL_MUL_16_16(kHpPoleCoefs[1],
|
||||||
tmpW32 -= (WebRtc_Word32)WEBRTC_SPL_MUL_16_16(kHpPoleCoefs[2], filter_state[3]);
|
filter_state[2]); // Q14
|
||||||
|
tmpW32 -= (int32_t) WEBRTC_SPL_MUL_16_16(kHpPoleCoefs[2], filter_state[3]);
|
||||||
filter_state[3] = filter_state[2];
|
filter_state[3] = filter_state[2];
|
||||||
filter_state[2] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32 (tmpW32, 14);
|
filter_state[2] = (int16_t) WEBRTC_SPL_RSHIFT_W32 (tmpW32, 14);
|
||||||
*outPtr++ = filter_state[2];
|
*outPtr++ = filter_state[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcVad_Allpass(WebRtc_Word16 *in_vector,
|
void WebRtcVad_Allpass(int16_t* in_vector,
|
||||||
WebRtc_Word16 *out_vector,
|
int16_t* out_vector,
|
||||||
WebRtc_Word16 filter_coefficients,
|
int16_t filter_coefficients,
|
||||||
int vector_length,
|
int vector_length,
|
||||||
WebRtc_Word16 *filter_state)
|
int16_t* filter_state) {
|
||||||
{
|
|
||||||
// The filter can only cause overflow (in the w16 output variable)
|
// The filter can only cause overflow (in the w16 output variable)
|
||||||
// if more than 4 consecutive input numbers are of maximum value and
|
// if more than 4 consecutive input numbers are of maximum value and
|
||||||
// has the the same sign as the impulse responses first taps.
|
// has the the same sign as the impulse responses first taps.
|
||||||
@ -81,65 +82,62 @@ void WebRtcVad_Allpass(WebRtc_Word16 *in_vector,
|
|||||||
// 0.2418 -0.1547 0.0990
|
// 0.2418 -0.1547 0.0990
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
WebRtc_Word16 tmp16;
|
int16_t tmp16;
|
||||||
WebRtc_Word32 tmp32, in32, state32;
|
int32_t tmp32, in32, state32;
|
||||||
|
|
||||||
state32 = WEBRTC_SPL_LSHIFT_W32(((WebRtc_Word32)(*filter_state)), 16); // Q31
|
state32 = WEBRTC_SPL_LSHIFT_W32(((int32_t) (*filter_state)), 16); // Q31
|
||||||
|
|
||||||
for (n = 0; n < vector_length; n++)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
for (n = 0; n < vector_length; n++) {
|
||||||
tmp32 = state32 + WEBRTC_SPL_MUL_16_16(filter_coefficients, (*in_vector));
|
tmp32 = state32 + WEBRTC_SPL_MUL_16_16(filter_coefficients, (*in_vector));
|
||||||
tmp16 = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
|
tmp16 = (int16_t) WEBRTC_SPL_RSHIFT_W32(tmp32, 16);
|
||||||
*out_vector++ = tmp16;
|
*out_vector++ = tmp16;
|
||||||
in32 = WEBRTC_SPL_LSHIFT_W32(((WebRtc_Word32)(*in_vector)), 14);
|
in32 = WEBRTC_SPL_LSHIFT_W32(((int32_t) (*in_vector)), 14);
|
||||||
state32 = in32 - WEBRTC_SPL_MUL_16_16(filter_coefficients, tmp16);
|
state32 = in32 - WEBRTC_SPL_MUL_16_16(filter_coefficients, tmp16);
|
||||||
state32 = WEBRTC_SPL_LSHIFT_W32(state32, 1);
|
state32 = WEBRTC_SPL_LSHIFT_W32(state32, 1);
|
||||||
in_vector += 2;
|
in_vector += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
*filter_state = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(state32, 16);
|
*filter_state = (int16_t) WEBRTC_SPL_RSHIFT_W32(state32, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcVad_SplitFilter(WebRtc_Word16 *in_vector,
|
void WebRtcVad_SplitFilter(int16_t* in_vector,
|
||||||
WebRtc_Word16 *out_vector_hp,
|
int16_t* out_vector_hp,
|
||||||
WebRtc_Word16 *out_vector_lp,
|
int16_t* out_vector_lp,
|
||||||
WebRtc_Word16 *upper_state,
|
int16_t* upper_state,
|
||||||
WebRtc_Word16 *lower_state,
|
int16_t* lower_state,
|
||||||
int in_vector_length)
|
int in_vector_length) {
|
||||||
{
|
int16_t tmpOut;
|
||||||
WebRtc_Word16 tmpOut;
|
|
||||||
int k, halflen;
|
int k, halflen;
|
||||||
|
|
||||||
// Downsampling by 2 and get two branches
|
// Downsampling by 2 and get two branches
|
||||||
halflen = WEBRTC_SPL_RSHIFT_W16(in_vector_length, 1);
|
halflen = WEBRTC_SPL_RSHIFT_W16(in_vector_length, 1);
|
||||||
|
|
||||||
// All-pass filtering upper branch
|
// All-pass filtering upper branch
|
||||||
WebRtcVad_Allpass(&in_vector[0], out_vector_hp, kAllPassCoefsQ15[0], halflen, upper_state);
|
WebRtcVad_Allpass(&in_vector[0], out_vector_hp, kAllPassCoefsQ15[0], halflen,
|
||||||
|
upper_state);
|
||||||
|
|
||||||
// All-pass filtering lower branch
|
// All-pass filtering lower branch
|
||||||
WebRtcVad_Allpass(&in_vector[1], out_vector_lp, kAllPassCoefsQ15[1], halflen, lower_state);
|
WebRtcVad_Allpass(&in_vector[1], out_vector_lp, kAllPassCoefsQ15[1], halflen,
|
||||||
|
lower_state);
|
||||||
|
|
||||||
// Make LP and HP signals
|
// Make LP and HP signals
|
||||||
for (k = 0; k < halflen; k++)
|
for (k = 0; k < halflen; k++) {
|
||||||
{
|
|
||||||
tmpOut = *out_vector_hp;
|
tmpOut = *out_vector_hp;
|
||||||
*out_vector_hp++ -= *out_vector_lp;
|
*out_vector_hp++ -= *out_vector_lp;
|
||||||
*out_vector_lp++ += tmpOut;
|
*out_vector_lp++ += tmpOut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word16 WebRtcVad_get_features(VadInstT *inst,
|
int16_t WebRtcVad_get_features(VadInstT* inst,
|
||||||
WebRtc_Word16 *in_vector,
|
int16_t* in_vector,
|
||||||
int frame_size,
|
int frame_size,
|
||||||
WebRtc_Word16 *out_vector)
|
int16_t* out_vector) {
|
||||||
{
|
|
||||||
int curlen, filtno;
|
int curlen, filtno;
|
||||||
WebRtc_Word16 vecHP1[120], vecLP1[120];
|
int16_t vecHP1[120], vecLP1[120];
|
||||||
WebRtc_Word16 vecHP2[60], vecLP2[60];
|
int16_t vecHP2[60], vecLP2[60];
|
||||||
WebRtc_Word16 *ptin;
|
int16_t *ptin;
|
||||||
WebRtc_Word16 *hptout, *lptout;
|
int16_t *hptout, *lptout;
|
||||||
WebRtc_Word16 power = 0;
|
int16_t power = 0;
|
||||||
|
|
||||||
// Split at 2000 Hz and downsample
|
// Split at 2000 Hz and downsample
|
||||||
filtno = 0;
|
filtno = 0;
|
||||||
@ -162,10 +160,12 @@ WebRtc_Word16 WebRtcVad_get_features(VadInstT *inst,
|
|||||||
|
|
||||||
// Energy in 3000 Hz - 4000 Hz
|
// Energy in 3000 Hz - 4000 Hz
|
||||||
curlen = WEBRTC_SPL_RSHIFT_W16(curlen, 1);
|
curlen = WEBRTC_SPL_RSHIFT_W16(curlen, 1);
|
||||||
WebRtcVad_LogOfEnergy(vecHP2, &out_vector[5], &power, kOffsetVector[5], curlen);
|
WebRtcVad_LogOfEnergy(vecHP2, &out_vector[5], &power, kOffsetVector[5],
|
||||||
|
curlen);
|
||||||
|
|
||||||
// Energy in 2000 Hz - 3000 Hz
|
// Energy in 2000 Hz - 3000 Hz
|
||||||
WebRtcVad_LogOfEnergy(vecLP2, &out_vector[4], &power, kOffsetVector[4], curlen);
|
WebRtcVad_LogOfEnergy(vecLP2, &out_vector[4], &power, kOffsetVector[4],
|
||||||
|
curlen);
|
||||||
|
|
||||||
// Split at 1000 Hz and downsample
|
// Split at 1000 Hz and downsample
|
||||||
filtno = 2;
|
filtno = 2;
|
||||||
@ -178,7 +178,8 @@ WebRtc_Word16 WebRtcVad_get_features(VadInstT *inst,
|
|||||||
|
|
||||||
// Energy in 1000 Hz - 2000 Hz
|
// Energy in 1000 Hz - 2000 Hz
|
||||||
curlen = WEBRTC_SPL_RSHIFT_W16(curlen, 1);
|
curlen = WEBRTC_SPL_RSHIFT_W16(curlen, 1);
|
||||||
WebRtcVad_LogOfEnergy(vecHP2, &out_vector[3], &power, kOffsetVector[3], curlen);
|
WebRtcVad_LogOfEnergy(vecHP2, &out_vector[3], &power, kOffsetVector[3],
|
||||||
|
curlen);
|
||||||
|
|
||||||
// Split at 500 Hz
|
// Split at 500 Hz
|
||||||
filtno = 3;
|
filtno = 3;
|
||||||
@ -191,7 +192,8 @@ WebRtc_Word16 WebRtcVad_get_features(VadInstT *inst,
|
|||||||
|
|
||||||
// Energy in 500 Hz - 1000 Hz
|
// Energy in 500 Hz - 1000 Hz
|
||||||
curlen = WEBRTC_SPL_RSHIFT_W16(curlen, 1);
|
curlen = WEBRTC_SPL_RSHIFT_W16(curlen, 1);
|
||||||
WebRtcVad_LogOfEnergy(vecHP1, &out_vector[2], &power, kOffsetVector[2], curlen);
|
WebRtcVad_LogOfEnergy(vecHP1, &out_vector[2], &power, kOffsetVector[2],
|
||||||
|
curlen);
|
||||||
// Split at 250 Hz
|
// Split at 250 Hz
|
||||||
filtno = 4;
|
filtno = 4;
|
||||||
ptin = vecLP1;
|
ptin = vecLP1;
|
||||||
@ -203,38 +205,39 @@ WebRtc_Word16 WebRtcVad_get_features(VadInstT *inst,
|
|||||||
|
|
||||||
// Energy in 250 Hz - 500 Hz
|
// Energy in 250 Hz - 500 Hz
|
||||||
curlen = WEBRTC_SPL_RSHIFT_W16(curlen, 1);
|
curlen = WEBRTC_SPL_RSHIFT_W16(curlen, 1);
|
||||||
WebRtcVad_LogOfEnergy(vecHP2, &out_vector[1], &power, kOffsetVector[1], curlen);
|
WebRtcVad_LogOfEnergy(vecHP2, &out_vector[1], &power, kOffsetVector[1],
|
||||||
|
curlen);
|
||||||
|
|
||||||
// Remove DC and LFs
|
// Remove DC and LFs
|
||||||
WebRtcVad_HpOutput(vecLP2, curlen, vecHP1, inst->hp_filter_state);
|
WebRtcVad_HpOutput(vecLP2, curlen, vecHP1, inst->hp_filter_state);
|
||||||
|
|
||||||
// Power in 80 Hz - 250 Hz
|
// Power in 80 Hz - 250 Hz
|
||||||
WebRtcVad_LogOfEnergy(vecHP1, &out_vector[0], &power, kOffsetVector[0], curlen);
|
WebRtcVad_LogOfEnergy(vecHP1, &out_vector[0], &power, kOffsetVector[0],
|
||||||
|
curlen);
|
||||||
|
|
||||||
return power;
|
return power;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcVad_LogOfEnergy(WebRtc_Word16 *vector,
|
void WebRtcVad_LogOfEnergy(int16_t* vector,
|
||||||
WebRtc_Word16 *enerlogval,
|
int16_t* enerlogval,
|
||||||
WebRtc_Word16 *power,
|
int16_t* power,
|
||||||
WebRtc_Word16 offset,
|
int16_t offset,
|
||||||
int vector_length)
|
int vector_length) {
|
||||||
{
|
int16_t enerSum = 0;
|
||||||
WebRtc_Word16 enerSum = 0;
|
int16_t zeros, frac, log2;
|
||||||
WebRtc_Word16 zeros, frac, log2;
|
int32_t energy;
|
||||||
WebRtc_Word32 energy;
|
|
||||||
|
|
||||||
int shfts = 0, shfts2;
|
int shfts = 0, shfts2;
|
||||||
|
|
||||||
energy = WebRtcSpl_Energy(vector, vector_length, &shfts);
|
energy = WebRtcSpl_Energy(vector, vector_length, &shfts);
|
||||||
|
|
||||||
if (energy > 0)
|
if (energy > 0) {
|
||||||
{
|
|
||||||
|
|
||||||
shfts2 = 16 - WebRtcSpl_NormW32(energy);
|
shfts2 = 16 - WebRtcSpl_NormW32(energy);
|
||||||
shfts += shfts2;
|
shfts += shfts2;
|
||||||
// "shfts" is the total number of right shifts that has been done to enerSum.
|
// "shfts" is the total number of right shifts that has been done to
|
||||||
enerSum = (WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(energy, -shfts2);
|
// enerSum.
|
||||||
|
enerSum = (int16_t) WEBRTC_SPL_SHIFT_W32(energy, -shfts2);
|
||||||
|
|
||||||
// Find:
|
// Find:
|
||||||
// 160*log10(enerSum*2^shfts) = 160*log10(2)*log2(enerSum*2^shfts) =
|
// 160*log10(enerSum*2^shfts) = 160*log10(2)*log2(enerSum*2^shfts) =
|
||||||
@ -242,19 +245,17 @@ void WebRtcVad_LogOfEnergy(WebRtc_Word16 *vector,
|
|||||||
// 160*log10(2)*(log2(enerSum) + shfts)
|
// 160*log10(2)*(log2(enerSum) + shfts)
|
||||||
|
|
||||||
zeros = WebRtcSpl_NormU32(enerSum);
|
zeros = WebRtcSpl_NormU32(enerSum);
|
||||||
frac = (WebRtc_Word16)(((WebRtc_UWord32)((WebRtc_Word32)(enerSum) << zeros)
|
frac = (int16_t) (((uint32_t) ((int32_t) (enerSum) << zeros) & 0x7FFFFFFF)
|
||||||
& 0x7FFFFFFF) >> 21);
|
>> 21);
|
||||||
log2 = (WebRtc_Word16)(((31 - zeros) << 10) + frac);
|
log2 = (int16_t) (((31 - zeros) << 10) + frac);
|
||||||
|
|
||||||
*enerlogval = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(kLogConst, log2, 19)
|
*enerlogval = (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(kLogConst, log2, 19)
|
||||||
+ (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(shfts, kLogConst, 9);
|
+ (int16_t) WEBRTC_SPL_MUL_16_16_RSFT(shfts, kLogConst, 9);
|
||||||
|
|
||||||
if (*enerlogval < 0)
|
if (*enerlogval < 0) {
|
||||||
{
|
|
||||||
*enerlogval = 0;
|
*enerlogval = 0;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
*enerlogval = 0;
|
*enerlogval = 0;
|
||||||
shfts = -15;
|
shfts = -15;
|
||||||
enerSum = 0;
|
enerSum = 0;
|
||||||
@ -263,16 +264,12 @@ void WebRtcVad_LogOfEnergy(WebRtc_Word16 *vector,
|
|||||||
*enerlogval += offset;
|
*enerlogval += offset;
|
||||||
|
|
||||||
// Total power in frame
|
// Total power in frame
|
||||||
if (*power <= MIN_ENERGY)
|
if (*power <= MIN_ENERGY) {
|
||||||
{
|
if (shfts > 0) {
|
||||||
if (shfts > 0)
|
|
||||||
{
|
|
||||||
*power += MIN_ENERGY + 1;
|
*power += MIN_ENERGY + 1;
|
||||||
} else if (WEBRTC_SPL_SHIFT_W16(enerSum, shfts) > MIN_ENERGY)
|
} else if (WEBRTC_SPL_SHIFT_W16(enerSum, shfts) > MIN_ENERGY) {
|
||||||
{
|
|
||||||
*power += MIN_ENERGY + 1;
|
*power += MIN_ENERGY + 1;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
*power += WEBRTC_SPL_SHIFT_W16(enerSum, shfts);
|
*power += WEBRTC_SPL_SHIFT_W16(enerSum, shfts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,18 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This header file includes the description of the internal VAD call
|
* This header file includes the description of the internal VAD call
|
||||||
* WebRtcVad_GaussianProbability.
|
* WebRtcVad_GaussianProbability.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WEBRTC_VAD_FILTERBANK_H_
|
#ifndef WEBRTC_COMMON_AUDIO_VAD_VAD_FILTERBANK_H_
|
||||||
#define WEBRTC_VAD_FILTERBANK_H_
|
#define WEBRTC_COMMON_AUDIO_VAD_VAD_FILTERBANK_H_
|
||||||
|
|
||||||
|
#include "typedefs.h"
|
||||||
#include "vad_core.h"
|
#include "vad_core.h"
|
||||||
|
|
||||||
|
// TODO(bjornv): Move local functions to vad_filterbank.c and make static.
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* WebRtcVad_HpOutput(...)
|
* WebRtcVad_HpOutput(...)
|
||||||
*
|
*
|
||||||
@ -34,10 +35,10 @@
|
|||||||
* - filter_state : Updated state of the filter
|
* - filter_state : Updated state of the filter
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void WebRtcVad_HpOutput(WebRtc_Word16* in_vector,
|
void WebRtcVad_HpOutput(int16_t* in_vector,
|
||||||
WebRtc_Word16 in_vector_length,
|
int16_t in_vector_length,
|
||||||
WebRtc_Word16* out_vector,
|
int16_t* out_vector,
|
||||||
WebRtc_Word16* filter_state);
|
int16_t* filter_state);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* WebRtcVad_Allpass(...)
|
* WebRtcVad_Allpass(...)
|
||||||
@ -58,11 +59,11 @@ void WebRtcVad_HpOutput(WebRtc_Word16* in_vector,
|
|||||||
* - filter_state : Updated state of the filter (Q(-1))
|
* - filter_state : Updated state of the filter (Q(-1))
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void WebRtcVad_Allpass(WebRtc_Word16* in_vector,
|
void WebRtcVad_Allpass(int16_t* in_vector,
|
||||||
WebRtc_Word16* outw16,
|
int16_t* outw16,
|
||||||
WebRtc_Word16 filter_coefficients,
|
int16_t filter_coefficients,
|
||||||
int vector_length,
|
int vector_length,
|
||||||
WebRtc_Word16* filter_state);
|
int16_t* filter_state);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* WebRtcVad_SplitFilter(...)
|
* WebRtcVad_SplitFilter(...)
|
||||||
@ -83,11 +84,11 @@ void WebRtcVad_Allpass(WebRtc_Word16* in_vector,
|
|||||||
* - lower_state : Updated state of the lower filter
|
* - lower_state : Updated state of the lower filter
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void WebRtcVad_SplitFilter(WebRtc_Word16* in_vector,
|
void WebRtcVad_SplitFilter(int16_t* in_vector,
|
||||||
WebRtc_Word16* out_vector_hp,
|
int16_t* out_vector_hp,
|
||||||
WebRtc_Word16* out_vector_lp,
|
int16_t* out_vector_lp,
|
||||||
WebRtc_Word16* upper_state,
|
int16_t* upper_state,
|
||||||
WebRtc_Word16* lower_state,
|
int16_t* lower_state,
|
||||||
int in_vector_length);
|
int in_vector_length);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -113,10 +114,10 @@ void WebRtcVad_SplitFilter(WebRtc_Word16* in_vector,
|
|||||||
* Return: total power in the signal (NOTE! This value is not exact since it
|
* Return: total power in the signal (NOTE! This value is not exact since it
|
||||||
* is only used in a comparison.
|
* is only used in a comparison.
|
||||||
*/
|
*/
|
||||||
WebRtc_Word16 WebRtcVad_get_features(VadInstT* inst,
|
int16_t WebRtcVad_get_features(VadInstT* inst,
|
||||||
WebRtc_Word16* in_vector,
|
int16_t* in_vector,
|
||||||
int frame_size,
|
int frame_size,
|
||||||
WebRtc_Word16* out_vector);
|
int16_t* out_vector);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* WebRtcVad_LogOfEnergy(...)
|
* WebRtcVad_LogOfEnergy(...)
|
||||||
@ -134,10 +135,10 @@ WebRtc_Word16 WebRtcVad_get_features(VadInstT* inst,
|
|||||||
* is not exact since it is only used in a comparison.
|
* is not exact since it is only used in a comparison.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void WebRtcVad_LogOfEnergy(WebRtc_Word16* vector,
|
void WebRtcVad_LogOfEnergy(int16_t* vector,
|
||||||
WebRtc_Word16* enerlogval,
|
int16_t* enerlogval,
|
||||||
WebRtc_Word16* power,
|
int16_t* power,
|
||||||
WebRtc_Word16 offset,
|
int16_t offset,
|
||||||
int vector_length);
|
int vector_length);
|
||||||
|
|
||||||
#endif // WEBRTC_VAD_FILTERBANK_H_
|
#endif // WEBRTC_COMMON_AUDIO_VAD_VAD_FILTERBANK_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user