Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 // Normalize the autocorrelation R[0]...R[order+1] | 40 // Normalize the autocorrelation R[0]...R[order+1] |
| 41 | 41 |
| 42 norm = WebRtcSpl_NormW32(R[0]); | 42 norm = WebRtcSpl_NormW32(R[0]); |
| 43 | 43 |
| 44 for (i = 0; i <= order; ++i) | 44 for (i = 0; i <= order; ++i) |
| 45 { | 45 { |
| 46 temp1W32 = R[i] * (1 << norm); | 46 temp1W32 = R[i] * (1 << norm); |
| 47 // Put R in hi and low format | 47 // Put R in hi and low format |
| 48 R_hi[i] = (int16_t)(temp1W32 >> 16); | 48 R_hi[i] = (int16_t)(temp1W32 >> 16); |
| 49 R_low[i] = (int16_t)((temp1W32 - ((int32_t)R_hi[i] * 65536)) >> 1); | 49 R_low[i] = (int16_t)((temp1W32 - ((int32_t)R_hi[i] * 65536)) >> 1); |
|
hlundin-webrtc
2016/12/14 08:24:05
I don't understand this code...
ivoc
2016/12/14 09:10:44
It's pretty hard to read, but I think it's just sp
| |
| 50 } | 50 } |
| 51 | 51 |
| 52 // K = A[1] = -R[1] / R[0] | 52 // K = A[1] = -R[1] / R[0] |
| 53 | 53 |
| 54 temp2W32 = WEBRTC_SPL_LSHIFT_W32((int32_t)R_hi[1],16) | 54 temp2W32 = (R[1] * (1 << norm)); // R[1] in Q31 |
|
hlundin-webrtc
2016/12/14 08:24:05
You can drop the outer parentheses.
hlundin-webrtc
2016/12/14 08:24:05
Since the code at line 49 is quite obscure, did yo
ivoc
2016/12/14 09:10:44
I verified that it gives exactly the same values.
| |
| 55 + WEBRTC_SPL_LSHIFT_W32((int32_t)R_low[1],1); // R[1] in Q31 | |
|
ivoc
2016/12/14 09:10:44
This code is putting the upper and lower bits toge
| |
| 56 temp3W32 = WEBRTC_SPL_ABS_W32(temp2W32); // abs R[1] | 55 temp3W32 = WEBRTC_SPL_ABS_W32(temp2W32); // abs R[1] |
| 57 temp1W32 = WebRtcSpl_DivW32HiLow(temp3W32, R_hi[0], R_low[0]); // abs(R[1])/ R[0] in Q31 | 56 temp1W32 = WebRtcSpl_DivW32HiLow(temp3W32, R_hi[0], R_low[0]); // abs(R[1])/ R[0] in Q31 |
| 58 // Put back the sign on R[1] | 57 // Put back the sign on R[1] |
| 59 if (temp2W32 > 0) | 58 if (temp2W32 > 0) |
| 60 { | 59 { |
| 61 temp1W32 = -temp1W32; | 60 temp1W32 = -temp1W32; |
| 62 } | 61 } |
| 63 | 62 |
| 64 // Put K in hi and low format | 63 // Put K in hi and low format |
| 65 K_hi = (int16_t)(temp1W32 >> 16); | 64 K_hi = (int16_t)(temp1W32 >> 16); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 for (i = 1; i <= order; i++) | 236 for (i = 1; i <= order; i++) |
| 238 { | 237 { |
| 239 // temp1W32 in Q27 | 238 // temp1W32 in Q27 |
| 240 temp1W32 = (int32_t)A_hi[i] * 65536 | 239 temp1W32 = (int32_t)A_hi[i] * 65536 |
| 241 + WEBRTC_SPL_LSHIFT_W32((int32_t)A_low[i], 1); | 240 + WEBRTC_SPL_LSHIFT_W32((int32_t)A_low[i], 1); |
| 242 // Round and store upper word | 241 // Round and store upper word |
| 243 A[i] = (int16_t)(((temp1W32 * 2) + 32768) >> 16); | 242 A[i] = (int16_t)(((temp1W32 * 2) + 32768) >> 16); |
| 244 } | 243 } |
| 245 return 1; // Stable filters | 244 return 1; // Stable filters |
| 246 } | 245 } |
| OLD | NEW |