Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangjie
OpenXG-RAN
Commits
4d19f6ae
Commit
4d19f6ae
authored
Aug 14, 2020
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dft tests
parent
d126ba9b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
19 deletions
+27
-19
openair1/PHY/TOOLS/oai_kissdfts.c
openair1/PHY/TOOLS/oai_kissdfts.c
+27
-19
No files found.
openair1/PHY/TOOLS/oai_kissdfts.c
View file @
4d19f6ae
...
@@ -85,19 +85,20 @@ void convert_floattoshort(int size,float *input,short *output,int factor){
...
@@ -85,19 +85,20 @@ void convert_floattoshort(int size,float *input,short *output,int factor){
}
}
}
}
void
rescale
(
int
size
,
int16_t
*
input
,
int16_t
*
output
){
void
rescale_up_int16buff
(
int
size
,
int16_t
*
input
,
int
factor
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
output
[
i
]
=
(
input
[
i
]
*
32
);
input
[
i
]
=
(
input
[
i
]
*
factor
);
}
}
}
}
void
rescale_
dftin
(
int
size
,
int16_t
*
input
){
void
rescale_
up_newint16buff
(
int
size
,
int16_t
*
input
,
int16_t
*
output
,
int
factor
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
input
[
i
]
=
(
input
[
i
]
*
32
);
output
[
i
]
=
(
input
[
i
]
*
factor
);
}
}
}
}
void
rescale_d
ftout
(
int
size
,
int16_t
*
input
,
int
factor
){
void
rescale_d
own_int16buff
(
int
size
,
int16_t
*
input
,
int
factor
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
input
[
i
]
=
(
input
[
i
]
/
factor
);
input
[
i
]
=
(
input
[
i
]
/
factor
);
}
}
...
@@ -109,13 +110,13 @@ void print_minmax(int size,int16_t *buf,int scale_flag) {
...
@@ -109,13 +110,13 @@ void print_minmax(int size,int16_t *buf,int scale_flag) {
if
(
buf
[
i
]
>
vmax
)
vmax
=
buf
[
i
];
if
(
buf
[
i
]
>
vmax
)
vmax
=
buf
[
i
];
if
(
buf
[
i
]
<
vmin
)
vmin
=
buf
[
i
];
if
(
buf
[
i
]
<
vmin
)
vmin
=
buf
[
i
];
}
}
// if (scale_flag == 0 || (vmax - vmin)>15
0)
if
(
scale_flag
==
0
||
(
vmax
-
vmin
)
>
1
0
)
//
printf("%i: %i - %i\n",scale_flag,vmin,vmax);
printf
(
"%i: %i - %i
\n
"
,
scale_flag
,
vmin
,
vmax
);
}
}
void
dft
(
uint8_t
sizeidx
,
int16_t
*
input
,
int16_t
*
output
,
unsigned
char
scale_flag
){
void
dft
(
uint8_t
sizeidx
,
int16_t
*
input
,
int16_t
*
output
,
unsigned
char
scale_flag
){
#ifndef FIXED_POINT
#ifndef FIXED_POINT
float
input_float
[
98304
*
2
];
float
input_float
[
98304
*
2
*
sizeof
(
float
)
];
float
output_float
[
98304
*
2
];
float
output_float
[
98304
*
2
*
sizeof
(
float
)
];
convert_shorttofloat
(
fftsizes
[
sizeidx
],
input
,
input_float
,
1
);
convert_shorttofloat
(
fftsizes
[
sizeidx
],
input
,
input_float
,
1
);
kiss_fft
(
fftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input_float
,(
kiss_fft_cpx
*
)
output_float
);
kiss_fft
(
fftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input_float
,(
kiss_fft_cpx
*
)
output_float
);
if
(
scale_flag
)
if
(
scale_flag
)
...
@@ -123,12 +124,19 @@ void dft(uint8_t sizeidx,int16_t *input,int16_t *output,unsigned char scale_flag
...
@@ -123,12 +124,19 @@ void dft(uint8_t sizeidx,int16_t *input,int16_t *output,unsigned char scale_flag
else
else
convert_floattoshort
(
fftsizes
[
sizeidx
],
output_float
,
output
,
98304
);
convert_floattoshort
(
fftsizes
[
sizeidx
],
output_float
,
output
,
98304
);
#else
#else
rescale_dftin
(
fftsizes
[
sizeidx
],
input
);
int16_t
tmpbuff
[
98304
*
2
*
sizeof
(
int16_t
)];
kiss_fft
(
fftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input
,(
kiss_fft_cpx
*
)
output
);
int16_t
*
inputptr
;
// if (scale_flag) {
rescale_up_newint16buff
(
fftsizes
[
sizeidx
],
input
,
tmpbuff
,
16
);
inputptr
=
tmpbuff
;
// }
// else
// inputptr=input;
kiss_fft
(
fftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
inputptr
,(
kiss_fft_cpx
*
)
output
);
if
(
scale_flag
)
if
(
scale_flag
)
rescale_dftout
(
fftsizes
[
sizeidx
],
output
,
32
);
rescale_down_int16buff
(
fftsizes
[
sizeidx
],
output
,
64
);
else
else
rescale_d
ftout
(
fftsizes
[
sizeidx
],
output
,
8
);
rescale_d
own_int16buff
(
fftsizes
[
sizeidx
],
output
,
16
);
// olddft(sizeidx,input,output,scale_flag);
// olddft(sizeidx,input,output,scale_flag);
print_minmax
(
fftsizes
[
sizeidx
],
output
,
scale_flag
);
print_minmax
(
fftsizes
[
sizeidx
],
output
,
scale_flag
);
#endif
#endif
...
@@ -142,10 +150,10 @@ void idft(uint8_t sizeidx, int16_t *input,int16_t *output,unsigned char scale_fl
...
@@ -142,10 +150,10 @@ void idft(uint8_t sizeidx, int16_t *input,int16_t *output,unsigned char scale_fl
kiss_fft
(
ifftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input_float2
,(
kiss_fft_cpx
*
)
output_float2
);
kiss_fft
(
ifftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input_float2
,(
kiss_fft_cpx
*
)
output_float2
);
convert_floattoshort
(
ifftsizes
[
sizeidx
],
output_float2
,
output
,
98304
);
convert_floattoshort
(
ifftsizes
[
sizeidx
],
output_float2
,
output
,
98304
);
#else
#else
int16_t
inputrs
[
98304
*
2
];
if
(
scale_flag
)
if
(
scale_flag
)
rescale
(
ifftsizes
[
sizeidx
],
input
,
inputrs
);
rescale_up_int16buff
(
ifftsizes
[
sizeidx
],
input
,
16
);
kiss_fft
(
ifftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
inputrs
,(
kiss_fft_cpx
*
)
output
);
kiss_fft
(
ifftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input
,(
kiss_fft_cpx
*
)
output
);
// oldidft(sizeidx,input,output,scale_flag);
// print_minmax(ifftsizes[sizeidx],output,scale_flag);
#endif
#endif
};
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment