blob: 9a3bfe90fa57f2745d96f607ab41304382e383a3 [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_H_
12#define 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
Mirko Bonadei71207422017-09-15 13:58:09 +020019#include "typedefs.h" // NOLINT(build/include)
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
Yves Gerey665174f2018-06-19 15:03:05 +020041size_t WebRtcPcm16b_Encode(const int16_t* speech, size_t len, uint8_t* encoded);
niklase@google.com470e71d2011-07-07 08:21:25 +000042
43/****************************************************************************
44 * WebRtcPcm16b_Decode(...)
45 *
46 * "Decode" a vector to 16 bit linear (Encoded standard is big endian)
47 *
48 * Input:
kwiberg@webrtc.org648f5d62015-02-10 09:18:28 +000049 * - encoded : Encoded data vector (big endian 16 bit)
50 * - len : Number of bytes in encoded
niklase@google.com470e71d2011-07-07 08:21:25 +000051 *
52 * Output:
kwiberg@webrtc.org648f5d62015-02-10 09:18:28 +000053 * - speech : Decoded speech vector
niklase@google.com470e71d2011-07-07 08:21:25 +000054 *
kwiberg@webrtc.org648f5d62015-02-10 09:18:28 +000055 * Returned value : Samples in speech
niklase@google.com470e71d2011-07-07 08:21:25 +000056 */
57
Yves Gerey665174f2018-06-19 15:03:05 +020058size_t WebRtcPcm16b_Decode(const uint8_t* encoded, size_t len, int16_t* speech);
niklase@google.com470e71d2011-07-07 08:21:25 +000059
60#ifdef __cplusplus
61}
62#endif
63
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020064#endif /* MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_H_ */