Removed the vad_const files and added the constants to the files where they are
used. Having them in a separate file did not add anything in readability or conceptual overview. Review URL: http://webrtc-codereview.appspot.com/230004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@746 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a59d80db45
commit
2111d3b0b0
@ -18,7 +18,6 @@ LOCAL_MODULE := libwebrtc_vad
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_SRC_FILES := \
|
||||
webrtc_vad.c \
|
||||
vad_const.c \
|
||||
vad_core.c \
|
||||
vad_filterbank.c \
|
||||
vad_gmm.c \
|
||||
|
@ -25,11 +25,9 @@
|
||||
'sources': [
|
||||
'../interface/webrtc_vad.h',
|
||||
'webrtc_vad.c',
|
||||
'vad_const.c',
|
||||
'vad_const.h',
|
||||
'vad_defines.h',
|
||||
'vad_core.c',
|
||||
'vad_core.h',
|
||||
'vad_defines.h',
|
||||
'vad_filterbank.c',
|
||||
'vad_filterbank.h',
|
||||
'vad_gmm.c',
|
||||
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file includes the constant values used internally in VAD.
|
||||
*/
|
||||
|
||||
#include "vad_const.h"
|
||||
|
||||
// Spectrum Weighting
|
||||
const WebRtc_Word16 kSpectrumWeight[6] = {6, 8, 10, 12, 14, 16};
|
||||
|
||||
const WebRtc_Word16 kCompVar = 22005;
|
||||
|
||||
// Constant 160*log10(2) in Q9
|
||||
const WebRtc_Word16 kLogConst = 24660;
|
||||
|
||||
// Constant log2(exp(1)) in Q12
|
||||
const WebRtc_Word16 kLog10Const = 5909;
|
||||
|
||||
// Q15
|
||||
const WebRtc_Word16 kNoiseUpdateConst = 655;
|
||||
const WebRtc_Word16 kSpeechUpdateConst = 6554;
|
||||
|
||||
// Q8
|
||||
const WebRtc_Word16 kBackEta = 154;
|
||||
|
||||
// Coefficients used by WebRtcVad_HpOutput, Q14
|
||||
const WebRtc_Word16 kHpZeroCoefs[3] = {6631, -13262, 6631};
|
||||
const WebRtc_Word16 kHpPoleCoefs[3] = {16384, -7756, 5620};
|
||||
|
||||
// Allpass filter coefficients, upper and lower, in Q15
|
||||
// Upper: 0.64, Lower: 0.17
|
||||
const WebRtc_Word16 kAllPassCoefsQ15[2] = {20972, 5571};
|
||||
const WebRtc_Word16 kAllPassCoefsQ13[2] = {5243, 1392}; // Q13
|
||||
|
||||
// Minimum difference between the two models, Q5
|
||||
const WebRtc_Word16 kMinimumDifference[6] = {544, 544, 576, 576, 576, 576};
|
||||
|
||||
// Upper limit of mean value for speech model, Q7
|
||||
const WebRtc_Word16 kMaximumSpeech[6] = {11392, 11392, 11520, 11520, 11520, 11520};
|
||||
|
||||
// Minimum value for mean value
|
||||
const WebRtc_Word16 kMinimumMean[2] = {640, 768};
|
||||
|
||||
// Upper limit of mean value for noise model, Q7
|
||||
const WebRtc_Word16 kMaximumNoise[6] = {9216, 9088, 8960, 8832, 8704, 8576};
|
||||
|
||||
// Adjustment for division with two in WebRtcVad_SplitFilter
|
||||
const WebRtc_Word16 kOffsetVector[6] = {368, 368, 272, 176, 176, 176};
|
||||
|
||||
// Start values for the Gaussian models, Q7
|
||||
// Weights for the two Gaussians for the six channels (noise)
|
||||
const WebRtc_Word16 kNoiseDataWeights[12] = {34, 62, 72, 66, 53, 25, 94, 66, 56, 62, 75, 103};
|
||||
|
||||
// Weights for the two Gaussians for the six channels (speech)
|
||||
const WebRtc_Word16 kSpeechDataWeights[12] = {48, 82, 45, 87, 50, 47, 80, 46, 83, 41, 78, 81};
|
||||
|
||||
// Means for the two Gaussians for the six channels (noise)
|
||||
const WebRtc_Word16 kNoiseDataMeans[12] = {6738, 4892, 7065, 6715, 6771, 3369, 7646, 3863,
|
||||
7820, 7266, 5020, 4362};
|
||||
|
||||
// Means for the two Gaussians for the six channels (speech)
|
||||
const WebRtc_Word16 kSpeechDataMeans[12] = {8306, 10085, 10078, 11823, 11843, 6309, 9473,
|
||||
9571, 10879, 7581, 8180, 7483};
|
||||
|
||||
// Stds for the two Gaussians for the six channels (noise)
|
||||
const WebRtc_Word16 kNoiseDataStds[12] = {378, 1064, 493, 582, 688, 593, 474, 697, 475, 688,
|
||||
421, 455};
|
||||
|
||||
// Stds for the two Gaussians for the six channels (speech)
|
||||
const WebRtc_Word16 kSpeechDataStds[12] = {555, 505, 567, 524, 585, 1231, 509, 828, 492, 1540,
|
||||
1079, 850};
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This header file includes the declarations of the internally used constants.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_VAD_CONST_H_
|
||||
#define WEBRTC_VAD_CONST_H_
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
// TODO(ajm): give these internal-linkage by moving to the appropriate file
|
||||
// where possible, and otherwise tag with WebRtcVad_.
|
||||
|
||||
// Spectrum Weighting
|
||||
extern const WebRtc_Word16 kSpectrumWeight[];
|
||||
extern const WebRtc_Word16 kCompVar;
|
||||
// Logarithm constant
|
||||
extern const WebRtc_Word16 kLogConst;
|
||||
extern const WebRtc_Word16 kLog10Const;
|
||||
// Q15
|
||||
extern const WebRtc_Word16 kNoiseUpdateConst;
|
||||
extern const WebRtc_Word16 kSpeechUpdateConst;
|
||||
// Q8
|
||||
extern const WebRtc_Word16 kBackEta;
|
||||
// Coefficients used by WebRtcVad_HpOutput, Q14
|
||||
extern const WebRtc_Word16 kHpZeroCoefs[];
|
||||
extern const WebRtc_Word16 kHpPoleCoefs[];
|
||||
// Allpass filter coefficients, upper and lower, in Q15 resp. Q13
|
||||
extern const WebRtc_Word16 kAllPassCoefsQ15[];
|
||||
extern const WebRtc_Word16 kAllPassCoefsQ13[];
|
||||
// Minimum difference between the two models, Q5
|
||||
extern const WebRtc_Word16 kMinimumDifference[];
|
||||
// Maximum value when updating the speech model, Q7
|
||||
extern const WebRtc_Word16 kMaximumSpeech[];
|
||||
// Minimum value for mean value
|
||||
extern const WebRtc_Word16 kMinimumMean[];
|
||||
// Upper limit of mean value for noise model, Q7
|
||||
extern const WebRtc_Word16 kMaximumNoise[];
|
||||
// Adjustment for division with two in WebRtcVad_SplitFilter
|
||||
extern const WebRtc_Word16 kOffsetVector[];
|
||||
// Start values for the Gaussian models, Q7
|
||||
extern const WebRtc_Word16 kNoiseDataWeights[];
|
||||
extern const WebRtc_Word16 kSpeechDataWeights[];
|
||||
extern const WebRtc_Word16 kNoiseDataMeans[];
|
||||
extern const WebRtc_Word16 kSpeechDataMeans[];
|
||||
extern const WebRtc_Word16 kNoiseDataStds[];
|
||||
extern const WebRtc_Word16 kSpeechDataStds[];
|
||||
|
||||
#endif // WEBRTC_VAD_CONST_H_
|
@ -15,12 +15,50 @@
|
||||
*/
|
||||
|
||||
#include "vad_core.h"
|
||||
#include "vad_const.h"
|
||||
|
||||
#include "signal_processing_library.h"
|
||||
#include "typedefs.h"
|
||||
#include "vad_defines.h"
|
||||
#include "vad_filterbank.h"
|
||||
#include "vad_gmm.h"
|
||||
#include "vad_sp.h"
|
||||
#include "signal_processing_library.h"
|
||||
|
||||
// Spectrum Weighting
|
||||
static const WebRtc_Word16 kSpectrumWeight[6] = { 6, 8, 10, 12, 14, 16 };
|
||||
static const WebRtc_Word16 kNoiseUpdateConst = 655; // Q15
|
||||
static const WebRtc_Word16 kSpeechUpdateConst = 6554; // Q15
|
||||
static const WebRtc_Word16 kBackEta = 154; // Q8
|
||||
// Minimum difference between the two models, Q5
|
||||
static const WebRtc_Word16 kMinimumDifference[6] = {
|
||||
544, 544, 576, 576, 576, 576 };
|
||||
// Upper limit of mean value for speech model, Q7
|
||||
static const WebRtc_Word16 kMaximumSpeech[6] = {
|
||||
11392, 11392, 11520, 11520, 11520, 11520 };
|
||||
// Minimum value for mean value
|
||||
static const WebRtc_Word16 kMinimumMean[2] = { 640, 768 };
|
||||
// Upper limit of mean value for noise model, Q7
|
||||
static const WebRtc_Word16 kMaximumNoise[6] = {
|
||||
9216, 9088, 8960, 8832, 8704, 8576 };
|
||||
// Start values for the Gaussian models, Q7
|
||||
// Weights for the two Gaussians for the six channels (noise)
|
||||
static const WebRtc_Word16 kNoiseDataWeights[12] = {
|
||||
34, 62, 72, 66, 53, 25, 94, 66, 56, 62, 75, 103 };
|
||||
// Weights for the two Gaussians for the six channels (speech)
|
||||
static const WebRtc_Word16 kSpeechDataWeights[12] = {
|
||||
48, 82, 45, 87, 50, 47, 80, 46, 83, 41, 78, 81 };
|
||||
// Means for the two Gaussians for the six channels (noise)
|
||||
static const WebRtc_Word16 kNoiseDataMeans[12] = {
|
||||
6738, 4892, 7065, 6715, 6771, 3369, 7646, 3863, 7820, 7266, 5020, 4362 };
|
||||
// Means for the two Gaussians for the six channels (speech)
|
||||
static const WebRtc_Word16 kSpeechDataMeans[12] = {
|
||||
8306, 10085, 10078, 11823, 11843, 6309, 9473, 9571, 10879, 7581, 8180, 7483
|
||||
};
|
||||
// Stds for the two Gaussians for the six channels (noise)
|
||||
static const WebRtc_Word16 kNoiseDataStds[12] = {
|
||||
378, 1064, 493, 582, 688, 593, 474, 697, 475, 688, 421, 455 };
|
||||
// Stds for the two Gaussians for the six channels (speech)
|
||||
static const WebRtc_Word16 kSpeechDataStds[12] = {
|
||||
555, 505, 567, 524, 585, 1231, 509, 828, 492, 1540, 1079, 850 };
|
||||
|
||||
static const int kInitCheck = 42;
|
||||
|
||||
|
@ -15,9 +15,21 @@
|
||||
*/
|
||||
|
||||
#include "vad_filterbank.h"
|
||||
#include "vad_defines.h"
|
||||
#include "vad_const.h"
|
||||
|
||||
#include "signal_processing_library.h"
|
||||
#include "typedefs.h"
|
||||
#include "vad_defines.h"
|
||||
|
||||
// Constant 160*log10(2) in Q9
|
||||
static const WebRtc_Word16 kLogConst = 24660;
|
||||
// Coefficients used by WebRtcVad_HpOutput, Q14
|
||||
static const WebRtc_Word16 kHpZeroCoefs[3] = {6631, -13262, 6631};
|
||||
static const WebRtc_Word16 kHpPoleCoefs[3] = {16384, -7756, 5620};
|
||||
// Allpass filter coefficients, upper and lower, in Q15
|
||||
// Upper: 0.64, Lower: 0.17
|
||||
static const WebRtc_Word16 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,
|
||||
WebRtc_Word16 in_vector_length,
|
||||
|
@ -15,8 +15,13 @@
|
||||
*/
|
||||
|
||||
#include "vad_gmm.h"
|
||||
|
||||
#include "signal_processing_library.h"
|
||||
#include "vad_const.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
static const WebRtc_Word32 kCompVar = 22005;
|
||||
// Constant log2(exp(1)) in Q12
|
||||
static const WebRtc_Word16 kLog10Const = 5909;
|
||||
|
||||
WebRtc_Word32 WebRtcVad_GaussianProbability(WebRtc_Word16 in_sample,
|
||||
WebRtc_Word16 mean,
|
||||
|
@ -10,15 +10,20 @@
|
||||
|
||||
|
||||
/*
|
||||
* This file includes the implementation of the VAD internal calls for Downsampling and
|
||||
* FindMinimum.
|
||||
* This file includes the implementation of the VAD internal calls for
|
||||
* Downsampling and FindMinimum.
|
||||
* For function call descriptions; See vad_sp.h.
|
||||
*/
|
||||
|
||||
#include "vad_sp.h"
|
||||
#include "vad_defines.h"
|
||||
#include "vad_const.h"
|
||||
|
||||
#include "signal_processing_library.h"
|
||||
#include "typedefs.h"
|
||||
#include "vad_defines.h"
|
||||
|
||||
// Allpass filter coefficients, upper and lower, in Q13
|
||||
// Upper: 0.64, Lower: 0.17
|
||||
static const WebRtc_Word16 kAllPassCoefsQ13[2] = {5243, 1392}; // Q13
|
||||
|
||||
// Downsampling filter based on the splitting filter and the allpass functions
|
||||
// in vad_filterbank.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user