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

Side by Side Diff: webrtc/common_audio/signal_processing/vector_scaling_operations_mips.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) 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 11
12 /* 12 /*
13 * This file contains implementations of the functions 13 * This file contains implementations of the functions
14 * WebRtcSpl_ScaleAndAddVectorsWithRound_mips() 14 * WebRtcSpl_ScaleAndAddVectorsWithRound_mips()
15 */ 15 */
16 16
17 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" 17 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h"
18 18
19 int WebRtcSpl_ScaleAndAddVectorsWithRound_mips(const int16_t* in_vector1, 19 int WebRtcSpl_ScaleAndAddVectorsWithRound_mips(const int16_t* in_vector1,
20 int16_t in_vector1_scale, 20 int16_t in_vector1_scale,
21 const int16_t* in_vector2, 21 const int16_t* in_vector2,
22 int16_t in_vector2_scale, 22 int16_t in_vector2_scale,
23 int right_shifts, 23 int right_shifts,
24 int16_t* out_vector, 24 int16_t* out_vector,
25 int length) { 25 size_t length) {
26 int16_t r0 = 0, r1 = 0; 26 int16_t r0 = 0, r1 = 0;
27 int16_t *in1 = (int16_t*)in_vector1; 27 int16_t *in1 = (int16_t*)in_vector1;
28 int16_t *in2 = (int16_t*)in_vector2; 28 int16_t *in2 = (int16_t*)in_vector2;
29 int16_t *out = out_vector; 29 int16_t *out = out_vector;
30 int i = 0, value32 = 0; 30 size_t i = 0;
31 int value32 = 0;
31 32
32 if (in_vector1 == NULL || in_vector2 == NULL || out_vector == NULL || 33 if (in_vector1 == NULL || in_vector2 == NULL || out_vector == NULL ||
33 length <= 0 || right_shifts < 0) { 34 length == 0 || right_shifts < 0) {
34 return -1; 35 return -1;
35 } 36 }
36 for (i = 0; i < length; i++) { 37 for (i = 0; i < length; i++) {
37 __asm __volatile ( 38 __asm __volatile (
38 "lh %[r0], 0(%[in1]) \n\t" 39 "lh %[r0], 0(%[in1]) \n\t"
39 "lh %[r1], 0(%[in2]) \n\t" 40 "lh %[r1], 0(%[in2]) \n\t"
40 "mult %[r0], %[in_vector1_scale] \n\t" 41 "mult %[r0], %[in_vector1_scale] \n\t"
41 "madd %[r1], %[in_vector2_scale] \n\t" 42 "madd %[r1], %[in_vector2_scale] \n\t"
42 "extrv_r.w %[value32], $ac0, %[right_shifts] \n\t" 43 "extrv_r.w %[value32], $ac0, %[right_shifts] \n\t"
43 "addiu %[in1], %[in1], 2 \n\t" 44 "addiu %[in1], %[in1], 2 \n\t"
44 "addiu %[in2], %[in2], 2 \n\t" 45 "addiu %[in2], %[in2], 2 \n\t"
45 "sh %[value32], 0(%[out]) \n\t" 46 "sh %[value32], 0(%[out]) \n\t"
46 "addiu %[out], %[out], 2 \n\t" 47 "addiu %[out], %[out], 2 \n\t"
47 : [value32] "=&r" (value32), [out] "+r" (out), [in1] "+r" (in1), 48 : [value32] "=&r" (value32), [out] "+r" (out), [in1] "+r" (in1),
48 [in2] "+r" (in2), [r0] "=&r" (r0), [r1] "=&r" (r1) 49 [in2] "+r" (in2), [r0] "=&r" (r0), [r1] "=&r" (r1)
49 : [in_vector1_scale] "r" (in_vector1_scale), 50 : [in_vector1_scale] "r" (in_vector1_scale),
50 [in_vector2_scale] "r" (in_vector2_scale), 51 [in_vector2_scale] "r" (in_vector2_scale),
51 [right_shifts] "r" (right_shifts) 52 [right_shifts] "r" (right_shifts)
52 : "hi", "lo", "memory" 53 : "hi", "lo", "memory"
53 ); 54 );
54 } 55 }
55 return 0; 56 return 0;
56 } 57 }
OLDNEW
« no previous file with comments | « webrtc/common_audio/signal_processing/vector_scaling_operations.c ('k') | webrtc/common_audio/sparse_fir_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698