Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
7aef5686
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7aef5686
编写于
1月 09, 2017
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter/af_sofalizer: speed and clean up fast convolution a little
Signed-off-by:
N
Paul B Mahol
<
onemda@gmail.com
>
上级
cd09e3b3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
5 deletion
+9
-5
libavfilter/af_sofalizer.c
libavfilter/af_sofalizer.c
+9
-5
未找到文件。
libavfilter/af_sofalizer.c
浏览文件 @
7aef5686
...
...
@@ -703,6 +703,8 @@ static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr,
FFTContext
*
fft
=
s
->
fft
[
jobnr
];
const
int
n_conv
=
s
->
n_conv
;
const
int
n_fft
=
s
->
n_fft
;
const
float
fft_scale
=
1
.
0
f
/
s
->
n_fft
;
FFTComplex
*
hrtf_offset
;
int
wr
=
*
write
;
int
n_read
;
int
i
,
j
;
...
...
@@ -736,6 +738,7 @@ static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr,
/* outer loop: go through all input channels to be convolved */
offset
=
i
*
n_fft
;
/* no. samples already processed */
hrtf_offset
=
hrtf
+
offset
;
/* fill FFT input with 0 (we want to zero-pad) */
memset
(
fft_in
,
0
,
sizeof
(
FFTComplex
)
*
n_fft
);
...
...
@@ -750,14 +753,15 @@ static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr,
av_fft_permute
(
fft
,
fft_in
);
av_fft_calc
(
fft
,
fft_in
);
for
(
j
=
0
;
j
<
n_fft
;
j
++
)
{
const
FFTComplex
*
hcomplex
=
hrtf_offset
+
j
;
const
float
re
=
fft_in
[
j
].
re
;
const
float
im
=
fft_in
[
j
].
im
;
/* complex multiplication of input signal and HRTFs */
/* output channel (real): */
fft_in
[
j
].
re
=
re
*
(
hrtf
+
offset
+
j
)
->
re
-
im
*
(
hrtf
+
offset
+
j
)
->
im
;
fft_in
[
j
].
re
=
re
*
hcomplex
->
re
-
im
*
hcomplex
->
im
;
/* output channel (imag): */
fft_in
[
j
].
im
=
re
*
(
hrtf
+
offset
+
j
)
->
im
+
im
*
(
hrtf
+
offset
+
j
)
->
re
;
fft_in
[
j
].
im
=
re
*
hcomplex
->
im
+
im
*
hcomplex
->
re
;
}
/* transform output signal of current channel back to time domain */
...
...
@@ -766,14 +770,14 @@ static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr,
for
(
j
=
0
;
j
<
in
->
nb_samples
;
j
++
)
{
/* write output signal of current channel to output buffer */
dst
[
2
*
j
]
+=
fft_in
[
j
].
re
/
(
float
)
n_fft
;
dst
[
2
*
j
]
+=
fft_in
[
j
].
re
*
fft_scale
;
}
for
(
j
=
0
;
j
<
n_samples
-
1
;
j
++
)
{
/* overflow length is IR length - 1 */
/* write the rest of output signal to overflow buffer */
int
write_pos
=
(
wr
+
j
)
&
modulo
;
*
(
ringbuffer
+
write_pos
)
+=
fft_in
[
in
->
nb_samples
+
j
].
re
/
(
float
)
n_fft
;
*
(
ringbuffer
+
write_pos
)
+=
fft_in
[
in
->
nb_samples
+
j
].
re
*
fft_scale
;
}
}
...
...
@@ -781,7 +785,7 @@ static int sofalizer_fast_convolute(AVFilterContext *ctx, void *arg, int jobnr,
for
(
i
=
0
;
i
<
out
->
nb_samples
;
i
++
)
{
/* clippings counter */
if
(
fabs
(
*
dst
)
>
1
)
{
/* if current output sample > 1 */
*
n_clippings
=
*
n_clippings
+
1
;
n_clippings
[
0
]
++
;
}
/* move output buffer pointer by +2 to get to next sample of processed channel: */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录