Skip to content

Commit

Permalink
Scale LDPC and CR to make them both integer
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Oct 27, 2021
1 parent e4073ad commit c54dc80
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions core/rtw_mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3287,54 +3287,54 @@ UINT LDPC_parameter_generator(
UINT N_TCB
)
{
double CR = 0.;
UINT CR12 = 0;
double N_CW = 0., N_shrt = 0.;
double L_LDPC = 0., K_LDPC = 0.;
UINT L_LDPC_12 = 0, K_LDPC = 0;
double N_punc = 0.;
UINT VHTSIGA2B3 = 0;/* extra symbol from VHT-SIG-A2 Bit 3*/

if (R == 0)
CR = 0.5;
CR12 = 6;
else if (R == 1)
CR = 2. / 3.;
CR12 = 8;
else if (R == 2)
CR = 3. / 4.;
CR12 = 9;
else if (R == 3)
CR = 5. / 6.;
CR12 = 10;

if (N_TCB <= 648) {
N_CW = 1.;
if (N_TCB >= N_pld + 912.*(1. - CR))
L_LDPC = 1296.;
if (N_TCB >= N_pld + 76 * (12 - CR12))
L_LDPC_12 = 1296 / 12;
else
L_LDPC = 648.;
L_LDPC_12 = 648 / 12;
} else if (N_TCB <= 1296) {
N_CW = 1.;
if (N_TCB >= N_pld + 1464.*(1. - CR))
L_LDPC = 1944.;
if (N_TCB >= N_pld + 122 * (12 - CR12))
L_LDPC_12 = 1944 / 12;
else
L_LDPC = 1296.;
L_LDPC_12 = 1296 / 12;
} else if (N_TCB <= 1944) {
N_CW = 1.;
L_LDPC = 1944.;
L_LDPC_12 = 1944 / 12;
} else if (N_TCB <= 2592) {
N_CW = 2.;
if (N_TCB >= N_pld + 2916.*(1. - CR))
L_LDPC = 1944.;
if (N_TCB >= N_pld + 243 * (12 - CR12))
L_LDPC_12 = 1944 / 12;
else
L_LDPC = 1296.;
L_LDPC_12 = 1296 / 12;
} else {
N_CW = ceil(N_pld / 1944. / CR);
L_LDPC = 1944.;
N_CW = ceil(N_pld / (162 * CR12));
L_LDPC_12 = 1944 / 12;
}
/* Number of information bits per CW*/
K_LDPC = L_LDPC * CR;
/* Number of shortening bits max(0, (N_CW * L_LDPC * R) - N_pld)*/
K_LDPC = L_LDPC_12 * CR12;
/* Number of shortening bits max(0, (N_CW * L_LDPC_12 * 12 * R) - N_pld)*/
N_shrt = (N_CW * K_LDPC - N_pld) > 0. ? (N_CW * K_LDPC - N_pld) : 0.;
/* Number of puncturing bits*/
N_punc = (N_CW * L_LDPC - N_TCB - N_shrt) > 0. ? (N_CW * L_LDPC - N_TCB - N_shrt) : 0.;
if (((N_punc > .1 * N_CW * L_LDPC * (1. - CR)) && (N_shrt < 1.2 * N_punc * CR / (1. - CR))) ||
(N_punc > 0.3 * N_CW * L_LDPC * (1. - CR))) {
N_punc = (N_CW * L_LDPC_12 * 12 - N_TCB - N_shrt) > 0. ? (N_CW * L_LDPC_12 * 12 - N_TCB - N_shrt) : 0.;
if (((N_punc > .1 * N_CW * L_LDPC_12 * (12 - CR12)) && (N_shrt < 1.2 * N_punc * CR12 / (12 - CR12))) ||
(N_punc > 0.3 * N_CW * L_LDPC_12 * (12 - CR12))) {
VHTSIGA2B3 = 1;
} else
VHTSIGA2B3 = 0;
Expand Down

0 comments on commit c54dc80

Please sign in to comment.