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 #include <string.h> | 10 #include <string.h> |
11 #include "g711.h" | 11 #include "g711.h" |
12 #include "g711_interface.h" | 12 #include "g711_interface.h" |
13 #include "webrtc/typedefs.h" | 13 #include "webrtc/typedefs.h" |
14 | 14 |
15 int16_t WebRtcG711_EncodeA(const int16_t* speechIn, | 15 size_t WebRtcG711_EncodeA(const int16_t* speechIn, |
16 int16_t len, | 16 size_t len, |
17 uint8_t* encoded) { | 17 uint8_t* encoded) { |
18 int n; | 18 size_t n; |
19 for (n = 0; n < len; n++) | 19 for (n = 0; n < len; n++) |
20 encoded[n] = linear_to_alaw(speechIn[n]); | 20 encoded[n] = linear_to_alaw(speechIn[n]); |
21 return len; | 21 return len; |
22 } | 22 } |
23 | 23 |
24 int16_t WebRtcG711_EncodeU(const int16_t* speechIn, | 24 size_t WebRtcG711_EncodeU(const int16_t* speechIn, |
25 int16_t len, | 25 size_t len, |
26 uint8_t* encoded) { | 26 uint8_t* encoded) { |
27 int n; | 27 size_t n; |
28 for (n = 0; n < len; n++) | 28 for (n = 0; n < len; n++) |
29 encoded[n] = linear_to_ulaw(speechIn[n]); | 29 encoded[n] = linear_to_ulaw(speechIn[n]); |
30 return len; | 30 return len; |
31 } | 31 } |
32 | 32 |
33 int16_t WebRtcG711_DecodeA(const uint8_t* encoded, | 33 size_t WebRtcG711_DecodeA(const uint8_t* encoded, |
34 int16_t len, | 34 size_t len, |
35 int16_t* decoded, | 35 int16_t* decoded, |
36 int16_t* speechType) { | 36 int16_t* speechType) { |
37 int n; | 37 size_t n; |
38 for (n = 0; n < len; n++) | 38 for (n = 0; n < len; n++) |
39 decoded[n] = alaw_to_linear(encoded[n]); | 39 decoded[n] = alaw_to_linear(encoded[n]); |
40 *speechType = 1; | 40 *speechType = 1; |
41 return len; | 41 return len; |
42 } | 42 } |
43 | 43 |
44 int16_t WebRtcG711_DecodeU(const uint8_t* encoded, | 44 size_t WebRtcG711_DecodeU(const uint8_t* encoded, |
45 int16_t len, | 45 size_t len, |
46 int16_t* decoded, | 46 int16_t* decoded, |
47 int16_t* speechType) { | 47 int16_t* speechType) { |
48 int n; | 48 size_t n; |
49 for (n = 0; n < len; n++) | 49 for (n = 0; n < len; n++) |
50 decoded[n] = ulaw_to_linear(encoded[n]); | 50 decoded[n] = ulaw_to_linear(encoded[n]); |
51 *speechType = 1; | 51 *speechType = 1; |
52 return len; | 52 return len; |
53 } | 53 } |
54 | 54 |
55 int16_t WebRtcG711_Version(char* version, int16_t lenBytes) { | 55 int16_t WebRtcG711_Version(char* version, int16_t lenBytes) { |
56 strncpy(version, "2.0.0", lenBytes); | 56 strncpy(version, "2.0.0", lenBytes); |
57 return 0; | 57 return 0; |
58 } | 58 } |
OLD | NEW |