| 1770 | } |
| 1771 | |
| 1772 | static void |
| 1773 | gen_qm2_llr(int8_t *llrs, uint32_t j, double N0, double llr_max) |
| 1774 | { |
| 1775 | double b, b1, n; |
| 1776 | double coeff = 2.0 * sqrt(N0); |
| 1777 | |
| 1778 | /* Ignore in vectors rare quasi null LLRs not to be saturated */ |
| 1779 | if (llrs[j] < 8 && llrs[j] > -8) |
| 1780 | return; |
| 1781 | |
| 1782 | /* Note don't change sign here */ |
| 1783 | n = randn(j % 2); |
| 1784 | b1 = ((llrs[j] > 0 ? 2.0 : -2.0) |
| 1785 | + coeff * n) / N0; |
| 1786 | b = b1 * (1 << ldpc_llr_decimals); |
| 1787 | b = round(b); |
| 1788 | if (b > llr_max) |
| 1789 | b = llr_max; |
| 1790 | if (b < -llr_max) |
| 1791 | b = -llr_max; |
| 1792 | llrs[j] = (int8_t) b; |
| 1793 | } |
| 1794 | |
| 1795 | /* Simple LLR generation assuming AWGN and QPSK */ |
| 1796 | static void |
no test coverage detected