|
|
|
@ -80,7 +80,6 @@ int decode37(void *o, uint8_t *symbols, uint8_t *data, uint32_t frame_length) {
|
|
|
|
|
#ifdef LV_HAVE_SSE
|
|
|
|
|
int decode37_sse(void *o, uint8_t *symbols, uint8_t *data, uint32_t frame_length) {
|
|
|
|
|
srslte_viterbi_t *q = o;
|
|
|
|
|
uint32_t i;
|
|
|
|
|
|
|
|
|
|
uint32_t best_state;
|
|
|
|
|
|
|
|
|
@ -91,25 +90,21 @@ int decode37_sse(void *o, uint8_t *symbols, uint8_t *data, uint32_t frame_length
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize Viterbi decoder */
|
|
|
|
|
init_viterbi37_sse(q->ptr, q->tail_biting ? -1 : 0);
|
|
|
|
|
init_viterbi37_sse(q->ptr, -1);
|
|
|
|
|
|
|
|
|
|
/* Decode block */
|
|
|
|
|
uint8_t *tmp = q->tmp;
|
|
|
|
|
if (q->tail_biting) {
|
|
|
|
|
memcpy(tmp, symbols, 3 * frame_length * sizeof(uint8_t));
|
|
|
|
|
for (i = 0; i < 3 * (q->K - 1); i++) {
|
|
|
|
|
q->tmp[i + 3 * frame_length] = q->tmp[i];
|
|
|
|
|
}
|
|
|
|
|
memcpy(q->tmp, symbols, 3*frame_length*sizeof(uint8_t));
|
|
|
|
|
memcpy(&q->tmp[3*frame_length], symbols, 3*frame_length*sizeof(uint8_t));
|
|
|
|
|
memcpy(&q->tmp[6*frame_length], symbols, 3*frame_length*sizeof(uint8_t));
|
|
|
|
|
update_viterbi37_blk_sse(q->ptr, q->tmp, 3*frame_length, &best_state);
|
|
|
|
|
chainback_viterbi37_sse(q->ptr, q->tmp, 3*frame_length, best_state);
|
|
|
|
|
memcpy(data, &q->tmp[frame_length], frame_length*sizeof(uint8_t));
|
|
|
|
|
} else {
|
|
|
|
|
tmp = symbols;
|
|
|
|
|
update_viterbi37_blk_sse(q->ptr, symbols, frame_length+q->K-1, &best_state);
|
|
|
|
|
chainback_viterbi37_sse(q->ptr, data, frame_length, best_state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update_viterbi37_blk_sse(q->ptr, tmp, frame_length + q->K - 1,
|
|
|
|
|
q->tail_biting ? &best_state : NULL);
|
|
|
|
|
|
|
|
|
|
/* Do Viterbi chainback */
|
|
|
|
|
chainback_viterbi37_sse(q->ptr, data, frame_length,
|
|
|
|
|
q->tail_biting ? best_state : 0);
|
|
|
|
|
|
|
|
|
|
return q->framebits;
|
|
|
|
|
}
|
|
|
|
@ -154,6 +149,7 @@ int init37(srslte_viterbi_t *q, uint32_t poly[3], uint32_t framebits, bool tail_
|
|
|
|
|
}
|
|
|
|
|
if (q->tail_biting) {
|
|
|
|
|
q->tmp = srslte_vec_malloc(3 * (q->framebits + q->K - 1) * sizeof(uint8_t));
|
|
|
|
|
bzero(q->tmp, 3 * (q->framebits + q->K - 1) * sizeof(uint8_t));
|
|
|
|
|
if (!q->tmp) {
|
|
|
|
|
perror("malloc");
|
|
|
|
|
free37(q);
|
|
|
|
@ -188,7 +184,7 @@ int init37_sse(srslte_viterbi_t *q, uint32_t poly[3], uint32_t framebits, bool t
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (q->tail_biting) {
|
|
|
|
|
q->tmp = srslte_vec_malloc(3 * (q->framebits + q->K - 1) * sizeof(uint8_t));
|
|
|
|
|
q->tmp = srslte_vec_malloc(10 * (q->framebits + q->K - 1) * sizeof(uint8_t));
|
|
|
|
|
if (!q->tmp) {
|
|
|
|
|
perror("malloc");
|
|
|
|
|
free37(q);
|
|
|
|
@ -198,7 +194,7 @@ int init37_sse(srslte_viterbi_t *q, uint32_t poly[3], uint32_t framebits, bool t
|
|
|
|
|
q->tmp = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((q->ptr = create_viterbi37_sse(poly, framebits)) == NULL) {
|
|
|
|
|
if ((q->ptr = create_viterbi37_sse(poly, 3*framebits)) == NULL) {
|
|
|
|
|
fprintf(stderr, "create_viterbi37 failed\n");
|
|
|
|
|
free37(q);
|
|
|
|
|
return -1;
|
|
|
|
|