mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
7.5 KiB
C
173 lines
7.5 KiB
C
4 years ago
|
/**
|
||
4 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
4 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
4 years ago
|
*
|
||
4 years ago
|
* By using this file, you agree to the terms and conditions set
|
||
|
* forth in the LICENSE file which can be found at the top level of
|
||
|
* the distribution.
|
||
4 years ago
|
*
|
||
|
*/
|
||
|
|
||
|
/*!
|
||
|
* \file polar_rm.h
|
||
|
* \brief Declaration of the polar RateMatcher and RateDematcher.
|
||
4 years ago
|
* \author Jesus Gomez
|
||
4 years ago
|
* \date 2020
|
||
|
*
|
||
|
* \copyright Software Radio Systems Limited
|
||
|
*
|
||
|
*/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_POLARRM_H
|
||
|
#define SRSRAN_POLARRM_H
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* \brief Describes a polar rate matcher or rate dematcher
|
||
|
*/
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
4 years ago
|
void* ptr; /*!< \brief Rate Matcher auxiliary registers. */
|
||
4 years ago
|
} srsran_polar_rm_t;
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* Initializes the Rate Matcher for the maximum rate-matched codeword length
|
||
4 years ago
|
* \param[out] q A pointer to a srsran_polar_rm_t structure.
|
||
4 years ago
|
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_polar_rm_tx_init(srsran_polar_rm_t* q);
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* Carries out the actual rate-matching.
|
||
4 years ago
|
* \param[in] q A pointer to the Rate-Matcher (a srsran_polar_rm_t structure
|
||
4 years ago
|
* instance) that carries out the rate matching.
|
||
|
* \param[in] input The codeword obtained from the polar encoder.
|
||
|
* \param[out] output The rate-matched codeword resulting from the rate-matching
|
||
|
* operation.
|
||
|
* \param[in] n \f$log_2\f$ of the codeword length.
|
||
|
* \param[in] E Rate-matched codeword length.
|
||
|
* \param[in] K Message size (including CRC).
|
||
|
* \param[in] ibil Indicator of bit interliaver (set to 0 to disable).
|
||
|
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_polar_rm_tx(srsran_polar_rm_t* q,
|
||
4 years ago
|
const uint8_t* input,
|
||
|
uint8_t* output,
|
||
|
const uint8_t n,
|
||
|
const uint32_t E,
|
||
|
const uint32_t K,
|
||
|
const uint8_t ibil);
|
||
|
|
||
|
/*!
|
||
|
* Initializes all the Rate DeMatcher variables.
|
||
4 years ago
|
* \param[out] q A pointer to a srsran_polar_rm_t structure.
|
||
4 years ago
|
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_polar_rm_rx_init_f(srsran_polar_rm_t* q);
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* Carries out the actual rate-dematching.
|
||
4 years ago
|
* \param[in] q A pointer to the Rate-DeMatcher (a srsran_polar_rm_t structure
|
||
4 years ago
|
* instance) that carries out the rate matching.
|
||
|
* \param[in] input The LLRs obtained from the channel samples that correspond to
|
||
|
* the codeword to be first, rate-dematched and then decoded.
|
||
|
* \param[out] output The rate-dematched codeword resulting from the rate-dematching
|
||
|
* operation.
|
||
|
* \param[in] E Rate-matched codeword length.
|
||
|
* \param[in] n \f$log_2\f$ of the codeword length.
|
||
|
* \param[in] K Message size (including CRC).
|
||
|
* \param[in] ibil Indicator of bit interliaver (set to 0 to disable).
|
||
|
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_polar_rm_rx_f(srsran_polar_rm_t* q,
|
||
4 years ago
|
const float* input,
|
||
|
float* output,
|
||
|
const uint32_t E,
|
||
|
const uint8_t n,
|
||
|
const uint32_t K,
|
||
|
const uint8_t ibil);
|
||
|
|
||
|
/*!
|
||
|
* Initializes all the Rate DeMatcher variables (int16_t inputs).
|
||
4 years ago
|
* \param[out] q A pointer to a srsran_polar_rm_t structure.
|
||
4 years ago
|
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_polar_rm_rx_init_s(srsran_polar_rm_t* q);
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* Carries out the actual rate-dematching (in16_t inputs)
|
||
4 years ago
|
* \param[in] q A pointer to the Rate-DeMatcher (a srsran_polar_rm_t structure
|
||
4 years ago
|
* instance) that carries out the rate matching.
|
||
|
* \param[in] input The LLRs obtained from the channel samples that correspond to
|
||
|
* the codeword to be first, rate-dematched and then decoded.
|
||
|
* \param[out] output The rate-dematched codeword resulting from the rate-dematching
|
||
|
* operation.
|
||
|
* \param[in] E Rate-matched codeword length.
|
||
|
* \param[in] n \f$log_2\f$ of the codeword length.
|
||
|
* \param[in] K Message size (including CRC).
|
||
|
* \param[in] ibil Indicator of bit interliaver (set to 0 to disable).
|
||
|
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_polar_rm_rx_s(srsran_polar_rm_t* q,
|
||
4 years ago
|
const int16_t* input,
|
||
|
int16_t* output,
|
||
|
const uint32_t E,
|
||
|
const uint8_t n,
|
||
|
const uint32_t K,
|
||
|
const uint8_t ibil);
|
||
|
|
||
|
/*!
|
||
|
* Initializes all the Rate DeMatcher variables (int8_t inputs).
|
||
4 years ago
|
* \param[out] q A pointer to a srsran_polar_rm_t structure.
|
||
4 years ago
|
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_polar_rm_rx_init_c(srsran_polar_rm_t* q);
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* Carries out the actual rate-dematching (int8_t inputs).
|
||
4 years ago
|
* \param[in] q A pointer to the Rate-DeMatcher (a srsran_polar_rm_t structure
|
||
4 years ago
|
* instance) that carries out the rate matching.
|
||
|
* \param[in] input The LLRs obtained from the channel samples that correspond to
|
||
|
* the codeword to be first, rate-dematched and then decoded.
|
||
|
* \param[out] output The rate-dematched codeword resulting from the rate-dematching
|
||
|
* operation.
|
||
|
* \param[in] E Rate-matched codeword length.
|
||
|
* \param[in] n \f$log_2\f$ of the codeword length.
|
||
|
* \param[in] K Message size (including CRC).
|
||
|
* \param[in] ibil Indicator of bit interliaver (set to 0 to disable).
|
||
|
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_polar_rm_rx_c(srsran_polar_rm_t* q,
|
||
4 years ago
|
const int8_t* input,
|
||
|
int8_t* output,
|
||
|
const uint32_t E,
|
||
|
const uint8_t n,
|
||
|
const uint32_t K,
|
||
|
const uint8_t ibil);
|
||
|
|
||
|
/*!
|
||
|
* The Rate Matcher "destructor": it frees all the resources allocated to the rate-matcher.
|
||
|
* \param[in] q A pointer to the dismantled rate-matcher.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API void srsran_polar_rm_tx_free(srsran_polar_rm_t* q);
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* The Rate Matcher "destructor": it frees all the resources allocated to the rate-dematcher.
|
||
|
* \param[in] q A pointer to the dismantled rate-dematcher.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API void srsran_polar_rm_rx_free_f(srsran_polar_rm_t* q);
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* The Rate Matcher "destructor" for short symbols: it frees all the resources allocated to the rate-dematcher.
|
||
|
* \param[in] q A pointer to the dismantled rate-dematcher.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API void srsran_polar_rm_rx_free_s(srsran_polar_rm_t* q);
|
||
4 years ago
|
|
||
|
/*!
|
||
|
* The Rate Matcher "destructor" for int8_t symbols: it frees all the resources allocated to the rate-dematcher.
|
||
|
* \param[in] q A pointer to the dismantled rate-dematcher.
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API void srsran_polar_rm_rx_free_c(srsran_polar_rm_t* q);
|
||
4 years ago
|
|
||
4 years ago
|
#endif // SRSRAN_POLARRM_H
|