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
17137877
Commit
17137877
authored
Aug 13, 2020
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tools to compare oai/kiss dfts
parent
7c628ca6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
28 deletions
+71
-28
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+1
-1
openair1/PHY/TOOLS/oai_dfts.c
openair1/PHY/TOOLS/oai_dfts.c
+0
-1
openair1/PHY/TOOLS/oai_kissdfts.c
openair1/PHY/TOOLS/oai_kissdfts.c
+70
-26
No files found.
cmake_targets/CMakeLists.txt
View file @
17137877
...
@@ -1417,7 +1417,7 @@ add_library(coding MODULE ${PHY_TURBOSRC} )
...
@@ -1417,7 +1417,7 @@ add_library(coding MODULE ${PHY_TURBOSRC} )
add_library
(
dfts MODULE
${
OPENAIR1_DIR
}
/PHY/TOOLS/oai_dfts.c
)
add_library
(
dfts MODULE
${
OPENAIR1_DIR
}
/PHY/TOOLS/oai_dfts.c
)
set
(
KISSFFT_DIR
${
OPENAIR_DIR
}
/kiss_fft130
)
set
(
KISSFFT_DIR
${
OPENAIR_DIR
}
/kiss_fft130
)
add_library
(
dfts_fpkiss MODULE
${
OPENAIR1_DIR
}
/PHY/TOOLS/oai_kissdfts.c
${
KISSFFT_DIR
}
/kiss_fft.c
)
add_library
(
dfts_fpkiss MODULE
${
OPENAIR1_DIR
}
/PHY/TOOLS/oai_kissdfts.c
${
OPENAIR1_DIR
}
/PHY/TOOLS/oai_dfts_tmp.c
${
KISSFFT_DIR
}
/kiss_fft.c
)
target_compile_definitions
(
dfts_fpkiss PUBLIC -DFIXED_POINT=16
)
target_compile_definitions
(
dfts_fpkiss PUBLIC -DFIXED_POINT=16
)
target_compile_options
(
dfts_fpkiss PUBLIC -O3 -mtune=native -ffast-math -fomit-frame-pointer -dA -fverbose-asm
)
target_compile_options
(
dfts_fpkiss PUBLIC -O3 -mtune=native -ffast-math -fomit-frame-pointer -dA -fverbose-asm
)
add_library
(
dfts_flkiss MODULE
${
OPENAIR1_DIR
}
/PHY/TOOLS/oai_kissdfts.c
${
KISSFFT_DIR
}
/kiss_fft.c
)
add_library
(
dfts_flkiss MODULE
${
OPENAIR1_DIR
}
/PHY/TOOLS/oai_kissdfts.c
${
KISSFFT_DIR
}
/kiss_fft.c
)
...
...
openair1/PHY/TOOLS/oai_dfts.c
View file @
17137877
...
@@ -9650,7 +9650,6 @@ int dfts_autoinit(void)
...
@@ -9650,7 +9650,6 @@ int dfts_autoinit(void)
}
}
#ifndef MR_MAIN
#ifndef MR_MAIN
void dft(uint8_t sizeidx, int16_t *sigF,int16_t *sig,unsigned char scale_flag){
void dft(uint8_t sizeidx, int16_t *sigF,int16_t *sig,unsigned char scale_flag){
...
...
openair1/PHY/TOOLS/oai_kissdfts.c
View file @
17137877
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include <stdint.h>
#include <stdint.h>
#include <math.h>
#include <math.h>
#include <execinfo.h>
#include <execinfo.h>
#include <limits.h>
#define OAIDFTS_LIB
#define OAIDFTS_LIB
#include "PHY/defs_common.h"
#include "PHY/defs_common.h"
#include "PHY/impl_defs_top.h"
#include "PHY/impl_defs_top.h"
...
@@ -58,50 +59,93 @@ int dfts_autoinit(void)
...
@@ -58,50 +59,93 @@ int dfts_autoinit(void)
}
}
for
(
int
i
=
0
;
i
<
IDFT_SIZE_IDXTABLESIZE
;
i
++
)
{
for
(
int
i
=
0
;
i
<
IDFT_SIZE_IDXTABLESIZE
;
i
++
)
{
ifftcfg
[
i
]
=
kiss_fft_alloc
(
ifftsizes
[
i
],
1
,
NULL
,
NULL
);
ifftcfg
[
i
]
=
kiss_fft_alloc
(
ifftsizes
[
i
],
1
,
NULL
,
NULL
);
}
}
#ifdef FIXED_POINT
olddfts_autoinit
();
#endif
return
0
;
return
0
;
}
}
#ifndef FIXED_POINT
static
float
input_float
[
98304
*
2
];
static
float
output_float
[
98304
*
2
];
static
float
input_float2
[
98304
*
2
];
static
float
output_float2
[
98304
*
2
];
#endif
void
convert_shorttofloat
(
int
sizeidx
,
short
*
input
,
float
*
output
){
for
(
int
i
=
0
;
i
<
sizeidx
;
i
=
i
+
2
){
output
[
2
*
i
]
=
(
float
)
input
[
2
*
i
];
output
[(
2
*
i
)
+
1
]
=
(
float
)
input
[(
2
*
i
)
+
1
];
void
convert_shorttofloat
(
int
size
,
short
*
input
,
float
*
output
,
int
factor
){
for
(
int
i
=
0
;
i
<
(
size
-
2
);
i
++
){
output
[
2
*
i
]
=
(
float
)(
input
[
2
*
i
]
*
factor
);
output
[(
2
*
i
)
+
1
]
=
(
float
)((
input
[(
2
*
i
)
+
1
])
*
factor
);
}
}
}
}
void
convert_floattoshort
(
int
sizeidx
,
float
*
input
,
short
*
output
){
void
convert_floattoshort
(
int
size
,
float
*
input
,
short
*
output
,
int
factor
){
for
(
int
i
=
0
;
i
<
sizeidx
;
i
=
i
+
2
){
for
(
int
i
=
0
;
i
<
(
size
-
2
);
i
++
){
output
[
2
*
i
]
=
(
short
)
input
[
2
*
i
];
output
[
2
*
i
]
=
(
int16_t
)(((
int
)(
roundf
(
input
[
2
*
i
])))
/
factor
);
output
[(
2
*
i
)
+
1
]
=
(
short
)
input
[(
2
*
i
)
+
1
];
output
[(
2
*
i
)
+
1
]
=
(
int16_t
)(((
int
)(
roundf
(
input
[(
2
*
i
)
+
1
])))
/
factor
);
}
}
void
rescale
(
int
size
,
int16_t
*
input
,
int16_t
*
output
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
output
[
i
]
=
(
input
[
i
]
*
32
);
}
}
void
rescale_dftin
(
int
size
,
int16_t
*
input
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
input
[
i
]
=
(
input
[
i
]
*
32
);
}
}
}
}
void
idft_fixedpoint
(
uint8_t
sizeidx
,
int16_t
*
input
,
int16_t
*
output
,
unsigned
char
scale_flag
){
kiss_fft
(
ifftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input
,(
kiss_fft_cpx
*
)
output
);
};
void
rescale_dftout
(
int
size
,
int16_t
*
input
,
int
factor
){
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
input
[
i
]
=
(
input
[
i
]
/
factor
);
}
}
void
print_minmax
(
int
size
,
int16_t
*
buf
,
int
scale_flag
)
{
int16_t
vmin
=
0
,
vmax
=
0
;
for
(
int
i
=
0
;
i
<
(
size
*
2
);
i
=
i
+
1
){
if
(
buf
[
i
]
>
vmax
)
vmax
=
buf
[
i
];
if
(
buf
[
i
]
<
vmin
)
vmin
=
buf
[
i
];
}
// if (scale_flag == 0 || (vmax - vmin)>150)
// 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
convert_shorttofloat
(
sizeidx
,
input
,
input_float
);
float
input_float
[
98304
*
2
];
float
output_float
[
98304
*
2
];
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
);
convert_floattoshort
(
sizeidx
,
output_float
,
output
);
if
(
scale_flag
)
convert_floattoshort
(
fftsizes
[
sizeidx
],
output_float
,
output
,
786732
);
else
convert_floattoshort
(
fftsizes
[
sizeidx
],
output_float
,
output
,
98304
);
#else
#else
kiss_fft
(
fftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input
,(
kiss_fft_cpx
*
)
output
);
rescale_dftin
(
fftsizes
[
sizeidx
],
input
);
kiss_fft
(
fftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input
,(
kiss_fft_cpx
*
)
output
);
if
(
scale_flag
)
rescale_dftout
(
fftsizes
[
sizeidx
],
output
,
32
);
else
rescale_dftout
(
fftsizes
[
sizeidx
],
output
,
8
);
// olddft(sizeidx,input,output,scale_flag);
print_minmax
(
fftsizes
[
sizeidx
],
output
,
scale_flag
);
#endif
#endif
};
};
void
idft
(
uint8_t
sizeidx
,
int16_t
*
input
,
int16_t
*
output
,
unsigned
char
scale_flag
){
void
idft
(
uint8_t
sizeidx
,
int16_t
*
input
,
int16_t
*
output
,
unsigned
char
scale_flag
){
#ifndef FIXED_POINT
#ifndef FIXED_POINT
convert_shorttofloat
(
sizeidx
,
input
,
input_float2
);
float
input_float2
[
98304
*
2
];
kiss_fft
(
fftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input_float2
,(
kiss_fft_cpx
*
)
output_float2
);
float
output_float2
[
98304
*
2
];
convert_floattoshort
(
sizeidx
,
output_float2
,
output
);
convert_shorttofloat
(
ifftsizes
[
sizeidx
],
input
,
input_float2
,
8192
);
#else
kiss_fft
(
ifftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input_float2
,(
kiss_fft_cpx
*
)
output_float2
);
kiss_fft
(
fftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
input
,(
kiss_fft_cpx
*
)
output
);
convert_floattoshort
(
ifftsizes
[
sizeidx
],
output_float2
,
output
,
98304
);
#else
int16_t
inputrs
[
98304
*
2
];
if
(
scale_flag
)
rescale
(
ifftsizes
[
sizeidx
],
input
,
inputrs
);
kiss_fft
(
ifftcfg
[
sizeidx
],(
kiss_fft_cpx
*
)
inputrs
,(
kiss_fft_cpx
*
)
output
);
#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