Commit ee1ea7e5 authored by knopp's avatar knopp

small simplification in computeLLR

parent b4aa58e0
......@@ -41,9 +41,8 @@ void updateLLR(double ***llr, uint8_t **llrU, uint8_t ***bit, uint8_t **bitU,
} 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);
for (uint8_t i=0; i<listSize; i++) {
computeLLR(llr, row, col, i, offset, approximation);
}
computeLLR(llr, row, col, listSize, offset, approximation);
}
llrU[row][col]=1;
......@@ -153,20 +152,26 @@ void updatePathMetric2(double *pathMetric, double ***llr, uint8_t listSize, uint
}
}
void computeLLR(double ***llr, uint16_t row, uint16_t col, uint8_t i,
uint16_t offset, uint8_t approximation) {
inline void computeLLR(double ***llr, uint16_t row, uint16_t col, uint8_t listSize,
uint16_t offset, uint8_t approximation) __attribute__((always_inline)) {
double *a = llr[row][col + 1];
double *b = llr[row + offset][col + 1];
double absA,absB;
double a = llr[row][col + 1][i];
double absA = fabs(a);
double b = llr[row + offset][col + 1][i];
double absB = fabs(b);
#ifdef SHOWCOMP
printf("computeLLR (%d,%d,%d,%d)\n",row,col,offset,i);
#endif
if (approximation || isinf(absA) || isinf(absB)) { //eq. (9)
llr[row][col][i] = copysign(1.0, a) * copysign(1.0, b) * fmin(absA, absB);
if (approximation) { //eq. (9)
for (int i=0;i<listSize;i++) {
absA = fabs(a[i]);
absB = fabs(b[i]);
llr[row][col][i] = copysign(1.0, a[i]) * copysign(1.0, b[i]) * fmin(absA, absB);
}
} else { //eq. (8a)
llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b)));
for (int i=0;i<listSize;i++)
llr[row][col][i] = log((exp(a[i] + b[i]) + 1) / (exp(a[i]) + exp(b[i])));
}
}
......
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