From ef3b99a263d5266e623ff28527dc6d719d1eaa76 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 16 Jan 2025 10:26:11 +0100 Subject: [PATCH] remove MMX instruction usage in threegpplte_turbo_encoder_sse() --- openair1/PHY/CODING/3gpplte_sse.c | 50 +++++++++++-------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c index 79fd825a4b..169f53e23e 100644 --- a/openair1/PHY/CODING/3gpplte_sse.c +++ b/openair1/PHY/CODING/3gpplte_sse.c @@ -47,14 +47,8 @@ //#define CALLGRIND 1 struct treillis { - union { - simde__m64 systematic_andp1_64[3]; - uint8_t systematic_andp1_8[24]; - }; - union { - simde__m64 parity2_64[3]; - uint8_t parity2_8[24]; - }; + uint8_t systematic_andp1[24]; + uint8_t parity2[24]; int exit_state; } __attribute__ ((aligned(64))); @@ -91,12 +85,11 @@ static void treillis_table_init(void) { current_state=i; for (b=0; b<8 ; b++ ) { // pre-compute the image of the byte j in _m128i vector right place - all_treillis[i][j].systematic_andp1_8[b*3]= (j&(1<<(7-b)))>>(7-b); - v=threegpplte_rsc( all_treillis[i][j].systematic_andp1_8[b*3] , - ¤t_state); - all_treillis[i][j].systematic_andp1_8[b*3+1]=v; // for the yparity1 + all_treillis[i][j].systematic_andp1[b * 3] = (j & (1 << (7 - b))) >> (7 - b); + v = threegpplte_rsc(all_treillis[i][j].systematic_andp1[b * 3], ¤t_state); + all_treillis[i][j].systematic_andp1[b * 3 + 1] = v; // for the yparity1 // all_treillis[i][j].parity1_8[b*3+1]=v; // for the yparity1 - all_treillis[i][j].parity2_8[b*3+2]=v; // for the yparity2 + all_treillis[i][j].parity2[b * 3 + 2] = v; // for the yparity2 } all_treillis[i][j].exit_state=current_state; @@ -275,13 +268,9 @@ char interleave_compact_byte(short *base_interleaver,unsigned char *input, unsig } */ -void threegpplte_turbo_encoder_sse(unsigned char *input, - unsigned short input_length_bytes, - unsigned char *output, - unsigned char F) { - int i; +void threegpplte_turbo_encoder_sse(unsigned char *input, unsigned short input_length_bytes, unsigned char *output, unsigned char F) +{ unsigned char *x; - unsigned char state0=0,state1=0; unsigned short input_length_bits = input_length_bytes<<3; short *base_interleaver; @@ -290,6 +279,7 @@ void threegpplte_turbo_encoder_sse(unsigned char *input, } // look for f1 and f2 precomputed interleaver values + int i; for (i=0; i < 188 && f1f2mat[i].nb_bits != input_length_bits; i++); if ( i == 188 ) { @@ -301,24 +291,18 @@ void threegpplte_turbo_encoder_sse(unsigned char *input, unsigned char systematic2[768] __attribute__((aligned(32))); interleave_compact_byte(base_interleaver, input, systematic2, input_length_bytes); - simde__m64 *ptr_output = (simde__m64 *)output; + unsigned char *ptr_output = output; unsigned char cur_s1, cur_s2; - int code_rate; - - for ( state0=state1=i=0 ; i