1 /******************************************************************************
3 * Copyright (c) 2020 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 C-callable API for compression/decompression with the use BFP algorithm and Modulation compression
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 numDataElements; /*!< number of elements in block process [UP: 24 i.e 12RE*2; CP: 16,32,64,128. i.e AntElm*2] */
41 int16_t compMethod; /*!< Compression method */
42 int16_t iqWidth; /*!< Bit size */
43 int16_t reMask; /*!< 12-bit RE mask representing 12REs in one RB */
44 int16_t csf; /*!< 1-bit constellation shift flag defined in section 5.4.7.4 */
45 uint16_t ScaleFactor; /*!< Scale factor as defined in section A.5*/
46 int32_t len; /*!< Length of input buffer in bytes */
50 \struct xranlib_compress_response
51 \brief Response structure containing pointer to data and its length.
53 struct xranlib_compress_response {
54 int8_t *data_out; /*!< Pointer to data after compression. */
56 int32_t len; /*!< Length of output data. */
60 \struct xranlib_decompress_request
61 \brief Request structure containing pointer to data and its length.
63 struct xranlib_decompress_request {
64 int8_t *data_in; /*!< Pointer to data to decompress. */
65 int16_t numRBs; /*!< numRBs */
66 int16_t numDataElements; /*!< number of elements in block process [UP: 24 i.e 12RE*2; CP: 16,32,64,128. i.e AntElm*2] */
67 int16_t compMethod; /*!< Compression method */
68 int16_t iqWidth; /*!< Bit size */
69 int16_t reMask; /*!< 12-bit RE mask representing 12REs in one RB */
70 int16_t csf; /*!< 1-bit constellation shift flag defined in section 5.4.7.4 */
71 uint16_t ScaleFactor; /*!< Scale factor as defined in section A.5*/
72 int32_t len; /*!< Length of input data. */
76 \struct xranlib_decompress_response
77 \brief Response structure containing pointer to data and its length.
79 struct xranlib_decompress_response {
80 int16_t *data_out; /*!< Pointer to data after decompression. */
82 int32_t len; /*!< Length of output data. */
86 \brief Report the version number for the xranlib_companding library.
87 \param [in] version Pointer to a char buffer where the version string should be copied.
88 \param [in] buffer_size The length of the string buffer, must be at least
89 xranlib_SDK_VERSION_STRING_MAX_LEN characters.
90 \return 0 if the version string was populated, otherwise -1.
93 xranlib_companding_version(char *version, int buffer_size);
97 \brief Compress functions - it converts a 16-bit linear PCM value to 8-bt A-law.
98 \param [in] request Structure containing the input data and data length.
99 \param [out] response Structure containing the output data and data length.
100 \return 0 for success, -1 for error
103 xranlib_compress(const struct xranlib_compress_request *request,
104 struct xranlib_compress_response *response);
106 xranlib_compress_sse(const struct xranlib_compress_request *request,
107 struct xranlib_compress_response *response);
109 xranlib_compress_avx2(const struct xranlib_compress_request *request,
110 struct xranlib_compress_response *response);
112 xranlib_compress_avx512(const struct xranlib_compress_request *request,
113 struct xranlib_compress_response *response);
115 xranlib_compress_avxsnc(const struct xranlib_compress_request *request,
116 struct xranlib_compress_response *response);
118 xranlib_compress_bfw(const struct xranlib_compress_request *request,
119 struct xranlib_compress_response *response);
121 xranlib_compress_avx512_bfw(const struct xranlib_compress_request *request,
122 struct xranlib_compress_response *response);
124 xranlib_compress_avxsnc_bfw(const struct xranlib_compress_request *request,
125 struct xranlib_compress_response *response);
130 \brief Decompress function - it converts an A-law value to 16-bit linear PCM.
131 \param [in] request Structure containing the input data and data length.
132 \param [out] response Structure containing the output data and data length.
133 \return 0 for success, -1 for error.
136 xranlib_decompress(const struct xranlib_decompress_request *request,
137 struct xranlib_decompress_response *response);
139 xranlib_decompress_sse(const struct xranlib_decompress_request *request,
140 struct xranlib_decompress_response *response);
142 xranlib_decompress_avx2(const struct xranlib_decompress_request *request,
143 struct xranlib_decompress_response *response);
145 xranlib_decompress_avx512(const struct xranlib_decompress_request *request,
146 struct xranlib_decompress_response *response);
148 xranlib_decompress_avxsnc(const struct xranlib_decompress_request *request,
149 struct xranlib_decompress_response *response);
151 xranlib_decompress_bfw(const struct xranlib_decompress_request *request,
152 struct xranlib_decompress_response *response);
154 xranlib_decompress_avx512_bfw(const struct xranlib_decompress_request *request,
155 struct xranlib_decompress_response *response);
157 xranlib_decompress_avxsnc_bfw(const struct xranlib_decompress_request *request,
158 struct xranlib_decompress_response *response);
166 #endif /* _XRAN_COMPRESSION_H_ */