mirror of https://github.com/PentHertz/srsLTE.git
Use LDPC RM number of useful LLR and rename functions
This commit is contained in:
parent
ecd2c1cdcc
commit
3568f633c3
|
@ -126,19 +126,6 @@ srsran_ldpc_decoder_decode_f(srsran_ldpc_decoder_t* q, const float* llrs, uint8_
|
|||
SRSRAN_API int
|
||||
srsran_ldpc_decoder_decode_s(srsran_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 srsran_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.
|
||||
*/
|
||||
SRSRAN_API int srsran_ldpc_decoder_decode_c(srsran_ldpc_decoder_t* q, const int8_t* llrs, uint8_t* message);
|
||||
|
||||
/*!
|
||||
* 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
|
||||
|
@ -151,9 +138,7 @@ SRSRAN_API int srsran_ldpc_decoder_decode_c(srsran_ldpc_decoder_t* q, const int8
|
|||
* operation.
|
||||
* \param[in] cdwd_rm_length The number of bits forming the codeword (after rate matching).
|
||||
*/
|
||||
SRSRAN_API int srsran_ldpc_decoder_decode_rm_c(srsran_ldpc_decoder_t* q,
|
||||
const int8_t* llrs,
|
||||
uint8_t* message,
|
||||
uint32_t cdwd_rm_length);
|
||||
SRSRAN_API int
|
||||
srsran_ldpc_decoder_decode_c(srsran_ldpc_decoder_t* q, const int8_t* llrs, uint8_t* message, uint32_t cdwd_rm_length);
|
||||
|
||||
#endif // SRSRAN_LDPCDECODER_H
|
||||
|
|
|
@ -169,7 +169,7 @@ SRSRAN_API int srsran_ldpc_rm_rx_init_c(srsran_ldpc_rm_t* q);
|
|||
* \param[in] rv Redundancy version 0,1,2,3.
|
||||
* \param[in] mod_type Modulation type.
|
||||
* \param[in] Nref Size of limited buffer.
|
||||
* \return An integer: 0 if the function executes correctly, -1 otherwise.
|
||||
* \return An integer: The number of useful LLR if the function executes correctly, -1 otherwise.
|
||||
*/
|
||||
SRSRAN_API int srsran_ldpc_rm_rx_c(srsran_ldpc_rm_t* q,
|
||||
const int8_t* input,
|
||||
|
|
|
@ -1028,22 +1028,10 @@ int srsran_ldpc_decoder_decode_s(srsran_ldpc_decoder_t* q,
|
|||
return q->decode_s(q, llrs, message, cdwd_rm_length);
|
||||
}
|
||||
|
||||
int srsran_ldpc_decoder_decode_c(srsran_ldpc_decoder_t* q, const int8_t* llrs, uint8_t* message)
|
||||
{
|
||||
uint32_t cdwd_rm_length = q->liftN - 2 * q->ls;
|
||||
|
||||
// Trim input LLR to find last zero
|
||||
while (llrs[cdwd_rm_length - 1] == 0 && cdwd_rm_length > 0) {
|
||||
cdwd_rm_length--;
|
||||
}
|
||||
|
||||
return q->decode_c(q, llrs, message, cdwd_rm_length);
|
||||
}
|
||||
|
||||
int srsran_ldpc_decoder_decode_rm_c(srsran_ldpc_decoder_t* q,
|
||||
const int8_t* llrs,
|
||||
uint8_t* message,
|
||||
uint32_t cdwd_rm_length)
|
||||
int srsran_ldpc_decoder_decode_c(srsran_ldpc_decoder_t* q,
|
||||
const int8_t* llrs,
|
||||
uint8_t* message,
|
||||
uint32_t cdwd_rm_length)
|
||||
{
|
||||
return q->decode_c(q, llrs, message, cdwd_rm_length);
|
||||
}
|
||||
|
|
|
@ -686,5 +686,6 @@ int srsran_ldpc_rm_rx_c(srsran_ldpc_rm_t* q,
|
|||
bit_selection_rm_rx_c(tmp_rm_symbol, q->E, output, indices, ini_exclude, end_exclude, q->k0, q->Ncb);
|
||||
}
|
||||
|
||||
return 0;
|
||||
// Return the number of useful LLR
|
||||
return (int)((q->k0 + q->E) % q->Ncb);
|
||||
}
|
||||
|
|
|
@ -422,8 +422,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
&decoder_c, symbols_c + j * finalN, messages_sim_c + j * finalK, n_useful_symbols);
|
||||
srsran_ldpc_decoder_decode_c(&decoder_c, symbols_c + j * finalN, messages_sim_c + j * finalK, n_useful_symbols);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
get_time_interval(t);
|
||||
|
@ -444,7 +443,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_c_flood, symbols_c + j * finalN, messages_sim_c_flood + j * finalK, n_useful_symbols);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
@ -467,7 +466,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_avx, symbols_c + j * finalN, messages_sim_avx + j * finalK, n_useful_symbols);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
@ -489,7 +488,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_avx_flood, symbols_c + j * finalN, messages_sim_avx_flood + j * finalK, n_useful_symbols);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
@ -513,7 +512,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_avx512, symbols_c + j * finalN, messages_sim_avx512 + j * finalK, n_useful_symbols);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
@ -534,7 +533,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_avx512_flood, symbols_c + j * finalN, messages_sim_avx512_flood + j * finalK, n_useful_symbols);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
|
|
@ -207,7 +207,7 @@ int main(int argc, char** argv)
|
|||
printf(" codeword %d\n", j);
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (l = 0; l < nof_reps; l++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
||||
srsran_ldpc_decoder_decode_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
||||
}
|
||||
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
|
|
@ -206,7 +206,7 @@ int main(int argc, char** argv)
|
|||
printf(" codeword %d\n", j);
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (l = 0; l < nof_reps; l++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
||||
srsran_ldpc_decoder_decode_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
||||
}
|
||||
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
|
|
@ -197,7 +197,7 @@ int main(int argc, char** argv)
|
|||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < NOF_MESSAGES; j++) {
|
||||
printf(" codeword %d\n", j);
|
||||
srsran_ldpc_decoder_decode_rm_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
||||
srsran_ldpc_decoder_decode_c(&decoder, symbols + j * finalN, messages_sim + j * finalK, finalN);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
get_time_interval(t);
|
||||
|
|
|
@ -554,7 +554,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_c, symbols_c + j * finalN, messages_sim_c + j * finalK, n_useful_symbols_dec);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
@ -576,7 +576,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_c_flood, symbols_c + j * finalN, messages_sim_c_flood + j * finalK, n_useful_symbols_dec);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
@ -599,7 +599,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_avx, symbols_c + j * finalN, messages_sim_avx + j * finalK, n_useful_symbols_dec);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
@ -621,7 +621,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_avx_flood, symbols_c + j * finalN, messages_sim_avx_flood + j * finalK, n_useful_symbols_dec);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
@ -645,8 +645,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
&decoder_avx512, symbols_c + j * finalN, messages_sim_avx512 + j * finalK, finalN);
|
||||
srsran_ldpc_decoder_decode_c(&decoder_avx512, symbols_c + j * finalN, messages_sim_avx512 + j * finalK, finalN);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
get_time_interval(t);
|
||||
|
@ -667,7 +666,7 @@ int main(int argc, char** argv)
|
|||
// Recover messages
|
||||
gettimeofday(&t[1], NULL);
|
||||
for (j = 0; j < batch_size; j++) {
|
||||
srsran_ldpc_decoder_decode_rm_c(
|
||||
srsran_ldpc_decoder_decode_c(
|
||||
&decoder_avx512_flood, symbols_c + j * finalN, messages_sim_avx512_flood + j * finalK, finalN);
|
||||
}
|
||||
gettimeofday(&t[2], NULL);
|
||||
|
|
|
@ -256,7 +256,8 @@ int main(int argc, char** argv)
|
|||
exit(-1);
|
||||
}
|
||||
if (srsran_ldpc_rm_rx_c(
|
||||
&rm_rx_c, rm_symbols_c + r * E, unrm_symbols_c + r * N, E, F, base_graph, lift_size, rv, mod_type, Nref)) {
|
||||
&rm_rx_c, rm_symbols_c + r * E, unrm_symbols_c + r * N, E, F, base_graph, lift_size, rv, mod_type, Nref) <
|
||||
0) {
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -269,7 +270,6 @@ int main(int argc, char** argv)
|
|||
((unrm_symbols[i + r * N] < 0) && (codewords[i + r * N]))) {
|
||||
// any of these cases are ok
|
||||
} else {
|
||||
|
||||
error = -1;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -581,10 +581,15 @@ int sch_nr_decode(srsran_sch_nr_t* q,
|
|||
tb->rv,
|
||||
cfg.Qm,
|
||||
cfg.Nref);
|
||||
srsran_ldpc_rm_rx_c(&q->rx_rm, input_ptr, rm_buffer, E, cfg.F, cfg.bg, cfg.Z, tb->rv, tb->mod, cfg.Nref);
|
||||
int n_llr =
|
||||
srsran_ldpc_rm_rx_c(&q->rx_rm, input_ptr, rm_buffer, E, cfg.F, cfg.bg, cfg.Z, tb->rv, tb->mod, cfg.Nref);
|
||||
if (n_llr < SRSRAN_SUCCESS) {
|
||||
ERROR("Error in LDPC rate mateching");
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
// Decode
|
||||
srsran_ldpc_decoder_decode_c(decoder, rm_buffer, q->temp_cb);
|
||||
srsran_ldpc_decoder_decode_c(decoder, rm_buffer, q->temp_cb, n_llr);
|
||||
|
||||
// Compute CB CRC
|
||||
uint32_t cb_len = cfg.Kp - cfg.L_cb;
|
||||
|
|
Loading…
Reference in New Issue