Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: webrtc/common_audio/signal_processing/downsample_fast_neon.c

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 #include <arm_neon.h> 13 #include <arm_neon.h>
14 14
15 // NEON intrinsics version of WebRtcSpl_DownsampleFast() 15 // NEON intrinsics version of WebRtcSpl_DownsampleFast()
16 // for ARM 32-bit/64-bit platforms. 16 // for ARM 32-bit/64-bit platforms.
17 int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in, 17 int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
18 int data_in_length, 18 size_t data_in_length,
19 int16_t* data_out, 19 int16_t* data_out,
20 int data_out_length, 20 size_t data_out_length,
21 const int16_t* __restrict coefficients, 21 const int16_t* __restrict coefficients,
22 int coefficients_length, 22 size_t coefficients_length,
23 int factor, 23 int factor,
24 int delay) { 24 size_t delay) {
25 int i = 0; 25 size_t i = 0;
26 int j = 0; 26 size_t j = 0;
27 int32_t out_s32 = 0; 27 int32_t out_s32 = 0;
28 int endpos = delay + factor * (data_out_length - 1) + 1; 28 size_t endpos = delay + factor * (data_out_length - 1) + 1;
29 int res = data_out_length & 0x7; 29 size_t res = data_out_length & 0x7;
30 int endpos1 = endpos - factor * res; 30 size_t endpos1 = endpos - factor * res;
31 31
32 // Return error if any of the running conditions doesn't meet. 32 // Return error if any of the running conditions doesn't meet.
33 if (data_out_length <= 0 || coefficients_length <= 0 33 if (data_out_length == 0 || coefficients_length == 0
34 || data_in_length < endpos) { 34 || data_in_length < endpos) {
35 return -1; 35 return -1;
36 } 36 }
37 37
38 // First part, unroll the loop 8 times, with 3 subcases 38 // First part, unroll the loop 8 times, with 3 subcases
39 // (factor == 2, 4, others). 39 // (factor == 2, 4, others).
40 switch (factor) { 40 switch (factor) {
41 case 2: { 41 case 2: {
42 for (i = delay; i < endpos1; i += 16) { 42 for (i = delay; i < endpos1; i += 16) {
43 // Round value, 0.5 in Q12. 43 // Round value, 0.5 in Q12.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 out_s32 = WebRtc_MulAccumW16(coefficients[j], data_in[i - j], out_s32); 208 out_s32 = WebRtc_MulAccumW16(coefficients[j], data_in[i - j], out_s32);
209 } 209 }
210 210
211 // Saturate and store the output. 211 // Saturate and store the output.
212 out_s32 >>= 12; 212 out_s32 >>= 12;
213 *data_out++ = WebRtcSpl_SatW32ToW16(out_s32); 213 *data_out++ = WebRtcSpl_SatW32ToW16(out_s32);
214 } 214 }
215 215
216 return 0; 216 return 0;
217 } 217 }
OLDNEW
« no previous file with comments | « webrtc/common_audio/signal_processing/downsample_fast_mips.c ('k') | webrtc/common_audio/signal_processing/energy.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698