Commit 948df46d authored by Thomas Laurent's avatar Thomas Laurent

remove precomputed turbo codec interleaver table, remove useless F1 and F2...

remove precomputed turbo codec interleaver table, remove useless F1 and F2 parameters to turbo codec (also remove global var dependancy between libraries)
parent 923817d8
Pipeline #10021 passed with stage
in 0 seconds
......@@ -30,7 +30,6 @@
#include <stdint.h>
#include <stdio.h>
#include "PHY/CODING/coding_defs.h"
#include "extern_3GPPinterleaver.h"
//#define DEBUG_TURBO_ENCODER 1
......@@ -110,9 +109,7 @@ uint32_t bit_byte_lut[2048];
void threegpplte_turbo_encoder(uint8_t *input,
uint16_t input_length_bytes,
uint8_t *output,
uint8_t F,
uint16_t interleaver_f1,
uint16_t interleaver_f2)
uint8_t F)
{
int i,k=0;
......@@ -256,6 +253,217 @@ inline short threegpp_interleaver_parameters(uint16_t bytes_per_codeword)
return(-1);
}
}
const interleaver_TS_36_212_t f1f2[188] = {
{ 40, 3, 10 },
{ 48, 7, 12 },
{ 56, 19, 42 },
{ 64, 7, 16 },
{ 72, 7, 18 },
{ 80, 11, 20 },
{ 88, 5, 22 },
{ 96, 11, 24 },
{ 104, 7, 26 },
{ 112, 41, 84 },
{ 120, 103, 90 },
{ 128, 15, 32 },
{ 136, 9, 34 },
{ 144, 17, 108 },
{ 152, 9, 38 },
{ 160, 21, 120 },
{ 168, 101, 84 },
{ 176, 21, 44 },
{ 184, 57, 46 },
{ 192, 23, 48 },
{ 200, 13, 50 },
{ 208, 27, 52 },
{ 216, 11, 36 },
{ 224, 27, 56 },
{ 232, 85, 58 },
{ 240, 29, 60 },
{ 248, 33, 62 },
{ 256, 15, 32 },
{ 264, 17, 198 },
{ 272, 33, 68 },
{ 280, 103, 210 },
{ 288, 19, 36 },
{ 296, 19, 74 },
{ 304, 37, 76 },
{ 312, 19, 78 },
{ 320, 21, 120 },
{ 328, 21, 82 },
{ 336, 115, 84 },
{ 344, 193, 86 },
{ 352, 21, 44 },
{ 360, 133, 90 },
{ 368, 81, 46 },
{ 376, 45, 94 },
{ 384, 23, 48 },
{ 392, 243, 98 },
{ 400, 151, 40 },
{ 408, 155, 102 },
{ 416, 25, 52 },
{ 424, 51, 106 },
{ 432, 47, 72 },
{ 440, 91, 110 },
{ 448, 29, 168 },
{ 456, 29, 114 },
{ 464, 247, 58 },
{ 472, 29, 118 },
{ 480, 89, 180 },
{ 488, 91, 122 },
{ 496, 157, 62 },
{ 504, 55, 84 },
{ 512, 31, 64 },
{ 528, 17, 66 },
{ 544, 35, 68 },
{ 560, 227, 420 },
{ 576, 65, 96 },
{ 592, 19, 74 },
{ 608, 37, 76 },
{ 624, 41, 234 },
{ 640, 39, 80 },
{ 656, 185, 82 },
{ 672, 43, 252 },
{ 688, 21, 86 },
{ 704, 155, 44 },
{ 720, 79, 120 },
{ 736, 139, 92 },
{ 752, 23, 94 },
{ 768, 217, 48 },
{ 784, 25, 98 },
{ 800, 17, 80 },
{ 816, 127, 102 },
{ 832, 25, 52 },
{ 848, 239, 106 },
{ 864, 17, 48 },
{ 880, 137, 110 },
{ 896, 215, 112 },
{ 912, 29, 114 },
{ 928, 15, 58 },
{ 944, 147, 118 },
{ 960, 29, 60 },
{ 976, 59, 122 },
{ 992, 65, 124 },
{ 1008, 55, 84 },
{ 1024, 31, 64 },
{ 1056, 17, 66 },
{ 1088, 171, 204 },
{ 1120, 67, 140 },
{ 1152, 35, 72 },
{ 1184, 19, 74 },
{ 1216, 39, 76 },
{ 1248, 19, 78 },
{ 1280, 199, 240 },
{ 1312, 21, 82 },
{ 1344, 211, 252 },
{ 1376, 21, 86 },
{ 1408, 43, 88 },
{ 1440, 149, 60 },
{ 1472, 45, 92 },
{ 1504, 49, 846 },
{ 1536, 71, 48 },
{ 1568, 13, 28 },
{ 1600, 17, 80 },
{ 1632, 25, 102 },
{ 1664, 183, 104 },
{ 1696, 55, 954 },
{ 1728, 127, 96 },
{ 1760, 27, 110 },
{ 1792, 29, 112 },
{ 1824, 29, 114 },
{ 1856, 57, 116 },
{ 1888, 45, 354 },
{ 1920, 31, 120 },
{ 1952, 59, 610 },
{ 1984, 185, 124 },
{ 2016, 113, 420 },
{ 2048, 31, 64 },
{ 2112, 17, 66 },
{ 2176, 171, 136 },
{ 2240, 209, 420 },
{ 2304, 253, 216 },
{ 2368, 367, 444 },
{ 2432, 265, 456 },
{ 2496, 181, 468 },
{ 2560, 39, 80 },
{ 2624, 27, 164 },
{ 2688, 127, 504 },
{ 2752, 143, 172 },
{ 2816, 43, 88 },
{ 2880, 29, 300 },
{ 2944, 45, 92 },
{ 3008, 157, 188 },
{ 3072, 47, 96 },
{ 3136, 13, 28 },
{ 3200, 111, 240 },
{ 3264, 443, 204 },
{ 3328, 51, 104 },
{ 3392, 51, 212 },
{ 3456, 451, 192 },
{ 3520, 257, 220 },
{ 3584, 57, 336 },
{ 3648, 313, 228 },
{ 3712, 271, 232 },
{ 3776, 179, 236 },
{ 3840, 331, 120 },
{ 3904, 363, 244 },
{ 3968, 375, 248 },
{ 4032, 127, 168 },
{ 4096, 31, 64 },
{ 4160, 33, 130 },
{ 4224, 43, 264 },
{ 4288, 33, 134 },
{ 4352, 477, 408 },
{ 4416, 35, 138 },
{ 4480, 233, 280 },
{ 4544, 357, 142 },
{ 4608, 337, 480 },
{ 4672, 37, 146 },
{ 4736, 71, 444 },
{ 4800, 71, 120 },
{ 4864, 37, 152 },
{ 4928, 39, 462 },
{ 4992, 127, 234 },
{ 5056, 39, 158 },
{ 5120, 39, 80 },
{ 5184, 31, 96 },
{ 5248, 113, 902 },
{ 5312, 41, 166 },
{ 5376, 251, 336 },
{ 5440, 43, 170 },
{ 5504, 21, 86 },
{ 5568, 43, 174 },
{ 5632, 45, 176 },
{ 5696, 45, 178 },
{ 5760, 161, 120 },
{ 5824, 89, 182 },
{ 5888, 323, 184 },
{ 5952, 47, 186 },
{ 6016, 23, 94 },
{ 6080, 47, 190 },
{ 6144, 263, 480 },
};
t_interleaver_codebook *f1f2mat;
short *il_tb;
__attribute__((constructor)) static void init_interleaver(void) {
int totSize=0;
f1f2mat=(t_interleaver_codebook*) malloc(sizeof(*f1f2mat) * sizeof(f1f2) / sizeof(*f1f2));
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++) {
f1f2mat[i].nb_bits=f1f2[i].nb_bits;
f1f2mat[i].f1=f1f2[i].f1;
f1f2mat[i].f2=f1f2[i].f2;
f1f2mat[i].beg_index=totSize;
totSize+=f1f2mat[i].nb_bits;
}
il_tb=(short*)malloc(sizeof(*il_tb)*totSize);
int idx=0;
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++)
for (uint64_t j=0; j<f1f2[i].nb_bits; j++)
il_tb[idx++]=(j*f1f2[i].f1+j*j*f1f2[i].f2)%f1f2[i].nb_bits;
}
#ifdef MAIN
......@@ -296,9 +504,7 @@ int main(int argc,char **argv)
threegpplte_turbo_encoder(&input[0],
5,
&output[0],
F1,
F2);
&output[0]);
return(0);
}
......
......@@ -27,9 +27,7 @@
*/
#ifndef TC_MAIN
#include "coding_defs.h"
#include "extern_3GPPinterleaver.h"
#else
#include "coding_vars.h"
#include <stdint.h>
#endif
#include <stdio.h>
......@@ -539,9 +537,7 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
void threegpplte_turbo_encoder_sse(unsigned char *input,
unsigned short input_length_bytes,
unsigned char *output,
unsigned char F,
unsigned short interleaver_f1,
unsigned short interleaver_f2)
unsigned char F)
{
int i;
......@@ -699,9 +695,7 @@ int main(int argc,char **argv)
threegpplte_turbo_encoder_sse(&input[0],
INPUT_LENGTH,
&output[0],
0,
F1,
F2);
0);
for (i=0;i<12+(INPUT_LENGTH*24);i++)
......
......@@ -46,7 +46,6 @@
#include "PHY/defs_common.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/CODING/lte_interleaver_inline.h"
#include "extern_3GPPinterleaver.h"
#else
#include "defs.h"
......@@ -893,8 +892,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint16_t f1,
uint16_t f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
......@@ -1417,8 +1414,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint16_t f1,
uint16_t f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
......
......@@ -41,7 +41,6 @@
#include "PHY/defs.h"
#include "PHY/CODING/defs.h"
#include "PHY/CODING/lte_interleaver_inline.h"
#include "extern_3GPPinterleaver.h"
#else
#include "defs.h"
......@@ -1983,8 +1982,6 @@ void init_td()
unsigned char phy_threegpplte_turbo_decoder(short *y,
unsigned char *decoded_bytes,
unsigned short n,
unsigned short f1,
unsigned short f2,
unsigned char max_iterations,
unsigned char crc_type,
unsigned char F,
......
......@@ -45,7 +45,6 @@
#include "PHY/defs_common.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/CODING/lte_interleaver_inline.h"
#include "extern_3GPPinterleaver.h"
#else
#include "defs.h"
......@@ -1172,24 +1171,21 @@ void init_td16(void)
}
}
unsigned char phy_threegpplte_turbo_decoder16(short *y,
short *y2,
unsigned char *decoded_bytes,
unsigned char *decoded_bytes2,
unsigned short n,
unsigned short f1,
unsigned short f2,
unsigned char max_iterations,
unsigned char crc_type,
unsigned char F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
{
uint8_t phy_threegpplte_turbo_decoder16(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats) {
/* y is a pointer to the input
decoded_bytes is a pointer to the decoded output
......
......@@ -42,7 +42,6 @@
#include "PHY/defs_common.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/CODING/lte_interleaver_inline.h"
#include "extern_3GPPinterleaver.h"
#else
#include "defs.h"
......@@ -897,25 +896,21 @@ void init_td8(void)
}
}
unsigned char phy_threegpplte_turbo_decoder8(short *y,
short y2,
unsigned char *decoded_bytes,
unsigned char *decoded_bytes2,
unsigned short n,
unsigned short f1,
unsigned short f2,
unsigned char max_iterations,
unsigned char crc_type,
unsigned char F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
{
uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats) {
/* y is a pointer to the input
decoded_bytes is a pointer to the decoded output
n is the size in bits of the coded block, with the tail */
......
......@@ -36,7 +36,6 @@
#include "UTIL/LOG/log.h"
//#include "PHY/CODING/lte_interleaver.h"
//#include "PHY/CODING/lte_interleaver_inline.h"
......
......@@ -29,7 +29,6 @@
#include "ARCH/CBMIMO1/DEVICE_DRIVER/vars.h"
#include "MAC_INTERFACE/vars.h"
#include "PHY/CODING/defs.h"
//#include "PHY/CODING/lte_interleaver.h"
//#include "PHY/CODING/lte_interleaver_inline.h"
......
......@@ -39,7 +39,24 @@
#define MAX_TURBO_ITERATIONS_MBSFN 8
#define MAX_TURBO_ITERATIONS max_turbo_iterations
typedef struct {
unsigned short nb_bits;
unsigned short f1;
unsigned short f2;
} interleaver_TS_36_212_t;
extern const interleaver_TS_36_212_t f1f2[188];
#define LTE_NULL 2
typedef struct interleaver_codebook {
unsigned long nb_bits;
unsigned short f1;
unsigned short f2;
unsigned int beg_index;
} t_interleaver_codebook;
extern t_interleaver_codebook *f1f2mat;
extern short *il_tb;
/** @addtogroup _PHY_CODING_BLOCKS_
* @{
......@@ -422,4 +439,8 @@ uint32_t crcbit (uint8_t * ,
int16_t reverseBits(int32_t ,int32_t);
void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t);
decoder_if_t phy_threegpplte_turbo_decoder;
decoder_if_t phy_threegpplte_turbo_decoder8;
decoder_if_t phy_threegpplte_turbo_decoder16;
#endif
......@@ -19,10 +19,9 @@
* contact@openairinterface.org
*/
extern unsigned short f1f2mat_old[2*188];
extern double cpuf;
extern decoder_if_t decoder16;
extern decoder_if_t decoder8;
extern encoder_if_t encoder;
extern decoder_if_t *decoder16;
extern decoder_if_t *decoder8;
extern encoder_if_t *encoder;
extern int load_codinglib(void);
extern int free_codinglib(void);
extern void free_codinglib(void);
......@@ -35,6 +35,7 @@
#include "PHY/defs_common.h"
#include "PHY/phy_extern.h"
#include "PHY/CODING/coding_extern.h"
#include "common/utils/load_module_shlib.h"
#include "common/utils/telnetsrv/telnetsrv.h"
......@@ -55,28 +56,26 @@ loader_shlibfunc_t shlib_fdesc[DECODE_NUM_FPTR];
/* encoding decoding functions pointers, filled here and used when encoding/decoding */
/*defined as extern in PHY?CODING/extern.h */
decoder_if_t decoder16;
decoder_if_t decoder8;
encoder_if_t encoder;
decoder_if_t *decoder16;
decoder_if_t *decoder8;
encoder_if_t *encoder;
extern int _may_i_use_cpu_feature(unsigned __int64);
uint8_t nodecod(short *y,
short *y2,
unsigned char *decoded_bytes,
unsigned char *decoded_bytes2,
unsigned short n,
unsigned short f1,
unsigned short f2,
unsigned char max_iterations,
unsigned char crc_type,
unsigned char F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
uint8_t nodecod(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
{
return max_iterations+1;
};
......@@ -86,24 +85,24 @@ void decoding_setmode (int mode) {
case MODE_DECODE_NONE:
decoder8=nodecod;
decoder16=nodecod;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
break;
case MODE_DECODE_C:
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
break;
case MODE_DECODE_AVX2:
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
break;
default:
mode=MODE_DECODE_SSE;
case MODE_DECODE_SSE:
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
break;
}
curmode=mode;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "lte_interleaver.h"
#include "lte_interleaver2.h"
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
typedef struct interleaver_codebook {
unsigned long nb_bits;
unsigned short f1;
unsigned short f2;
unsigned int beg_index;
} t_interleaver_codebook;
#ifndef INCL_INTERLEAVE
extern t_interleaver_codebook f1f2mat[];
extern short il_tb[];
extern short reverse_il_tl[];
#endif
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
unsigned short f1f2mat_old[2*188] = {3, 10,
7, 12,
19, 42,
7, 16,
7, 18,
11, 20,
5, 22,
11, 24,
7, 26,
41, 84,
103, 90,
15, 32,
9, 34,
17, 108,
9, 38,
21, 120,
101, 84,
21, 44,
57, 46,
23, 48,
13, 50,
27, 52,
11, 36,
27, 56,
85, 58,
29, 60,
33, 62,
15, 32,
17, 198,
33, 68,
103, 210,
19, 36,
19, 74,
37, 76,
19, 78,
21, 120,
21, 82,
115, 84,
193, 86,
21, 44,
133, 90,
81, 46,
45, 94,
23, 48,
243, 98,
151, 40,
155, 102,
25, 52,
51, 106,
47, 72,
91, 110,
29, 168,
29, 114,
247, 58,
29, 118,
89, 180,
91, 122,