|
|
|
@ -36,10 +36,12 @@ void demod_16qam_lte_s_sse(const cf_t *symbols, short *llr, int nsymbols);
|
|
|
|
|
#define SCALE_SHORT_CONV_QPSK 100
|
|
|
|
|
#define SCALE_SHORT_CONV_QAM16 400
|
|
|
|
|
#define SCALE_SHORT_CONV_QAM64 700
|
|
|
|
|
#define SCALE_SHORT_CONV_QAM256 1000
|
|
|
|
|
|
|
|
|
|
#define SCALE_BYTE_CONV_QPSK 20
|
|
|
|
|
#define SCALE_BYTE_CONV_QAM16 30
|
|
|
|
|
#define SCALE_BYTE_CONV_QAM64 40
|
|
|
|
|
#define SCALE_BYTE_CONV_QAM256 50
|
|
|
|
|
|
|
|
|
|
void demod_bpsk_lte_b(const cf_t *symbols, int8_t *llr, int nsymbols) {
|
|
|
|
|
for (int i=0;i<nsymbols;i++) {
|
|
|
|
@ -408,6 +410,57 @@ void demod_64qam_lte_b(const cf_t *symbols, int8_t *llr, int nsymbols)
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void demod_256qam_lte(const cf_t* symbols, float* llr, int nsymbols)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < nsymbols; i++) {
|
|
|
|
|
float real = crealf(symbols[i]);
|
|
|
|
|
float imag = cimagf(symbols[i]);
|
|
|
|
|
|
|
|
|
|
llr[8 * i + 0] = -real;
|
|
|
|
|
llr[8 * i + 1] = -imag;
|
|
|
|
|
llr[8 * i + 2] = fabsf(real) - 8 / sqrt(170);
|
|
|
|
|
llr[8 * i + 3] = fabsf(imag) - 8 / sqrt(170);
|
|
|
|
|
llr[8 * i + 4] = fabsf(llr[8 * i + 2]) - 4 / sqrt(170);
|
|
|
|
|
llr[8 * i + 5] = fabsf(llr[8 * i + 3]) - 4 / sqrt(170);
|
|
|
|
|
llr[8 * i + 6] = fabsf(llr[8 * i + 4]) - 2 / sqrt(170);
|
|
|
|
|
llr[8 * i + 7] = fabsf(llr[8 * i + 5]) - 2 / sqrt(170);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void demod_256qam_lte_b(const cf_t* symbols, int8_t* llr, int nsymbols)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < nsymbols; i++) {
|
|
|
|
|
float real = SCALE_BYTE_CONV_QAM256 * crealf(symbols[i]);
|
|
|
|
|
float imag = SCALE_BYTE_CONV_QAM256 * cimagf(symbols[i]);
|
|
|
|
|
|
|
|
|
|
llr[8 * i + 0] = -real;
|
|
|
|
|
llr[8 * i + 1] = -imag;
|
|
|
|
|
llr[8 * i + 2] = fabsf(real) - SCALE_BYTE_CONV_QAM256 * 8 / sqrt(170);
|
|
|
|
|
llr[8 * i + 3] = fabsf(imag) - SCALE_BYTE_CONV_QAM256 * 8 / sqrt(170);
|
|
|
|
|
llr[8 * i + 4] = fabsf(llr[8 * i + 2]) - SCALE_BYTE_CONV_QAM256 * 4 / sqrt(170);
|
|
|
|
|
llr[8 * i + 5] = fabsf(llr[8 * i + 3]) - SCALE_BYTE_CONV_QAM256 * 4 / sqrt(170);
|
|
|
|
|
llr[8 * i + 6] = fabsf(llr[8 * i + 4]) - SCALE_BYTE_CONV_QAM256 * 2 / sqrt(170);
|
|
|
|
|
llr[8 * i + 7] = fabsf(llr[8 * i + 5]) - SCALE_BYTE_CONV_QAM256 * 2 / sqrt(170);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void demod_256qam_lte_s(const cf_t* symbols, short* llr, int nsymbols)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < nsymbols; i++) {
|
|
|
|
|
float real = SCALE_SHORT_CONV_QAM256 * crealf(symbols[i]);
|
|
|
|
|
float imag = SCALE_SHORT_CONV_QAM256 * cimagf(symbols[i]);
|
|
|
|
|
|
|
|
|
|
llr[8 * i + 0] = -real;
|
|
|
|
|
llr[8 * i + 1] = -imag;
|
|
|
|
|
llr[8 * i + 2] = fabsf(real) - SCALE_SHORT_CONV_QAM256 * 8 / sqrt(170);
|
|
|
|
|
llr[8 * i + 3] = fabsf(imag) - SCALE_SHORT_CONV_QAM256 * 8 / sqrt(170);
|
|
|
|
|
llr[8 * i + 4] = fabsf(llr[8 * i + 2]) - SCALE_SHORT_CONV_QAM256 * 4 / sqrt(170);
|
|
|
|
|
llr[8 * i + 5] = fabsf(llr[8 * i + 3]) - SCALE_SHORT_CONV_QAM256 * 4 / sqrt(170);
|
|
|
|
|
llr[8 * i + 6] = fabsf(llr[8 * i + 4]) - SCALE_SHORT_CONV_QAM256 * 2 / sqrt(170);
|
|
|
|
|
llr[8 * i + 7] = fabsf(llr[8 * i + 5]) - SCALE_SHORT_CONV_QAM256 * 2 / sqrt(170);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int srslte_demod_soft_demodulate(srslte_mod_t modulation, const cf_t* symbols, float* llr, int nsymbols) {
|
|
|
|
|
switch(modulation) {
|
|
|
|
|
case SRSLTE_MOD_BPSK:
|
|
|
|
@ -422,6 +475,9 @@ int srslte_demod_soft_demodulate(srslte_mod_t modulation, const cf_t* symbols, f
|
|
|
|
|
case SRSLTE_MOD_64QAM:
|
|
|
|
|
demod_64qam_lte(symbols, llr, nsymbols);
|
|
|
|
|
break;
|
|
|
|
|
case SRSLTE_MOD_256QAM:
|
|
|
|
|
demod_256qam_lte(symbols, llr, nsymbols);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ERROR("Invalid modulation %d\n", modulation);
|
|
|
|
|
return -1;
|
|
|
|
@ -443,6 +499,9 @@ int srslte_demod_soft_demodulate_s(srslte_mod_t modulation, const cf_t* symbols,
|
|
|
|
|
case SRSLTE_MOD_64QAM:
|
|
|
|
|
demod_64qam_lte_s(symbols, llr, nsymbols);
|
|
|
|
|
break;
|
|
|
|
|
case SRSLTE_MOD_256QAM:
|
|
|
|
|
demod_256qam_lte_s(symbols, llr, nsymbols);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ERROR("Invalid modulation %d\n", modulation);
|
|
|
|
|
return -1;
|
|
|
|
@ -464,6 +523,9 @@ int srslte_demod_soft_demodulate_b(srslte_mod_t modulation, const cf_t* symbols,
|
|
|
|
|
case SRSLTE_MOD_64QAM:
|
|
|
|
|
demod_64qam_lte_b(symbols, llr, nsymbols);
|
|
|
|
|
break;
|
|
|
|
|
case SRSLTE_MOD_256QAM:
|
|
|
|
|
demod_256qam_lte_b(symbols, llr, nsymbols);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ERROR("Invalid modulation %d\n", modulation);
|
|
|
|
|
return -1;
|
|
|
|
|