OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/common_audio/vad/vad_sp.h" | 11 #include "webrtc/common_audio/vad/vad_sp.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/rtc_base/checks.h" |
14 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 14 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
15 #include "webrtc/common_audio/vad/vad_core.h" | 15 #include "webrtc/common_audio/vad/vad_core.h" |
16 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
17 | 17 |
18 // Allpass filter coefficients, upper and lower, in Q13. | 18 // Allpass filter coefficients, upper and lower, in Q13. |
19 // Upper: 0.64, Lower: 0.17. | 19 // Upper: 0.64, Lower: 0.17. |
20 static const int16_t kAllPassCoefsQ13[2] = { 5243, 1392 }; // Q13. | 20 static const int16_t kAllPassCoefsQ13[2] = { 5243, 1392 }; // Q13. |
21 static const int16_t kSmoothingDown = 6553; // 0.2 in Q15. | 21 static const int16_t kSmoothingDown = 6553; // 0.2 in Q15. |
22 static const int16_t kSmoothingUp = 32439; // 0.99 in Q15. | 22 static const int16_t kSmoothingUp = 32439; // 0.99 in Q15. |
23 | 23 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 alpha = kSmoothingUp; // 0.99 in Q15. | 168 alpha = kSmoothingUp; // 0.99 in Q15. |
169 } | 169 } |
170 } | 170 } |
171 tmp32 = (alpha + 1) * self->mean_value[channel]; | 171 tmp32 = (alpha + 1) * self->mean_value[channel]; |
172 tmp32 += (WEBRTC_SPL_WORD16_MAX - alpha) * current_median; | 172 tmp32 += (WEBRTC_SPL_WORD16_MAX - alpha) * current_median; |
173 tmp32 += 16384; | 173 tmp32 += 16384; |
174 self->mean_value[channel] = (int16_t) (tmp32 >> 15); | 174 self->mean_value[channel] = (int16_t) (tmp32 >> 15); |
175 | 175 |
176 return self->mean_value[channel]; | 176 return self->mean_value[channel]; |
177 } | 177 } |
OLD | NEW |