Simple LLR generation assuming AWGN and QPSK */
| 1794 | |
| 1795 | /* Simple LLR generation assuming AWGN and QPSK */ |
| 1796 | static void |
| 1797 | gen_turbo_llr(int8_t *llrs, uint32_t j, double N0, double llr_max) |
| 1798 | { |
| 1799 | double b, b1, n; |
| 1800 | double coeff = 2.0 * sqrt(N0); |
| 1801 | |
| 1802 | /* Ignore in vectors null LLRs not to be saturated */ |
| 1803 | if (llrs[j] == 0) |
| 1804 | return; |
| 1805 | |
| 1806 | /* Note don't change sign here */ |
| 1807 | n = randn(j % 2); |
| 1808 | b1 = ((llrs[j] > 0 ? 2.0 : -2.0) |
| 1809 | + coeff * n) / N0; |
| 1810 | b = b1 * (1 << 4); |
| 1811 | b = round(b); |
| 1812 | if (b > llr_max) |
| 1813 | b = llr_max; |
| 1814 | if (b < -llr_max) |
| 1815 | b = -llr_max; |
| 1816 | llrs[j] = (int8_t) b; |
| 1817 | } |
| 1818 | |
| 1819 | /* Generate LLR for a given SNR */ |
| 1820 | static void |
no test coverage detected