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