OLD | NEW |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 size_t size, | 67 size_t size, |
68 float skew, | 68 float skew, |
69 float* outspeech, | 69 float* outspeech, |
70 size_t* size_out) { | 70 size_t* size_out) { |
71 AecResampler* obj = static_cast<AecResampler*>(resampInst); | 71 AecResampler* obj = static_cast<AecResampler*>(resampInst); |
72 | 72 |
73 float* y; | 73 float* y; |
74 float be, tnew; | 74 float be, tnew; |
75 size_t tn, mm; | 75 size_t tn, mm; |
76 | 76 |
77 RTC_DCHECK_LE(size, 2u * FRAME_LEN); | 77 RTC_DCHECK_LE(size, 2 * FRAME_LEN); |
78 RTC_DCHECK(resampInst); | 78 RTC_DCHECK(resampInst); |
79 RTC_DCHECK(inspeech); | 79 RTC_DCHECK(inspeech); |
80 RTC_DCHECK(outspeech); | 80 RTC_DCHECK(outspeech); |
81 RTC_DCHECK(size_out); | 81 RTC_DCHECK(size_out); |
82 | 82 |
83 // Add new frame data in lookahead | 83 // Add new frame data in lookahead |
84 memcpy(&obj->buffer[FRAME_LEN + kResamplingDelay], inspeech, | 84 memcpy(&obj->buffer[FRAME_LEN + kResamplingDelay], inspeech, |
85 size * sizeof(inspeech[0])); | 85 size * sizeof(inspeech[0])); |
86 | 86 |
87 // Sample rate ratio | 87 // Sample rate ratio |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 denom = x2 - xAvg * x; | 198 denom = x2 - xAvg * x; |
199 | 199 |
200 if (denom != 0) { | 200 if (denom != 0) { |
201 skew = (xy - xAvg * y) / denom; | 201 skew = (xy - xAvg * y) / denom; |
202 } | 202 } |
203 | 203 |
204 *skewEst = skew; | 204 *skewEst = skew; |
205 return 0; | 205 return 0; |
206 } | 206 } |
207 } // namespace webrtc | 207 } // namespace webrtc |
OLD | NEW |