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