Use signed types for dB measurements to support negative values

This commit is contained in:
rmagueta
2026-03-04 16:26:59 +00:00
parent 46b7670672
commit 0e38bd239e
17 changed files with 71 additions and 68 deletions
+3 -2
View File
@@ -520,7 +520,8 @@ int main(int argc, char **argv) {
DCI_ALLOC_t da;
DCI_ALLOC_t *dci_alloc = &da;
unsigned int coded_bits_per_codeword=0,nsymb; //,tbs=0;
unsigned int tx_lev=0,tx_lev_dB=0,trials;
unsigned int tx_lev = 0, trials;
int tx_lev_dB = 0;
unsigned int errs[4],errs2[4],round_trials[4],dci_errors[4];//,num_layers;
memset(errs,0,4*sizeof(unsigned int));
memset(errs2,0,4*sizeof(unsigned int));
@@ -1494,7 +1495,7 @@ int main(int argc, char **argv) {
eNB->frame_parms.samples_per_tti);
}
tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
tx_lev_dB = dB_fixed(tx_lev);
if (n_frames==1) {
printf("tx_lev = %u (%u dB)\n",tx_lev,tx_lev_dB);
+1 -1
View File
@@ -393,7 +393,7 @@ int main(int argc, char **argv) {
subframe,
0); //Nf
/* tx_lev_dB not used later, no need to set */
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
//tx_lev_dB = dB_fixed(tx_lev);
LOG_M("txsig0_new.m","txs0", &txdata[0][subframe*frame_parms->samples_per_tti],frame_parms->samples_per_tti,1,1);
//LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
// multipath channel
+3 -2
View File
@@ -343,7 +343,8 @@ int main(int argc, char **argv) {
unsigned short input_buffer_length;
unsigned int ret;
unsigned int coded_bits_per_codeword,nsymb;
unsigned int tx_lev = 0, tx_lev_dB = 0, trials, errs[6] = {0}, round_trials[4] = {0};
unsigned int tx_lev = 0, trials, errs[6] = {0}, round_trials[4] = {0};
int tx_lev_dB = 0;
FILE *bler_fd=NULL;
char bler_fname[512];
FILE *time_meas_fd=NULL;
@@ -894,7 +895,7 @@ int main(int argc, char **argv) {
// LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
tx_lev = signal_energy(&txdata[0][0],
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
tx_lev_dB = dB_fixed(tx_lev);
}
iter_trials=0;
+1 -1
View File
@@ -667,7 +667,7 @@ int main(int argc, char **argv){
generate_nr_prach(UE, 0, frame, slot, tx);
/* tx_lev_dB not used later, no need to set */
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
//tx_lev_dB = dB_fixed(tx_lev);
#ifdef NR_PRACH_DEBUG
LOG_M("txsig0.m", "txs0", &txdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);