Commit a52e9848 authored by Robert Schmidt's avatar Robert Schmidt

Provide term_freq_channel() to free memory in abstraction.c

parent 5ec196dc
...@@ -33,11 +33,26 @@ ...@@ -33,11 +33,26 @@
// NEW code with lookup table for sin/cos based on delay profile (TO BE TESTED) // NEW code with lookup table for sin/cos based on delay profile (TO BE TESTED)
double **cos_lut=NULL,* *sin_lut=NULL; double **cos_lut=NULL,* *sin_lut=NULL;
static int freq_channel_init = 0;
static int n_samples_max = 0;
//#if 1 //#if 1
void term_freq_channel(void)
{
for (int f = -(n_samples_max >> 1); f <= n_samples_max >> 1; f++) {
const int idx = f + (n_samples_max >> 1);
if (cos_lut[idx])
free_and_zero(cos_lut[idx]);
if (sin_lut[idx])
free_and_zero(sin_lut[idx]);
}
free_and_zero(cos_lut);
free_and_zero(sin_lut);
freq_channel_init = 0;
n_samples_max = 0;
}
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs) { int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs) {
double delta_f,freq; // 90 kHz spacing double delta_f,freq; // 90 kHz spacing
...@@ -78,8 +93,6 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs) ...@@ -78,8 +93,6 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs)
int16_t f,f2,d; int16_t f,f2,d;
uint8_t aarx,aatx,l; uint8_t aarx,aatx,l;
double *clut,*slut; double *clut,*slut;
static int freq_channel_init=0;
static int n_samples_max=0;
// do some error checking // do some error checking
// n_samples has to be a odd number because we assume the spectrum is symmetric around the DC and includes the DC // n_samples has to be a odd number because we assume the spectrum is symmetric around the DC and includes the DC
......
...@@ -479,6 +479,7 @@ void randominit(unsigned int seed_init); ...@@ -479,6 +479,7 @@ void randominit(unsigned int seed_init);
double uniformrandom(void); double uniformrandom(void);
int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples,int scs); int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples,int scs);
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs); int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs);
void term_freq_channel(void);
uint8_t multipath_channel_nosigconv(channel_desc_t *desc); uint8_t multipath_channel_nosigconv(channel_desc_t *desc);
void multipath_tv_channel(channel_desc_t *desc, void multipath_tv_channel(channel_desc_t *desc,
double **tx_sig_re, double **tx_sig_re,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment