blob: f96e741c461b93409036944de8ae31cb76cbe9e4 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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
kjellander@webrtc.org3c652b62015-11-18 23:07:57 +010011#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_H_
12#define WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013/*
14 * Define the fixpoint numeric formats
15 */
16
Peter Kastingdce40cf2015-08-24 14:52:23 -070017#include <stddef.h>
18
andresp@webrtc.org262e6762014-09-04 13:28:48 +000019#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000020
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/****************************************************************************
niklase@google.com470e71d2011-07-07 08:21:25 +000026 * WebRtcPcm16b_Encode(...)
27 *
28 * "Encode" a sample vector to 16 bit linear (Encoded standard is big endian)
29 *
30 * Input:
kwiberg@webrtc.org648f5d62015-02-10 09:18:28 +000031 * - speech : Input speech vector
32 * - len : Number of samples in speech vector
niklase@google.com470e71d2011-07-07 08:21:25 +000033 *
34 * Output:
kwiberg@webrtc.org648f5d62015-02-10 09:18:28 +000035 * - encoded : Encoded data vector (big endian 16 bit)
niklase@google.com470e71d2011-07-07 08:21:25 +000036 *
jmarusic@webrtc.org2acec4c2015-02-23 15:27:52 +000037 * Returned value : Length (in bytes) of coded data.
38 * Always equal to twice the len input parameter.
niklase@google.com470e71d2011-07-07 08:21:25 +000039 */
40
Peter Kastingdce40cf2015-08-24 14:52:23 -070041size_t WebRtcPcm16b_Encode(const int16_t* speech,
42 size_t len,
43 uint8_t* encoded);
niklase@google.com470e71d2011-07-07 08:21:25 +000044
45/****************************************************************************
46 * WebRtcPcm16b_Decode(...)
47 *
48 * "Decode" a vector to 16 bit linear (Encoded standard is big endian)
49 *
50 * Input:
kwiberg@webrtc.org648f5d62015-02-10 09:18:28 +000051 * - encoded : Encoded data vector (big endian 16 bit)
52 * - len : Number of bytes in encoded
niklase@google.com470e71d2011-07-07 08:21:25 +000053 *
54 * Output:
kwiberg@webrtc.org648f5d62015-02-10 09:18:28 +000055 * - speech : Decoded speech vector
niklase@google.com470e71d2011-07-07 08:21:25 +000056 *
kwiberg@webrtc.org648f5d62015-02-10 09:18:28 +000057 * Returned value : Samples in speech
niklase@google.com470e71d2011-07-07 08:21:25 +000058 */
59
Peter Kastingdce40cf2015-08-24 14:52:23 -070060size_t WebRtcPcm16b_Decode(const uint8_t* encoded,
61 size_t len,
62 int16_t* speech);
niklase@google.com470e71d2011-07-07 08:21:25 +000063
64#ifdef __cplusplus
65}
66#endif
67
kjellander@webrtc.org3c652b62015-11-18 23:07:57 +010068#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_H_ */