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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 int size, | 73 int size, |
74 float skew, | 74 float skew, |
75 float* outspeech, | 75 float* outspeech, |
76 int* size_out) { | 76 int* size_out) { |
77 AecResampler* obj = (AecResampler*)resampInst; | 77 AecResampler* obj = (AecResampler*)resampInst; |
78 | 78 |
79 float* y; | 79 float* y; |
80 float be, tnew; | 80 float be, tnew; |
81 int tn, mm; | 81 int tn, mm; |
82 | 82 |
83 assert(!(size < 0 || size > 2 * FRAME_LEN)); | 83 assert(size >= 0); |
| 84 assert(size <= 2 * FRAME_LEN); |
84 assert(resampInst != NULL); | 85 assert(resampInst != NULL); |
85 assert(inspeech != NULL); | 86 assert(inspeech != NULL); |
86 assert(outspeech != NULL); | 87 assert(outspeech != NULL); |
87 assert(size_out != NULL); | 88 assert(size_out != NULL); |
88 | 89 |
89 // Add new frame data in lookahead | 90 // Add new frame data in lookahead |
90 memcpy(&obj->buffer[FRAME_LEN + kResamplingDelay], | 91 memcpy(&obj->buffer[FRAME_LEN + kResamplingDelay], |
91 inspeech, | 92 inspeech, |
92 size * sizeof(inspeech[0])); | 93 size * sizeof(inspeech[0])); |
93 | 94 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 xAvg = x / n; | 207 xAvg = x / n; |
207 denom = x2 - xAvg * x; | 208 denom = x2 - xAvg * x; |
208 | 209 |
209 if (denom != 0) { | 210 if (denom != 0) { |
210 skew = (xy - xAvg * y) / denom; | 211 skew = (xy - xAvg * y) / denom; |
211 } | 212 } |
212 | 213 |
213 *skewEst = skew; | 214 *skewEst = skew; |
214 return 0; | 215 return 0; |
215 } | 216 } |
OLD | NEW |