OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 iLBC specific functions | 13 * This file contains implementations of the iLBC specific functions |
14 * WebRtcSpl_ReverseOrderMultArrayElements() | 14 * WebRtcSpl_ReverseOrderMultArrayElements() |
15 * WebRtcSpl_ElementwiseVectorMult() | 15 * WebRtcSpl_ElementwiseVectorMult() |
16 * WebRtcSpl_AddVectorsAndShift() | 16 * WebRtcSpl_AddVectorsAndShift() |
17 * WebRtcSpl_AddAffineVectorToVector() | 17 * WebRtcSpl_AddAffineVectorToVector() |
18 * WebRtcSpl_AffineTransformVector() | 18 * WebRtcSpl_AffineTransformVector() |
19 * | 19 * |
20 */ | 20 */ |
21 | 21 |
22 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 22 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
23 | 23 |
24 void WebRtcSpl_ReverseOrderMultArrayElements(int16_t *out, const int16_t *in, | 24 void WebRtcSpl_ReverseOrderMultArrayElements(int16_t *out, const int16_t *in, |
25 const int16_t *win, | 25 const int16_t *win, |
26 int16_t vector_length, | 26 size_t vector_length, |
27 int16_t right_shifts) | 27 int16_t right_shifts) |
28 { | 28 { |
29 int i; | 29 size_t i; |
30 int16_t *outptr = out; | 30 int16_t *outptr = out; |
31 const int16_t *inptr = in; | 31 const int16_t *inptr = in; |
32 const int16_t *winptr = win; | 32 const int16_t *winptr = win; |
33 for (i = 0; i < vector_length; i++) | 33 for (i = 0; i < vector_length; i++) |
34 { | 34 { |
35 *outptr++ = (int16_t)((*inptr++ * *winptr--) >> right_shifts); | 35 *outptr++ = (int16_t)((*inptr++ * *winptr--) >> right_shifts); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 void WebRtcSpl_ElementwiseVectorMult(int16_t *out, const int16_t *in, | 39 void WebRtcSpl_ElementwiseVectorMult(int16_t *out, const int16_t *in, |
40 const int16_t *win, int16_t vector_length, | 40 const int16_t *win, size_t vector_length, |
41 int16_t right_shifts) | 41 int16_t right_shifts) |
42 { | 42 { |
43 int i; | 43 size_t i; |
44 int16_t *outptr = out; | 44 int16_t *outptr = out; |
45 const int16_t *inptr = in; | 45 const int16_t *inptr = in; |
46 const int16_t *winptr = win; | 46 const int16_t *winptr = win; |
47 for (i = 0; i < vector_length; i++) | 47 for (i = 0; i < vector_length; i++) |
48 { | 48 { |
49 *outptr++ = (int16_t)((*inptr++ * *winptr++) >> right_shifts); | 49 *outptr++ = (int16_t)((*inptr++ * *winptr++) >> right_shifts); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 void WebRtcSpl_AddVectorsAndShift(int16_t *out, const int16_t *in1, | 53 void WebRtcSpl_AddVectorsAndShift(int16_t *out, const int16_t *in1, |
54 const int16_t *in2, int16_t vector_length, | 54 const int16_t *in2, size_t vector_length, |
55 int16_t right_shifts) | 55 int16_t right_shifts) |
56 { | 56 { |
57 int i; | 57 size_t i; |
58 int16_t *outptr = out; | 58 int16_t *outptr = out; |
59 const int16_t *in1ptr = in1; | 59 const int16_t *in1ptr = in1; |
60 const int16_t *in2ptr = in2; | 60 const int16_t *in2ptr = in2; |
61 for (i = vector_length; i > 0; i--) | 61 for (i = vector_length; i > 0; i--) |
62 { | 62 { |
63 (*outptr++) = (int16_t)(((*in1ptr++) + (*in2ptr++)) >> right_shifts); | 63 (*outptr++) = (int16_t)(((*in1ptr++) + (*in2ptr++)) >> right_shifts); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void WebRtcSpl_AddAffineVectorToVector(int16_t *out, int16_t *in, | 67 void WebRtcSpl_AddAffineVectorToVector(int16_t *out, int16_t *in, |
68 int16_t gain, int32_t add_constant, | 68 int16_t gain, int32_t add_constant, |
69 int16_t right_shifts, int vector_length) | 69 int16_t right_shifts, |
| 70 size_t vector_length) |
70 { | 71 { |
71 int i; | 72 size_t i; |
72 | 73 |
73 for (i = 0; i < vector_length; i++) | 74 for (i = 0; i < vector_length; i++) |
74 { | 75 { |
75 out[i] += (int16_t)((in[i] * gain + add_constant) >> right_shifts); | 76 out[i] += (int16_t)((in[i] * gain + add_constant) >> right_shifts); |
76 } | 77 } |
77 } | 78 } |
78 | 79 |
79 void WebRtcSpl_AffineTransformVector(int16_t *out, int16_t *in, | 80 void WebRtcSpl_AffineTransformVector(int16_t *out, int16_t *in, |
80 int16_t gain, int32_t add_constant, | 81 int16_t gain, int32_t add_constant, |
81 int16_t right_shifts, int vector_length) | 82 int16_t right_shifts, size_t vector_length) |
82 { | 83 { |
83 int i; | 84 size_t i; |
84 | 85 |
85 for (i = 0; i < vector_length; i++) | 86 for (i = 0; i < vector_length; i++) |
86 { | 87 { |
87 out[i] = (int16_t)((in[i] * gain + add_constant) >> right_shifts); | 88 out[i] = (int16_t)((in[i] * gain + add_constant) >> right_shifts); |
88 } | 89 } |
89 } | 90 } |
OLD | NEW |