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 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 int32_t len; /*!< Length of input buffer in bytes */
47 \struct xranlib_compress_response
48 \brief Response structure containing pointer to data and its length.
50 struct xranlib_compress_response {
51 int8_t *data_out; /*!< Pointer to data after compression. */
53 int32_t len; /*!< Length of output data. */
57 \struct xranlib_decompress_request
58 \brief Request structure containing pointer to data and its length.
60 struct xranlib_decompress_request {
61 int8_t *data_in; /*!< Pointer to data to decompress. */
62 int16_t numRBs; /*!< numRBs */
63 int16_t numDataElements; /*!< number of elements in block process [UP: 24 i.e 12RE*2; CP: 16,32,64,128. i.e AntElm*2] */
64 int16_t compMethod; /*!< Compression method */
65 int16_t iqWidth; /*!< Bit size */
67 int32_t len; /*!< Length of input data. */
71 \struct xranlib_decompress_response
72 \brief Response structure containing pointer to data and its length.
74 struct xranlib_decompress_response {
75 int16_t *data_out; /*!< Pointer to data after decompression. */
77 int32_t len; /*!< Length of output data. */
81 \brief Report the version number for the xranlib_companding library.
82 \param [in] version Pointer to a char buffer where the version string should be copied.
83 \param [in] buffer_size The length of the string buffer, must be at least
84 xranlib_SDK_VERSION_STRING_MAX_LEN characters.
85 \return 0 if the version string was populated, otherwise -1.
88 xranlib_companding_version(char *version, int buffer_size);
92 \brief Compress functions - it converts a 16-bit linear PCM value to 8-bt A-law.
93 \param [in] request Structure containing the input data and data length.
94 \param [out] response Structure containing the output data and data length.
95 \return 0 for success, -1 for error
98 xranlib_compress(const struct xranlib_compress_request *request,
99 struct xranlib_compress_response *response);
101 xranlib_compress_sse(const struct xranlib_compress_request *request,
102 struct xranlib_compress_response *response);
104 xranlib_compress_avx2(const struct xranlib_compress_request *request,
105 struct xranlib_compress_response *response);
107 xranlib_compress_avx512(const struct xranlib_compress_request *request,
108 struct xranlib_compress_response *response);
110 xranlib_compress_avx512_bfw(const struct xranlib_compress_request *request,
111 struct xranlib_compress_response *response);
116 \brief Decompress function - it converts an A-law value to 16-bit linear PCM.
117 \param [in] request Structure containing the input data and data length.
118 \param [out] response Structure containing the output data and data length.
119 \return 0 for success, -1 for error.
122 xranlib_decompress(const struct xranlib_decompress_request *request,
123 struct xranlib_decompress_response *response);
126 xranlib_decompress_sse(const struct xranlib_decompress_request *request,
127 struct xranlib_decompress_response *response);
129 xranlib_decompress_avx2(const struct xranlib_decompress_request *request,
130 struct xranlib_decompress_response *response);
132 xranlib_decompress_avx512(const struct xranlib_decompress_request *request,
133 struct xranlib_decompress_response *response);
135 xranlib_decompress_avx512_bfw(const struct xranlib_decompress_request *request,
136 struct xranlib_decompress_response *response);
144 #endif /* _XRAN_COMPRESSION_H_ */