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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 for (i = 0; i < x_length; i++) | 39 for (i = 0; i < x_length; i++) |
40 { | 40 { |
41 // Calculate filtered[i] and filtered_low[i] | 41 // Calculate filtered[i] and filtered_low[i] |
42 const int16_t* a_ptr = &a[1]; | 42 const int16_t* a_ptr = &a[1]; |
43 int16_t* filtered_ptr = &filtered[i - 1]; | 43 int16_t* filtered_ptr = &filtered[i - 1]; |
44 int16_t* filtered_low_ptr = &filtered_low[i - 1]; | 44 int16_t* filtered_low_ptr = &filtered_low[i - 1]; |
45 int16_t* state_ptr = &state[state_length - 1]; | 45 int16_t* state_ptr = &state[state_length - 1]; |
46 int16_t* state_low_ptr = &state_low[state_length - 1]; | 46 int16_t* state_low_ptr = &state_low[state_length - 1]; |
47 | 47 |
48 o = (int32_t)(*x_ptr++) << 12; | 48 o = (int32_t)(*x_ptr++) * (1 << 12); |
49 oLOW = (int32_t)0; | 49 oLOW = (int32_t)0; |
50 | 50 |
51 stop = (i < a_length) ? i + 1 : a_length; | 51 stop = (i < a_length) ? i + 1 : a_length; |
52 for (j = 1; j < stop; j++) | 52 for (j = 1; j < stop; j++) |
53 { | 53 { |
54 o -= *a_ptr * *filtered_ptr--; | 54 o -= *a_ptr * *filtered_ptr--; |
55 oLOW -= *a_ptr++ * *filtered_low_ptr--; | 55 oLOW -= *a_ptr++ * *filtered_low_ptr--; |
56 } | 56 } |
57 for (j = i + 1; j < a_length; j++) | 57 for (j = i + 1; j < a_length; j++) |
58 { | 58 { |
59 o -= *a_ptr * *state_ptr--; | 59 o -= *a_ptr * *state_ptr--; |
60 oLOW -= *a_ptr++ * *state_low_ptr--; | 60 oLOW -= *a_ptr++ * *state_low_ptr--; |
61 } | 61 } |
62 | 62 |
63 o += (oLOW >> 12); | 63 o += (oLOW >> 12); |
64 *filteredFINAL_ptr = (int16_t)((o + (int32_t)2048) >> 12); | 64 *filteredFINAL_ptr = (int16_t)((o + (int32_t)2048) >> 12); |
65 *filteredFINAL_LOW_ptr++ = (int16_t)(o - ((int32_t)(*filteredFINAL_ptr++
) | 65 *filteredFINAL_LOW_ptr++ = |
66 << 12)); | 66 (int16_t)(o - ((int32_t)(*filteredFINAL_ptr++) * (1 << 12))); |
67 } | 67 } |
68 | 68 |
69 // Save the filter state | 69 // Save the filter state |
70 if (x_length >= state_length) | 70 if (x_length >= state_length) |
71 { | 71 { |
72 WebRtcSpl_CopyFromEndW16(filtered, x_length, a_length - 1, state); | 72 WebRtcSpl_CopyFromEndW16(filtered, x_length, a_length - 1, state); |
73 WebRtcSpl_CopyFromEndW16(filtered_low, x_length, a_length - 1, state_low
); | 73 WebRtcSpl_CopyFromEndW16(filtered_low, x_length, a_length - 1, state_low
); |
74 } else | 74 } else |
75 { | 75 { |
76 for (i = 0; i < state_length - x_length; i++) | 76 for (i = 0; i < state_length - x_length; i++) |
77 { | 77 { |
78 state[i] = state[i + x_length]; | 78 state[i] = state[i + x_length]; |
79 state_low[i] = state_low[i + x_length]; | 79 state_low[i] = state_low[i + x_length]; |
80 } | 80 } |
81 for (i = 0; i < x_length; i++) | 81 for (i = 0; i < x_length; i++) |
82 { | 82 { |
83 state[state_length - x_length + i] = filtered[i]; | 83 state[state_length - x_length + i] = filtered[i]; |
84 state[state_length - x_length + i] = filtered_low[i]; | 84 state[state_length - x_length + i] = filtered_low[i]; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 return x_length; | 88 return x_length; |
89 } | 89 } |
OLD | NEW |