Line data Source code
1 : /*
2 : * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 : *
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
6 : * tree. An additional intellectual property rights grant can be found
7 : * in the file PATENTS. All contributing project authors may
8 : * be found in the AUTHORS file in the root of the source tree.
9 : */
10 : #include <string.h>
11 : #include "g711.h"
12 : #include "g711_interface.h"
13 : #include "webrtc/typedefs.h"
14 :
15 0 : size_t WebRtcG711_EncodeA(const int16_t* speechIn,
16 : size_t len,
17 : uint8_t* encoded) {
18 : size_t n;
19 0 : for (n = 0; n < len; n++)
20 0 : encoded[n] = linear_to_alaw(speechIn[n]);
21 0 : return len;
22 : }
23 :
24 0 : size_t WebRtcG711_EncodeU(const int16_t* speechIn,
25 : size_t len,
26 : uint8_t* encoded) {
27 : size_t n;
28 0 : for (n = 0; n < len; n++)
29 0 : encoded[n] = linear_to_ulaw(speechIn[n]);
30 0 : return len;
31 : }
32 :
33 0 : size_t WebRtcG711_DecodeA(const uint8_t* encoded,
34 : size_t len,
35 : int16_t* decoded,
36 : int16_t* speechType) {
37 : size_t n;
38 0 : for (n = 0; n < len; n++)
39 0 : decoded[n] = alaw_to_linear(encoded[n]);
40 0 : *speechType = 1;
41 0 : return len;
42 : }
43 :
44 0 : size_t WebRtcG711_DecodeU(const uint8_t* encoded,
45 : size_t len,
46 : int16_t* decoded,
47 : int16_t* speechType) {
48 : size_t n;
49 0 : for (n = 0; n < len; n++)
50 0 : decoded[n] = ulaw_to_linear(encoded[n]);
51 0 : *speechType = 1;
52 0 : return len;
53 : }
54 :
55 0 : int16_t WebRtcG711_Version(char* version, int16_t lenBytes) {
56 0 : strncpy(version, "2.0.0", lenBytes);
57 0 : return 0;
58 : }
|