From b4aa58e0c03e6f7367650bc973ccfebc9df69670 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sun, 9 Sep 2018 09:18:15 +0200 Subject: [PATCH] removed some computations which are repeated in a loop (updateLLR) --- .../CODING/nrPolar_tools/nr_polar_decoder.c | 3 +- .../nrPolar_tools/nr_polar_decoding_tools.c | 44 ++++++++++--------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c index b24c78495b..6243d281c9 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c @@ -105,8 +105,9 @@ int8_t polar_decoder( int16_t checkCrcBits=-1; uint8_t listIndex[2*listSize], copyIndex; + // for (uint8_t i = 0; i < 2*listSize; i++) listIndex[i]=i; for (uint16_t currentBit=0; currentBitN; currentBit++){ - printf("***************** BIT %d\n",currentBit); + // printf("***************** BIT %d\n",currentBit); updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1), pathMetricAppr); if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit. diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index 58292c236a..2c586d8f7d 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -20,29 +20,33 @@ */ #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" -#define SHOWCOMP 1 +//#define SHOWCOMP 1 void updateLLR(double ***llr, uint8_t **llrU, uint8_t ***bit, uint8_t **bitU, - uint8_t listSize, uint16_t row, uint16_t col, uint16_t xlen, uint8_t ylen, uint8_t approximation) { - uint16_t offset = (xlen/(pow(2,(ylen-col-1)))); - for (uint8_t i=0; i= offset ) { - if(bitU[row-offset][col]==0) updateBit(bit, bitU, listSize, (row-offset), col, xlen, ylen); - if(llrU[row-offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row-offset), (col+1), xlen, ylen, approximation); - if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen, approximation); -#ifdef SHOWCOMP - printf("updating LLR (%d,%d,%d) (bit %d,%d,%d, llr0 %d,%d,%d, llr1 %d,%d,%d \n",row,col,i, - row-offset,col,i,row-offset,col+1,i,row,col+1,i); -#endif - llr[row][col][i] = (pow((-1),bit[row-offset][col][i])*llr[row-offset][col+1][i]) + llr[row][col+1][i]; - } else { - if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen, approximation); - if(llrU[row+offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row+offset), (col+1), xlen, ylen, approximation); - computeLLR(llr, row, col, i, offset, approximation); - } - } + uint8_t listSize, uint16_t row, uint16_t col, uint16_t xlen, uint8_t ylen, uint8_t approximation) { + uint16_t offset = (xlen/(1<<(ylen-col-1))); + if (( (row) % (2*offset) ) >= offset ) { + if (bitU[row-offset][col]==0) updateBit(bit, bitU, listSize, (row-offset), col, xlen, ylen); + if (llrU[row-offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row-offset), (col+1), xlen, ylen, approximation); + if (llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen, approximation); + for (uint8_t i=0; i