mirror of https://github.com/PentHertz/srsLTE.git
Added LDPC decoder RM interface
This commit is contained in:
parent
fa691bb8e3
commit
794d1b5c4b
|
@ -132,6 +132,19 @@ srslte_ldpc_decoder_decode_f(srslte_ldpc_decoder_t* q, const float* llrs, uint8_
|
||||||
SRSLTE_API int
|
SRSLTE_API int
|
||||||
srslte_ldpc_decoder_decode_s(srslte_ldpc_decoder_t* q, const int16_t* llrs, uint8_t* message, uint32_t cdwd_rm_length);
|
srslte_ldpc_decoder_decode_s(srslte_ldpc_decoder_t* q, const int16_t* llrs, uint8_t* message, uint32_t cdwd_rm_length);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Carries out the actual decoding with 8-bit integer-valued LLRs. It is
|
||||||
|
* recommended to use a 7-bit representation for the LLRs, given that all
|
||||||
|
* values exceeding \f$ 2^{7}-1 \f$ (in magnitude) will be considered as infinity.
|
||||||
|
* \param[in] q A pointer to the LDPC decoder (a srslte_ldpc_decoder_t structure
|
||||||
|
* instance) that carries out the decoding.
|
||||||
|
* \param[in] llrs The LLRs obtained from the channel samples that correspond to
|
||||||
|
* the codeword to be decoded.
|
||||||
|
* \param[out] message The message (uncoded bits) resulting from the decoding
|
||||||
|
* operation.
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_ldpc_decoder_decode_c(srslte_ldpc_decoder_t* q, const int8_t* llrs, uint8_t* message);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Carries out the actual decoding with 8-bit integer-valued LLRs. It is
|
* Carries out the actual decoding with 8-bit integer-valued LLRs. It is
|
||||||
* recommended to use a 7-bit representation for the LLRs, given that all
|
* recommended to use a 7-bit representation for the LLRs, given that all
|
||||||
|
@ -144,7 +157,9 @@ srslte_ldpc_decoder_decode_s(srslte_ldpc_decoder_t* q, const int16_t* llrs, uint
|
||||||
* operation.
|
* operation.
|
||||||
* \param[in] cdwd_rm_length The number of bits forming the codeword (after rate matching).
|
* \param[in] cdwd_rm_length The number of bits forming the codeword (after rate matching).
|
||||||
*/
|
*/
|
||||||
SRSLTE_API int
|
SRSLTE_API int srslte_ldpc_decoder_decode_rm_c(srslte_ldpc_decoder_t* q,
|
||||||
srslte_ldpc_decoder_decode_c(srslte_ldpc_decoder_t* q, const int8_t* llrs, uint8_t* message, uint32_t cdwd_rm_length);
|
const int8_t* llrs,
|
||||||
|
uint8_t* message,
|
||||||
|
uint32_t cdwd_rm_length);
|
||||||
|
|
||||||
#endif // SRSLTE_LDPCDECODER_H
|
#endif // SRSLTE_LDPCDECODER_H
|
||||||
|
|
|
@ -776,7 +776,12 @@ int srslte_ldpc_decoder_decode_s(srslte_ldpc_decoder_t* q,
|
||||||
return q->decode_s(q, llrs, message, cdwd_rm_length);
|
return q->decode_s(q, llrs, message, cdwd_rm_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
int srslte_ldpc_decoder_decode_c(srslte_ldpc_decoder_t* q,
|
int srslte_ldpc_decoder_decode_c(srslte_ldpc_decoder_t* q, const int8_t* llrs, uint8_t* message)
|
||||||
|
{
|
||||||
|
return q->decode_c(q, llrs, message, q->liftN - 2 * q->ls);
|
||||||
|
}
|
||||||
|
|
||||||
|
int srslte_ldpc_decoder_decode_rm_c(srslte_ldpc_decoder_t* q,
|
||||||
const int8_t* llrs,
|
const int8_t* llrs,
|
||||||
uint8_t* message,
|
uint8_t* message,
|
||||||
uint32_t cdwd_rm_length)
|
uint32_t cdwd_rm_length)
|
||||||
|
|
|
@ -526,39 +526,61 @@ void srslte_ldpc_rm_tx_free(srslte_ldpc_rm_t* q)
|
||||||
{
|
{
|
||||||
if (q != NULL) {
|
if (q != NULL) {
|
||||||
struct pRM_tx* qq = q->ptr;
|
struct pRM_tx* qq = q->ptr;
|
||||||
|
if (qq != NULL) {
|
||||||
|
if (qq->tmp_rm_codeword != NULL) {
|
||||||
free(qq->tmp_rm_codeword);
|
free(qq->tmp_rm_codeword);
|
||||||
|
}
|
||||||
free(qq);
|
free(qq);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void srslte_ldpc_rm_rx_free_f(srslte_ldpc_rm_t* q)
|
void srslte_ldpc_rm_rx_free_f(srslte_ldpc_rm_t* q)
|
||||||
{
|
{
|
||||||
if (q != NULL) {
|
if (q != NULL) {
|
||||||
struct pRM_rx_f* qq = q->ptr;
|
struct pRM_rx_f* qq = q->ptr;
|
||||||
|
if (qq != NULL) {
|
||||||
|
if (qq->tmp_rm_symbol != NULL) {
|
||||||
free(qq->tmp_rm_symbol);
|
free(qq->tmp_rm_symbol);
|
||||||
|
}
|
||||||
|
if (qq->indices != NULL) {
|
||||||
free(qq->indices);
|
free(qq->indices);
|
||||||
|
}
|
||||||
free(qq);
|
free(qq);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void srslte_ldpc_rm_rx_free_s(srslte_ldpc_rm_t* q)
|
void srslte_ldpc_rm_rx_free_s(srslte_ldpc_rm_t* q)
|
||||||
{
|
{
|
||||||
if (q != NULL) {
|
if (q != NULL) {
|
||||||
struct pRM_rx_s* qq = q->ptr;
|
struct pRM_rx_s* qq = q->ptr;
|
||||||
|
if (qq != NULL) {
|
||||||
|
if (qq->tmp_rm_symbol != NULL) {
|
||||||
free(qq->tmp_rm_symbol);
|
free(qq->tmp_rm_symbol);
|
||||||
|
}
|
||||||
|
if (qq->indices != NULL) {
|
||||||
free(qq->indices);
|
free(qq->indices);
|
||||||
|
}
|
||||||
free(qq);
|
free(qq);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void srslte_ldpc_rm_rx_free_c(srslte_ldpc_rm_t* q)
|
void srslte_ldpc_rm_rx_free_c(srslte_ldpc_rm_t* q)
|
||||||
{
|
{
|
||||||
if (q != NULL) {
|
if (q != NULL) {
|
||||||
struct pRM_rx_c* qq = q->ptr;
|
struct pRM_rx_c* qq = q->ptr;
|
||||||
|
if (qq != NULL) {
|
||||||
|
if (qq->tmp_rm_symbol != NULL) {
|
||||||
free(qq->tmp_rm_symbol);
|
free(qq->tmp_rm_symbol);
|
||||||
|
}
|
||||||
|
if (qq->indices != NULL) {
|
||||||
free(qq->indices);
|
free(qq->indices);
|
||||||
|
}
|
||||||
free(qq);
|
free(qq);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int srslte_ldpc_rm_tx(srslte_ldpc_rm_t* q,
|
int srslte_ldpc_rm_tx(srslte_ldpc_rm_t* q,
|
||||||
|
|
|
@ -399,7 +399,8 @@ int main(int argc, char** argv)
|
||||||
// Recover messages
|
// Recover messages
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < batch_size; j++) {
|
for (j = 0; j < batch_size; j++) {
|
||||||
srslte_ldpc_decoder_decode_c(&decoder_c, symbols_c + j * finalN, messages_sim_c + j * finalK, n_useful_symbols);
|
srslte_ldpc_decoder_decode_rm_c(
|
||||||
|
&decoder_c, symbols_c + j * finalN, messages_sim_c + j * finalK, n_useful_symbols);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
get_time_interval(t);
|
get_time_interval(t);
|
||||||
|
@ -420,7 +421,7 @@ int main(int argc, char** argv)
|
||||||
// Recover messages
|
// Recover messages
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < batch_size; j++) {
|
for (j = 0; j < batch_size; j++) {
|
||||||
srslte_ldpc_decoder_decode_c(
|
srslte_ldpc_decoder_decode_rm_c(
|
||||||
&decoder_c_flood, symbols_c + j * finalN, messages_sim_c_flood + j * finalK, n_useful_symbols);
|
&decoder_c_flood, symbols_c + j * finalN, messages_sim_c_flood + j * finalK, n_useful_symbols);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
|
@ -443,7 +444,7 @@ int main(int argc, char** argv)
|
||||||
// Recover messages
|
// Recover messages
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < batch_size; j++) {
|
for (j = 0; j < batch_size; j++) {
|
||||||
srslte_ldpc_decoder_decode_c(
|
srslte_ldpc_decoder_decode_rm_c(
|
||||||
&decoder_avx, symbols_c + j * finalN, messages_sim_avx + j * finalK, n_useful_symbols);
|
&decoder_avx, symbols_c + j * finalN, messages_sim_avx + j * finalK, n_useful_symbols);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
|
@ -465,7 +466,7 @@ int main(int argc, char** argv)
|
||||||
// Recover messages
|
// Recover messages
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < batch_size; j++) {
|
for (j = 0; j < batch_size; j++) {
|
||||||
srslte_ldpc_decoder_decode_c(
|
srslte_ldpc_decoder_decode_rm_c(
|
||||||
&decoder_avx_flood, symbols_c + j * finalN, messages_sim_avx_flood + j * finalK, n_useful_symbols);
|
&decoder_avx_flood, symbols_c + j * finalN, messages_sim_avx_flood + j * finalK, n_useful_symbols);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
|
|
|
@ -206,7 +206,7 @@ int main(int argc, char** argv)
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < NOF_MESSAGES; j++) {
|
for (j = 0; j < NOF_MESSAGES; j++) {
|
||||||
printf(" codeword %d\n", j);
|
printf(" codeword %d\n", j);
|
||||||
srslte_ldpc_decoder_decode_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
srslte_ldpc_decoder_decode_rm_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
get_time_interval(t);
|
get_time_interval(t);
|
||||||
|
|
|
@ -205,7 +205,7 @@ int main(int argc, char** argv)
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < NOF_MESSAGES; j++) {
|
for (j = 0; j < NOF_MESSAGES; j++) {
|
||||||
printf(" codeword %d\n", j);
|
printf(" codeword %d\n", j);
|
||||||
srslte_ldpc_decoder_decode_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
srslte_ldpc_decoder_decode_rm_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
get_time_interval(t);
|
get_time_interval(t);
|
||||||
|
|
|
@ -505,7 +505,7 @@ int main(int argc, char** argv)
|
||||||
// Recover messages
|
// Recover messages
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < batch_size; j++) {
|
for (j = 0; j < batch_size; j++) {
|
||||||
srslte_ldpc_decoder_decode_c(&decoder_c, symbols_c + j * finalN, messages_sim_c + j * finalK, finalN);
|
srslte_ldpc_decoder_decode_rm_c(&decoder_c, symbols_c + j * finalN, messages_sim_c + j * finalK, finalN);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
get_time_interval(t);
|
get_time_interval(t);
|
||||||
|
@ -526,7 +526,8 @@ int main(int argc, char** argv)
|
||||||
// Recover messages
|
// Recover messages
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < batch_size; j++) {
|
for (j = 0; j < batch_size; j++) {
|
||||||
srslte_ldpc_decoder_decode_c(&decoder_c_flood, symbols_c + j * finalN, messages_sim_c_flood + j * finalK, finalN);
|
srslte_ldpc_decoder_decode_rm_c(
|
||||||
|
&decoder_c_flood, symbols_c + j * finalN, messages_sim_c_flood + j * finalK, finalN);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
get_time_interval(t);
|
get_time_interval(t);
|
||||||
|
@ -548,7 +549,7 @@ int main(int argc, char** argv)
|
||||||
// Recover messages
|
// Recover messages
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < batch_size; j++) {
|
for (j = 0; j < batch_size; j++) {
|
||||||
srslte_ldpc_decoder_decode_c(&decoder_avx, symbols_c + j * finalN, messages_sim_avx + j * finalK, finalN);
|
srslte_ldpc_decoder_decode_rm_c(&decoder_avx, symbols_c + j * finalN, messages_sim_avx + j * finalK, finalN);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
get_time_interval(t);
|
get_time_interval(t);
|
||||||
|
@ -569,7 +570,7 @@ int main(int argc, char** argv)
|
||||||
// Recover messages
|
// Recover messages
|
||||||
gettimeofday(&t[1], NULL);
|
gettimeofday(&t[1], NULL);
|
||||||
for (j = 0; j < batch_size; j++) {
|
for (j = 0; j < batch_size; j++) {
|
||||||
srslte_ldpc_decoder_decode_c(
|
srslte_ldpc_decoder_decode_rm_c(
|
||||||
&decoder_avx_flood, symbols_c + j * finalN, messages_sim_avx_flood + j * finalK, finalN);
|
&decoder_avx_flood, symbols_c + j * finalN, messages_sim_avx_flood + j * finalK, finalN);
|
||||||
}
|
}
|
||||||
gettimeofday(&t[2], NULL);
|
gettimeofday(&t[2], NULL);
|
||||||
|
|
Loading…
Reference in New Issue