From: okcsampson Date: Mon, 12 Jun 2017 02:22:06 +0000 (+0000) Subject: Change W row/col X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=3342b80068948a0fdfc33dc138f187519306786a;p=freetel-svn-tracking.git Change W row/col git-svn-id: https://svn.code.sf.net/p/freetel/code@3181 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/ofdm.c b/codec2-dev/src/ofdm.c index 5cb26115..2dc247a1 100644 --- a/codec2-dev/src/ofdm.c +++ b/codec2-dev/src/ofdm.c @@ -82,7 +82,7 @@ static void matrix_vector_multiply(struct OFDM *ofdm, complex float *result, com result[row] = 0.0f + 0.0f * I; for (col = 0; col < (OFDM_NC + 2); col++) { - result[row] += (vector[col] * (ofdm->W[row][col] / (float) OFDM_M)); /* complex result */ + result[row] += (vector[col] * (ofdm->W[col][row] / (float) OFDM_M)); /* complex result */ } } } @@ -238,9 +238,9 @@ struct OFDM *ofdm_create() { ofdm->w[i] = j * TAU * OFDM_RS / OFDM_FS; } - for (i = 0; i < OFDM_M; i++) { - for (j = 0; j < (OFDM_NC + 2); j++) { - ofdm->W[i][j] = cexpf(I * ofdm->w[j] * i); + for (i = 0; i < (OFDM_NC + 2); i++) { + for (j = 0; j < OFDM_M; j++) { + ofdm->W[i][j] = cexpf(I * ofdm->w[i] * j); } } diff --git a/codec2-dev/src/ofdm_internal.h b/codec2-dev/src/ofdm_internal.h index fa966f6b..b01241f5 100644 --- a/codec2-dev/src/ofdm_internal.h +++ b/codec2-dev/src/ofdm_internal.h @@ -64,7 +64,7 @@ struct OFDM { bool phase_est_en; complex float rate_fs_pilot_samples[OFDM_M + OFDM_NCP]; - complex float W[OFDM_M][OFDM_NC + 2]; + complex float W[OFDM_NC + 2][OFDM_M]; complex float rxbuf[OFDM_RXBUF]; complex float pilots[OFDM_NC + 2]; float w[OFDM_NC + 2]; diff --git a/codec2-dev/unittest/tofdm.c b/codec2-dev/unittest/tofdm.c index b6936b06..61e3a3dc 100644 --- a/codec2-dev/unittest/tofdm.c +++ b/codec2-dev/unittest/tofdm.c @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) fout = fopen("tofdm_out.txt","wt"); assert(fout != NULL); fprintf(fout, "# Created by tofdm.c\n"); - octave_save_complex(fout, "W_c", (COMP*)ofdm->W, OFDM_M, OFDM_NC + 2, OFDM_NC + 2); + octave_save_complex(fout, "W_c", (COMP*)ofdm->W, OFDM_NC + 2, OFDM_M, OFDM_M); octave_save_int(fout, "tx_bits_log_c", tx_bits_log, 1, OFDM_BITSPERFRAME*FRAMES); octave_save_complex(fout, "tx_log_c", (COMP*)tx_log, 1, OFDM_SAMPLESPERFRAME*FRAMES, OFDM_SAMPLESPERFRAME*FRAMES); fclose(fout);