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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 @Reference C code: | 153 @Reference C code: |
154 @ | 154 @ |
155 @void WebRtcSpl_FilterARFastQ12(int16_t* data_in, | 155 @void WebRtcSpl_FilterARFastQ12(int16_t* data_in, |
156 @ int16_t* data_out, | 156 @ int16_t* data_out, |
157 @ int16_t* __restrict coefficients, | 157 @ int16_t* __restrict coefficients, |
158 @ int coefficients_length, | 158 @ int coefficients_length, |
159 @ int data_length) { | 159 @ int data_length) { |
160 @ int i = 0; | 160 @ int i = 0; |
161 @ int j = 0; | 161 @ int j = 0; |
162 @ | 162 @ |
| 163 @ assert(data_length > 0); |
| 164 @ assert(coefficients_length > 1); |
| 165 @ |
163 @ for (i = 0; i < data_length - 1; i += 2) { | 166 @ for (i = 0; i < data_length - 1; i += 2) { |
164 @ int32_t output1 = 0; | 167 @ int32_t output1 = 0; |
165 @ int32_t sum1 = 0; | 168 @ int32_t sum1 = 0; |
166 @ int32_t output2 = 0; | 169 @ int32_t output2 = 0; |
167 @ int32_t sum2 = 0; | 170 @ int32_t sum2 = 0; |
168 @ | 171 @ |
169 @ for (j = coefficients_length - 1; j > 2; j -= 2) { | 172 @ for (j = coefficients_length - 1; j > 2; j -= 2) { |
170 @ sum1 += coefficients[j] * data_out[i - j]; | 173 @ sum1 += coefficients[j] * data_out[i - j]; |
171 @ sum1 += coefficients[j - 1] * data_out[i - j + 1]; | 174 @ sum1 += coefficients[j - 1] * data_out[i - j + 1]; |
172 @ sum2 += coefficients[j] * data_out[i - j + 1]; | 175 @ sum2 += coefficients[j] * data_out[i - j + 1]; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 @ sum1 += coefficients[1] * data_out[i - 1]; | 209 @ sum1 += coefficients[1] * data_out[i - 1]; |
207 @ } | 210 @ } |
208 @ | 211 @ |
209 @ output1 = coefficients[0] * data_in[i]; | 212 @ output1 = coefficients[0] * data_in[i]; |
210 @ output1 -= sum1; | 213 @ output1 -= sum1; |
211 @ // Saturate and store the output. | 214 @ // Saturate and store the output. |
212 @ output1 = WEBRTC_SPL_SAT(134215679, output1, -134217728); | 215 @ output1 = WEBRTC_SPL_SAT(134215679, output1, -134217728); |
213 @ data_out[i] = (int16_t)((output1 + 2048) >> 12); | 216 @ data_out[i] = (int16_t)((output1 + 2048) >> 12); |
214 @ } | 217 @ } |
215 @} | 218 @} |
OLD | NEW |