Fix more issues in PHY lib

Fix variable shadowing issues in chest_test
Fix mutex unlock position in dft_fftw.c
CID 371598 Out of bounds access, in ssb_decode_test.c
This commit is contained in:
joaquim-SRS 2021-10-27 11:50:27 +02:00 committed by Andre Puschmann
parent 9b74e3429c
commit 00b82bc772
4 changed files with 15 additions and 7 deletions

View File

@ -163,7 +163,7 @@ int main(int argc, char** argv)
struct timeval t[3];
gettimeofday(&t[1], NULL);
for (int j = 0; j < 100; j++) {
for (int k = 0; k < 100; k++) {
srsran_chest_dl_estimate(&est, &sf_cfg, input_m, &res);
}
gettimeofday(&t[2], NULL);
@ -171,7 +171,7 @@ int main(int argc, char** argv)
printf("CHEST: %f us\n", (float)t[0].tv_usec / 100);
gettimeofday(&t[1], NULL);
for (int j = 0; j < 100; j++) {
for (int k = 0; k < 100; k++) {
srsran_predecoding_single(input, ce, output, NULL, num_re, 1.0f, 0);
}
gettimeofday(&t[2], NULL);
@ -186,7 +186,7 @@ int main(int argc, char** argv)
printf("MSE: %f\n", mse);
gettimeofday(&t[1], NULL);
for (int j = 0; j < 100; j++) {
for (int k = 0; k < 100; k++) {
srsran_predecoding_single(input, ce, output, NULL, num_re, 1.0f, res.noise_estimate);
}
gettimeofday(&t[2], NULL);

View File

@ -158,7 +158,7 @@ int main(int argc, char** argv)
// Loop through subframe idx and cyclic shifts
for (int sf_idx = 0; sf_idx < 10; sf_idx += 3) {
for (sf_idx = 0; sf_idx < 10; sf_idx += 3) {
for (int cshift_dmrs = 0; cshift_dmrs < SRSRAN_NOF_CSHIFT; cshift_dmrs += 5) {
if (SRSRAN_VERBOSE_ISINFO()) {
printf("nof_prb: %d, ", nof_prb);

View File

@ -208,11 +208,11 @@ int srsran_dft_plan_guru_c(srsran_dft_plan_t* plan,
pthread_mutex_lock(&fft_mutex);
plan->p = fftwf_plan_guru_dft(1, &iodim, 1, &howmany_dims, in_buffer, out_buffer, sign, FFTW_TYPE);
pthread_mutex_unlock(&fft_mutex);
if (!plan->p) {
pthread_mutex_unlock(&fft_mutex);
return -1;
}
pthread_mutex_unlock(&fft_mutex);
plan->size = dft_points;
plan->init_size = plan->size;

View File

@ -20,6 +20,14 @@
#include <srsran/phy/utils/random.h>
#include <stdlib.h>
/**
* @brief NR PBCH payload buffer size for the SSB decode test.
*
* @note This needs to be a multiple of 32, since the PBCH message payload is
* generated with srs_random_bit_vector.
*/
#define SRSRAN_PBCH_TEST_MSG_NR_SZ 32
// NR parameters
static uint32_t carrier_nof_prb = 52;
static srsran_subcarrier_spacing_t carrier_scs = srsran_subcarrier_spacing_15kHz;
@ -113,7 +121,7 @@ static void gen_pbch_msg(srsran_pbch_msg_nr_t* pbch_msg, uint32_t ssb_idx)
SRSRAN_MEM_ZERO(pbch_msg, srsran_pbch_msg_nr_t, 1);
// Generate payload
srsran_random_bit_vector(random_gen, pbch_msg->payload, SRSRAN_PBCH_MSG_NR_SZ);
srsran_random_bit_vector(random_gen, pbch_msg->payload, SRSRAN_PBCH_TEST_MSG_NR_SZ);
pbch_msg->ssb_idx = ssb_idx;
pbch_msg->crc = true;