• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 #ifndef MODULES_AUDIO_PROCESSING_VAD_VAD_AUDIO_PROC_INTERNAL_H_
12 #define MODULES_AUDIO_PROCESSING_VAD_VAD_AUDIO_PROC_INTERNAL_H_
13 
14 #include <stddef.h>
15 
16 namespace webrtc {
17 
18 // These values should match MATLAB counterparts for unit-tests to pass.
19 static const double kCorrWeight[] = {
20     1.000000, 0.985000, 0.970225, 0.955672, 0.941337, 0.927217,
21     0.913308, 0.899609, 0.886115, 0.872823, 0.859730, 0.846834,
22     0.834132, 0.821620, 0.809296, 0.797156, 0.785199};
23 
24 static const double kLpcAnalWin[] = {
25     0.00000000, 0.01314436, 0.02628645, 0.03942400, 0.05255473, 0.06567639,
26     0.07878670, 0.09188339, 0.10496421, 0.11802689, 0.13106918, 0.14408883,
27     0.15708358, 0.17005118, 0.18298941, 0.19589602, 0.20876878, 0.22160547,
28     0.23440387, 0.24716177, 0.25987696, 0.27254725, 0.28517045, 0.29774438,
29     0.31026687, 0.32273574, 0.33514885, 0.34750406, 0.35979922, 0.37203222,
30     0.38420093, 0.39630327, 0.40833713, 0.42030043, 0.43219112, 0.44400713,
31     0.45574642, 0.46740697, 0.47898676, 0.49048379, 0.50189608, 0.51322164,
32     0.52445853, 0.53560481, 0.54665854, 0.55761782, 0.56848075, 0.57924546,
33     0.58991008, 0.60047278, 0.61093173, 0.62128512, 0.63153117, 0.64166810,
34     0.65169416, 0.66160761, 0.67140676, 0.68108990, 0.69065536, 0.70010148,
35     0.70942664, 0.71862923, 0.72770765, 0.73666033, 0.74548573, 0.75418233,
36     0.76274862, 0.77118312, 0.77948437, 0.78765094, 0.79568142, 0.80357442,
37     0.81132858, 0.81894256, 0.82641504, 0.83374472, 0.84093036, 0.84797069,
38     0.85486451, 0.86161063, 0.86820787, 0.87465511, 0.88095122, 0.88709512,
39     0.89308574, 0.89892206, 0.90460306, 0.91012776, 0.91549520, 0.92070447,
40     0.92575465, 0.93064488, 0.93537432, 0.93994213, 0.94434755, 0.94858979,
41     0.95266814, 0.95658189, 0.96033035, 0.96391289, 0.96732888, 0.97057773,
42     0.97365889, 0.97657181, 0.97931600, 0.98189099, 0.98429632, 0.98653158,
43     0.98859639, 0.99049038, 0.99221324, 0.99376466, 0.99514438, 0.99635215,
44     0.99738778, 0.99825107, 0.99894188, 0.99946010, 0.99980562, 0.99997840,
45     0.99997840, 0.99980562, 0.99946010, 0.99894188, 0.99825107, 0.99738778,
46     0.99635215, 0.99514438, 0.99376466, 0.99221324, 0.99049038, 0.98859639,
47     0.98653158, 0.98429632, 0.98189099, 0.97931600, 0.97657181, 0.97365889,
48     0.97057773, 0.96732888, 0.96391289, 0.96033035, 0.95658189, 0.95266814,
49     0.94858979, 0.94434755, 0.93994213, 0.93537432, 0.93064488, 0.92575465,
50     0.92070447, 0.91549520, 0.91012776, 0.90460306, 0.89892206, 0.89308574,
51     0.88709512, 0.88095122, 0.87465511, 0.86820787, 0.86161063, 0.85486451,
52     0.84797069, 0.84093036, 0.83374472, 0.82641504, 0.81894256, 0.81132858,
53     0.80357442, 0.79568142, 0.78765094, 0.77948437, 0.77118312, 0.76274862,
54     0.75418233, 0.74548573, 0.73666033, 0.72770765, 0.71862923, 0.70942664,
55     0.70010148, 0.69065536, 0.68108990, 0.67140676, 0.66160761, 0.65169416,
56     0.64166810, 0.63153117, 0.62128512, 0.61093173, 0.60047278, 0.58991008,
57     0.57924546, 0.56848075, 0.55761782, 0.54665854, 0.53560481, 0.52445853,
58     0.51322164, 0.50189608, 0.49048379, 0.47898676, 0.46740697, 0.45574642,
59     0.44400713, 0.43219112, 0.42030043, 0.40833713, 0.39630327, 0.38420093,
60     0.37203222, 0.35979922, 0.34750406, 0.33514885, 0.32273574, 0.31026687,
61     0.29774438, 0.28517045, 0.27254725, 0.25987696, 0.24716177, 0.23440387,
62     0.22160547, 0.20876878, 0.19589602, 0.18298941, 0.17005118, 0.15708358,
63     0.14408883, 0.13106918, 0.11802689, 0.10496421, 0.09188339, 0.07878670,
64     0.06567639, 0.05255473, 0.03942400, 0.02628645, 0.01314436, 0.00000000};
65 
66 static const size_t kFilterOrder = 2;
67 static const float kCoeffNumerator[kFilterOrder + 1] = {0.974827f, -1.949650f,
68                                                         0.974827f};
69 static const float kCoeffDenominator[kFilterOrder + 1] = {1.0f, -1.971999f,
70                                                           0.972457f};
71 
72 static_assert(kFilterOrder + 1 ==
73                   sizeof(kCoeffNumerator) / sizeof(kCoeffNumerator[0]),
74               "numerator coefficients incorrect size");
75 static_assert(kFilterOrder + 1 ==
76                   sizeof(kCoeffDenominator) / sizeof(kCoeffDenominator[0]),
77               "denominator coefficients incorrect size");
78 
79 }  // namespace webrtc
80 
81 #endif  // MODULES_AUDIO_PROCESSING_VAD_VAD_AUDIO_PROCESSING_H_
82