ldpc check based on crc

This commit is contained in:
laurent
2023-06-12 10:24:57 +02:00
parent 3645c96c09
commit 615324294b
16 changed files with 222 additions and 408 deletions
@@ -2728,41 +2728,25 @@ static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, int8_t* bnProcBuf, int8_t*
*/
static inline void nrLDPC_llr2bit(int8_t* out, int8_t* llrOut, uint16_t numLLR)
{
__m256i* p_llrOut = (__m256i*) llrOut;
__m256i* p_out = (__m256i*) out;
int8_t* p_llrOut8;
int8_t* p_out8;
uint32_t i;
uint32_t M = numLLR>>5;
uint32_t Mr = numLLR&31;
__m256i* p_llrOut = (__m256i*)llrOut;
__m256i* p_out = (__m256i*)out;
const int M = numLLR >> 5;
const int Mr = numLLR & 31;
const __m256i* p_zeros = (__m256i*) zeros256_epi8;
const __m256i* p_ones = (__m256i*) ones256_epi8;
const __m256i* p_zeros = (__m256i*)zeros256_epi8;
const __m256i* p_ones = (__m256i*)ones256_epi8;
for (i=0; i<M; i++)
{
*p_out++ = simde_mm256_and_si256(*p_ones, simde_mm256_cmpgt_epi8(*p_zeros, *p_llrOut));
p_llrOut++;
}
for (int i = 0; i < M; i++) {
*p_out++ = simde_mm256_and_si256(*p_ones, simde_mm256_cmpgt_epi8(*p_zeros, *p_llrOut));
p_llrOut++;
}
if (Mr > 0)
{
// Remaining LLRs that do not fit in multiples of 32 bytes
p_llrOut8 = (int8_t*) p_llrOut;
p_out8 = (int8_t*) p_out;
// Remaining LLRs that do not fit in multiples of 32 bytes
int8_t* p_llrOut8 = (int8_t*)p_llrOut;
int8_t* p_out8 = (int8_t*)p_out;
for (i=0; i<Mr; i++)
{
if (p_llrOut8[i] < 0)
{
p_out8[i] = 1;
}
else
{
p_out8[i] = 0;
}
}
}
for (int i = 0; i < Mr; i++)
p_out8[i] = p_llrOut8[i] < 0;
}
/**
@@ -2778,44 +2762,29 @@ static inline void nrLDPC_llr2bitPacked(int8_t* out, int8_t* llrOut, uint16_t nu
{
/** Vector of indices for shuffling input */
const uint8_t constShuffle_256_epi8[32] __attribute__ ((aligned(32))) = {7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
const __m256i* p_shuffle = (__m256i*)constShuffle_256_epi8;
__m256i* p_llrOut = (__m256i*) llrOut;
uint32_t* p_bits = (uint32_t*) out;
__m256i inPerm;
int8_t* p_llrOut8;
uint32_t bitsTmp = 0;
uint32_t i;
uint32_t M = numLLR>>5;
uint32_t Mr = numLLR&31;
const __m256i* p_shuffle = (__m256i*) constShuffle_256_epi8;
const uint32_t M = numLLR >> 5;
const uint32_t Mr = numLLR & 31;
for (i=0; i<M; i++)
{
// Move LSB to MSB on 8 bits
inPerm = simde_mm256_shuffle_epi8(*p_llrOut,*p_shuffle);
// Hard decision
*p_bits++ = simde_mm256_movemask_epi8(inPerm);
p_llrOut++;
for (uint32_t i = 0; i < M; i++) {
// Move LSB to MSB on 8 bits
const __m256i inPerm = simde_mm256_shuffle_epi8(*p_llrOut, *p_shuffle);
// Hard decision
*p_bits++ = simde_mm256_movemask_epi8(inPerm);
p_llrOut++;
}
if (Mr > 0)
{
// Remaining LLRs that do not fit in multiples of 32 bytes
p_llrOut8 = (int8_t*) p_llrOut;
for (i=0; i<Mr; i++)
{
if (p_llrOut8[i] < 0)
{
bitsTmp |= (1<<((7-i) + (16*(i/8))));
}
else
{
bitsTmp |= (0<<((7-i) + (16*(i/8))));
}
}
// Remaining LLRs that do not fit in multiples of 32 bytes
if (Mr) {
const int8_t* p_llrOut8 = (int8_t*)p_llrOut;
uint32_t bitsTmp = 0;
for (uint32_t i = 0; i < Mr; i++)
bitsTmp |= (p_llrOut8[i] < 0) << ((7 - i) + (16 * (i / 8)));
*p_bits = bitsTmp;
}
*p_bits = bitsTmp;
}
#endif