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, | 44 void WebRtcSpl_Resample48khzTo32khz(const int32_t *In, int32_t *Out, int32_t K) |
45 int32_t K) | |
46 { | 45 { |
47 ///////////////////////////////////////////////////////////// | 46 ///////////////////////////////////////////////////////////// |
48 // Filter operation: | 47 // Filter operation: |
49 // | 48 // |
50 // Perform resampling (3 input samples -> 2 output samples); | 49 // Perform resampling (3 input samples -> 2 output samples); |
51 // process in sub blocks of size 3 samples. | 50 // process in sub blocks of size 3 samples. |
52 int32_t tmp; | 51 int32_t tmp; |
53 int32_t m; | 52 int32_t m; |
54 | 53 |
55 for (m = 0; m < K; m++) | 54 for (m = 0; m < K; m++) |
(...skipping 24 matching lines...) Expand all Loading... |
80 In += 3; | 79 In += 3; |
81 Out += 2; | 80 Out += 2; |
82 } | 81 } |
83 } | 82 } |
84 | 83 |
85 // Resampling ratio: 3/4 | 84 // Resampling ratio: 3/4 |
86 // input: int32_t (normalized, not saturated) :: size 4 * K | 85 // input: int32_t (normalized, not saturated) :: size 4 * K |
87 // 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 |
88 // K: number of blocks | 87 // K: number of blocks |
89 | 88 |
90 void WebRtcSpl_Resample32khzTo24khz(const int32_t *In, int32_t *Out, | 89 void WebRtcSpl_Resample32khzTo24khz(const int32_t *In, int32_t *Out, int32_t K) |
91 int32_t K) | |
92 { | 90 { |
93 ///////////////////////////////////////////////////////////// | 91 ///////////////////////////////////////////////////////////// |
94 // Filter operation: | 92 // Filter operation: |
95 // | 93 // |
96 // Perform resampling (4 input samples -> 3 output samples); | 94 // Perform resampling (4 input samples -> 3 output samples); |
97 // process in sub blocks of size 4 samples. | 95 // process in sub blocks of size 4 samples. |
98 int32_t m; | 96 int32_t m; |
99 int32_t tmp; | 97 int32_t tmp; |
100 | 98 |
101 for (m = 0; m < K; m++) | 99 for (m = 0; m < K; m++) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 coef = coef_ptr[8]; | 187 coef = coef_ptr[8]; |
190 *out1 = tmp1 + coef * in1[8]; | 188 *out1 = tmp1 + coef * in1[8]; |
191 *out2 = tmp2 + coef * in2[-8]; | 189 *out2 = tmp2 + coef * in2[-8]; |
192 } | 190 } |
193 | 191 |
194 // Resampling ratio: 8/11 | 192 // Resampling ratio: 8/11 |
195 // input: int32_t (normalized, not saturated) :: size 11 * K | 193 // input: int32_t (normalized, not saturated) :: size 11 * K |
196 // 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 |
197 // K: number of blocks | 195 // K: number of blocks |
198 | 196 |
199 void WebRtcSpl_Resample44khzTo32khz(const int32_t *In, int32_t *Out, | 197 void WebRtcSpl_Resample44khzTo32khz(const int32_t *In, int32_t *Out, int32_t K) |
200 int32_t K) | |
201 { | 198 { |
202 ///////////////////////////////////////////////////////////// | 199 ///////////////////////////////////////////////////////////// |
203 // Filter operation: | 200 // Filter operation: |
204 // | 201 // |
205 // Perform resampling (11 input samples -> 8 output samples); | 202 // Perform resampling (11 input samples -> 8 output samples); |
206 // process in sub blocks of size 11 samples. | 203 // process in sub blocks of size 11 samples. |
207 int32_t tmp; | 204 int32_t tmp; |
208 int32_t m; | 205 int32_t m; |
209 | 206 |
210 for (m = 0; m < K; m++) | 207 for (m = 0; m < K; m++) |
(...skipping 22 matching lines...) Expand all Loading... |
233 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]); |
234 | 231 |
235 // sum and accumulate filter coefficients and input samples | 232 // sum and accumulate filter coefficients and input samples |
236 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]); |
237 | 234 |
238 // update pointers | 235 // update pointers |
239 In += 11; | 236 In += 11; |
240 Out += 8; | 237 Out += 8; |
241 } | 238 } |
242 } | 239 } |
OLD | NEW |