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 23 matching lines...) Expand all Loading... |
34 {-101, 612, -2283, 8532, 29790, -5138, 1789, -524, 91}, | 34 {-101, 612, -2283, 8532, 29790, -5138, 1789, -524, 91}, |
35 {50, -292, 1016, -3064, 32010, 3933, -1147, 315, -53}, | 35 {50, -292, 1016, -3064, 32010, 3933, -1147, 315, -53}, |
36 {-156, 974, -3863, 18603, 21691, -6246, 2353, -712, 126} | 36 {-156, 974, -3863, 18603, 21691, -6246, 2353, -712, 126} |
37 }; | 37 }; |
38 | 38 |
39 // Resampling ratio: 2/3 | 39 // Resampling ratio: 2/3 |
40 // input: int32_t (normalized, not saturated) :: size 3 * K | 40 // input: int32_t (normalized, not saturated) :: size 3 * K |
41 // output: int32_t (shifted 15 positions to the left, + offset 16384) :: size 2
* K | 41 // output: int32_t (shifted 15 positions to the left, + offset 16384) :: size 2
* K |
42 // K: number of blocks | 42 // K: number of blocks |
43 | 43 |
44 void WebRtcSpl_Resample48khzTo32khz(const int32_t *In, int32_t *Out, int32_t K) | 44 void WebRtcSpl_Resample48khzTo32khz(const int32_t *In, int32_t *Out, size_t K) |
45 { | 45 { |
46 ///////////////////////////////////////////////////////////// | 46 ///////////////////////////////////////////////////////////// |
47 // Filter operation: | 47 // Filter operation: |
48 // | 48 // |
49 // Perform resampling (3 input samples -> 2 output samples); | 49 // Perform resampling (3 input samples -> 2 output samples); |
50 // process in sub blocks of size 3 samples. | 50 // process in sub blocks of size 3 samples. |
51 int32_t tmp; | 51 int32_t tmp; |
52 int32_t m; | 52 size_t m; |
53 | 53 |
54 for (m = 0; m < K; m++) | 54 for (m = 0; m < K; m++) |
55 { | 55 { |
56 tmp = 1 << 14; | 56 tmp = 1 << 14; |
57 tmp += kCoefficients48To32[0][0] * In[0]; | 57 tmp += kCoefficients48To32[0][0] * In[0]; |
58 tmp += kCoefficients48To32[0][1] * In[1]; | 58 tmp += kCoefficients48To32[0][1] * In[1]; |
59 tmp += kCoefficients48To32[0][2] * In[2]; | 59 tmp += kCoefficients48To32[0][2] * In[2]; |
60 tmp += kCoefficients48To32[0][3] * In[3]; | 60 tmp += kCoefficients48To32[0][3] * In[3]; |
61 tmp += kCoefficients48To32[0][4] * In[4]; | 61 tmp += kCoefficients48To32[0][4] * In[4]; |
62 tmp += kCoefficients48To32[0][5] * In[5]; | 62 tmp += kCoefficients48To32[0][5] * In[5]; |
(...skipping 16 matching lines...) Expand all Loading... |
79 In += 3; | 79 In += 3; |
80 Out += 2; | 80 Out += 2; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 // Resampling ratio: 3/4 | 84 // Resampling ratio: 3/4 |
85 // input: int32_t (normalized, not saturated) :: size 4 * K | 85 // input: int32_t (normalized, not saturated) :: size 4 * K |
86 // output: int32_t (shifted 15 positions to the left, + offset 16384) :: size 3
* K | 86 // output: int32_t (shifted 15 positions to the left, + offset 16384) :: size 3
* K |
87 // K: number of blocks | 87 // K: number of blocks |
88 | 88 |
89 void WebRtcSpl_Resample32khzTo24khz(const int32_t *In, int32_t *Out, int32_t K) | 89 void WebRtcSpl_Resample32khzTo24khz(const int32_t *In, int32_t *Out, size_t K) |
90 { | 90 { |
91 ///////////////////////////////////////////////////////////// | 91 ///////////////////////////////////////////////////////////// |
92 // Filter operation: | 92 // Filter operation: |
93 // | 93 // |
94 // Perform resampling (4 input samples -> 3 output samples); | 94 // Perform resampling (4 input samples -> 3 output samples); |
95 // process in sub blocks of size 4 samples. | 95 // process in sub blocks of size 4 samples. |
96 int32_t m; | 96 size_t m; |
97 int32_t tmp; | 97 int32_t tmp; |
98 | 98 |
99 for (m = 0; m < K; m++) | 99 for (m = 0; m < K; m++) |
100 { | 100 { |
101 tmp = 1 << 14; | 101 tmp = 1 << 14; |
102 tmp += kCoefficients32To24[0][0] * In[0]; | 102 tmp += kCoefficients32To24[0][0] * In[0]; |
103 tmp += kCoefficients32To24[0][1] * In[1]; | 103 tmp += kCoefficients32To24[0][1] * In[1]; |
104 tmp += kCoefficients32To24[0][2] * In[2]; | 104 tmp += kCoefficients32To24[0][2] * In[2]; |
105 tmp += kCoefficients32To24[0][3] * In[3]; | 105 tmp += kCoefficients32To24[0][3] * In[3]; |
106 tmp += kCoefficients32To24[0][4] * In[4]; | 106 tmp += kCoefficients32To24[0][4] * In[4]; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 coef = coef_ptr[8]; | 187 coef = coef_ptr[8]; |
188 *out1 = tmp1 + coef * in1[8]; | 188 *out1 = tmp1 + coef * in1[8]; |
189 *out2 = tmp2 + coef * in2[-8]; | 189 *out2 = tmp2 + coef * in2[-8]; |
190 } | 190 } |
191 | 191 |
192 // Resampling ratio: 8/11 | 192 // Resampling ratio: 8/11 |
193 // input: int32_t (normalized, not saturated) :: size 11 * K | 193 // input: int32_t (normalized, not saturated) :: size 11 * K |
194 // output: int32_t (shifted 15 positions to the left, + offset 16384) :: size 8
* K | 194 // output: int32_t (shifted 15 positions to the left, + offset 16384) :: size 8
* K |
195 // K: number of blocks | 195 // K: number of blocks |
196 | 196 |
197 void WebRtcSpl_Resample44khzTo32khz(const int32_t *In, int32_t *Out, int32_t K) | 197 void WebRtcSpl_Resample44khzTo32khz(const int32_t *In, int32_t *Out, size_t K) |
198 { | 198 { |
199 ///////////////////////////////////////////////////////////// | 199 ///////////////////////////////////////////////////////////// |
200 // Filter operation: | 200 // Filter operation: |
201 // | 201 // |
202 // Perform resampling (11 input samples -> 8 output samples); | 202 // Perform resampling (11 input samples -> 8 output samples); |
203 // process in sub blocks of size 11 samples. | 203 // process in sub blocks of size 11 samples. |
204 int32_t tmp; | 204 int32_t tmp; |
205 int32_t m; | 205 size_t m; |
206 | 206 |
207 for (m = 0; m < K; m++) | 207 for (m = 0; m < K; m++) |
208 { | 208 { |
209 tmp = 1 << 14; | 209 tmp = 1 << 14; |
210 | 210 |
211 // first output sample | 211 // first output sample |
212 Out[0] = ((int32_t)In[3] << 15) + tmp; | 212 Out[0] = ((int32_t)In[3] << 15) + tmp; |
213 | 213 |
214 // sum and accumulate filter coefficients and input samples | 214 // sum and accumulate filter coefficients and input samples |
215 tmp += kCoefficients44To32[3][0] * In[5]; | 215 tmp += kCoefficients44To32[3][0] * In[5]; |
(...skipping 14 matching lines...) Expand all Loading... |
230 WebRtcSpl_ResampDotProduct(&In[2], &In[15], kCoefficients44To32[1], &Out
[2], &Out[6]); | 230 WebRtcSpl_ResampDotProduct(&In[2], &In[15], kCoefficients44To32[1], &Out
[2], &Out[6]); |
231 | 231 |
232 // sum and accumulate filter coefficients and input samples | 232 // sum and accumulate filter coefficients and input samples |
233 WebRtcSpl_ResampDotProduct(&In[3], &In[14], kCoefficients44To32[2], &Out
[3], &Out[5]); | 233 WebRtcSpl_ResampDotProduct(&In[3], &In[14], kCoefficients44To32[2], &Out
[3], &Out[5]); |
234 | 234 |
235 // update pointers | 235 // update pointers |
236 In += 11; | 236 In += 11; |
237 Out += 8; | 237 Out += 8; |
238 } | 238 } |
239 } | 239 } |
OLD | NEW |