O-RAN E Maintenance Release contribution for ODULOW
[o-du/phy.git] / fhi_lib / lib / src / xran_mod_compression.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2020 Intel.
4 *
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
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 *
17 *******************************************************************************/
18 #include <inttypes.h>
19 #include <stdio.h>
20
21
22 /*!
23     \struct bblib_llr_demapping_5gnr_mod_compression_request
24     \brief Structure defining modulation compression lib.
25 */
26
27 enum xran_modulation_order {
28     XRAN_BPSK   = 1, /*!< BPSK */
29     XRAN_QPSK   = 2, /*!< QPSK */
30     XRAN_PAM4   = 3, /*!< PAM4 */
31     XRAN_QAM16  = 4, /*!< QAM16 */
32     XRAN_PAM8   = 5, /*!< PAM8 */
33     XRAN_QAM64  = 6, /*!< QAM64 */
34     XRAN_PAM16  = 7, /*!< PAM16 */
35     XRAN_QAM256 = 8  /*!< QAM256 */
36 };
37
38 struct xranlib_5gnr_mod_compression_request
39 {
40     /*! Pointer to buffer of the input symbols - buffer must be 64 byte aligned. Format 16Sx. */
41     int16_t * data_in;
42     /*! 16bit shift value used to scale the input samples. */
43     int16_t unit;
44     /*! Supported modulation values are: 2 (QPSK), 4 (16QAM), 6 (64QAM), 8 (256QAM). */
45     enum xran_modulation_order modulation;
46     int32_t num_symbols;  /*!< Number of complex input symbols. */
47     int16_t re_mask;  /*!< RE mask in one RB. */
48 };
49
50 /*!
51     \struct bblib_llr_demapping_5gnr_mod_compression_response
52     \brief Structure defining the modualtion compression output.
53  */
54 struct xranlib_5gnr_mod_compression_response
55 {
56     /*! Pointer to output buffer - buffer should be 64 byte aligned.bit sequence*/
57     int8_t * data_out; /*!< Pointer to data after compression. */
58     int32_t len_out;  /*!< Length of output data in bytes. */
59 };
60
61 struct xranlib_5gnr_mod_decompression_request
62 {
63     /*! Pointer to buffer of the input symbols - buffer must be 64 byte aligned. Format 16Sx. */
64     int8_t * data_in;
65     /*! 16bit shift value used to scale the input samples. */
66     int16_t unit;
67     /*! Supported modulation values are: 2 (QPSK), 4 (16QAM), 6 (64QAM), 8 (256QAM). */
68     enum xran_modulation_order modulation;
69     int32_t num_symbols;  /*!< Number of complex input symbols. */
70     int16_t re_mask;  /*!< RE mask in one RB. */
71 };
72
73 /*!
74     \struct bblib_llr_demapping_5gnr_mod_compression_response
75     \brief Structure defining the modualtion compression output.
76  */
77 struct xranlib_5gnr_mod_decompression_response
78 {
79     /*! Pointer to output buffer - buffer should be 64 byte aligned.bit sequence*/
80     int16_t * data_out; /*!< Pointer to data after compression. */
81     int32_t len_out;  /*!< Length of output data in bytes. */
82 };
83
84 //! @{
85 /*! \brief modulation compression procedures.
86 */
87 int xranlib_5gnr_mod_compression(const struct xranlib_5gnr_mod_compression_request* request,
88         struct xranlib_5gnr_mod_compression_response* response);
89 int xranlib_5gnr_mod_compression_avx512(const struct xranlib_5gnr_mod_compression_request* request,
90         struct xranlib_5gnr_mod_compression_response* response);
91 int xranlib_5gnr_mod_compression_snc(const struct xranlib_5gnr_mod_compression_request* request,
92         struct xranlib_5gnr_mod_compression_response* response);
93 int xranlib_5gnr_mod_compression_c(const struct xranlib_5gnr_mod_compression_request* request,
94         struct xranlib_5gnr_mod_compression_response* response);
95 int xranlib_5gnr_mod_decompression(const struct xranlib_5gnr_mod_decompression_request* request,
96     struct xranlib_5gnr_mod_decompression_response* response);
97