Fixed bug in channel estimation test

This commit is contained in:
ismagom 2014-07-06 21:59:12 +02:00
parent 2b291be6b0
commit 561a2abd53
2 changed files with 10 additions and 6 deletions

View File

@ -104,6 +104,7 @@ int chest_ce_ref(chest_t *q, cf_t *input, uint32_t nslot, uint32_t port_id, uint
if (nref < q->refsignal[port_id][nslot].nof_refs) {
fidx = q->refsignal[port_id][nslot].refs[nref].freq_idx; // reference frequency index
tidx = q->refsignal[port_id][nslot].refs[nref].time_idx; // reference time index
known_ref = q->refsignal[port_id][nslot].refs[nref].simbol;
channel_ref = input[tidx * q->nof_re + fidx];
q->refsignal[port_id][nslot].refs[nref].recv_simbol = channel_ref;
@ -129,7 +130,7 @@ int chest_ce_ref(chest_t *q, cf_t *input, uint32_t nslot, uint32_t port_id, uint
* Saves the nof_prb * 12 * nof_symbols channel estimates in the array ce
*/
int chest_ce_slot_port(chest_t *q, cf_t *input, cf_t *ce, uint32_t nslot, uint32_t port_id) {
int i, j;
uint32_t i, j;
cf_t x[2], y[MAX_NSYMB];
int ret = LIBLTE_ERROR_INVALID_INPUTS;
@ -228,7 +229,7 @@ int chest_init(chest_t *q, chest_interp_t interp, uint32_t nof_re, uint32_t nof_
int ret = LIBLTE_ERROR_INVALID_INPUTS;
if (q != NULL &&
nof_ports < MAX_PORTS)
nof_ports <= MAX_PORTS)
{
bzero(q, sizeof(chest_t));
@ -263,7 +264,7 @@ int chest_ref_LTEDL_slot_port(chest_t *q, uint32_t nslot, uint32_t port_id, lte_
int ret = LIBLTE_ERROR_INVALID_INPUTS;
if (q != NULL &&
port_id < MAX_PORTS &&
port_id < MAX_PORTS &&
nslot < NSLOTS_X_FRAME)
{
ret = refsignal_init_LTEDL(&q->refsignal[port_id][nslot], port_id, nslot, cell);

View File

@ -123,9 +123,7 @@ int main(int argc, char **argv) {
int max_cid;
FILE *fmatlab = NULL;
float mse_mag, mse_phase;
lte_cell_t cell;
cell.nof_ports = 1;
parse_args(argc,argv);
if (output_matlab) {
@ -161,7 +159,7 @@ int main(int argc, char **argv) {
cid = cell.id;
max_cid = cell.id;
}
while(cid <= max_cid) {
cell.id = cid;
if (chest_init_LTEDL(&eq, LINEAR, cell)) {
@ -172,6 +170,11 @@ int main(int argc, char **argv) {
for (n_slot=0;n_slot<NSLOTS_X_FRAME;n_slot++) {
for (n_port=0;n_port<cell.nof_ports;n_port++) {
if (refsignal_init_LTEDL(&refs, n_port, n_slot, cell)) {
fprintf(stderr, "Error initiating CRS slot=%d\n", i);
return -1;
}
bzero(input, sizeof(cf_t) * num_re);
for (i=0;i<num_re;i++) {
input[i] = 0.5-rand()/RAND_MAX+I*(0.5-rand()/RAND_MAX);