Fix memory alignment in PUCCH processing. Fixes #94

master
Ismael Gomez 7 years ago
parent a631798057
commit 2dbc0f0663

@ -57,8 +57,8 @@ typedef struct SRSLTE_API {
} srslte_uci_cqi_pusch_t; } srslte_uci_cqi_pusch_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint8_t cqi_table[16][32]; uint8_t *cqi_table[16];
int16_t cqi_table_s[16][32]; // aligned for simd int16_t *cqi_table_s[16];
} srslte_uci_cqi_pucch_t; } srslte_uci_cqi_pucch_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
@ -85,6 +85,8 @@ typedef struct {
SRSLTE_API void srslte_uci_cqi_pucch_init(srslte_uci_cqi_pucch_t *q); SRSLTE_API void srslte_uci_cqi_pucch_init(srslte_uci_cqi_pucch_t *q);
SRSLTE_API void srslte_uci_cqi_pucch_free(srslte_uci_cqi_pucch_t *q);
SRSLTE_API int srslte_uci_encode_cqi_pucch(uint8_t *cqi_data, SRSLTE_API int srslte_uci_encode_cqi_pucch(uint8_t *cqi_data,
uint32_t cqi_len, uint32_t cqi_len,
uint8_t b_bits[SRSLTE_UCI_CQI_CODED_PUCCH_B]); uint8_t b_bits[SRSLTE_UCI_CQI_CODED_PUCCH_B]);

@ -464,6 +464,7 @@ void srslte_pucch_free(srslte_pucch_t *q) {
} }
free(q->users); free(q->users);
} }
srslte_uci_cqi_pucch_free(&q->cqi);
if (q->z) { if (q->z) {
free(q->z); free(q->z);
} }

@ -32,6 +32,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
#include <srslte/phy/phch/uci.h>
#include "srslte/phy/phch/uci.h" #include "srslte/phy/phch/uci.h"
#include "srslte/phy/fec/cbsegm.h" #include "srslte/phy/fec/cbsegm.h"
@ -109,6 +110,8 @@ void srslte_uci_cqi_pucch_init(srslte_uci_cqi_pucch_t *q) {
uint32_t nwords = 16; uint32_t nwords = 16;
for (uint32_t w=0;w<nwords;w++) { for (uint32_t w=0;w<nwords;w++) {
q->cqi_table[w] = srslte_vec_malloc(SRSLTE_UCI_CQI_CODED_PUCCH_B*sizeof(int8_t));
q->cqi_table_s[w] = srslte_vec_malloc(SRSLTE_UCI_CQI_CODED_PUCCH_B*sizeof(int16_t));
uint8_t *ptr = word; uint8_t *ptr = word;
srslte_bit_unpack(w, &ptr, 4); srslte_bit_unpack(w, &ptr, 4);
srslte_uci_encode_cqi_pucch(word, 4, q->cqi_table[w]); srslte_uci_encode_cqi_pucch(word, 4, q->cqi_table[w]);
@ -118,6 +121,18 @@ void srslte_uci_cqi_pucch_init(srslte_uci_cqi_pucch_t *q) {
} }
} }
void srslte_uci_cqi_pucch_free(srslte_uci_cqi_pucch_t *q) {
uint32_t nwords = 16;
for (uint32_t w=0;w<nwords;w++) {
if (q->cqi_table[w]) {
free(q->cqi_table[w]);
}
if (q->cqi_table_s[w]) {
free(q->cqi_table_s[w]);
}
}
}
/* Encode UCI CQI/PMI as described in 5.2.3.3 of 36.212 /* Encode UCI CQI/PMI as described in 5.2.3.3 of 36.212
*/ */
int srslte_uci_encode_cqi_pucch(uint8_t *cqi_data, uint32_t cqi_len, uint8_t b_bits[SRSLTE_UCI_CQI_CODED_PUCCH_B]) int srslte_uci_encode_cqi_pucch(uint8_t *cqi_data, uint32_t cqi_len, uint8_t b_bits[SRSLTE_UCI_CQI_CODED_PUCCH_B])

Loading…
Cancel
Save