Fixed static analysis float/double conversion

This commit is contained in:
Xavier Arteaga 2019-12-02 10:11:42 +01:00 committed by Andre Puschmann
parent 41e911fd76
commit a51d989e2e
7 changed files with 19 additions and 21 deletions

View File

@ -1061,7 +1061,7 @@ void *plot_thread_run(void *arg) {
bzero(tmp_plot2, sizeof(float) * sz); bzero(tmp_plot2, sizeof(float) * sz);
int g = (sz - 12 * ue_dl.cell.nof_prb) / 2; int g = (sz - 12 * ue_dl.cell.nof_prb) / 2;
for (i = 0; i < 12 * ue_dl.cell.nof_prb; i++) { for (i = 0; i < 12 * ue_dl.cell.nof_prb; i++) {
tmp_plot2[g + i] = srslte_convert_amplitude_to_dB(cabs(ue_dl.chest_res.ce[0][0][i])); tmp_plot2[g + i] = srslte_convert_amplitude_to_dB(cabsf(ue_dl.chest_res.ce[0][0][i]));
if (isinf(tmp_plot2[g + i])) { if (isinf(tmp_plot2[g + i])) {
tmp_plot2[g + i] = -80; tmp_plot2[g + i] = -80;
} }

View File

@ -704,7 +704,7 @@ static int estimate_port(srslte_chest_dl_t* q,
/* Compute RSRP for the channel estimates in this port */ /* Compute RSRP for the channel estimates in this port */
if (cfg->rsrp_neighbour) { if (cfg->rsrp_neighbour) {
double energy = cabs(srslte_vec_acc_cc(q->pilot_estimates, npilots)/npilots); double energy = cabsf(srslte_vec_acc_cc(q->pilot_estimates, npilots) / npilots);
q->rsrp_corr[rxant_id][port_id] = energy * energy; q->rsrp_corr[rxant_id][port_id] = energy * energy;
} }
q->rsrp[rxant_id][port_id] = srslte_vec_avg_power_cf(q->pilot_recv_signal, npilots); q->rsrp[rxant_id][port_id] = srslte_vec_avg_power_cf(q->pilot_recv_signal, npilots);

View File

@ -130,8 +130,8 @@ int srslte_predecoding_single_sse(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_
cf_t r = 0; cf_t r = 0;
cf_t hh = 0; cf_t hh = 0;
for (int p=0;p<nof_rxant;p++) { for (int p=0;p<nof_rxant;p++) {
r += y[p][i]*conj(h[p][i]); r += y[p][i] * conjf(h[p][i]);
hh += conj(h[p][i])*h[p][i]; hh += conjf(h[p][i]) * h[p][i];
} }
x[i] = scaling*r/(hh+noise_estimate); x[i] = scaling*r/(hh+noise_estimate);
} }
@ -225,8 +225,8 @@ int srslte_predecoding_single_avx(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_
cf_t r = 0; cf_t r = 0;
cf_t hh = 0; cf_t hh = 0;
for (int p=0;p<nof_rxant;p++) { for (int p=0;p<nof_rxant;p++) {
r += y[p][i]*conj(h[p][i]); r += y[p][i] * conjf(h[p][i]);
hh += conj(h[p][i])*h[p][i]; hh += conjf(h[p][i]) * h[p][i];
} }
x[i] = r/((hh+noise_estimate) * scaling); x[i] = r/((hh+noise_estimate) * scaling);
} }
@ -240,8 +240,8 @@ int srslte_predecoding_single_gen(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_
cf_t r = 0; cf_t r = 0;
cf_t hh = 0; cf_t hh = 0;
for (int p=0;p<nof_rxant;p++) { for (int p=0;p<nof_rxant;p++) {
r += y[p][i]*conj(h[p][i]); r += y[p][i] * conjf(h[p][i]);
hh += conj(h[p][i])*h[p][i]; hh += conjf(h[p][i]) * h[p][i];
} }
x[i] = r / ((hh+noise_estimate) * scaling); x[i] = r / ((hh+noise_estimate) * scaling);
} }
@ -280,7 +280,7 @@ int srslte_predecoding_single_csi(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_
float hh = 0; float hh = 0;
float norm = 1.0f / scaling; float norm = 1.0f / scaling;
for (int p = 0; p < nof_rxant; p++) { for (int p = 0; p < nof_rxant; p++) {
r += y[p][i] * conj(h[p][i]); r += y[p][i] * conjf(h[p][i]);
hh += (__real__ h[p][i] * __real__ h[p][i]) + (__imag__ h[p][i] * __imag__ h[p][i]); hh += (__real__ h[p][i] * __real__ h[p][i]) + (__imag__ h[p][i] * __imag__ h[p][i]);
} }
csi[i] = hh + noise_estimate; csi[i] = hh + noise_estimate;
@ -373,7 +373,7 @@ int srslte_predecoding_diversity_gen_(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_
hh = 1e-4; hh = 1e-4;
} }
x0 += (conjf(h00) * r0 + h11 * conjf(r1)); x0 += (conjf(h00) * r0 + h11 * conjf(r1));
x1 += (-h10 * conj(r0) + conj(h01) * r1); x1 += (-h10 * conjf(r0) + conjf(h01) * r1);
} }
hh *= scaling; hh *= scaling;
x[0][i] = x0 / hh * M_SQRT2; x[0][i] = x0 / hh * M_SQRT2;
@ -585,7 +585,7 @@ int srslte_predecoding_diversity_csi(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_M
hh = 1e-4; hh = 1e-4;
} }
x0 += (conjf(h00) * r0 + h11 * conjf(r1)); x0 += (conjf(h00) * r0 + h11 * conjf(r1));
x1 += (-h10 * conj(r0) + conj(h01) * r1); x1 += (-h10 * conjf(r0) + conjf(h01) * r1);
} }
csi[0][2*i + 0] = hh; csi[0][2*i + 0] = hh;

View File

@ -198,38 +198,36 @@ int srslte_pmch_init(srslte_pmch_t* q, uint32_t max_prb, uint32_t nof_rx_antenna
} }
void srslte_pmch_free(srslte_pmch_t *q) { void srslte_pmch_free(srslte_pmch_t *q) {
uint16_t i;
if (q->e) { if (q->e) {
free(q->e); free(q->e);
} }
if (q->d) { if (q->d) {
free(q->d); free(q->d);
} }
for (i = 0; i < SRSLTE_MAX_PORTS; i++) { for (uint32_t i = 0; i < SRSLTE_MAX_PORTS; i++) {
if (q->x[i]) { if (q->x[i]) {
free(q->x[i]); free(q->x[i]);
} }
for (int j=0;j<q->nof_rx_antennas;j++) { for (uint32_t j = 0; j < q->nof_rx_antennas; j++) {
if (q->ce[i][j]) { if (q->ce[i][j]) {
free(q->ce[i][j]); free(q->ce[i][j]);
} }
} }
} }
for (i=0;i<q->nof_rx_antennas;i++) { for (uint32_t i = 0; i < q->nof_rx_antennas; i++) {
if (q->symbols[i]) { if (q->symbols[i]) {
free(q->symbols[i]); free(q->symbols[i]);
} }
} }
if (q->seqs) { if (q->seqs) {
for (i=0; i<SRSLTE_MAX_MBSFN_AREA_IDS; i++) { for (uint32_t i = 0; i < SRSLTE_MAX_MBSFN_AREA_IDS; i++) {
if (q->seqs[i]) { if (q->seqs[i]) {
srslte_pmch_free_area_id(q, i); srslte_pmch_free_area_id(q, i);
} }
} }
free(q->seqs); free(q->seqs);
} }
for (i = 0; i < 4; i++) { for (uint32_t i = 0; i < 4; i++) {
srslte_modem_table_free(&q->mod[i]); srslte_modem_table_free(&q->mod[i]);
} }

View File

@ -616,6 +616,6 @@ float srslte_pss_cfo_compute(srslte_pss_t* q, const cf_t *pss_recv) {
y0 = srslte_vec_dot_prod_ccc(q->pss_signal_time[q->N_id_2], pss_ptr, q->fft_size/2); y0 = srslte_vec_dot_prod_ccc(q->pss_signal_time[q->N_id_2], pss_ptr, q->fft_size/2);
y1 = srslte_vec_dot_prod_ccc(&q->pss_signal_time[q->N_id_2][q->fft_size/2], &pss_ptr[q->fft_size/2], q->fft_size/2); y1 = srslte_vec_dot_prod_ccc(&q->pss_signal_time[q->N_id_2][q->fft_size/2], &pss_ptr[q->fft_size/2], q->fft_size/2);
return carg(conjf(y0) * y1)/M_PI; return cargf(conjf(y0) * y1) / M_PI;
} }

View File

@ -574,7 +574,7 @@ static float cfo_cp_estimate(srslte_sync_t *q, const cf_t *input)
uint32_t cp_offset = 0; uint32_t cp_offset = 0;
cp_offset = srslte_cp_synch(&q->cp_synch, input, q->max_offset, q->cfo_cp_nsymbols, SRSLTE_CP_LEN_NORM(1,q->fft_size)); cp_offset = srslte_cp_synch(&q->cp_synch, input, q->max_offset, q->cfo_cp_nsymbols, SRSLTE_CP_LEN_NORM(1,q->fft_size));
cf_t cp_corr_max = srslte_cp_synch_corr_output(&q->cp_synch, cp_offset); cf_t cp_corr_max = srslte_cp_synch_corr_output(&q->cp_synch, cp_offset);
float cfo = -carg(cp_corr_max) / M_PI / 2; float cfo = -cargf(cp_corr_max) / M_PI / 2;
return cfo; return cfo;
} }

View File

@ -260,7 +260,7 @@ float cfo_estimate_nbiot(srslte_sync_nbiot_t* q, cf_t* input)
cp_offset = cp_offset =
srslte_cp_synch(&q->cp_synch, input, q->max_offset, SRSLTE_NPSS_CFO_NUM_SYMS, SRSLTE_CP_LEN_NORM(1, q->fft_size)); srslte_cp_synch(&q->cp_synch, input, q->max_offset, SRSLTE_NPSS_CFO_NUM_SYMS, SRSLTE_CP_LEN_NORM(1, q->fft_size));
cf_t cp_corr_max = srslte_cp_synch_corr_output(&q->cp_synch, cp_offset); cf_t cp_corr_max = srslte_cp_synch_corr_output(&q->cp_synch, cp_offset);
float cfo = -carg(cp_corr_max) / M_PI / 2; float cfo = -cargf(cp_corr_max) / M_PI / 2;
return cfo; return cfo;
} }