Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
nems
openairinterface5G
Commits
1da3a24c
Commit
1da3a24c
authored
Oct 30, 2018
by
yilmazt
Browse files
Warning removals.
parent
c660a1e5
Changes
15
Hide whitespace changes
Inline
Side-by-side
openair1/PHY/CODING/TESTBENCH/ldpctest.c
View file @
1da3a24c
...
...
@@ -259,6 +259,7 @@ int test_ldpc(short No_iteration,
//estimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
n_iter
=
nrLDPC_decoder
(
&
decParams
,
(
int8_t
*
)
channel_output_fixed
,
(
int8_t
*
)
estimated_output
,
NULL
);
printf
(
"nrLDPC_decoder n_iter=%d
\n
"
,
n_iter
);
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
...
...
@@ -268,9 +269,9 @@ int test_ldpc(short No_iteration,
{
if
(
estimated_output
[
i
]
!=
test_input
[
0
][
i
])
{
printf
(
"error pos %d (%d, %d)
\n
"
,
i
,
estimated_output
[
i
],
test_input
[
0
][
i
]);
*
errors
=
(
*
errors
)
+
1
;
break
;
printf
(
"error pos %d (%d, %d)
\n
"
,
i
,
estimated_output
[
i
],
test_input
[
0
][
i
]);
*
errors
=
(
*
errors
)
+
1
;
break
;
}
}
...
...
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
1da3a24c
...
...
@@ -18,11 +18,8 @@ int main(int argc, char *argv[]) {
//Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.)
time_stats_t
timeEncoder
,
timeDecoder
;
time_stats_t
polar_decoder_init
,
polar_rate_matching
,
decoding
,
bit_extraction
,
deinterleaving
;
time_stats_t
path_metric
,
sorting
,
update_LLR
;
opp_enabled
=
1
;
int
decoder_int16
=
0
;
int
generate_optim_code
=
0
;
cpu_freq_GHz
=
get_cpu_freq_GHz
();
reset_meas
(
&
timeEncoder
);
reset_meas
(
&
timeDecoder
);
...
...
@@ -71,20 +68,20 @@ int main(int argc, char *argv[]) {
pathMetricAppr
=
(
uint8_t
)
atoi
(
optarg
);
break
;
case
'q'
:
decoder_int16
=
1
;
break
;
case
'g'
:
generate_optim_code
=
1
;
iterations
=
1
;
SNRst
art
=
-
6
.
0
;
SNRstop
=-
6
.
0
;
decoder_int16
=
1
;
break
;
case
'h'
:
printf
(
"./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr
\n
"
);
exit
(
-
1
);
case
'q'
:
decoder_int16
=
1
;
break
;
case
'g'
:
iterations
=
1
;
SNRstart
=
-
6
.
0
;
SNRst
op
=
-
6
.
0
;
decoder_int16
=
1
;
break
;
case
'h'
:
printf
(
"./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr
\n
"
);
exit
(
-
1
);
default:
perror
(
"[polartest.c] Problem at argument parsing with getopt"
);
...
...
@@ -141,18 +138,18 @@ int main(int argc, char *argv[]) {
uint8_t
testArrayLength
=
ceil
(
testLength
/
32
.
0
);
uint8_t
coderArrayLength
=
ceil
(
coderLength
/
32
.
0
);
uint32_t
*
testInput
=
malloc
(
sizeof
(
uint32_t
)
*
testArrayLength
)
;
//generate randomly
uint32_t
*
encoderOutput
=
malloc
(
sizeof
(
uint32_t
)
*
coderArrayLength
)
;
uint32_t
*
estimatedOutput
=
malloc
(
sizeof
(
uint32_t
)
*
testArrayLength
)
;
//decoder output
uint32_t
testInput
[
testArrayLength
]
;
//generate randomly
uint32_t
encoderOutput
[
coderArrayLength
]
;
uint32_t
estimatedOutput
[
testArrayLength
]
;
//decoder output
memset
(
testInput
,
0
,
sizeof
(
uint32_t
)
*
testArrayLength
);
memset
(
encoderOutput
,
0
,
sizeof
(
uint32_t
)
*
coderArrayLength
);
memset
(
estimatedOutput
,
0
,
sizeof
(
uint32_t
)
*
testArrayLength
);
uint8_t
*
encoderOutputByte
=
malloc
(
sizeof
(
uint8_t
)
*
coderLength
)
;
double
*
modulatedInput
=
malloc
(
sizeof
(
double
)
*
coderLength
)
;
//channel input
double
*
channelOutput
=
malloc
(
sizeof
(
double
)
*
coderLength
);
//add noise
int16_t
*
channelOutput_int16
;
i
f
(
decoder_int16
==
1
)
channelOutput_int16
=
(
int16_t
*
)
malloc
(
sizeof
(
int16_t
)
*
coderLength
)
;
uint8_t
encoderOutputByte
[
coderLength
]
;
double
modulatedInput
[
coderLength
]
;
//channel input
double
channelOutput
[
coderLength
];
//add noise
i
nt16_t
channelOutput_int16
[
coderLength
]
;
t_nrPolar_paramsPtr
nrPolar_params
=
NULL
,
currentPtr
=
NULL
;
nr_polar_init
(
&
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
...
...
@@ -203,6 +200,8 @@ int main(int argc, char *argv[]) {
rnti
);
printf
(
"dci_estimation: [0]->0x%08x
\t
[1]->0x%08x
\t
[2]->0x%08x
\t
[3]->0x%08x
\n
"
,
dci_estimation
[
0
],
dci_estimation
[
1
],
dci_estimation
[
2
],
dci_estimation
[
3
]);
free
(
encoder_outputByte
);
free
(
channel_output
);
return
0
;
#endif
...
...
@@ -262,7 +261,7 @@ int main(int argc, char *argv[]) {
uint8_t
nr_polar_A
[
32
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
1
};
uint8_t
nr_polar_crc
[
24
];
uint8_t
**
crc_generator_matrix
=
crc24c_generator_matrix
(
32
);
nr_matrix_multiplication_uint8_
t_
1D_uint8_
t_
2D
(
nr_polar_A
,
nr_matrix_multiplication_uint8_1D_uint8_2D
(
nr_polar_A
,
crc_generator_matrix
,
nr_polar_crc
,
32
,
...
...
@@ -318,15 +317,12 @@ int main(int argc, char *argv[]) {
for (int i=0; i<32; i++)
printf("%d\n",(testInput[0]>>i)&1);*/
start_meas
(
&
timeEncoder
);
if
(
decoder_int16
==
0
)
polar_encoder
(
testInput
,
encoderOutput
,
currentPtr
);
else
polar_encoder_fast
((
uint64_t
*
)
testInput
,
(
uint64_t
*
)
encoderOutput
,
0
,
currentPtr
);
polar_encoder_fast
((
uint64_t
*
)
testInput
,
encoderOutput
,
0
,
currentPtr
);
//polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0, currentPtr);
stop_meas
(
&
timeEncoder
);
/*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]);
printf("encoderOutput: [1]->0x%08x\n", encoderOutput[1]);*/
...
...
@@ -428,14 +424,5 @@ int main(int argc, char *argv[]) {
print_meas
(
&
timeDecoder
,
"polar_decoder"
,
NULL
,
NULL
);
fclose
(
logFile
);
//Bit
free
(
testInput
);
free
(
encoderOutput
);
free
(
estimatedOutput
);
//Byte
free
(
encoderOutputByte
);
free
(
modulatedInput
);
free
(
channelOutput
);
return
(
0
);
}
openair1/PHY/CODING/coding_defs.h
View file @
1da3a24c
...
...
@@ -337,7 +337,7 @@ void ccodedab_init_inv(void);
/*!\fn void crcTableInit(void)
\brief This function initializes the different crc tables.*/
//
void crcTableInit (void);
void
crcTableInit
(
void
);
...
...
openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
View file @
1da3a24c
...
...
@@ -201,7 +201,13 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho
int
ldpc_encoder_optim
(
unsigned
char
*
test_input
,
unsigned
char
*
channel_input
,
short
block_length
,
short
BG
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
{
short
Kb
,
Zc
,
nrows
,
ncols
;
short
Zc
;
//initialize for BG == 1
short
Kb
=
22
;
short
nrows
=
46
;
//parity check bits
short
ncols
=
22
;
//info bits
int
i
,
i1
;
int
no_punctured_columns
,
removed_bit
;
...
...
@@ -211,13 +217,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int
simd_size
;
//determine number of bits in codeword
if
(
BG
==
1
)
{
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
else
if
(
BG
==
2
)
if
(
BG
==
2
)
{
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
...
...
@@ -251,7 +251,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
#endif
if
((
Zc
&
31
)
>
0
)
simd_size
=
16
;
else
simd_size
=
32
;
else
simd_size
=
32
;
unsigned
char
c
[
22
*
Zc
]
__attribute__
((
aligned
(
32
)));
//padded input, unpacked, max size
unsigned
char
d
[
46
*
Zc
]
__attribute__
((
aligned
(
32
)));
//coded parity part output, unpacked, max size
...
...
@@ -316,7 +316,13 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int
ldpc_encoder_optim_8seg
(
unsigned
char
**
test_input
,
unsigned
char
**
channel_input
,
short
block_length
,
short
BG
,
int
n_segments
,
time_stats_t
*
tinput
,
time_stats_t
*
tprep
,
time_stats_t
*
tparity
,
time_stats_t
*
toutput
)
{
short
Kb
,
Zc
,
nrows
,
ncols
;
short
Zc
;
//initialize for BG == 1
short
Kb
=
22
;
short
nrows
=
46
;
//parity check bits
short
ncols
=
22
;
//info bits
int
i
,
i1
,
j
;
int
no_punctured_columns
,
removed_bit
;
//Table of possible lifting sizes
...
...
@@ -343,13 +349,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
AssertFatal
(
n_segments
>
0
&&
n_segments
<=
8
,
"0 < n_segments %d <= 8
\n
"
,
n_segments
);
//determine number of bits in codeword
if
(
BG
==
1
)
{
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
else
if
(
BG
==
2
)
if
(
BG
==
2
)
{
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
...
...
openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
View file @
1da3a24c
...
...
@@ -367,7 +367,13 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
unsigned
char
d
[
68
*
384
];
//coded output, unpacked, max size
unsigned
char
channel_temp
,
temp
;
short
*
Gen_shift_values
,
*
no_shift_values
,
*
pointer_shift_values
;
short
Zc
,
Kb
,
nrows
,
ncols
;
short
Zc
;
//initialize for BG == 1
short
Kb
=
22
;
short
nrows
=
46
;
//parity check bits
short
ncols
=
22
;
//info bits
int
i
,
i1
,
i2
,
i3
,
i4
,
i5
,
temp_prime
,
var
;
int
no_punctured_columns
,
removed_bit
;
//Table of possible lifting sizes
...
...
@@ -378,13 +384,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
int
indlist2
[
1000
];
//determine number of bits in codeword
if
(
BG
==
1
)
{
Kb
=
22
;
nrows
=
46
;
//parity check bits
ncols
=
22
;
//info bits
}
else
if
(
BG
==
2
)
if
(
BG
==
2
)
{
nrows
=
42
;
//parity check bits
ncols
=
10
;
// info bits
...
...
@@ -415,7 +415,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
return
(
-
1
);
}
int
K
=
ncols
*
Zc
;
//
int K = ncols*Zc;
//unused variable
Gen_shift_values
=
choose_generator_matrix
(
BG
,
Zc
);
if
(
Gen_shift_values
==
NULL
)
{
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
1da3a24c
...
...
@@ -48,11 +48,11 @@ int8_t polar_decoder(
{
//Assumes no a priori knowledge.
uint8_t
***
bit
=
nr_alloc_uint8_
t_
3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
***
bit
=
nr_alloc_uint8_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
...
...
@@ -231,9 +231,9 @@ int8_t polar_decoder(
free
(
d_tilde
);
free
(
pathMetric
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
return
(
-
1
);
}
...
...
@@ -267,11 +267,11 @@ int8_t polar_decoder(
free
(
d_tilde
);
free
(
pathMetric
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_
t_
2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_
t_
2D_array
(
tempECGM
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
tempECGM
,
polarParams
->
K
);
/*
* Return bits.
...
...
@@ -287,11 +287,11 @@ int8_t polar_decoder_aPriori(double *input,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
)
{
uint8_t
***
bit
=
nr_alloc_uint8_
t_
3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
***
bit
=
nr_alloc_uint8_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
...
...
@@ -484,9 +484,9 @@ int8_t polar_decoder_aPriori(double *input,
free
(
d_tilde
);
free
(
pathMetric
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
return
(
-
1
);
}
...
...
@@ -519,11 +519,11 @@ int8_t polar_decoder_aPriori(double *input,
free
(
d_tilde
);
free
(
pathMetric
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_
t_
2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_
t_
2D_array
(
tempECGM
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
tempECGM
,
polarParams
->
K
);
/*
* Return bits.
...
...
@@ -546,11 +546,11 @@ int8_t polar_decoder_aPriori_timing(double *input,
FILE
*
logFile
)
{
uint8_t
***
bit
=
nr_alloc_uint8_
t_
3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
***
bit
=
nr_alloc_uint8_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
...
...
@@ -742,9 +742,9 @@ int8_t polar_decoder_aPriori_timing(double *input,
free
(
d_tilde
);
free
(
pathMetric
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
return
(
-
1
);
}
...
...
@@ -777,11 +777,11 @@ int8_t polar_decoder_aPriori_timing(double *input,
free
(
d_tilde
);
free
(
pathMetric
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_
t_
2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_
t_
2D_array
(
tempECGM
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
tempECGM
,
polarParams
->
K
);
/*
* Return bits.
...
...
@@ -799,11 +799,11 @@ int8_t polar_decoder_dci(double *input,
uint16_t
n_RNTI
)
{
uint8_t
***
bit
=
nr_alloc_uint8_
t_
3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
***
bit
=
nr_alloc_uint8_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
bitUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
uint8_t
**
llrUpdated
=
nr_alloc_uint8_2D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
));
//0=False, 1=True
double
***
llr
=
nr_alloc_double_3D_array
(
polarParams
->
N
,
(
polarParams
->
n
+
1
),
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_
t_
2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
uint8_t
**
crcChecksum
=
nr_alloc_uint8_2D_array
(
polarParams
->
crcParityBits
,
2
*
listSize
);
double
*
pathMetric
=
malloc
(
sizeof
(
double
)
*
(
2
*
listSize
));
uint8_t
*
crcState
=
malloc
(
sizeof
(
uint8_t
)
*
(
2
*
listSize
));
//0=False, 1=True
uint8_t
extended_crc_scrambling_pattern
[
polarParams
->
crcParityBits
];
...
...
@@ -991,9 +991,9 @@ int8_t polar_decoder_dci(double *input,
free
(
d_tilde
);
free
(
pathMetric
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
return
(
-
1
);
}
...
...
@@ -1026,11 +1026,11 @@ int8_t polar_decoder_dci(double *input,
free
(
d_tilde
);
free
(
pathMetric
);
free
(
crcState
);
nr_free_uint8_
t_
3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_3D_array
(
bit
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_double_3D_array
(
llr
,
polarParams
->
N
,
(
polarParams
->
n
+
1
));
nr_free_uint8_
t_
2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_
t_
2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_
t_
2D_array
(
tempECGM
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
crcChecksum
,
polarParams
->
crcParityBits
);
nr_free_uint8_2D_array
(
extended_crc_generator_matrix
,
polarParams
->
K
);
nr_free_uint8_2D_array
(
tempECGM
,
polarParams
->
K
);
/*
* Return bits.
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
1da3a24c
...
...
@@ -145,11 +145,10 @@ void polar_encoder_dci(uint32_t *in,
t_nrPolar_paramsPtr
polarParams
,
uint16_t
n_RNTI
);
void
polar_encoder_timing
(
uint32_t
*
in
,
uint32_t
*
out
,
t_nrPolar_paramsPtr
polarParams
,
double
cpuFreqGHz
,
FILE
*
logFile
);
void
polar_encoder_fast
(
uint64_t
*
A
,
uint32_t
*
out
,
int32_t
crcmask
,
t_nrPolar_paramsPtr
polarParams
);
int8_t
polar_decoder
(
double
*
input
,
uint8_t
*
output
,
...
...
@@ -184,7 +183,12 @@ int8_t polar_decoder_dci(double *input,
uint8_t
pathMetricAppr
,
uint16_t
n_RNTI
);
void
generic_polar_decoder
(
t_nrPolar_params
*
,
decoder_node_t
*
);
void
generic_polar_decoder
(
t_nrPolar_params
*
,
decoder_node_t
*
);
void
build_decoder_tree
(
t_nrPolar_params
*
pp
);
void
build_polar_tables
(
t_nrPolar_paramsPtr
polarParams
);
void
init_polar_deinterleaver_table
(
t_nrPolar_params
*
polarParams
);
void
nr_polar_init
(
t_nrPolar_paramsPtr
*
polarParams
,
int8_t
messageType
,
...
...
@@ -210,150 +214,165 @@ const uint16_t* nr_polar_sequence_pattern(uint8_t n);
* @param E
* @param n_max */
uint32_t
nr_polar_output_length
(
uint16_t
K
,
uint16_t
E
,
uint8_t
n_max
);
uint16_t
E
,
uint8_t
n_max
);
void
nr_polar_channel_interleaver_pattern
(
uint16_t
*
cip
,
uint8_t
I_BIL
,
uint16_t
E
);
uint8_t
I_BIL
,
uint16_t
E
);
void
nr_polar_rate_matching_pattern
(
uint16_t
*
rmp
,
uint16_t
*
J
,
const
uint8_t
*
P_i_
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
uint16_t
*
J
,
const
uint8_t
*
P_i_
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
void
nr_polar_rate_matching
(
double
*
input
,
double
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
void
nr_polar_rate_matching_int16
(
int16_t
*
input
,
int16_t
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
double
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
void
nr_polar_rate_matching_int16
(
int16_t
*
input
,
int16_t
*
output
,
uint16_t
*
rmp
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
);
void
nr_polar_interleaving_pattern
(
uint16_t
K
,
uint8_t
I_IL
,
uint16_t
*
PI_k_
);
uint8_t
I_IL
,
uint16_t
*
PI_k_
);
void
nr_polar_info_bit_pattern
(
uint8_t
*
ibp
,
int16_t
*
Q_I_N
,
int16_t
*
Q_F_N
,
uint16_t
*
J
,
const
uint16_t
*
Q_0_Nminus1
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
,
uint8_t
n_PC
);
int16_t
*
Q_I_N
,
int16_t
*
Q_F_N
,
uint16_t
*
J
,
const
uint16_t
*
Q_0_Nminus1
,
uint16_t
K
,
uint16_t
N
,
uint16_t
E
,
uint8_t
n_PC
);
void
nr_polar_info_bit_extraction
(
uint8_t
*
input
,
uint8_t
*
output
,
uint8_t
*
pattern
,
uint16_t
size
);
uint8_t
*
output
,
uint8_t
*
pattern
,
uint16_t
size
);
void
nr_bit2byte_uint32_8_t
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
);
uint16_t
arraySize
,
uint8_t
*
out
);
void
nr_byte2bit_uint8_32_t
(
uint8_t
*
in
,
uint16_t
arraySize
,
uint32_t
*
out
);
uint16_t
arraySize
,
uint32_t
*
out
);
void
nr_crc_bit2bit_uint32_8_t
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
);
uint16_t
arraySize
,
uint8_t
*
out
);
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
N
,
uint16_t
K
,
int16_t
*
Q_I_N
,
int16_t
*
Q_PC_N
,
uint8_t
n_PC
);
void
nr_matrix_multiplication_uint8_
t_
1D_uint8_
t_
2D
(
uint8_t
*
matrix1
,
uint8_t
**
matrix2
,
uint8_t
*
output
,
uint16_t
row
,
uint16_t
col
);
uint8_t
***
nr_alloc_uint8_
t_
3D_array
(
uint16_t
xlen
,
uint16_t
ylen
,
uint16_t
zlen
);
uint8_t
**
nr_alloc_uint8_
t_
2D_array
(
uint16_t
xlen
,
uint16_t
ylen
);
uint8_t
*
output
,
uint16_t
N
,
uint16_t
K
,