Commit 3a5df627 authored by Raymond Knopp's avatar Raymond Knopp Committed by Robert Schmidt

Rate match simd

parent 9f8d4452
......@@ -610,6 +610,82 @@ int nr_rate_matching_ldpc(uint32_t Tbslbrm,
return 0;
}
#define RMLOOP for (;ind<(ind2&7);k+=8,ind+=8) \
simde_mm_storeu_si128(&d[ind],simde_mm_adds_epi16(simde_mm_loadu_si128(&soft_input[k]),simde_mm_loadu_si128(&d[ind])));\
for (; ind<ind2 ; ind++,k++) d[ind] += soft_input[k];
int nr_rate_matching_ldpc_rx_simd(uint32_t Tbslbrm,
uint8_t BG,
uint16_t Z,
int16_t *d,
int16_t *soft_input,
uint8_t C,
uint8_t rvidx,
uint8_t clear,
uint32_t E,
uint32_t F,
uint32_t Foffset)
{
if (C == 0) {
LOG_E(PHY, "nr_rate_matching: invalid parameter C %d\n", C);
return -1;
}
//Bit selection
uint32_t N = (BG == 1) ? (66 * Z) : (50 * Z);
uint32_t Ncb;
if (Tbslbrm == 0)
Ncb = N;
else {
uint32_t Nref = (3 * Tbslbrm / (2 * C)); //R_LBRM = 2/3
Ncb = min(N, Nref);
}
uint32_t ind = (index_k0[BG - 1][rvidx] * Ncb / N) * Z;
if (Foffset > E) {
LOG_E(PHY, "nr_rate_matching: invalid parameters (Foffset %d > E %d)\n", Foffset, E);
return -1;
}
if (Foffset > Ncb) {
LOG_E(PHY, "nr_rate_matching: invalid parameters (Foffset %d > Ncb %d)\n", Foffset, Ncb);
return -1;
}
#ifdef RM_DEBUG
printf("nr_rate_matching_ldpc_rx: Clear %d, E %u, Foffset %u, k0 %u, Ncb %u, rvidx %d, Tbslbrm %u\n",
clear,
E,
Foffset,
ind,
Ncb,
rvidx,
Tbslbrm);
#endif
if (clear == 1)
memset(d, 0, Ncb * sizeof(int16_t));
uint32_t k = 0;
if (ind < Foffset) {
int ind2 = ind + min(Foffset-ind,E);
RMLOOP;
}
if (ind >= Foffset && ind < Foffset + F)
ind = Foffset + F;
int ind2 = ind + min(Ncb-ind,E-k);
RMLOOP;
while (k < E) {
ind=0;
ind2 = min(Foffset,E-k);
RMLOOP;
ind = Foffset+F;
ind2 = ind + min(Ncb-ind,E-k);
RMLOOP;
}
return 0;
}
int nr_rate_matching_ldpc_rx(uint32_t Tbslbrm,
uint8_t BG,
uint16_t Z,
......@@ -622,6 +698,21 @@ int nr_rate_matching_ldpc_rx(uint32_t Tbslbrm,
uint32_t F,
uint32_t Foffset)
{
if (BG == 1) {
nr_rate_matching_ldpc_rx_simd(Tbslbrm,
BG,
Z,
d,
soft_input,
C,
rvidx,
clear,
E,
F,
Foffset);
return 0;
}
if (C == 0) {
LOG_E(PHY, "nr_rate_matching: invalid parameter C %d\n", C);
return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment