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

Side by Side Diff: webrtc/modules/audio_processing/aec3/decimator_by_4.cc

Issue 2644123002: Adding full initial version of delay estimation functionality in echo canceller 3 (Closed)
Patch Set: Rebase Created 3 years, 10 months 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
(Empty)
1 /*
2 * Copyright (c) 2017 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 #include "webrtc/modules/audio_processing/aec3/decimator_by_4.h"
11
12 #include "webrtc/base/checks.h"
13
14 namespace webrtc {
15 namespace {
16
17 // [B,A] = butter(2,1500/16000) which are the same as [B,A] =
18 // butter(2,750/8000).
19 const CascadedBiQuadFilter::BiQuadCoefficients kLowPassFilterCoefficients = {
20 {0.0179f, 0.0357f, 0.0179f},
21 {-1.5879f, 0.6594f}};
22
23 } // namespace
24
25 DecimatorBy4::DecimatorBy4()
26 : low_pass_filter_(kLowPassFilterCoefficients, 3) {}
27
28 void DecimatorBy4::Decimate(rtc::ArrayView<const float> in,
29 std::array<float, kSubBlockSize>* out) {
30 RTC_DCHECK_EQ(kBlockSize, in.size());
31 RTC_DCHECK(out);
32 std::array<float, kBlockSize> x;
33
34 // Limit the frequency content of the signal to avoid aliasing.
35 low_pass_filter_.Process(in, x);
36
37 // Downsample the signal.
38 for (size_t j = 0, k = 0; j < out->size(); ++j, k += 4) {
39 RTC_DCHECK_GT(kBlockSize, k);
40 (*out)[j] = x[k];
41 }
42 }
43
44 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec3/decimator_by_4.h ('k') | webrtc/modules/audio_processing/aec3/decimator_by_4_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698