|
|
@ -50,7 +50,6 @@
|
|
|
|
* \param S Soft demapping auxiliary matrix
|
|
|
|
* \param S Soft demapping auxiliary matrix
|
|
|
|
* \param sigma2 Noise vatiance
|
|
|
|
* \param sigma2 Noise vatiance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
/* Note: Optimized implementation of approximate LLR algorithm, July 2014*/
|
|
|
|
|
|
|
|
void llr_approx(const _Complex float *in, float *out, int N, int M, int B,
|
|
|
|
void llr_approx(const _Complex float *in, float *out, int N, int M, int B,
|
|
|
|
_Complex float *symbols, uint32_t (*S)[6][32], float sigma2) {
|
|
|
|
_Complex float *symbols, uint32_t (*S)[6][32], float sigma2) {
|
|
|
|
int i, s, b;
|
|
|
|
int i, s, b;
|
|
|
@ -59,7 +58,7 @@ void llr_approx(const _Complex float *in, float *out, int N, int M, int B,
|
|
|
|
float x, y, d[64];
|
|
|
|
float x, y, d[64];
|
|
|
|
|
|
|
|
|
|
|
|
for (s=0; s<N; s++) { /* recevied symbols */
|
|
|
|
for (s=0; s<N; s++) { /* recevied symbols */
|
|
|
|
/* Compute exp{·} of the distances between received symbol and all constallation symbols */
|
|
|
|
/* Compute the distances squared d[i] between the received symbol and all constellation points */
|
|
|
|
for (i=0; i<M; i++) {
|
|
|
|
for (i=0; i<M; i++) {
|
|
|
|
x = __real__ in[s] - __real__ symbols[i];
|
|
|
|
x = __real__ in[s] - __real__ symbols[i];
|
|
|
|
y = __imag__ in[s] - __imag__ symbols[i];
|
|
|
|
y = __imag__ in[s] - __imag__ symbols[i];
|
|
|
@ -71,8 +70,9 @@ void llr_approx(const _Complex float *in, float *out, int N, int M, int B,
|
|
|
|
num = d[S[0][b][0]];
|
|
|
|
num = d[S[0][b][0]];
|
|
|
|
den = d[S[1][b][0]];
|
|
|
|
den = d[S[1][b][0]];
|
|
|
|
|
|
|
|
|
|
|
|
/* half the constellation symbols have '1'|'0' at any bit pos. */
|
|
|
|
/* Minimum distance squared search between recevied symbol and a constellation point with a
|
|
|
|
for (i=1; i<M/2; i++) {
|
|
|
|
'1' and a '0' for each bit position */
|
|
|
|
|
|
|
|
for (i=1; i<M/2; i++) { /* half the constellation points have '1'|'0' at any given bit position */
|
|
|
|
if (d[S[0][b][i]] < num) {
|
|
|
|
if (d[S[0][b][i]] < num) {
|
|
|
|
num = d[S[0][b][i]];
|
|
|
|
num = d[S[0][b][i]];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -106,7 +106,6 @@ void llr_approx(const _Complex float *in, float *out, int N, int M, int B,
|
|
|
|
* \param S Soft demapping auxiliary matrix
|
|
|
|
* \param S Soft demapping auxiliary matrix
|
|
|
|
* \param sigma2 Noise vatiance
|
|
|
|
* \param sigma2 Noise vatiance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
/* Note: Optimized implementation of exact LLR algorithm, July 2014*/
|
|
|
|
|
|
|
|
void llr_exact(const _Complex float *in, float *out, int N, int M, int B,
|
|
|
|
void llr_exact(const _Complex float *in, float *out, int N, int M, int B,
|
|
|
|
_Complex float *symbols, uint32_t (*S)[6][32], float sigma2) {
|
|
|
|
_Complex float *symbols, uint32_t (*S)[6][32], float sigma2) {
|
|
|
|
int i, s, b;
|
|
|
|
int i, s, b;
|
|
|
@ -115,19 +114,20 @@ void llr_exact(const _Complex float *in, float *out, int N, int M, int B,
|
|
|
|
float x, y, d[64];
|
|
|
|
float x, y, d[64];
|
|
|
|
|
|
|
|
|
|
|
|
for (s=0; s<N; s++) { /* recevied symbols */
|
|
|
|
for (s=0; s<N; s++) { /* recevied symbols */
|
|
|
|
/* Compute exp{·} of the distances between received symbol and all constallation symbols */
|
|
|
|
/* Compute exp{·} of the distances squared d[i] between the received symbol and all constellation points */
|
|
|
|
for (i=0; i<M; i++) {
|
|
|
|
for (i=0; i<M; i++) {
|
|
|
|
x = __real__ in[s] - __real__ symbols[i];
|
|
|
|
x = __real__ in[s] - __real__ symbols[i];
|
|
|
|
y = __imag__ in[s] - __imag__ symbols[i];
|
|
|
|
y = __imag__ in[s] - __imag__ symbols[i];
|
|
|
|
d[i] = exp(-1*(x*x + y*y)/sigma2);
|
|
|
|
d[i] = exp(-1*(x*x + y*y)/sigma2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Sum up the corresponding d[i]'s for each bit position */
|
|
|
|
for (b=0; b<B; b++) {/* bits per symbol*/
|
|
|
|
for (b=0; b<B; b++) {/* bits per symbol*/
|
|
|
|
/* initiate num[b] and den[b] */
|
|
|
|
/* initiate num[b] and den[b] */
|
|
|
|
num = 0;
|
|
|
|
num = 0;
|
|
|
|
den = 0;
|
|
|
|
den = 0;
|
|
|
|
/* half the constellation symbols have '1'|'0' at any bit pos. */
|
|
|
|
|
|
|
|
for (i=0; i<M/2; i++) {
|
|
|
|
for (i=0; i<M/2; i++) { /* half the constellation points have '1'|'0' at any given bit position */
|
|
|
|
num += d[S[0][b][i]];
|
|
|
|
num += d[S[0][b][i]];
|
|
|
|
den += d[S[1][b][i]];
|
|
|
|
den += d[S[1][b][i]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|