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
11#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_MAIN_INTERFACE_PCM16B_H_
12#define WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_MAIN_INTERFACE_PCM16B_H_
13/*
14 * Define the fixpoint numeric formats
15 */
16
17#include "webrtc/typedefs.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/****************************************************************************
24 * WebRtcPcm16b_EncodeW16(...)
25 *
26 * "Encode" a sample vector to 16 bit linear (Encoded standard is big endian)
27 *
28 * Input:
29 *    - speechIn16b    : Input speech vector
30 *    - length_samples : Number of samples in speech vector
31 *
32 * Output:
33 *    - speechOut16b   : Encoded data vector (big endian 16 bit)
34 *
35 * Returned value      : Size in bytes of speechOut16b
36 */
37
38int16_t WebRtcPcm16b_EncodeW16(const int16_t* speechIn16b,
39                               int16_t length_samples,
40                               int16_t* speechOut16b);
41
42/****************************************************************************
43 * WebRtcPcm16b_Encode(...)
44 *
45 * "Encode" a sample vector to 16 bit linear (Encoded standard is big endian)
46 *
47 * Input:
48 *		- speech16b		: Input speech vector
49 *		- len			: Number of samples in speech vector
50 *
51 * Output:
52 *		- speech8b		: Encoded data vector (big endian 16 bit)
53 *
54 * Returned value		: Size in bytes of speech8b
55 */
56
57int16_t WebRtcPcm16b_Encode(int16_t *speech16b,
58                            int16_t len,
59                            unsigned char *speech8b);
60
61/****************************************************************************
62 * WebRtcPcm16b_DecodeW16(...)
63 *
64 * "Decode" a vector to 16 bit linear (Encoded standard is big endian)
65 *
66 * Input:
67 *    - speechIn16b  : Encoded data vector (big endian 16 bit)
68 *    - length_bytes : Number of bytes in speechIn16b
69 *
70 * Output:
71 *    - speechOut16b : Decoded speech vector
72 *
73 * Returned value    : Samples in speechOut16b
74 */
75
76int16_t WebRtcPcm16b_DecodeW16(void *inst,
77                               int16_t *speechIn16b,
78                               int16_t length_bytes,
79                               int16_t *speechOut16b,
80                               int16_t* speechType);
81
82/****************************************************************************
83 * WebRtcPcm16b_Decode(...)
84 *
85 * "Decode" a vector to 16 bit linear (Encoded standard is big endian)
86 *
87 * Input:
88 *		- speech8b		: Encoded data vector (big endian 16 bit)
89 *		- len			: Number of bytes in speech8b
90 *
91 * Output:
92 *		- speech16b		: Decoded speech vector
93 *
94 * Returned value		: Samples in speech16b
95 */
96
97
98int16_t WebRtcPcm16b_Decode(unsigned char *speech8b,
99                            int16_t len,
100                            int16_t *speech16b);
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif /* PCM16B */
107