niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_H_ |
| 12 | #define MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | /* |
| 14 | * Define the fixpoint numeric formats |
| 15 | */ |
| 16 | |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 17 | #include <stddef.h> |
Niels Möller | a12c42a | 2018-07-25 16:05:48 +0200 | [diff] [blame^] | 18 | #include <stdint.h> |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 19 | |
| 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
| 24 | /**************************************************************************** |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 25 | * WebRtcPcm16b_Encode(...) |
| 26 | * |
| 27 | * "Encode" a sample vector to 16 bit linear (Encoded standard is big endian) |
| 28 | * |
| 29 | * Input: |
kwiberg@webrtc.org | 648f5d6 | 2015-02-10 09:18:28 +0000 | [diff] [blame] | 30 | * - speech : Input speech vector |
| 31 | * - len : Number of samples in speech vector |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 32 | * |
| 33 | * Output: |
kwiberg@webrtc.org | 648f5d6 | 2015-02-10 09:18:28 +0000 | [diff] [blame] | 34 | * - encoded : Encoded data vector (big endian 16 bit) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | * |
jmarusic@webrtc.org | 2acec4c | 2015-02-23 15:27:52 +0000 | [diff] [blame] | 36 | * Returned value : Length (in bytes) of coded data. |
| 37 | * Always equal to twice the len input parameter. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 38 | */ |
| 39 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 40 | size_t WebRtcPcm16b_Encode(const int16_t* speech, size_t len, uint8_t* encoded); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 41 | |
| 42 | /**************************************************************************** |
| 43 | * WebRtcPcm16b_Decode(...) |
| 44 | * |
| 45 | * "Decode" a vector to 16 bit linear (Encoded standard is big endian) |
| 46 | * |
| 47 | * Input: |
kwiberg@webrtc.org | 648f5d6 | 2015-02-10 09:18:28 +0000 | [diff] [blame] | 48 | * - encoded : Encoded data vector (big endian 16 bit) |
| 49 | * - len : Number of bytes in encoded |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 50 | * |
| 51 | * Output: |
kwiberg@webrtc.org | 648f5d6 | 2015-02-10 09:18:28 +0000 | [diff] [blame] | 52 | * - speech : Decoded speech vector |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 53 | * |
kwiberg@webrtc.org | 648f5d6 | 2015-02-10 09:18:28 +0000 | [diff] [blame] | 54 | * Returned value : Samples in speech |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 55 | */ |
| 56 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 57 | size_t WebRtcPcm16b_Decode(const uint8_t* encoded, size_t len, int16_t* speech); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | |
| 59 | #ifdef __cplusplus |
| 60 | } |
| 61 | #endif |
| 62 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 63 | #endif /* MODULES_AUDIO_CODING_CODECS_PCM16B_PCM16B_H_ */ |