Fix more Coverity issues in the PHY lib

CID 369560 Missing unlock, in dft_fftw.c
CID 363710 Logically dead code, in resampler.c
CID 55097 Result is not floating point, in chest_test_dl.c
CID 351020 Result is not floating point, in chest_nbiot_test_dl.c
master
joaquim-SRS 3 years ago committed by Andre Puschmann
parent 3b1131936e
commit 9b74e3429c

@ -145,7 +145,7 @@ int main(int argc, char** argv)
for (int n_port = 0; n_port < cell.base.nof_ports; n_port++) { for (int n_port = 0; n_port < cell.base.nof_ports; n_port++) {
srsran_vec_cf_zero(input, num_re); srsran_vec_cf_zero(input, num_re);
for (int i = 0; i < num_re; i++) { for (int i = 0; i < num_re; i++) {
input[i] = 0.5 - rand() / RAND_MAX + I * (0.5 - rand() / RAND_MAX); input[i] = 0.5 - rand() / (float)RAND_MAX + I * (0.5 - rand() / (float)RAND_MAX);
} }
srsran_vec_cf_zero(ce, num_re); srsran_vec_cf_zero(ce, num_re);

@ -137,7 +137,7 @@ int main(int argc, char** argv)
for (uint32_t n_port = 0; n_port < cell.nof_ports; n_port++) { for (uint32_t n_port = 0; n_port < cell.nof_ports; n_port++) {
srsran_vec_cf_zero(input, num_re); srsran_vec_cf_zero(input, num_re);
for (i = 0; i < num_re; i++) { for (i = 0; i < num_re; i++) {
input[i] = 0.5 - rand() / RAND_MAX + I * (0.5 - rand() / RAND_MAX); input[i] = 0.5 - rand() / (float)RAND_MAX + I * (0.5 - rand() / (float)RAND_MAX);
} }
srsran_vec_cf_zero(ce, num_re); srsran_vec_cf_zero(ce, num_re);

@ -209,6 +209,7 @@ int srsran_dft_plan_guru_c(srsran_dft_plan_t* plan,
plan->p = fftwf_plan_guru_dft(1, &iodim, 1, &howmany_dims, in_buffer, out_buffer, sign, FFTW_TYPE); plan->p = fftwf_plan_guru_dft(1, &iodim, 1, &howmany_dims, in_buffer, out_buffer, sign, FFTW_TYPE);
if (!plan->p) { if (!plan->p) {
pthread_mutex_unlock(&fft_mutex);
return -1; return -1;
} }
pthread_mutex_unlock(&fft_mutex); pthread_mutex_unlock(&fft_mutex);

@ -234,31 +234,27 @@ static void resampler_fft_decimate(srsran_resampler_fft_t* q, const cf_t* input,
while (count < nsamples) { while (count < nsamples) {
uint32_t n = SRSRAN_MIN(q->window_sz, nsamples - count); uint32_t n = SRSRAN_MIN(q->window_sz, nsamples - count);
if (input) { // Copy input samples
// Copy input samples srsran_vec_cf_copy(q->in_buffer, &input[count], n);
srsran_vec_cf_copy(q->in_buffer, &input[count], n);
// Pad zeroes
srsran_vec_cf_zero(&q->in_buffer[n], q->fft.size - n);
// Execute FFT // Pad zeroes
srsran_dft_run_guru_c(&q->fft); srsran_vec_cf_zero(&q->in_buffer[n], q->fft.size - n);
// Apply filter // Execute FFT
srsran_vec_prod_ccc(q->out_buffer, q->filter, q->out_buffer, q->fft.size); srsran_dft_run_guru_c(&q->fft);
// Decimate // Apply filter
srsran_vec_cf_copy(q->in_buffer, q->out_buffer, q->ifft.size); srsran_vec_prod_ccc(q->out_buffer, q->filter, q->out_buffer, q->fft.size);
for (uint32_t i = 1; i < q->ratio; i++) {
srsran_vec_sum_ccc(&q->out_buffer[q->ifft.size * i], q->in_buffer, q->in_buffer, q->ifft.size);
}
// Execute iFFT // Decimate
srsran_dft_run_guru_c(&q->ifft); srsran_vec_cf_copy(q->in_buffer, q->out_buffer, q->ifft.size);
} else { for (uint32_t i = 1; i < q->ratio; i++) {
srsran_vec_cf_zero(q->out_buffer, q->ifft.size); srsran_vec_sum_ccc(&q->out_buffer[q->ifft.size * i], q->in_buffer, q->in_buffer, q->ifft.size);
} }
// Execute iFFT
srsran_dft_run_guru_c(&q->ifft);
// Add previous state // Add previous state
srsran_vec_sum_ccc(q->out_buffer, q->state, q->out_buffer, q->state_len); srsran_vec_sum_ccc(q->out_buffer, q->state, q->out_buffer, q->state_len);

Loading…
Cancel
Save