fix cpu cost in phy simulation with sanitize addr, some code un-obfuscation

This commit is contained in:
laurent
2022-11-09 18:58:09 +00:00
committed by Roberto Louro Magueta
parent d9660677c4
commit 2d46638aa1
3 changed files with 36 additions and 66 deletions
+14 -22
View File
@@ -38,7 +38,7 @@ uint8_t multipath_channel_nosigconv(channel_desc_t *desc)
//#define CHANNEL_SSE
#ifdef CHANNEL_SSE
void multipath_channel(channel_desc_t *desc,
void __attribute__ ((no_sanitize_address)) multipath_channel(channel_desc_t *desc,
double tx_sig_re[NB_ANTENNAS_TX][30720*2],
double tx_sig_im[NB_ANTENANS_TX][30720*2],
double rx_sig_re[NB_ANTENNAS_RX][30720*2],
@@ -170,7 +170,7 @@ void add_noise(c16_t **rxdata,
}
}
void multipath_channel(channel_desc_t *desc,
void __attribute__ ((no_sanitize_address)) multipath_channel(channel_desc_t *desc,
double *tx_sig_re[NB_ANTENNAS_TX],
double *tx_sig_im[NB_ANTENNAS_TX],
double *rx_sig_re[NB_ANTENNAS_RX],
@@ -180,9 +180,6 @@ void multipath_channel(channel_desc_t *desc,
int log_channel)
{
int i,ii,j,l;
struct complexd rx_tmp,tx;
double path_loss = pow(10,desc->path_loss_dB/20);
int dd;
dd = abs(desc->channel_offset);
@@ -204,29 +201,24 @@ void multipath_channel(channel_desc_t *desc,
}
#endif
for (i=0; i<((int)length-dd); i++) {
for (ii=0; ii<desc->nb_rx; ii++) {
rx_tmp.r = 0;
rx_tmp.i = 0;
for (j=0; j<desc->nb_tx; j++) {
for (l = 0; l<(int)desc->channel_length; l++) {
for (int i=0; i<((int)length-dd); i++) {
for (int ii=0; ii<desc->nb_rx; ii++) {
struct complexd rx_tmp={0};
for (int j=0; j<desc->nb_tx; j++) {
struct complexd *chan=desc->ch[ii+(j*desc->nb_rx)];
for (int l = 0; l<(int)desc->channel_length; l++) {
if ((i>=0) && (i-l)>=0) {
struct complexd tx;
tx.r = tx_sig_re[j][i-l];
tx.i = tx_sig_im[j][i-l];
} else {
tx.r =0;
tx.i =0;
rx_tmp.r += (tx.r * chan[l].r) - (tx.i * chan[l].i);
rx_tmp.i += (tx.i * chan[l].r) + (tx.r * chan[l].i);
}
rx_tmp.r += (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].r) - (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].i);
rx_tmp.i += (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].r) + (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].i);
if (i==0 && log_channel == 1) {
printf("channel[%d][%d][%d] = %f dB \t(%e, %e)\n",
ii, j, l, 10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].r,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].i,2.0)),
desc->ch[ii+(j*desc->nb_rx)][l].r,
desc->ch[ii+(j*desc->nb_rx)][l].i);
ii, j, l, 10*log10(pow(chan[l].r,2.0)+pow(chan[l].i,2.0)),
chan[l].r,
chan[l].i);
}
} //l
} // j
+2 -2
View File
@@ -86,7 +86,7 @@ double uniformrandom(void)
/*!\brief Gaussian random number generator based on modified Box-Muller transformation.Returns a double-precision floating-point number. */
double gaussdouble(double mean, double variance)
double __attribute__ ((no_sanitize_address)) gaussdouble(double mean, double variance)
{
static int iset=0;
static double gset;
@@ -175,7 +175,7 @@ void tableNor(unsigned long seed)
return;
}
double gaussZiggurat(double mean, double variance)
double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double variance)
{
hz = SHR3;
iz = hz & 127;