Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
taskbus
提交
9e4a7837
taskbus
项目概览
colorEagleStdio
/
taskbus
通知
166
Star
12
Fork
6
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
taskbus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e4a7837
编写于
5月 29, 2022
作者:
D
dev@dev.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加一个控制FFT频繁程度的参数 frame_span ,以解决在高采样率下,FFT用于频谱显示来不及处理的问题。
解决该问题终极手段是多线程,但多线程显著增加了复杂性,让代码用于教学不再合适。因此,通过简单的设置间隔来变相解决该问题。
上级
28ec8d6d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
34 addition
and
19 deletion
+34
-19
modules/transforms/transform_fft/function_info.cpp
modules/transforms/transform_fft/function_info.cpp
+10
-3
modules/transforms/transform_fft/main.cpp
modules/transforms/transform_fft/main.cpp
+24
-16
未找到文件。
modules/transforms/transform_fft/function_info.cpp
浏览文件 @
9e4a7837
...
...
@@ -24,9 +24,16 @@ const char * g_info = "{\n\
\"
tooltip
\"
:
\"
0=Real,1=Complex
\"
,
\n
\
\"
default
\"
:0
\n
\
},
\n
\
\"
mod:
\"
:{
\n
\
\"
frame_span
\"
:{
\n
\
\"
type
\"
:
\"
int
\"
,
\n
\
\"
tooltip
\"
:
\"
0=frame,1=continous
\"
,
\n
\
\"
tooltip
\"
:
\"
Frame Span (count) between each fft calc. Slower CPU need larger spans.
\"
,
\n
\
\"
range
\"
:
\"
>=1
\"
,
\n
\
\"
default
\"
:16
\n
\
},
\n
\
\"
mod
\"
:{
\n
\
\"
type
\"
:
\"
int
\"
,
\n
\
\"
tooltip
\"
:
\"
WorkingMod
\"
,
\n
\
\"
range
\"
:
\"
0=Frame,1=Continous
\"
,
\n
\
\"
default
\"
:0
\n
\
},
\n
\
\"
fftsize
\"
:{
\n
\
...
...
modules/transforms/transform_fft/main.cpp
浏览文件 @
9e4a7837
...
...
@@ -76,6 +76,7 @@ int do_fftw(const cmdlineParser & args)
unsigned
int
itmstamp_in
=
args
.
toUInt
(
"tmstamp_in"
,
0
);
unsigned
int
itmstamp_out
=
args
.
toUInt
(
"tmstamp_out"
,
0
);
unsigned
int
itypes
=
args
.
toUInt
(
"input_type"
,
0
);
//0=real,1=complex
const
unsigned
int
frame_span
=
args
.
toInt
(
"frame_span"
,
1
)
>
0
?
args
.
toInt
(
"frame_span"
,
1
)
:
1
;
//工作模式
const
int
sptype
=
args
.
toInt
(
"sptype"
,
0
);
fprintf
(
stderr
,
"sptype is %d."
,
sptype
);
...
...
@@ -90,7 +91,6 @@ int do_fftw(const cmdlineParser & args)
fprintf
(
stderr
,
"fftsize must >16."
);
return
res
;
}
fflush
(
stderr
);
try
{
...
...
@@ -150,6 +150,9 @@ int do_fftw(const cmdlineParser & args)
}
}
if
(
map_tmst_inside
[
header
.
path_id
]
++%
frame_span
)
continue
;
const
unsigned
char
*
pdta
=
packagedta
.
data
();
//Normalizer
double
nmr
=
fftsize
;
...
...
@@ -328,7 +331,6 @@ int do_fftw(const cmdlineParser & args)
push_subject
(
FFT
,
header
.
path_id
,
fftsize
*
sizeof
(
double
)
/
(
itypes
==
0
?
2
:
1
),(
const
unsigned
char
*
)
vec_fft_abs
.
data
());
if
(
Spec
>
0
)
push_subject
(
Spec
,
header
.
path_id
,
fftsize
*
sizeof
(
double
),(
const
unsigned
char
*
)
out
);
++
map_tmst_inside
[
header
.
path_id
];
}
}
...
...
@@ -359,6 +361,8 @@ int do_fftw_continous(const cmdlineParser & args)
unsigned
int
FFT
=
args
.
toInt
(
"FFT"
,
0
);
unsigned
int
Spec
=
args
.
toInt
(
"Spec"
,
0
);
unsigned
int
itmstamp_in
=
args
.
toUInt
(
"tmstamp_in"
,
0
);
const
unsigned
int
frame_span
=
args
.
toInt
(
"frame_span"
,
1
)
>
0
?
args
.
toInt
(
"frame_span"
,
1
)
:
1
;
unsigned
int
itypes
=
args
.
toUInt
(
"input_type"
,
0
);
//0=real,1=complex
//工作模式
const
int
sptype
=
args
.
toInt
(
"sptype"
,
0
);
fprintf
(
stderr
,
"sptype is %d."
,
sptype
);
...
...
@@ -394,6 +398,7 @@ int do_fftw_continous(const cmdlineParser & args)
//Ring buf
unordered_map
<
unsigned
int
,
std
::
vector
<
double
>
>
map_buf_inside
;
unordered_map
<
unsigned
int
,
long
long
>
map_buf_pos
,
map_buf_deal
;
unordered_map
<
unsigned
int
,
long
long
>
cal_cnt
;
for
(
int
i
=
0
;
i
<
fftsize
;
++
i
)
vec_fft_abs
.
push_back
(
0
);
...
...
@@ -427,7 +432,10 @@ int do_fftw_continous(const cmdlineParser & args)
map_buf_inside
[
header
.
path_id
]
=
std
::
vector
<
double
>
(
2
*
RingSize
);
map_buf_pos
[
header
.
path_id
]
=
0
;
map_buf_deal
[
header
.
path_id
]
=
0
;
cal_cnt
[
header
.
path_id
]
=
0
;
}
if
(
cal_cnt
[
header
.
path_id
]
++%
frame_span
)
continue
;
const
unsigned
char
*
pdta
=
packagedta
.
data
();
//Normalizer
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录