provide follow features implementation:
[o-du/phy.git] / fhi_lib / lib / api / xran_compression.h
diff --git a/fhi_lib/lib/api/xran_compression.h b/fhi_lib/lib/api/xran_compression.h
new file mode 100644 (file)
index 0000000..063bc49
--- /dev/null
@@ -0,0 +1,132 @@
+/******************************************************************************\r
+*\r
+*   Copyright (c) 2019 Intel.\r
+*\r
+*   Licensed under the Apache License, Version 2.0 (the "License");\r
+*   you may not use this file except in compliance with the License.\r
+*   You may obtain a copy of the License at\r
+*\r
+*       http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+*   Unless required by applicable law or agreed to in writing, software\r
+*   distributed under the License is distributed on an "AS IS" BASIS,\r
+*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+*   See the License for the specific language governing permissions and\r
+*   limitations under the License.\r
+*\r
+*******************************************************************************/\r
+\r
+/*!\r
+    \file   xran_compression.h\r
+    \brief  External API for compading with the use BFP algorithm.\r
+*/\r
+\r
+#ifndef _XRAN_COMPRESSION_H_\r
+#define _XRAN_COMPRESSION_H_\r
+\r
+#include <stdint.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/*!\r
+    \struct xranlib_compress_request\r
+    \brief Request structure containing pointer to data and its length.\r
+*/\r
+struct xranlib_compress_request {\r
+    int16_t *data_in;   /*!< Pointer to data to compress. */\r
+    int16_t numRBs;     /*!< numRBs  */\r
+    int16_t compMethod; /*!< Compression method */\r
+    int16_t iqWidth;    /*!< Bit size */\r
+    int32_t len;        /*!< Length of input buffer in bytes */\r
+};\r
+\r
+/*!\r
+    \struct xranlib_compress_response\r
+    \brief Response structure containing pointer to data and its length.\r
+*/\r
+struct xranlib_compress_response {\r
+    int8_t *data_out; /*!< Pointer to data after compression. */\r
+\r
+    int32_t len; /*!< Length of output data. */\r
+};\r
+\r
+/*!\r
+    \struct xranlib_decompress_request\r
+    \brief Request structure containing pointer to data and its length.\r
+*/\r
+struct xranlib_decompress_request {\r
+    int8_t *data_in; /*!< Pointer to data to decompress. */\r
+    int16_t numRBs;     /*!< numRBs  */\r
+    int16_t compMethod; /*!< Compression method */\r
+    int16_t iqWidth;    /*!< Bit size */\r
+\r
+    int32_t len; /*!< Length of input data. */\r
+};\r
+\r
+/*!\r
+    \struct xranlib_decompress_response\r
+    \brief Response structure containing pointer to data and its length.\r
+*/\r
+struct xranlib_decompress_response {\r
+    int16_t *data_out; /*!< Pointer to data after decompression. */\r
+\r
+    int32_t len; /*!< Length of output data. */\r
+};\r
+\r
+/*!\r
+    \brief Report the version number for the xranlib_companding library.\r
+    \param [in] version Pointer to a char buffer where the version string should be copied.\r
+    \param [in] buffer_size The length of the string buffer, must be at least\r
+               xranlib_SDK_VERSION_STRING_MAX_LEN characters.\r
+    \return 0 if the version string was populated, otherwise -1.\r
+*/\r
+int16_t\r
+xranlib_companding_version(char *version, int buffer_size);\r
+\r
+//! @{\r
+/*!\r
+    \brief Compress functions - it converts a 16-bit linear PCM value to 8-bt A-law.\r
+    \param [in]  request Structure containing the input data and data length.\r
+    \param [out] response Structure containing the output data and data length.\r
+    \return 0 for success, -1 for error\r
+*/\r
+int\r
+xranlib_compress(const struct xranlib_compress_request *request,\r
+    struct xranlib_compress_response *response);\r
+\r
+int  xranlib_compress_sse(const struct xranlib_compress_request *request,\r
+    struct xranlib_compress_response *response);\r
+int  xranlib_compress_avx2(const struct xranlib_compress_request *request,\r
+    struct xranlib_compress_response *response);\r
+int xranlib_compress_avx512(const struct xranlib_compress_request *request,\r
+    struct xranlib_compress_response *response);\r
+int xranlib_compress_avx512_bfw(const struct xranlib_compress_request *request,\r
+    struct xranlib_compress_response *response);\r
+//! @}\r
+\r
+//! @{\r
+/*!\r
+    \brief Decompress function - it converts an A-law value to 16-bit linear PCM.\r
+    \param [in] request Structure containing the input data and data length.\r
+    \param [out] response Structure containing the output data and data length.\r
+    \return 0 for success, -1 for error.\r
+**/\r
+int\r
+xranlib_decompress(const struct xranlib_decompress_request *request,\r
+    struct xranlib_decompress_response *response);\r
+\r
+int xranlib_decompress_sse(const struct xranlib_decompress_request *request,\r
+    struct xranlib_decompress_response *response);\r
+int xranlib_decompress_avx2(const struct xranlib_decompress_request *request,\r
+    struct xranlib_decompress_response *response);\r
+int xranlib_decompress_avx512(const struct xranlib_decompress_request *request,\r
+    struct xranlib_decompress_response *response);\r
+//! @}\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* _XRAN_COMPRESSION_H_ */\r