1 // Copyright (C) 2022 Beken Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef __G711_H__ 16 #define __G711_H__ 17 #include <stdint.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif//__cplusplus 22 23 /** 24 * @brief AEC API 25 * @defgroup AEC API group 26 * @{ 27 */ 28 29 /** 30 * @brief G711A encodec pcm data to a-law data 31 * 32 * @param pcm_val 16 bit pcm data 33 * 34 * @return 35 * - unsigned char: a-law data after pcm data has been encoded by G711A 36 */ 37 unsigned char linear2alaw(int pcm_val); 38 39 /** 40 * @brief G711A decodec a-law data to pcm data 41 * 42 * @param a_val 8 bit a-law data 43 * 44 * @return 45 * - int: pcm data after a-law data has been decoded by G711A 46 */ 47 int alaw2linear(unsigned char a_val); 48 49 /** 50 * @brief G711U encodec pcm data to u-law data 51 * 52 * @param pcm_val 16 bit pcm data 53 * 54 * @return 55 * - unsigned char: u-law data after pcm data has been encoded by G711U 56 */ 57 unsigned char linear2ulaw(int pcm_val); 58 59 /** 60 * @brief G711U decodec u-law data to pcm data 61 * 62 * @param u_val 8 bit u-law data 63 * 64 * @return 65 * - int: pcm data after u-law data has been decoded by G711U 66 */ 67 int ulaw2linear(unsigned char u_val); 68 69 /** 70 * @} 71 */ 72 73 74 #ifdef __cplusplus 75 } 76 #endif//__cplusplus 77 78 #endif//__AEC_H__ 79 80