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

Side by Side Diff: webrtc/common_audio/resampler/sinc_resampler.cc

Issue 1235643003: Miscellaneous changes split from https://codereview.webrtc.org/1230503003 . (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 5 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
« no previous file with comments | « no previous file | webrtc/common_audio/vad/vad_core_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include <assert.h> 90 #include <assert.h>
91 #include <math.h> 91 #include <math.h>
92 #include <string.h> 92 #include <string.h>
93 93
94 #include <limits> 94 #include <limits>
95 95
96 #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" 96 #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h"
97 #include "webrtc/typedefs.h" 97 #include "webrtc/typedefs.h"
98 98
99 namespace webrtc { 99 namespace webrtc {
100
100 namespace { 101 namespace {
101 102
102 double SincScaleFactor(double io_ratio) { 103 double SincScaleFactor(double io_ratio) {
103 // |sinc_scale_factor| is basically the normalized cutoff frequency of the 104 // |sinc_scale_factor| is basically the normalized cutoff frequency of the
104 // low-pass filter. 105 // low-pass filter.
105 double sinc_scale_factor = io_ratio > 1.0 ? 1.0 / io_ratio : 1.0; 106 double sinc_scale_factor = io_ratio > 1.0 ? 1.0 / io_ratio : 1.0;
106 107
107 // The sinc function is an idealized brick-wall filter, but since we're 108 // The sinc function is an idealized brick-wall filter, but since we're
108 // windowing it the transition from pass to stop does not happen right away. 109 // windowing it the transition from pass to stop does not happen right away.
109 // So we should adjust the low pass filter cutoff slightly downward to avoid 110 // So we should adjust the low pass filter cutoff slightly downward to avoid
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 sum1 += *input_ptr * *k1++; 368 sum1 += *input_ptr * *k1++;
368 sum2 += *input_ptr++ * *k2++; 369 sum2 += *input_ptr++ * *k2++;
369 } 370 }
370 371
371 // Linearly interpolate the two "convolutions". 372 // Linearly interpolate the two "convolutions".
372 return static_cast<float>((1.0 - kernel_interpolation_factor) * sum1 + 373 return static_cast<float>((1.0 - kernel_interpolation_factor) * sum1 +
373 kernel_interpolation_factor * sum2); 374 kernel_interpolation_factor * sum2);
374 } 375 }
375 376
376 } // namespace webrtc 377 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/common_audio/vad/vad_core_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698