1 /******************************************************************************
3 * Copyright (c) 2019 Intel.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 *******************************************************************************/
20 \file xran_compression.h
21 \brief External API for compading with the use BFP algorithm.
24 #ifndef _XRAN_COMPRESSION_H_
25 #define _XRAN_COMPRESSION_H_
34 \struct xranlib_compress_request
35 \brief Request structure containing pointer to data and its length.
37 struct xranlib_compress_request {
38 int16_t *data_in; /*!< Pointer to data to compress. */
39 int16_t numRBs; /*!< numRBs */
40 int16_t compMethod; /*!< Compression method */
41 int16_t iqWidth; /*!< Bit size */
42 int32_t len; /*!< Length of input buffer in bytes */
46 \struct xranlib_compress_response
47 \brief Response structure containing pointer to data and its length.
49 struct xranlib_compress_response {
50 int8_t *data_out; /*!< Pointer to data after compression. */
52 int32_t len; /*!< Length of output data. */
56 \struct xranlib_decompress_request
57 \brief Request structure containing pointer to data and its length.
59 struct xranlib_decompress_request {
60 int8_t *data_in; /*!< Pointer to data to decompress. */
61 int16_t numRBs; /*!< numRBs */
62 int16_t compMethod; /*!< Compression method */
63 int16_t iqWidth; /*!< Bit size */
65 int32_t len; /*!< Length of input data. */
69 \struct xranlib_decompress_response
70 \brief Response structure containing pointer to data and its length.
72 struct xranlib_decompress_response {
73 int16_t *data_out; /*!< Pointer to data after decompression. */
75 int32_t len; /*!< Length of output data. */
79 \brief Report the version number for the xranlib_companding library.
80 \param [in] version Pointer to a char buffer where the version string should be copied.
81 \param [in] buffer_size The length of the string buffer, must be at least
82 xranlib_SDK_VERSION_STRING_MAX_LEN characters.
83 \return 0 if the version string was populated, otherwise -1.
86 xranlib_companding_version(char *version, int buffer_size);
90 \brief Compress functions - it converts a 16-bit linear PCM value to 8-bt A-law.
91 \param [in] request Structure containing the input data and data length.
92 \param [out] response Structure containing the output data and data length.
93 \return 0 for success, -1 for error
96 xranlib_compress(const struct xranlib_compress_request *request,
97 struct xranlib_compress_response *response);
99 int xranlib_compress_sse(const struct xranlib_compress_request *request,
100 struct xranlib_compress_response *response);
101 int xranlib_compress_avx2(const struct xranlib_compress_request *request,
102 struct xranlib_compress_response *response);
103 int xranlib_compress_avx512(const struct xranlib_compress_request *request,
104 struct xranlib_compress_response *response);
105 int xranlib_compress_avx512_bfw(const struct xranlib_compress_request *request,
106 struct xranlib_compress_response *response);
111 \brief Decompress function - it converts an A-law value to 16-bit linear PCM.
112 \param [in] request Structure containing the input data and data length.
113 \param [out] response Structure containing the output data and data length.
114 \return 0 for success, -1 for error.
117 xranlib_decompress(const struct xranlib_decompress_request *request,
118 struct xranlib_decompress_response *response);
120 int xranlib_decompress_sse(const struct xranlib_decompress_request *request,
121 struct xranlib_decompress_response *response);
122 int xranlib_decompress_avx2(const struct xranlib_decompress_request *request,
123 struct xranlib_decompress_response *response);
124 int xranlib_decompress_avx512(const struct xranlib_decompress_request *request,
125 struct xranlib_decompress_response *response);
132 #endif /* _XRAN_COMPRESSION_H_ */