OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 11 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
12 | 12 |
13 // Version of WebRtcSpl_DownsampleFast() for MIPS platforms. | 13 // Version of WebRtcSpl_DownsampleFast() for MIPS platforms. |
14 int WebRtcSpl_DownsampleFast_mips(const int16_t* data_in, | 14 int WebRtcSpl_DownsampleFast_mips(const int16_t* data_in, |
15 int data_in_length, | 15 size_t data_in_length, |
16 int16_t* data_out, | 16 int16_t* data_out, |
17 int data_out_length, | 17 size_t data_out_length, |
18 const int16_t* __restrict coefficients, | 18 const int16_t* __restrict coefficients, |
19 int coefficients_length, | 19 size_t coefficients_length, |
20 int factor, | 20 int factor, |
21 int delay) { | 21 size_t delay) { |
22 int i; | 22 int i; |
23 int j; | 23 int j; |
24 int k; | 24 int k; |
25 int32_t out_s32 = 0; | 25 int32_t out_s32 = 0; |
26 int endpos = delay + factor * (data_out_length - 1) + 1; | 26 size_t endpos = delay + factor * (data_out_length - 1) + 1; |
27 | 27 |
28 int32_t tmp1, tmp2, tmp3, tmp4, factor_2; | 28 int32_t tmp1, tmp2, tmp3, tmp4, factor_2; |
29 int16_t* p_coefficients; | 29 int16_t* p_coefficients; |
30 int16_t* p_data_in; | 30 int16_t* p_data_in; |
31 int16_t* p_data_in_0 = (int16_t*)&data_in[delay]; | 31 int16_t* p_data_in_0 = (int16_t*)&data_in[delay]; |
32 int16_t* p_coefficients_0 = (int16_t*)&coefficients[0]; | 32 int16_t* p_coefficients_0 = (int16_t*)&coefficients[0]; |
33 #if !defined(MIPS_DSP_R1_LE) | 33 #if !defined(MIPS_DSP_R1_LE) |
34 int32_t max_16 = 0x7FFF; | 34 int32_t max_16 = 0x7FFF; |
35 int32_t min_16 = 0xFFFF8000; | 35 int32_t min_16 = 0xFFFF8000; |
36 #endif // #if !defined(MIPS_DSP_R1_LE) | 36 #endif // #if !defined(MIPS_DSP_R1_LE) |
37 | 37 |
38 // Return error if any of the running conditions doesn't meet. | 38 // Return error if any of the running conditions doesn't meet. |
39 if (data_out_length <= 0 || coefficients_length <= 0 | 39 if (data_out_length == 0 || coefficients_length == 0 |
40 || data_in_length < endpos) { | 40 || data_in_length < endpos) { |
41 return -1; | 41 return -1; |
42 } | 42 } |
43 #if defined(MIPS_DSP_R2_LE) | 43 #if defined(MIPS_DSP_R2_LE) |
44 __asm __volatile ( | 44 __asm __volatile ( |
45 ".set push \n\t" | 45 ".set push \n\t" |
46 ".set noreorder \n\t" | 46 ".set noreorder \n\t" |
47 "subu %[i], %[endpos], %[delay] \n\t" | 47 "subu %[i], %[endpos], %[delay] \n\t" |
48 "sll %[factor_2], %[factor], 1 \n\t" | 48 "sll %[factor_2], %[factor], 1 \n\t" |
49 "1: \n\t" | 49 "1: \n\t" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 [p_coefs_0] "r" (p_coefficients_0), [endpos] "r" (endpos), | 160 [p_coefs_0] "r" (p_coefficients_0), [endpos] "r" (endpos), |
161 #if !defined(MIPS_DSP_R1_LE) | 161 #if !defined(MIPS_DSP_R1_LE) |
162 [max_16] "r" (max_16), [min_16] "r" (min_16), | 162 [max_16] "r" (max_16), [min_16] "r" (min_16), |
163 #endif // #if !defined(MIPS_DSP_R1_LE) | 163 #endif // #if !defined(MIPS_DSP_R1_LE) |
164 [delay] "r" (delay), [factor] "r" (factor) | 164 [delay] "r" (delay), [factor] "r" (factor) |
165 : "memory", "hi", "lo" | 165 : "memory", "hi", "lo" |
166 ); | 166 ); |
167 #endif // #if defined(MIPS_DSP_R2_LE) | 167 #endif // #if defined(MIPS_DSP_R2_LE) |
168 return 0; | 168 return 0; |
169 } | 169 } |
OLD | NEW |