OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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/modules/audio_processing/transient/transient_detector.h" | 11 #include "webrtc/modules/audio_processing/transient/transient_detector.h" |
12 | 12 |
13 #include <float.h> | 13 #include <float.h> |
14 #include <math.h> | 14 #include <math.h> |
15 #include <string.h> | 15 #include <string.h> |
16 | 16 |
17 #include <algorithm> | 17 #include <algorithm> |
18 | 18 |
19 #include "webrtc/base/checks.h" | |
20 #include "webrtc/modules/audio_processing/transient/common.h" | 19 #include "webrtc/modules/audio_processing/transient/common.h" |
21 #include "webrtc/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.
h" | 20 #include "webrtc/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.
h" |
22 #include "webrtc/modules/audio_processing/transient/moving_moments.h" | 21 #include "webrtc/modules/audio_processing/transient/moving_moments.h" |
23 #include "webrtc/modules/audio_processing/transient/wpd_tree.h" | 22 #include "webrtc/modules/audio_processing/transient/wpd_tree.h" |
| 23 #include "webrtc/rtc_base/checks.h" |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 | 26 |
27 static const int kTransientLengthMs = 30; | 27 static const int kTransientLengthMs = 30; |
28 static const int kChunksAtStartupLeftToDelete = | 28 static const int kChunksAtStartupLeftToDelete = |
29 kTransientLengthMs / ts::kChunkSizeMs; | 29 kTransientLengthMs / ts::kChunkSizeMs; |
30 static const float kDetectThreshold = 16.f; | 30 static const float kDetectThreshold = 16.f; |
31 | 31 |
32 TransientDetector::TransientDetector(int sample_rate_hz) | 32 TransientDetector::TransientDetector(int sample_rate_hz) |
33 : samples_per_chunk_(sample_rate_hz * ts::kChunkSizeMs / 1000), | 33 : samples_per_chunk_(sample_rate_hz * ts::kChunkSizeMs / 1000), |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 reference_energy / reference_energy_))); | 167 reference_energy / reference_energy_))); |
168 reference_energy_ = | 168 reference_energy_ = |
169 kMemory * reference_energy_ + (1.f - kMemory) * reference_energy; | 169 kMemory * reference_energy_ + (1.f - kMemory) * reference_energy; |
170 | 170 |
171 using_reference_ = true; | 171 using_reference_ = true; |
172 | 172 |
173 return result; | 173 return result; |
174 } | 174 } |
175 | 175 |
176 } // namespace webrtc | 176 } // namespace webrtc |
OLD | NEW |