Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(799)

Side by Side Diff: webrtc/modules/audio_processing/high_pass_filter_impl.cc

Issue 1507683006: Make NoiseSuppression not a processing component (bit exact). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: missing explicit Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 }; 82 };
83 83
84 HighPassFilterImpl::HighPassFilterImpl(rtc::CriticalSection* crit) 84 HighPassFilterImpl::HighPassFilterImpl(rtc::CriticalSection* crit)
85 : crit_(crit) { 85 : crit_(crit) {
86 RTC_DCHECK(crit_); 86 RTC_DCHECK(crit_);
87 } 87 }
88 88
89 HighPassFilterImpl::~HighPassFilterImpl() {} 89 HighPassFilterImpl::~HighPassFilterImpl() {}
90 90
91 void HighPassFilterImpl::Initialize(int channels, int sample_rate_hz) { 91 void HighPassFilterImpl::Initialize(int channels, int sample_rate_hz) {
92 RTC_DCHECK_LE(0, channels);
92 std::vector<rtc::scoped_ptr<BiquadFilter>> new_filters(channels); 93 std::vector<rtc::scoped_ptr<BiquadFilter>> new_filters(channels);
93 for (int i = 0; i < channels; i++) { 94 for (int i = 0; i < channels; i++) {
94 new_filters[i].reset(new BiquadFilter(sample_rate_hz)); 95 new_filters[i].reset(new BiquadFilter(sample_rate_hz));
95 } 96 }
96 rtc::CritScope cs(crit_); 97 rtc::CritScope cs(crit_);
97 filters_.swap(new_filters); 98 filters_.swap(new_filters);
98 } 99 }
99 100
100 void HighPassFilterImpl::ProcessCaptureAudio(AudioBuffer* audio) { 101 void HighPassFilterImpl::ProcessCaptureAudio(AudioBuffer* audio) {
102 RTC_DCHECK(audio);
101 rtc::CritScope cs(crit_); 103 rtc::CritScope cs(crit_);
102 if (!enabled_) { 104 if (!enabled_) {
103 return; 105 return;
104 } 106 }
105 107
106 RTC_DCHECK_GE(160u, audio->num_frames_per_band()); 108 RTC_DCHECK_GE(160u, audio->num_frames_per_band());
107 RTC_DCHECK_EQ(filters_.size(), static_cast<size_t>(audio->num_channels())); 109 RTC_DCHECK_EQ(filters_.size(), static_cast<size_t>(audio->num_channels()));
108 for (size_t i = 0; i < filters_.size(); i++) { 110 for (size_t i = 0; i < filters_.size(); i++) {
109 filters_[i]->Process(audio->split_bands(i)[kBand0To8kHz], 111 filters_[i]->Process(audio->split_bands(i)[kBand0To8kHz],
110 audio->num_frames_per_band()); 112 audio->num_frames_per_band());
111 } 113 }
112 } 114 }
113 115
114 int HighPassFilterImpl::Enable(bool enable) { 116 int HighPassFilterImpl::Enable(bool enable) {
115 rtc::CritScope cs(crit_); 117 rtc::CritScope cs(crit_);
116 enabled_ = enable; 118 enabled_ = enable;
117 return AudioProcessing::kNoError; 119 return AudioProcessing::kNoError;
118 } 120 }
119 121
120 bool HighPassFilterImpl::is_enabled() const { 122 bool HighPassFilterImpl::is_enabled() const {
121 rtc::CritScope cs(crit_); 123 rtc::CritScope cs(crit_);
122 return enabled_; 124 return enabled_;
123 } 125 }
124 } // namespace webrtc 126 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/high_pass_filter_impl.h ('k') | webrtc/modules/audio_processing/noise_suppression_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698