/* Static Prototypes */
static void matrix_vector_multiply(struct OFDM *, complex float *, complex float *);
-static void matrix_vector_conjugate_multiply(struct OFDM *, complex float *, int, complex float *);
+static void matrix_vector_conjugate_multiply(struct OFDM *, complex float *, complex float *);
static complex float vector_sum(complex float *, int, int);
static complex float vector_conjugate_sum(complex float *, int, int);
static complex float qpsk_mod(int *);
static void qpsk_demod(complex float symbol, int *bits) {
complex float rotate = symbol * cexpf(I * (M_PI / 4.0f));
- bits[1] = crealf(rotate) < 0.0f;
- bits[0] = cimagf(rotate) < 0.0f;
+ bits[0] = crealf(rotate) < 0.0f;
+ bits[1] = cimagf(rotate) < 0.0f;
}
/* convert frequency domain into time domain */
/* convert time domain into frequency domain */
-static void matrix_vector_conjugate_multiply(struct OFDM *ofdm, complex float *result, int index, complex float *vector) {
+static void matrix_vector_conjugate_multiply(struct OFDM *ofdm, complex float *result, complex float *vector) {
int row, col;
for (col = 0; col < (OFDM_NC + 2); col++) {
result[col] = 0.0f + 0.0f * I;
for (row = 0; row < OFDM_M; row++) {
- result[col] += (vector[row] * conjf(ofdm->W[index][row])); /* complex result */
+ result[col] += (vector[row] * conjf(ofdm->W[col][row])); /* complex result */
}
}
}
// UNTESTED
void ofdm_demod(struct OFDM *ofdm, int *rx_bits, COMP *rxbuf_in) {
- complex float acarrier[OFDM_NC + 2];
complex float aphase_est_pilot_rect;
float aphase_est_pilot[OFDM_NC + 2];
float aamp_est_pilot[OFDM_NC + 2];
work[k] = ofdm->rxbuf[j] * cexpf(-I * woff_est * j);
}
- for (i = 0; i < (OFDM_NC + 2); i++) {
- matrix_vector_conjugate_multiply(ofdm, acarrier, i, work);
- ofdm->rx_sym[0][i] = vector_sum(acarrier, 0, (OFDM_NC + 2));
- }
+ matrix_vector_conjugate_multiply(ofdm, ofdm->rx_sym[0], work);
/* pilot - this frame - pilot */
work[k] = ofdm->rxbuf[j] * cexpf(-I * woff_est * j);
}
- for (i = 0; i < (OFDM_NC + 2); i++) {
- matrix_vector_conjugate_multiply(ofdm, acarrier, i, work);
- ofdm->rx_sym[rr + 1][i] = vector_sum(acarrier, 0, (OFDM_NC + 2));
- }
+ matrix_vector_conjugate_multiply(ofdm, ofdm->rx_sym[rr + 1], work);
}
/* next pilot */
work[k] = ofdm->rxbuf[j] * cexpf(-I * woff_est * j);
}
- for (i = 0; i < (OFDM_NC + 2); i++) {
- matrix_vector_conjugate_multiply(ofdm, acarrier, i, work);
- ofdm->rx_sym[(OFDM_NS + 2)][i] = vector_sum(acarrier, 0, (OFDM_NC + 2));
- }
+ matrix_vector_conjugate_multiply(ofdm, ofdm->rx_sym[OFDM_NS + 2], work);
/* est freq err based on all carriers ------------------------------------ */