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 |
11 | 11 |
12 /* | 12 /* |
13 * This file contains the function WebRtcSpl_LevinsonDurbin(). | 13 * This file contains the function WebRtcSpl_LevinsonDurbin(). |
14 * The description header can be found in signal_processing_library.h | 14 * The description header can be found in signal_processing_library.h |
15 * | 15 * |
16 */ | 16 */ |
17 | 17 |
18 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 18 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
19 | 19 |
20 #define SPL_LEVINSON_MAXORDER 20 | 20 #define SPL_LEVINSON_MAXORDER 20 |
21 | 21 |
22 int16_t WebRtcSpl_LevinsonDurbin(const int32_t* R, int16_t* A, int16_t* K, | 22 int16_t WebRtcSpl_LevinsonDurbin(const int32_t* R, int16_t* A, int16_t* K, |
23 int16_t order) | 23 size_t order) |
24 { | 24 { |
25 int16_t i, j; | 25 size_t i, j; |
26 // Auto-correlation coefficients in high precision | 26 // Auto-correlation coefficients in high precision |
27 int16_t R_hi[SPL_LEVINSON_MAXORDER + 1], R_low[SPL_LEVINSON_MAXORDER + 1]; | 27 int16_t R_hi[SPL_LEVINSON_MAXORDER + 1], R_low[SPL_LEVINSON_MAXORDER + 1]; |
28 // LPC coefficients in high precision | 28 // LPC coefficients in high precision |
29 int16_t A_hi[SPL_LEVINSON_MAXORDER + 1], A_low[SPL_LEVINSON_MAXORDER + 1]; | 29 int16_t A_hi[SPL_LEVINSON_MAXORDER + 1], A_low[SPL_LEVINSON_MAXORDER + 1]; |
30 // LPC coefficients for next iteration | 30 // LPC coefficients for next iteration |
31 int16_t A_upd_hi[SPL_LEVINSON_MAXORDER + 1], A_upd_low[SPL_LEVINSON_MAXORDER
+ 1]; | 31 int16_t A_upd_hi[SPL_LEVINSON_MAXORDER + 1], A_upd_low[SPL_LEVINSON_MAXORDER
+ 1]; |
32 // Reflection coefficient in high precision | 32 // Reflection coefficient in high precision |
33 int16_t K_hi, K_low; | 33 int16_t K_hi, K_low; |
34 // Prediction gain Alpha in high precision and with scale factor | 34 // Prediction gain Alpha in high precision and with scale factor |
35 int16_t Alpha_hi, Alpha_low, Alpha_exp; | 35 int16_t Alpha_hi, Alpha_low, Alpha_exp; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 for (i = 1; i <= order; i++) | 237 for (i = 1; i <= order; i++) |
238 { | 238 { |
239 // temp1W32 in Q27 | 239 // temp1W32 in Q27 |
240 temp1W32 = WEBRTC_SPL_LSHIFT_W32((int32_t)A_hi[i], 16) | 240 temp1W32 = WEBRTC_SPL_LSHIFT_W32((int32_t)A_hi[i], 16) |
241 + WEBRTC_SPL_LSHIFT_W32((int32_t)A_low[i], 1); | 241 + WEBRTC_SPL_LSHIFT_W32((int32_t)A_low[i], 1); |
242 // Round and store upper word | 242 // Round and store upper word |
243 A[i] = (int16_t)(((temp1W32 << 1) + 32768) >> 16); | 243 A[i] = (int16_t)(((temp1W32 << 1) + 32768) >> 16); |
244 } | 244 } |
245 return 1; // Stable filters | 245 return 1; // Stable filters |
246 } | 246 } |
OLD | NEW |