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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 TransientSuppressor::TransientSuppressor() | 47 TransientSuppressor::TransientSuppressor() |
48 : data_length_(0), | 48 : data_length_(0), |
49 detection_length_(0), | 49 detection_length_(0), |
50 analysis_length_(0), | 50 analysis_length_(0), |
51 buffer_delay_(0), | 51 buffer_delay_(0), |
52 complex_analysis_length_(0), | 52 complex_analysis_length_(0), |
53 num_channels_(0), | 53 num_channels_(0), |
54 window_(NULL), | 54 window_(nullptr), |
55 detector_smoothed_(0.f), | 55 detector_smoothed_(0.f), |
56 keypress_counter_(0), | 56 keypress_counter_(0), |
57 chunks_since_keypress_(0), | 57 chunks_since_keypress_(0), |
58 detection_enabled_(false), | 58 detection_enabled_(false), |
59 suppression_enabled_(false), | 59 suppression_enabled_(false), |
60 use_hard_restoration_(false), | 60 use_hard_restoration_(false), |
61 chunks_since_voice_change_(0), | 61 chunks_since_voice_change_(0), |
62 seed_(182), | 62 seed_(182), |
63 using_reference_(false) { | 63 using_reference_(false) {} |
64 } | |
65 | 64 |
66 TransientSuppressor::~TransientSuppressor() {} | 65 TransientSuppressor::~TransientSuppressor() {} |
67 | 66 |
68 int TransientSuppressor::Initialize(int sample_rate_hz, | 67 int TransientSuppressor::Initialize(int sample_rate_hz, |
69 int detection_rate_hz, | 68 int detection_rate_hz, |
70 int num_channels) { | 69 int num_channels) { |
71 switch (sample_rate_hz) { | 70 switch (sample_rate_hz) { |
72 case ts::kSampleRate8kHz: | 71 case ts::kSampleRate8kHz: |
73 analysis_length_ = 128u; | 72 analysis_length_ = 128u; |
74 window_ = kBlocks80w128; | 73 window_ = kBlocks80w128; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 const float magnitude_ratio = new_magnitude / magnitudes_[i]; | 414 const float magnitude_ratio = new_magnitude / magnitudes_[i]; |
416 | 415 |
417 fft_buffer_[i * 2] *= magnitude_ratio; | 416 fft_buffer_[i * 2] *= magnitude_ratio; |
418 fft_buffer_[i * 2 + 1] *= magnitude_ratio; | 417 fft_buffer_[i * 2 + 1] *= magnitude_ratio; |
419 magnitudes_[i] = new_magnitude; | 418 magnitudes_[i] = new_magnitude; |
420 } | 419 } |
421 } | 420 } |
422 } | 421 } |
423 | 422 |
424 } // namespace webrtc | 423 } // namespace webrtc |
OLD | NEW |